@motionscript/math 0.0.0-stage → 0.1.0-alpha.4
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 +92 -0
- package/LICENSE +201 -0
- package/NOTICE +48 -0
- package/README.md +385 -3
- package/dist/annotate/angle-mark.d.ts +46 -0
- package/dist/annotate/angle-mark.d.ts.map +1 -0
- package/dist/annotate/angle-mark.js +132 -0
- package/dist/annotate/angle-mark.js.map +1 -0
- package/dist/annotate/curly-brace.d.ts +46 -0
- package/dist/annotate/curly-brace.d.ts.map +1 -0
- package/dist/annotate/curly-brace.js +114 -0
- package/dist/annotate/curly-brace.js.map +1 -0
- package/dist/annotate/emphasis-mark.d.ts +20 -0
- package/dist/annotate/emphasis-mark.d.ts.map +1 -0
- package/dist/annotate/emphasis-mark.js +81 -0
- package/dist/annotate/emphasis-mark.js.map +1 -0
- package/dist/browser/THIRD_PARTY_LICENSES.txt +420 -0
- package/dist/browser/chunks/chunk-3GJB6AVO.js +2 -0
- package/dist/browser/chunks/chunk-3GJB6AVO.js.map +7 -0
- package/dist/browser/chunks/chunk-D5WHCVBC.js +2 -0
- package/dist/browser/chunks/chunk-D5WHCVBC.js.map +7 -0
- package/dist/browser/chunks/chunk-WL4KEX7Y.js +2 -0
- package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +7 -0
- package/dist/browser/chunks/mathjax-DNP3YRES.js +61 -0
- package/dist/browser/chunks/mathjax-DNP3YRES.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +30 -0
- package/dist/browser/tex.js +2 -0
- package/dist/browser/tex.js.map +7 -0
- package/dist/engine.d.ts +64 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +42 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/brace.d.ts +8 -0
- package/dist/kit/brace.d.ts.map +1 -0
- package/dist/kit/brace.js +36 -0
- package/dist/kit/brace.js.map +1 -0
- package/dist/kit/cache.d.ts +30 -0
- package/dist/kit/cache.d.ts.map +1 -0
- package/dist/kit/cache.js +53 -0
- package/dist/kit/cache.js.map +1 -0
- package/dist/kit/contour.d.ts +8 -0
- package/dist/kit/contour.d.ts.map +1 -0
- package/dist/kit/contour.js +93 -0
- package/dist/kit/contour.js.map +1 -0
- package/dist/kit/coords.d.ts +69 -0
- package/dist/kit/coords.d.ts.map +1 -0
- package/dist/kit/coords.js +224 -0
- package/dist/kit/coords.js.map +1 -0
- package/dist/kit/curve.d.ts +17 -0
- package/dist/kit/curve.d.ts.map +1 -0
- package/dist/kit/curve.js +22 -0
- package/dist/kit/curve.js.map +1 -0
- package/dist/kit/equation.d.ts +61 -0
- package/dist/kit/equation.d.ts.map +1 -0
- package/dist/kit/equation.js +168 -0
- package/dist/kit/equation.js.map +1 -0
- package/dist/kit/equation3d.d.ts +50 -0
- package/dist/kit/equation3d.d.ts.map +1 -0
- package/dist/kit/equation3d.js +103 -0
- package/dist/kit/equation3d.js.map +1 -0
- package/dist/kit/expression.d.ts +35 -0
- package/dist/kit/expression.d.ts.map +1 -0
- package/dist/kit/expression.js +124 -0
- package/dist/kit/expression.js.map +1 -0
- package/dist/kit/field-mark.d.ts +58 -0
- package/dist/kit/field-mark.d.ts.map +1 -0
- package/dist/kit/field-mark.js +129 -0
- package/dist/kit/field-mark.js.map +1 -0
- package/dist/kit/field.d.ts +14 -0
- package/dist/kit/field.d.ts.map +1 -0
- package/dist/kit/field.js +46 -0
- package/dist/kit/field.js.map +1 -0
- package/dist/kit/follow.d.ts +71 -0
- package/dist/kit/follow.d.ts.map +1 -0
- package/dist/kit/follow.js +159 -0
- package/dist/kit/follow.js.map +1 -0
- package/dist/kit/furniture.d.ts +30 -0
- package/dist/kit/furniture.d.ts.map +1 -0
- package/dist/kit/furniture.js +87 -0
- package/dist/kit/furniture.js.map +1 -0
- package/dist/kit/geometry.d.ts +13 -0
- package/dist/kit/geometry.d.ts.map +1 -0
- package/dist/kit/geometry.js +54 -0
- package/dist/kit/geometry.js.map +1 -0
- package/dist/kit/mark.d.ts +47 -0
- package/dist/kit/mark.d.ts.map +1 -0
- package/dist/kit/mark.js +103 -0
- package/dist/kit/mark.js.map +1 -0
- package/dist/kit/part-fills.d.ts +23 -0
- package/dist/kit/part-fills.d.ts.map +1 -0
- package/dist/kit/part-fills.js +46 -0
- package/dist/kit/part-fills.js.map +1 -0
- package/dist/kit/place.d.ts +18 -0
- package/dist/kit/place.d.ts.map +1 -0
- package/dist/kit/place.js +68 -0
- package/dist/kit/place.js.map +1 -0
- package/dist/kit/placement.d.ts +8 -0
- package/dist/kit/placement.d.ts.map +1 -0
- package/dist/kit/placement.js +8 -0
- package/dist/kit/placement.js.map +1 -0
- package/dist/kit/sampler.d.ts +17 -0
- package/dist/kit/sampler.d.ts.map +1 -0
- package/dist/kit/sampler.js +250 -0
- package/dist/kit/sampler.js.map +1 -0
- package/dist/kit/scale.d.ts +12 -0
- package/dist/kit/scale.d.ts.map +1 -0
- package/dist/kit/scale.js +37 -0
- package/dist/kit/scale.js.map +1 -0
- package/dist/kit/source.d.ts +22 -0
- package/dist/kit/source.d.ts.map +1 -0
- package/dist/kit/source.js +45 -0
- package/dist/kit/source.js.map +1 -0
- package/dist/kit/system.d.ts +33 -0
- package/dist/kit/system.d.ts.map +1 -0
- package/dist/kit/system.js +67 -0
- package/dist/kit/system.js.map +1 -0
- package/dist/kit/ticks.d.ts +19 -0
- package/dist/kit/ticks.d.ts.map +1 -0
- package/dist/kit/ticks.js +78 -0
- package/dist/kit/ticks.js.map +1 -0
- package/dist/kit/withdrawn.d.ts +9 -0
- package/dist/kit/withdrawn.d.ts.map +1 -0
- package/dist/kit/withdrawn.js +9 -0
- package/dist/kit/withdrawn.js.map +1 -0
- package/dist/marks/curve-area.d.ts +32 -0
- package/dist/marks/curve-area.d.ts.map +1 -0
- package/dist/marks/curve-area.js +82 -0
- package/dist/marks/curve-area.js.map +1 -0
- package/dist/marks/drop-lines.d.ts +22 -0
- package/dist/marks/drop-lines.d.ts.map +1 -0
- package/dist/marks/drop-lines.js +58 -0
- package/dist/marks/drop-lines.js.map +1 -0
- package/dist/marks/plot-point.d.ts +35 -0
- package/dist/marks/plot-point.d.ts.map +1 -0
- package/dist/marks/plot-point.js +97 -0
- package/dist/marks/plot-point.js.map +1 -0
- package/dist/marks/riemann-sum.d.ts +37 -0
- package/dist/marks/riemann-sum.d.ts.map +1 -0
- package/dist/marks/riemann-sum.js +91 -0
- package/dist/marks/riemann-sum.js.map +1 -0
- package/dist/marks/tangent-line.d.ts +27 -0
- package/dist/marks/tangent-line.d.ts.map +1 -0
- package/dist/marks/tangent-line.js +103 -0
- package/dist/marks/tangent-line.js.map +1 -0
- package/dist/marks/vector-arrow.d.ts +32 -0
- package/dist/marks/vector-arrow.d.ts.map +1 -0
- package/dist/marks/vector-arrow.js +87 -0
- package/dist/marks/vector-arrow.js.map +1 -0
- package/dist/nodes.d.ts +35 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +63 -0
- package/dist/nodes.js.map +1 -0
- package/dist/plots/function-plot.d.ts +67 -0
- package/dist/plots/function-plot.d.ts.map +1 -0
- package/dist/plots/function-plot.js +215 -0
- package/dist/plots/function-plot.js.map +1 -0
- package/dist/plots/points-plot.d.ts +28 -0
- package/dist/plots/points-plot.d.ts.map +1 -0
- package/dist/plots/points-plot.js +99 -0
- package/dist/plots/points-plot.js.map +1 -0
- package/dist/plots/stream-lines.d.ts +35 -0
- package/dist/plots/stream-lines.d.ts.map +1 -0
- package/dist/plots/stream-lines.js +141 -0
- package/dist/plots/stream-lines.js.map +1 -0
- package/dist/plots/traced-path.d.ts +31 -0
- package/dist/plots/traced-path.d.ts.map +1 -0
- package/dist/plots/traced-path.js +56 -0
- package/dist/plots/traced-path.js.map +1 -0
- package/dist/plots/vector-field.d.ts +23 -0
- package/dist/plots/vector-field.d.ts.map +1 -0
- package/dist/plots/vector-field.js +91 -0
- package/dist/plots/vector-field.js.map +1 -0
- package/dist/structures/graph-layout.d.ts +11 -0
- package/dist/structures/graph-layout.d.ts.map +1 -0
- package/dist/structures/graph-layout.js +135 -0
- package/dist/structures/graph-layout.js.map +1 -0
- package/dist/structures/network-graph.d.ts +83 -0
- package/dist/structures/network-graph.d.ts.map +1 -0
- package/dist/structures/network-graph.js +289 -0
- package/dist/structures/network-graph.js.map +1 -0
- package/dist/structures/sample-space.d.ts +62 -0
- package/dist/structures/sample-space.d.ts.map +1 -0
- package/dist/structures/sample-space.js +199 -0
- package/dist/structures/sample-space.js.map +1 -0
- package/dist/systems/axes2d.d.ts +75 -0
- package/dist/systems/axes2d.d.ts.map +1 -0
- package/dist/systems/axes2d.js +193 -0
- package/dist/systems/axes2d.js.map +1 -0
- package/dist/systems/number-line.d.ts +49 -0
- package/dist/systems/number-line.d.ts.map +1 -0
- package/dist/systems/number-line.js +127 -0
- package/dist/systems/number-line.js.map +1 -0
- package/dist/systems/number-plane.d.ts +59 -0
- package/dist/systems/number-plane.d.ts.map +1 -0
- package/dist/systems/number-plane.js +193 -0
- package/dist/systems/number-plane.js.map +1 -0
- package/dist/systems/polar-plane.d.ts +48 -0
- package/dist/systems/polar-plane.d.ts.map +1 -0
- package/dist/systems/polar-plane.js +165 -0
- package/dist/systems/polar-plane.js.map +1 -0
- package/dist/tex/geometry.d.ts +85 -0
- package/dist/tex/geometry.d.ts.map +1 -0
- package/dist/tex/geometry.js +632 -0
- package/dist/tex/geometry.js.map +1 -0
- package/dist/tex/index.d.ts +11 -0
- package/dist/tex/index.d.ts.map +1 -0
- package/dist/tex/index.js +9 -0
- package/dist/tex/index.js.map +1 -0
- package/dist/tex/mathjax.d.ts +33 -0
- package/dist/tex/mathjax.d.ts.map +1 -0
- package/dist/tex/mathjax.js +74 -0
- package/dist/tex/mathjax.js.map +1 -0
- package/dist/tex/matrix.d.ts +31 -0
- package/dist/tex/matrix.d.ts.map +1 -0
- package/dist/tex/matrix.js +73 -0
- package/dist/tex/matrix.js.map +1 -0
- package/dist/tex/node.d.ts +215 -0
- package/dist/tex/node.d.ts.map +1 -0
- package/dist/tex/node.js +595 -0
- package/dist/tex/node.js.map +1 -0
- package/dist/tex/tween.d.ts +50 -0
- package/dist/tex/tween.d.ts.map +1 -0
- package/dist/tex/tween.js +253 -0
- package/dist/tex/tween.js.map +1 -0
- package/dist/three/axes3d.d.ts +87 -0
- package/dist/three/axes3d.d.ts.map +1 -0
- package/dist/three/axes3d.js +228 -0
- package/dist/three/axes3d.js.map +1 -0
- package/dist/three/curve-plot3d.d.ts +60 -0
- package/dist/three/curve-plot3d.d.ts.map +1 -0
- package/dist/three/curve-plot3d.js +143 -0
- package/dist/three/curve-plot3d.js.map +1 -0
- package/dist/three/label3d.d.ts +11 -0
- package/dist/three/label3d.d.ts.map +1 -0
- package/dist/three/label3d.js +40 -0
- package/dist/three/label3d.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +26 -0
- package/dist/three/plot-point3d.d.ts.map +1 -0
- package/dist/three/plot-point3d.js +60 -0
- package/dist/three/plot-point3d.js.map +1 -0
- package/dist/three/space.d.ts +28 -0
- package/dist/three/space.d.ts.map +1 -0
- package/dist/three/space.js +47 -0
- package/dist/three/space.js.map +1 -0
- package/dist/three/surface-plot3d.d.ts +80 -0
- package/dist/three/surface-plot3d.d.ts.map +1 -0
- package/dist/three/surface-plot3d.js +290 -0
- package/dist/three/surface-plot3d.js.map +1 -0
- package/dist/three/vector-arrow3d.d.ts +25 -0
- package/dist/three/vector-arrow3d.d.ts.map +1 -0
- package/dist/three/vector-arrow3d.js +72 -0
- package/dist/three/vector-arrow3d.js.map +1 -0
- package/package.json +79 -3
- package/registry.json +251 -0
- package/src/annotate/angle-mark.ts +147 -0
- package/src/annotate/curly-brace.ts +126 -0
- package/src/annotate/emphasis-mark.ts +89 -0
- package/src/engine.ts +72 -0
- package/src/index.ts +29 -0
- package/src/kit/brace.ts +37 -0
- package/src/kit/cache.ts +61 -0
- package/src/kit/contour.ts +94 -0
- package/src/kit/coords.ts +278 -0
- package/src/kit/curve.ts +29 -0
- package/src/kit/equation.ts +181 -0
- package/src/kit/equation3d.ts +137 -0
- package/src/kit/expression.ts +159 -0
- package/src/kit/field-mark.ts +155 -0
- package/src/kit/field.ts +50 -0
- package/src/kit/follow.ts +203 -0
- package/src/kit/furniture.ts +108 -0
- package/src/kit/geometry.ts +49 -0
- package/src/kit/mark.ts +131 -0
- package/src/kit/part-fills.ts +61 -0
- package/src/kit/place.ts +101 -0
- package/src/kit/placement.ts +8 -0
- package/src/kit/sampler.ts +281 -0
- package/src/kit/scale.ts +39 -0
- package/src/kit/source.ts +57 -0
- package/src/kit/system.ts +99 -0
- package/src/kit/ticks.ts +85 -0
- package/src/kit/withdrawn.ts +8 -0
- package/src/marks/curve-area.ts +89 -0
- package/src/marks/drop-lines.ts +63 -0
- package/src/marks/plot-point.ts +107 -0
- package/src/marks/riemann-sum.ts +98 -0
- package/src/marks/tangent-line.ts +103 -0
- package/src/marks/vector-arrow.ts +98 -0
- package/src/nodes.ts +63 -0
- package/src/plots/function-plot.ts +236 -0
- package/src/plots/points-plot.ts +107 -0
- package/src/plots/stream-lines.ts +151 -0
- package/src/plots/traced-path.ts +52 -0
- package/src/plots/vector-field.ts +88 -0
- package/src/structures/graph-layout.ts +145 -0
- package/src/structures/network-graph.ts +308 -0
- package/src/structures/sample-space.ts +209 -0
- package/src/systems/axes2d.ts +217 -0
- package/src/systems/number-line.ts +131 -0
- package/src/systems/number-plane.ts +203 -0
- package/src/systems/polar-plane.ts +176 -0
- package/src/tex/geometry.ts +703 -0
- package/src/tex/index.ts +14 -0
- package/src/tex/mathjax.ts +82 -0
- package/src/tex/matrix.ts +75 -0
- package/src/tex/node.ts +641 -0
- package/src/tex/tween.ts +308 -0
- package/src/three/axes3d.ts +240 -0
- package/src/three/curve-plot3d.ts +147 -0
- package/src/three/label3d.ts +50 -0
- package/src/three/plot-point3d.ts +66 -0
- package/src/three/space.ts +67 -0
- package/src/three/surface-plot3d.ts +323 -0
- package/src/three/vector-arrow3d.ts +77 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { RenderContext2D, EasingFunction, NodeConfig, ShapeNode, ShapeProps, InsetsProps, Size2D, SizeConstraints, InsetsResolved, type AssetScope, type BoxBounds, type Command, type CommandArgs, type Fill } from "@motionscript/sdk";
|
|
2
|
+
import { type LatexMorphStrategy } from "./tween.js";
|
|
3
|
+
import { type PartFill } from "../kit/part-fills.js";
|
|
4
|
+
export interface LatexProps extends ShapeProps {
|
|
5
|
+
latex: string;
|
|
6
|
+
fontSize: number;
|
|
7
|
+
padding: InsetsProps;
|
|
8
|
+
partFills: PartFill[];
|
|
9
|
+
written: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Construction-time-only options: pluggable engine behavior, set once when
|
|
13
|
+
* the node is created. Deliberately *not* part of {@link LatexProps} — every
|
|
14
|
+
* `@property` field accepts either a value or a zero-arg reactive binding
|
|
15
|
+
* (`value | (() => value)`, see `PropInputs`), and the node's own reactive
|
|
16
|
+
* write path (`_writeProp`) treats any function value as the latter. A
|
|
17
|
+
* strategy *is* a function, so it can't be told apart from a binding that
|
|
18
|
+
* computes one — it has to stay outside the reactive prop system entirely.
|
|
19
|
+
*/
|
|
20
|
+
export interface LatexStrategies {
|
|
21
|
+
/** How the node morphs between two formulas. Defaults to `defaultLatexMorph`. */
|
|
22
|
+
morph?: LatexMorphStrategy;
|
|
23
|
+
}
|
|
24
|
+
export declare class Latex extends ShapeNode<LatexProps> {
|
|
25
|
+
readonly latex: string;
|
|
26
|
+
readonly fontSize: number;
|
|
27
|
+
readonly padding: InsetsResolved;
|
|
28
|
+
/** Paints for parts of the formula, named by their source. Later entries win where two name a glyph. */
|
|
29
|
+
partFills: PartFill[];
|
|
30
|
+
/**
|
|
31
|
+
* How much of the formula is written, 0 to 1: its glyphs are drawn one after
|
|
32
|
+
* another, each outlined and then filled.
|
|
33
|
+
*/
|
|
34
|
+
written: number;
|
|
35
|
+
/**
|
|
36
|
+
* How this node morphs between two formulas. Construction-time-only (see
|
|
37
|
+
* {@link LatexStrategies}) — resolved once here rather than left as
|
|
38
|
+
* `?? defaultLatexMorph` at every call site.
|
|
39
|
+
*/
|
|
40
|
+
private readonly morph;
|
|
41
|
+
private _intrinsicWidth;
|
|
42
|
+
private _intrinsicHeight;
|
|
43
|
+
/**
|
|
44
|
+
* Shared center frame for all current tokens, [minX, minY, maxX, maxY] in
|
|
45
|
+
* token space. Passed to every per-token path so glyphs keep their relative
|
|
46
|
+
* layout instead of each centering on its own bbox.
|
|
47
|
+
*/
|
|
48
|
+
private _bounds;
|
|
49
|
+
/** Current tokens to render. Each has its own opacity for tween transitions. */
|
|
50
|
+
private _tokens;
|
|
51
|
+
/** The parts of the formula `_tokens` was built from; empty while a morph holds the tokens. */
|
|
52
|
+
private _parts;
|
|
53
|
+
/** While a morph holds the tokens: each end's colours by token, and how far between them it is. */
|
|
54
|
+
private _morphFills;
|
|
55
|
+
/**
|
|
56
|
+
* How far through a morph the playhead is, in `(0, 1)` while one is
|
|
57
|
+
* driving frames and `0` otherwise: the node's own signal, not a prop an
|
|
58
|
+
* author states.
|
|
59
|
+
*
|
|
60
|
+
* A prop rather than a field because it is the one thing the timeline
|
|
61
|
+
* restores. The morph writes the tokens, the box and the intrinsic size
|
|
62
|
+
* straight onto the node, so nothing else says whether what is on screen is
|
|
63
|
+
* a morph frame; and a seek from inside a morph to a time before it
|
|
64
|
+
* evaluates no command at all. Restored to `0` with every other prop, this
|
|
65
|
+
* is how the node learns the playhead has left the morph.
|
|
66
|
+
*/
|
|
67
|
+
morphProgress: number;
|
|
68
|
+
/** Suppresses retokenization while a custom to() is driving frames. */
|
|
69
|
+
private _animating;
|
|
70
|
+
/** The `fontSize|latex` the live tokens were built from. See {@link _ensureTokens}. */
|
|
71
|
+
private _tokenizedFrom;
|
|
72
|
+
constructor(props?: NodeConfig<Latex, LatexProps> & LatexStrategies);
|
|
73
|
+
/**
|
|
74
|
+
* Rebuild the token list when the formula or size has moved since it last
|
|
75
|
+
* was built.
|
|
76
|
+
*
|
|
77
|
+
* Pulled from every reader rather than pushed from a prop write, because
|
|
78
|
+
* `latex` can be a binding — and a binding has no write to hang a
|
|
79
|
+
* subscription on. The key is what the current tokens were built from;
|
|
80
|
+
* `_animating` hands ownership to the morph command for its open interval.
|
|
81
|
+
*/
|
|
82
|
+
private _ensureTokens;
|
|
83
|
+
/** MathJax, before this node is laid out: a scene with no formula in it never loads it. */
|
|
84
|
+
declareAssets(assets: AssetScope): void;
|
|
85
|
+
/** @internal The formula typeset once `next` is laid over the node's own props: `latex` here, a subclass's own props there. */
|
|
86
|
+
_source(next?: Partial<LatexProps>): string;
|
|
87
|
+
/** @internal The props that state the formula, as `next` leaves them: what a morph commits at its end. */
|
|
88
|
+
_sourceProps(next?: Partial<LatexProps>): Partial<LatexProps>;
|
|
89
|
+
/** @internal Whether `next` re-sets the glyphs, and so is a morph rather than an ordinary tween. */
|
|
90
|
+
_resets(next: Partial<LatexProps>): boolean;
|
|
91
|
+
private _updateTokens;
|
|
92
|
+
private _clearTokens;
|
|
93
|
+
measure(constraints: SizeConstraints): Partial<Size2D>;
|
|
94
|
+
/**
|
|
95
|
+
* A LaTeX morph — one {@link Command}, like every other `to()`.
|
|
96
|
+
*
|
|
97
|
+
* Sequence two of them with `sequence(...)` rather than chaining: the chain
|
|
98
|
+
* builder this used to return existed only so `latexRef().to(a, 1).to(b, 1)`
|
|
99
|
+
* would read as two steps, and it could not compose with anything that was
|
|
100
|
+
* not another Latex morph.
|
|
101
|
+
*/
|
|
102
|
+
to<D extends Partial<LatexProps> = Partial<LatexProps>>(args: CommandArgs<D> & {
|
|
103
|
+
duration: number;
|
|
104
|
+
}): Command<LatexProps>;
|
|
105
|
+
/**
|
|
106
|
+
* Morph this formula into another — a document-facing name for {@link to},
|
|
107
|
+
* which already routes through {@link _buildMorph}.
|
|
108
|
+
*/
|
|
109
|
+
morphTo(args: CommandArgs<{
|
|
110
|
+
latex: string;
|
|
111
|
+
}> & {
|
|
112
|
+
duration: number;
|
|
113
|
+
}): Command<LatexProps>;
|
|
114
|
+
/** Write the formula on, or off: its glyphs one after another, each outlined and then filled. */
|
|
115
|
+
writeTo(args: CommandArgs<{
|
|
116
|
+
written: number;
|
|
117
|
+
}> & {
|
|
118
|
+
duration: number;
|
|
119
|
+
}): Command<LatexProps>;
|
|
120
|
+
/** Paint one part of the formula, leaving the rest as it is. */
|
|
121
|
+
partFillTo(args: CommandArgs<{
|
|
122
|
+
part: string;
|
|
123
|
+
fill: Fill;
|
|
124
|
+
occurrence?: number;
|
|
125
|
+
}> & {
|
|
126
|
+
duration: number;
|
|
127
|
+
}): Command<LatexProps>;
|
|
128
|
+
/**
|
|
129
|
+
* The box around one part of the formula, centred on the node's own centre
|
|
130
|
+
* and y-up, or `null` when the formula does not write `part`. `occurrence`
|
|
131
|
+
* counts from 1.
|
|
132
|
+
*/
|
|
133
|
+
partBounds(part: string, occurrence?: number): BoxBounds | null;
|
|
134
|
+
/**
|
|
135
|
+
* Build a single LaTeX morph as a {@link Command}: every ordinary
|
|
136
|
+
* `ShapeProps` field (via the inherited `_prepareStep`), plus the
|
|
137
|
+
* intrinsic size, shared center frame and per-glyph token list — state a
|
|
138
|
+
* plain `set()` can't reach — driven together by one eased `t`, matching
|
|
139
|
+
* the concurrent `parallel` the generator version ran.
|
|
140
|
+
*
|
|
141
|
+
* The "from" snapshot (`fromTokens`, `fromLatex`, …) is captured
|
|
142
|
+
* **lazily, on the command's first evaluation**, not when this is called.
|
|
143
|
+
* That is what lets two morphs be sequenced: `commandSequence` settles each
|
|
144
|
+
* prior step before evaluating the next, so a second morph's "from" reads
|
|
145
|
+
* the first one's end state rather than whatever the node held before either
|
|
146
|
+
* of them ran.
|
|
147
|
+
*
|
|
148
|
+
* `_animating` suppresses {@link _ensureTokens} for the open interval, and
|
|
149
|
+
* both ends commit: `t === 1`
|
|
150
|
+
* lands on the target formula, `t === 0` restores the source one — the same
|
|
151
|
+
* "membership for the open interval, commit at either end" shape
|
|
152
|
+
* `packages/components/code`'s `runTransition` uses, so seeking into either
|
|
153
|
+
* side of the morph (not just running it forward) shows the right thing.
|
|
154
|
+
*
|
|
155
|
+
* `@internal` — the entry point for authors is {@link to}.
|
|
156
|
+
*/
|
|
157
|
+
_buildMorph(to: Partial<LatexProps>, duration: number, easing?: EasingFunction): Command<LatexProps>;
|
|
158
|
+
/**
|
|
159
|
+
* The shadow op comes **first**, as it does on every other painted node.
|
|
160
|
+
*
|
|
161
|
+
* The renderer does not draw a shadow when it sees one: `.shadow()` stores
|
|
162
|
+
* it pending and the *next* fill or stroke op casts it (`_shadow` →
|
|
163
|
+
* `storePendingShadows`, `_fill`/`_stroke` → `takePendingShadows`). Appended
|
|
164
|
+
* last, it was stored by every token and then thrown away by the reset at
|
|
165
|
+
* the end of the draw — a shadow set on a LaTeX node simply never appeared,
|
|
166
|
+
* with no error to say why. Same failure {@link PaintedNode.renderStroke}
|
|
167
|
+
* documents for a fill-less stroked shape, and the same one-op fix.
|
|
168
|
+
*
|
|
169
|
+
* Order also carries the fill-less case for free: an empty fill returns
|
|
170
|
+
* before it takes the pending shadow, so the stroke below casts it from the
|
|
171
|
+
* glyph outlines instead — which is what `castsShadowFromStroke` arranges on
|
|
172
|
+
* a plain shape.
|
|
173
|
+
*/
|
|
174
|
+
protected renderSelf(ctx: RenderContext2D): void;
|
|
175
|
+
/** Each token's part fill: by its place in the formula at rest, by both ends' mid-morph. */
|
|
176
|
+
private _tokenFills;
|
|
177
|
+
/**
|
|
178
|
+
* How far each glyph is written at the node's `written`: its outline first,
|
|
179
|
+
* then its fill, each glyph starting before the one ahead of it is done.
|
|
180
|
+
* `null` once the whole formula is.
|
|
181
|
+
*/
|
|
182
|
+
private _writing;
|
|
183
|
+
/**
|
|
184
|
+
* The overlay, painted *through* the glyphs.
|
|
185
|
+
*
|
|
186
|
+
* `ShapeNode`'s inherited overlay pass fills whatever {@link
|
|
187
|
+
* ShapeNode.shapeGraphics} describes, and this node describes nothing there:
|
|
188
|
+
* a formula has no single fillable silhouette — its silhouette *is* the list
|
|
189
|
+
* of token paths, which is why `renderSelf` is overridden rather than a
|
|
190
|
+
* `shapeGraphics` supplied. So the generic pass drew nothing and an overlay
|
|
191
|
+
* set on a LaTeX node simply never appeared, with no error to say why.
|
|
192
|
+
*
|
|
193
|
+
* Painted the same way the fill is: one `Graphics2D` per token, all sharing the
|
|
194
|
+
* centre frame, each scaled by its token's animated opacity — so a morph
|
|
195
|
+
* carries the overlay along with the glyph it is laid over instead of leaving
|
|
196
|
+
* a wash hanging over glyphs that have faded out.
|
|
197
|
+
*
|
|
198
|
+
* The stroke is *not* re-drawn here. `renderSelf` already strokes each token
|
|
199
|
+
* (there is no silhouette for the deferred {@link ShapeNode.renderStroke} to
|
|
200
|
+
* outline), so it is painted under the overlay rather than over it — the one
|
|
201
|
+
* place this node's draw order differs from a plain shape's, and the price of
|
|
202
|
+
* a stroke that follows glyphs rather than a box.
|
|
203
|
+
*/
|
|
204
|
+
protected renderOverlay(ctx: RenderContext2D): void;
|
|
205
|
+
/**
|
|
206
|
+
* Draws every visible token's path once, handing each one to `paint` to have
|
|
207
|
+
* its paint ops appended.
|
|
208
|
+
*
|
|
209
|
+
* A fresh `Graphics2D` per token per pass, because `.fill()`/`.stroke()` push
|
|
210
|
+
* onto one op list and return `this` — a silhouette shared between the fill
|
|
211
|
+
* pass and the overlay pass would accumulate both.
|
|
212
|
+
*/
|
|
213
|
+
private eachToken;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/tex/node.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EAAc,cAAc,EA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