@motionscript/math 0.1.0 → 0.1.1-alpha.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/CHANGELOG.md +19 -0
- package/dist/annotate/angle-mark.d.ts +4 -14
- package/dist/annotate/angle-mark.d.ts.map +1 -1
- package/dist/annotate/angle-mark.js +2 -1
- package/dist/annotate/angle-mark.js.map +1 -1
- package/dist/annotate/curly-brace.d.ts +4 -16
- package/dist/annotate/curly-brace.d.ts.map +1 -1
- package/dist/annotate/curly-brace.js.map +1 -1
- package/dist/annotate/emphasis-mark.d.ts +0 -5
- package/dist/annotate/emphasis-mark.d.ts.map +1 -1
- package/dist/annotate/emphasis-mark.js.map +1 -1
- package/dist/browser/chunks/chunk-FZ2YBTPL.js +2 -0
- package/dist/browser/chunks/chunk-FZ2YBTPL.js.map +7 -0
- package/dist/browser/chunks/chunk-T42HWKBC.js +2 -0
- package/dist/browser/chunks/chunk-T42HWKBC.js.map +7 -0
- package/dist/browser/chunks/{mathjax-WV55AC2P.js → mathjax-SOM6RSPV.js} +1 -1
- package/dist/browser/chunks/{mathjax-WV55AC2P.js.map → mathjax-SOM6RSPV.js.map} +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/tex.js +1 -1
- package/dist/engine.d.ts +3 -4
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -4
- package/dist/engine.js.map +1 -1
- package/dist/kit/cache.d.ts +10 -21
- package/dist/kit/cache.d.ts.map +1 -1
- package/dist/kit/cache.js +33 -24
- package/dist/kit/cache.js.map +1 -1
- package/dist/kit/component.d.ts +5 -14
- package/dist/kit/component.d.ts.map +1 -1
- package/dist/kit/component.js +1 -8
- package/dist/kit/component.js.map +1 -1
- package/dist/kit/coords.d.ts +1 -1
- package/dist/kit/coords.d.ts.map +1 -1
- package/dist/kit/coords.js +2 -1
- package/dist/kit/coords.js.map +1 -1
- package/dist/kit/curve.d.ts +1 -5
- package/dist/kit/curve.d.ts.map +1 -1
- package/dist/kit/curve.js.map +1 -1
- package/dist/kit/equation.d.ts +10 -30
- package/dist/kit/equation.d.ts.map +1 -1
- package/dist/kit/equation.js +9 -44
- package/dist/kit/equation.js.map +1 -1
- package/dist/kit/equation3d.d.ts +3 -3
- package/dist/kit/equation3d.d.ts.map +1 -1
- package/dist/kit/equation3d.js +27 -59
- package/dist/kit/equation3d.js.map +1 -1
- package/dist/kit/expression.d.ts +7 -7
- package/dist/kit/expression.d.ts.map +1 -1
- package/dist/kit/expression.js +18 -17
- package/dist/kit/expression.js.map +1 -1
- package/dist/kit/field-mark.d.ts +0 -7
- package/dist/kit/field-mark.d.ts.map +1 -1
- package/dist/kit/field-mark.js.map +1 -1
- package/dist/kit/field.d.ts +2 -2
- package/dist/kit/field.d.ts.map +1 -1
- package/dist/kit/field.js +11 -31
- package/dist/kit/field.js.map +1 -1
- package/dist/kit/follow.d.ts +3 -10
- package/dist/kit/follow.d.ts.map +1 -1
- package/dist/kit/follow.js +5 -11
- package/dist/kit/follow.js.map +1 -1
- package/dist/kit/furniture.d.ts +2 -1
- package/dist/kit/furniture.d.ts.map +1 -1
- package/dist/kit/furniture.js +6 -3
- package/dist/kit/furniture.js.map +1 -1
- package/dist/kit/geometry.d.ts +1 -0
- package/dist/kit/geometry.d.ts.map +1 -1
- package/dist/kit/geometry.js +3 -0
- package/dist/kit/geometry.js.map +1 -1
- package/dist/kit/mark.d.ts +4 -10
- package/dist/kit/mark.d.ts.map +1 -1
- package/dist/kit/mark.js.map +1 -1
- package/dist/kit/place.d.ts +3 -5
- package/dist/kit/place.d.ts.map +1 -1
- package/dist/kit/place.js +3 -5
- package/dist/kit/place.js.map +1 -1
- package/dist/kit/sampler.d.ts +0 -5
- package/dist/kit/sampler.d.ts.map +1 -1
- package/dist/kit/sampler.js.map +1 -1
- package/dist/kit/system.d.ts +0 -1
- package/dist/kit/system.d.ts.map +1 -1
- package/dist/kit/system.js +3 -10
- package/dist/kit/system.js.map +1 -1
- package/dist/marks/curve-area.d.ts +2 -12
- package/dist/marks/curve-area.d.ts.map +1 -1
- package/dist/marks/curve-area.js +4 -9
- package/dist/marks/curve-area.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +1 -5
- package/dist/marks/drop-lines.d.ts.map +1 -1
- package/dist/marks/drop-lines.js.map +1 -1
- package/dist/marks/plot-point.d.ts +4 -13
- package/dist/marks/plot-point.d.ts.map +1 -1
- package/dist/marks/plot-point.js.map +1 -1
- package/dist/marks/riemann-sum.d.ts +1 -7
- package/dist/marks/riemann-sum.d.ts.map +1 -1
- package/dist/marks/riemann-sum.js +2 -2
- package/dist/marks/riemann-sum.js.map +1 -1
- package/dist/marks/tangent-line.d.ts +2 -12
- package/dist/marks/tangent-line.d.ts.map +1 -1
- package/dist/marks/tangent-line.js +1 -5
- package/dist/marks/tangent-line.js.map +1 -1
- package/dist/marks/vector-arrow.d.ts +2 -11
- package/dist/marks/vector-arrow.d.ts.map +1 -1
- package/dist/marks/vector-arrow.js +3 -6
- package/dist/marks/vector-arrow.js.map +1 -1
- package/dist/nodes.d.ts +1 -12
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/plots/function-plot.d.ts +1 -6
- package/dist/plots/function-plot.d.ts.map +1 -1
- package/dist/plots/function-plot.js +1 -5
- package/dist/plots/function-plot.js.map +1 -1
- package/dist/plots/points-plot.d.ts +1 -6
- package/dist/plots/points-plot.d.ts.map +1 -1
- package/dist/plots/points-plot.js.map +1 -1
- package/dist/plots/stream-lines.d.ts +0 -7
- package/dist/plots/stream-lines.d.ts.map +1 -1
- package/dist/plots/stream-lines.js.map +1 -1
- package/dist/plots/traced-path.d.ts +1 -12
- package/dist/plots/traced-path.d.ts.map +1 -1
- package/dist/plots/traced-path.js +1 -6
- package/dist/plots/traced-path.js.map +1 -1
- package/dist/plots/vector-field.d.ts +1 -10
- package/dist/plots/vector-field.d.ts.map +1 -1
- package/dist/plots/vector-field.js +3 -6
- package/dist/plots/vector-field.js.map +1 -1
- package/dist/structures/network-graph.d.ts +15 -34
- package/dist/structures/network-graph.d.ts.map +1 -1
- package/dist/structures/network-graph.js +2 -5
- package/dist/structures/network-graph.js.map +1 -1
- package/dist/structures/sample-space.d.ts +8 -22
- package/dist/structures/sample-space.d.ts.map +1 -1
- package/dist/structures/sample-space.js +3 -5
- package/dist/structures/sample-space.js.map +1 -1
- package/dist/systems/axes2d.d.ts +0 -1
- package/dist/systems/axes2d.d.ts.map +1 -1
- package/dist/systems/axes2d.js +3 -4
- package/dist/systems/axes2d.js.map +1 -1
- package/dist/systems/number-line.d.ts +7 -22
- package/dist/systems/number-line.d.ts.map +1 -1
- package/dist/systems/number-line.js +2 -2
- package/dist/systems/number-line.js.map +1 -1
- package/dist/systems/number-plane.d.ts +12 -27
- package/dist/systems/number-plane.d.ts.map +1 -1
- package/dist/systems/number-plane.js +1 -7
- package/dist/systems/number-plane.js.map +1 -1
- package/dist/systems/polar-plane.d.ts +11 -26
- package/dist/systems/polar-plane.d.ts.map +1 -1
- package/dist/systems/polar-plane.js +7 -10
- package/dist/systems/polar-plane.js.map +1 -1
- package/dist/tex/geometry.d.ts +5 -24
- package/dist/tex/geometry.d.ts.map +1 -1
- package/dist/tex/geometry.js +19 -90
- package/dist/tex/geometry.js.map +1 -1
- package/dist/tex/mathjax.d.ts +0 -13
- package/dist/tex/mathjax.d.ts.map +1 -1
- package/dist/tex/mathjax.js +4 -24
- package/dist/tex/mathjax.js.map +1 -1
- package/dist/tex/matrix.d.ts +1 -10
- package/dist/tex/matrix.d.ts.map +1 -1
- package/dist/tex/matrix.js +1 -5
- package/dist/tex/matrix.js.map +1 -1
- package/dist/tex/tween.d.ts +9 -30
- package/dist/tex/tween.d.ts.map +1 -1
- package/dist/tex/tween.js +19 -67
- package/dist/tex/tween.js.map +1 -1
- package/dist/tex/typeset.d.ts +2 -23
- package/dist/tex/typeset.d.ts.map +1 -1
- package/dist/tex/typeset.js +4 -30
- package/dist/tex/typeset.js.map +1 -1
- package/dist/three/axes3d.d.ts +32 -62
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +5 -13
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +4 -15
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js.map +1 -1
- package/dist/three/plot-point3d.d.ts +7 -14
- package/dist/three/plot-point3d.d.ts.map +1 -1
- package/dist/three/plot-point3d.js.map +1 -1
- package/dist/three/space.d.ts +3 -8
- package/dist/three/space.d.ts.map +1 -1
- package/dist/three/space.js +1 -8
- package/dist/three/space.js.map +1 -1
- package/dist/three/surface-plot3d.d.ts +9 -23
- package/dist/three/surface-plot3d.d.ts.map +1 -1
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +1 -7
- package/dist/three/vector-arrow3d.d.ts.map +1 -1
- package/dist/three/vector-arrow3d.js.map +1 -1
- package/package.json +4 -4
- package/src/annotate/angle-mark.ts +4 -14
- package/src/annotate/curly-brace.ts +2 -14
- package/src/annotate/emphasis-mark.ts +1 -6
- package/src/engine.ts +3 -4
- package/src/kit/cache.ts +33 -25
- package/src/kit/component.ts +5 -19
- package/src/kit/coords.ts +2 -2
- package/src/kit/curve.ts +1 -5
- package/src/kit/equation.ts +12 -50
- package/src/kit/equation3d.ts +23 -59
- package/src/kit/expression.ts +18 -23
- package/src/kit/field-mark.ts +1 -7
- package/src/kit/field.ts +10 -26
- package/src/kit/follow.ts +5 -13
- package/src/kit/furniture.ts +7 -4
- package/src/kit/geometry.ts +4 -0
- package/src/kit/mark.ts +4 -11
- package/src/kit/place.ts +3 -5
- package/src/kit/sampler.ts +0 -6
- package/src/kit/system.ts +3 -12
- package/src/marks/curve-area.ts +3 -16
- package/src/marks/drop-lines.ts +0 -6
- package/src/marks/plot-point.ts +2 -12
- package/src/marks/riemann-sum.ts +2 -10
- package/src/marks/tangent-line.ts +1 -13
- package/src/marks/vector-arrow.ts +3 -13
- package/src/nodes.ts +1 -12
- package/src/plots/function-plot.ts +1 -6
- package/src/plots/points-plot.ts +0 -7
- package/src/plots/stream-lines.ts +1 -8
- package/src/plots/traced-path.ts +2 -13
- package/src/plots/vector-field.ts +4 -12
- package/src/structures/network-graph.ts +6 -25
- package/src/structures/sample-space.ts +5 -20
- package/src/systems/axes2d.ts +3 -6
- package/src/systems/number-line.ts +4 -20
- package/src/systems/number-plane.ts +4 -19
- package/src/systems/polar-plane.ts +11 -25
- package/src/tex/geometry.ts +24 -126
- package/src/tex/mathjax.ts +4 -26
- package/src/tex/matrix.ts +1 -11
- package/src/tex/tween.ts +21 -75
- package/src/tex/typeset.ts +4 -37
- package/src/three/axes3d.ts +7 -42
- package/src/three/curve-plot3d.ts +0 -12
- package/src/three/plot-point3d.ts +0 -10
- package/src/three/space.ts +2 -11
- package/src/three/surface-plot3d.ts +0 -15
- package/src/three/vector-arrow3d.ts +0 -8
- package/dist/browser/chunks/chunk-IRZCG6PM.js +0 -2
- package/dist/browser/chunks/chunk-IRZCG6PM.js.map +0 -7
- package/dist/browser/chunks/chunk-WMVW6ZIV.js +0 -2
- package/dist/browser/chunks/chunk-WMVW6ZIV.js.map +0 -7
- package/dist/kit/withdrawn.d.ts +0 -9
- package/dist/kit/withdrawn.d.ts.map +0 -1
- package/dist/kit/withdrawn.js +0 -9
- package/dist/kit/withdrawn.js.map +0 -1
- package/src/kit/withdrawn.ts +0 -8
package/dist/tex/geometry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/tex/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMlD,IAAI,OAAO,GAA0B,IAAI,CAAC;AAC1C,IAAI,OAAO,GAAyB,IAAI,CAAC;AACzC,2HAA2H;AAC3H,IAAI,O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AAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;QACtE,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC","sourcesContent":["\nimport { PathCommand } from '@motionscript/sdk';\n\nimport { createBoundedCache } from '../kit/cache';\n\n// --- MathJax, on demand ---\n\ntype MathJaxRuntime = typeof import('./mathjax');\n\nlet runtime: MathJaxRuntime | null = null;\nlet loading: Promise<void> | null = null;\n// MathJax's DOM, a real one or its own DOM-free tree: read only through its accessors, so its element type is opaque here.\nlet adaptor: any = null;\n\n/**\n * The asset key a node that typesets declares its loader under: the host waits\n * for it before laying the node out, and a scene with no formula never loads it.\n */\nexport const MATHJAX_LOADER = 'math:mathjax';\n\n/** Load MathJax, once. A host that typesets outside a scene (a tool, a test) awaits this first. */\nexport function loadMathJax(): Promise<void> {\n loading ??= import('./mathjax').then((module) => {\n runtime = module;\n adaptor = module.adaptor;\n });\n return loading;\n}\n\n/** Whether MathJax has loaded, so a formula can be typeset now. */\nexport function mathJaxLoaded(): boolean {\n return runtime !== null;\n}\n\n/** What a formula is before MathJax has loaded: nothing to draw, and nothing cached. */\nexport function blankLatex(): LatexPathResult {\n return { tokens: [], parts: [], commands: [], width: 0, height: 0, bounds: [0, 0, 0, 0] };\n}\n\n/** MathJax is not loaded yet: what typesetting throws before {@link loadMathJax} has resolved. */\nexport class LatexNotLoaded extends Error {\n constructor() {\n super('MathJax is not loaded: declare the math:mathjax loader, or await loadMathJax(), before typesetting.');\n this.name = 'LatexNotLoaded';\n }\n}\n\n// --- Public API ---\n\n/**\n * A formula MathJax could not typeset.\n *\n * MathJax does not throw on malformed TeX. It typesets an error box in place of\n * the formula and tags it `data-mjx-error`, so the failure arrives as a drawing:\n * nothing at all from the browser adaptor and a filled bar from the DOM-free\n * one, which left a host able to tell a bad formula from a blank one only by the\n * token count. {@link buildLatexPath} raises this instead, the same way under\n * both adaptors. `\\require` is an error too, since only the packages named above\n * are loaded.\n */\nexport class LatexError extends Error {\n /** The formula that failed, as it was given. */\n readonly latex: string;\n /** MathJax's own description of what is wrong with it. */\n readonly reason: string;\n\n constructor(latex: string, reason: string) {\n super(`Cannot typeset \"${latex}\": ${reason}`);\n this.name = 'LatexError';\n this.latex = latex;\n this.reason = reason;\n }\n}\n\n/** A single rendered glyph or shape with its character key and path commands. */\nexport interface LatexToken {\n /** Character this token represents, or a synthetic key for non-glyph shapes. */\n token: string;\n path: PathCommand[];\n /** The source of the top-level term the token belongs to, `a^2` in `a^2 + b^2`; empty for none. */\n term?: string;\n}\n\n/**\n * A piece of a formula as its source wrote it: `x^2`, `\\frac{d}{dx}`, a lone\n * `+`. Every group the typesetter makes is one, so parts nest.\n */\nexport interface LatexPart {\n /** The part's own source. */\n latex: string;\n /** The tokens it draws, as a span of the formula's token list: `from` up to, not including, `to`. */\n from: number;\n to: number;\n /** The index of the part it sits in, or -1 at the top. */\n parent: number;\n}\n\nexport interface LatexPathResult {\n /** All tokens in render order. */\n tokens: LatexToken[];\n /** Every part of the formula, outermost first, in source order. */\n parts: LatexPart[];\n /** Flat array of all path commands (for legacy single-path rendering). */\n commands: PathCommand[];\n width: number;\n height: number;\n /**\n * Bounding box over every token, in token coordinate space:\n * [minX, minY, maxX, maxY]. All tokens share this frame, so passing it as\n * each path's center frame keeps their relative layout (instead of each\n * glyph centering on its own bbox).\n */\n bounds: [number, number, number, number];\n}\n\n/**\n * A formula's glyph geometry, before a type size is applied to it.\n *\n * The dividing line this whole module's caching turns on. Getting here is the\n * expensive part — MathJax lays the formula out, then the SVG it produces is\n * parsed, its glyph dictionary resolved and every `<use>` walked through its\n * transform stack — and **none of it depends on `fontSize`**: `mjDoc.convert`\n * is called at a fixed em/ex, and the size arrives at the very end as one\n * uniform scale (see {@link scaleLatexGeometry}).\n *\n * So this is what gets remembered per formula, and the size is applied to it\n * afresh. A formula animating from 24pt to 120pt is one trip through MathJax\n * and one DOM parse, not one per frame.\n */\ninterface LatexGeometry {\n tokens: RawToken[];\n parts: LatexPart[];\n /** Box over every command, in the SVG's own coordinates. */\n box: { minX: number; minY: number; maxX: number; maxY: number };\n /** The formula's height in `ex`, as MathJax reported it. */\n heightEx: number;\n}\n\n/**\n * Formulas already worked out, and formulas already sized.\n *\n * `buildLatexPath` is a pure function of `(text, fontSize)` and used to have no\n * memory, which made every caller pay full price for a question it had already\n * asked. The callers are not occasional about it either: constructing a `Latex`\n * resolves its formula, and so does every `to({ latex })` the moment it starts,\n * so a scene re-resolves every formula in it whenever it is rebuilt *and*\n * whenever the playhead moves backwards, since a backward seek replays the\n * scene's generator from its first frame. An editor that rebuilds on a keystroke\n * and seeks on a click asks for the same handful of formulas hundreds of times.\n *\n * Two memos, each keyed by what its stage actually depends on, and deliberately\n * different sizes:\n *\n * - {@link geometryCache} is everything up to the type size, keyed by the text\n * alone. This is the expensive one, and it is generously sized because\n * nothing a scene does can churn it: a deck holds as many distinct formulas\n * as it holds, and it holds them for as long as it is open.\n * - {@link pathCache} is the finished result, keyed by text *and* size. Small\n * on purpose: an animated `fontSize` inserts a distinct key every frame, and\n * the right thing for a stream like that is to churn a little memo rather\n * than a big one. What a miss costs here is arithmetic over glyphs already\n * worked out — no MathJax, no parse.\n */\nconst geometryCache = createBoundedCache<LatexGeometry>(128);\nconst pathCache = createBoundedCache<LatexPathResult>(64);\n\nexport function buildLatexPath(text: string, fontSize: number): LatexPathResult {\n // NUL rather than a punctuation separator, so no formula can spell a key\n // belonging to another size.\n const key = `${fontSize}\\0${text}`;\n\n const hit = pathCache.get(key);\n if (hit) return lend(hit);\n\n let geometry = geometryCache.get(text);\n if (!geometry) {\n geometry = buildLatexGeometry(text);\n geometryCache.set(text, geometry);\n }\n\n const result = scaleLatexGeometry(geometry, fontSize);\n pathCache.set(key, result);\n return lend(result);\n}\n\n/** Typeset `text` and reduce the SVG MathJax returns to glyph geometry. */\nfunction buildLatexGeometry(text: string): LatexGeometry {\n if (!runtime) throw new LatexNotLoaded();\n const svgEl = adaptor.firstChild(runtime.convert(text));\n const failure = mathJaxError(svgEl);\n if (failure !== null) throw new LatexError(text, failure);\n\n const heightAttr = adaptor.getAttribute(svgEl, 'height') ?? '';\n\n return parseLatexSvg(svgEl, parseFloat(heightAttr) || 0);\n}\n\n/**\n * MathJax's description of the error box in a typeset formula, or `null` when\n * there is none. Read through the adaptor, so a real DOM and the DOM-free tree\n * give the same answer.\n */\nfunction mathJaxError(svgEl: unknown): string | null {\n for (const el of adaptor.tags(svgEl, 'g') as unknown[]) {\n const reason = adaptor.getAttribute(el, 'data-mjx-error');\n if (reason !== null && reason !== undefined) return String(reason) || 'unknown error';\n }\n return null;\n}\n\n/**\n * A cached result, handed out safely.\n *\n * `tokens`, `commands` and the path arrays inside them are shared: they are read\n * by everything downstream and written by none of it — `Latex` maps tokens into\n * its own wrappers, and the morph builds new paths rather than editing the ones\n * it is given — so copying them would be copying the whole formula for nothing.\n *\n * `bounds` is copied, because it is the one field a caller *stores*: `Latex`\n * assigns `result.bounds` straight to `this._bounds` and hands it to the\n * renderer as a shared centring frame. That was one node holding its own array\n * before there was a memo, and would be two nodes drawing the same formula\n * holding one array between them after — four numbers is not a price worth\n * paying to find out whether anything downstream ever writes to it.\n */\nfunction lend(result: LatexPathResult): LatexPathResult {\n const [minX, minY, maxX, maxY] = result.bounds;\n return { ...result, bounds: [minX, minY, maxX, maxY] };\n}\n\n// --- High-Speed Matrix Math ---\n\ntype Matrix = [number, number, number, number, number, number]; // [a, b, c, d, tx, ty]\nconst identityMatrix: Matrix = [1, 0, 0, 1, 0, 0];\n\nfunction multiplyMatrix(m1: Matrix, m2: Matrix): Matrix {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n}\n\nfunction parseTransform(str: string | null): Matrix {\n if (!str) return identityMatrix;\n let m: Matrix = [...identityMatrix];\n const re = /([a-z]+)\\(([^)]+)\\)/g;\n let match;\n while ((match = re.exec(str)) !== null) {\n const type = match[1];\n const args = match[2].split(/[ ,]+/).map(parseFloat);\n if (type === 'translate') {\n m = multiplyMatrix(m, [1, 0, 0, 1, args[0] || 0, args[1] || 0]);\n } else if (type === 'scale') {\n const sx = args[0] || 1;\n const sy = args[1] !== undefined ? args[1] : sx;\n m = multiplyMatrix(m, [sx, 0, 0, sy, 0, 0]);\n } else if (type === 'matrix') {\n m = multiplyMatrix(m, [args[0], args[1], args[2], args[3], args[4], args[5]]);\n }\n }\n return m;\n}\n\nfunction applyMatrix(x: number, y: number, m: Matrix): [number, number] {\n return [\n x * m[0] + y * m[2] + m[4],\n x * m[1] + y * m[3] + m[5],\n ];\n}\n\n// --- Glyph ID → character decoding ---\n\n/**\n * MathJax SVG glyph IDs look like \"MJX-1-TEX-N-78\" or \"MJX-1-TEX-I-1D465\".\n * The last segment is the Unicode codepoint in hex.\n */\nfunction glyphIdToChar(id: string): string {\n const parts = id.split('-');\n const hex = parts[parts.length - 1];\n const cp = parseInt(hex, 16);\n if (!isNaN(cp)) {\n try { return String.fromCodePoint(cp); } catch { /* fall through */ }\n }\n return id;\n}\n\n// --- Core Fast Traversal Engine ---\n\ntype RawToken = { token: string; cmds: Array<{ cmd: string; args: number[] }>; term?: string };\n\n/** The tag name of a node's parent, or \"\" at the root. */\nfunction parentKind(node: unknown): string {\n const parent = adaptor.parent(node);\n return parent ? String(adaptor.kind(parent)).toLowerCase() : \"\";\n}\n\n/**\n * The size-independent half: MathJax's own SVG tree in, glyph geometry out.\n *\n * Walked through the **adaptor** rather than a `DOMParser`. MathJax already\n * builds this tree, and the adaptor is its own abstraction over \"a real DOM\" and\n * \"the DOM-free `LiteElement` tree\" — the two this module already picks between\n * at load. Serialising it to a string and parsing it back needed a `DOMParser`,\n * which Node does not have, so every LaTeX node threw `DOMParser is not defined`\n * and could not render headlessly at all: no export, and nothing the visual\n * suite could check.\n *\n * Reading the tree directly is also one representation instead of three (tree →\n * string → tree), so a browser and a headless host cannot disagree about how the\n * markup re-parsed.\n */\nfunction parseLatexSvg(svgEl: unknown, heightEx: number): LatexGeometry {\n // Pre-parse the glyph dictionary. `tags` reaches every <path> in the tree,\n // including the ones inside <defs> that the `use` elements reference.\n const glyphMap = new Map<string, Array<{ cmd: string; args: number[] }>>();\n for (const el of adaptor.tags(svgEl, 'path') as unknown[]) {\n const id = adaptor.getAttribute(el, 'id');\n const d = adaptor.getAttribute(el, 'd');\n if (id && d) {\n glyphMap.set(`#${id}`, expandToAbsolute(tokenisePath(d)));\n }\n }\n\n // Collect raw tokens — each <use> is one token, rects/paths are grouped as synthetic tokens\n const rawTokens: RawToken[] = [];\n const parts: LatexPart[] = [];\n let synthIdx = 0;\n\n function pushCmds(token: string, cmds: Array<{ cmd: string; args: number[] }>) {\n rawTokens.push({ token, cmds });\n }\n\n function traverse(node: unknown, currentMatrix: Matrix, within: number) {\n let nodeMatrix = currentMatrix;\n\n const transformStr = adaptor.getAttribute(node, \"transform\");\n if (transformStr) {\n nodeMatrix = multiplyMatrix(nodeMatrix, parseTransform(transformStr));\n }\n\n const nodeName = String(adaptor.kind(node)).toLowerCase();\n\n // MathJax tags each group with the source it typeset; the root's is the whole formula.\n let part = within;\n const source = nodeName === \"g\" ? adaptor.getAttribute(node, \"data-latex\") : null;\n if (source && adaptor.getAttribute(node, \"data-mml-node\") !== \"math\") {\n part = parts.length;\n parts.push({ latex: String(source), from: rawTokens.length, to: rawTokens.length, parent: within });\n }\n\n if (nodeName === \"use\") {\n const href = adaptor.getAttribute(node, \"href\") || adaptor.getAttribute(node, \"xlink:href\");\n const x = parseFloat(adaptor.getAttribute(node, \"x\") || \"0\");\n const y = parseFloat(adaptor.getAttribute(node, \"y\") || \"0\");\n\n if (href && glyphMap.has(href)) {\n const glyphCommands = glyphMap.get(href)!;\n const cmds: Array<{ cmd: string; args: number[] }> = [];\n for (const gc of glyphCommands) {\n const shiftedArgs = [...gc.args];\n for (let j = 0; j < shiftedArgs.length; j += 2) {\n const [nx, ny] = applyMatrix(shiftedArgs[j] + x, shiftedArgs[j + 1] + y, nodeMatrix);\n shiftedArgs[j] = nx;\n shiftedArgs[j + 1] = ny;\n }\n cmds.push({ cmd: gc.cmd, args: shiftedArgs });\n }\n // Derive character from glyph ID\n const rawId = href.startsWith('#') ? href.slice(1) : href;\n pushCmds(glyphIdToChar(rawId), cmds);\n }\n } else if (nodeName === \"rect\") {\n const x = parseFloat(adaptor.getAttribute(node, \"x\") || \"0\");\n const y = parseFloat(adaptor.getAttribute(node, \"y\") || \"0\");\n const w = parseFloat(adaptor.getAttribute(node, \"width\") || \"0\");\n const h = parseFloat(adaptor.getAttribute(node, \"height\") || \"0\");\n\n if (w > 0 && h > 0) {\n const pts = [[x, y], [x + w, y], [x + w, y + h], [x, y + h]];\n const tp = pts.map(p => applyMatrix(p[0], p[1], nodeMatrix));\n pushCmds(`__rect_${synthIdx++}`, [\n { cmd: 'M', args: [tp[0][0], tp[0][1]] },\n { cmd: 'L', args: [tp[1][0], tp[1][1]] },\n { cmd: 'L', args: [tp[2][0], tp[2][1]] },\n { cmd: 'L', args: [tp[3][0], tp[3][1]] },\n { cmd: 'Z', args: [] },\n ]);\n }\n } else if (nodeName === \"path\" && parentKind(node) !== \"defs\") {\n const d = adaptor.getAttribute(node, \"d\");\n if (d) {\n const abs = expandToAbsolute(tokenisePath(d));\n const cmds: Array<{ cmd: string; args: number[] }> = [];\n for (const gc of abs) {\n const shiftedArgs = [...gc.args];\n for (let j = 0; j < shiftedArgs.length; j += 2) {\n const [nx, ny] = applyMatrix(shiftedArgs[j], shiftedArgs[j + 1], nodeMatrix);\n shiftedArgs[j] = nx;\n shiftedArgs[j + 1] = ny;\n }\n cmds.push({ cmd: gc.cmd, args: shiftedArgs });\n }\n pushCmds(`__path_${synthIdx++}`, cmds);\n }\n }\n\n for (const child of adaptor.childNodes(node) as unknown[]) {\n // A text node's kind is \"#text\"; only elements carry geometry, and\n // <defs> holds the dictionary rather than anything drawn.\n const kind = String(adaptor.kind(child)).toLowerCase();\n if (kind.startsWith(\"#\") || kind === \"defs\") continue;\n traverse(child, nodeMatrix, part);\n }\n if (part !== within) parts[part].to = rawTokens.length;\n }\n\n traverse(svgEl, identityMatrix, -1);\n\n for (const part of parts) {\n if (part.parent !== -1) continue;\n for (let i = part.from; i < part.to; i++) rawTokens[i].term = part.latex;\n }\n\n // Bounding box across all raw commands, in the SVG's own coordinates.\n const box = svgBBox(rawTokens.flatMap(t => t.cmds));\n return { tokens: rawTokens, parts, box, heightEx };\n}\n\n/**\n * The size-dependent half: glyph geometry in, a laid-out formula out.\n *\n * Everything here is one uniform scale about the geometry's own centre, which\n * is exactly why {@link LatexGeometry} is worth remembering on its own.\n */\nfunction scaleLatexGeometry(geometry: LatexGeometry, fontSize: number): LatexPathResult {\n const { tokens: rawTokens, parts, box, heightEx } = geometry;\n if (rawTokens.length === 0) return { tokens: [], parts: [], commands: [], width: 0, height: 0, bounds: [0, 0, 0, 0] };\n\n const { minX, minY, maxX, maxY } = box;\n const svgW = maxX - minX;\n const svgH = maxY - minY;\n\n let scale: number;\n if (heightEx > 0 && svgH > 0) {\n const exInCoords = svgH / heightEx;\n scale = fontSize / (2 * exInCoords);\n } else {\n scale = svgH > 0 ? fontSize / svgH : 1;\n }\n\n const ocx = (minX + maxX) / 2;\n const ocy = (minY + maxY) / 2;\n\n const tx = (svgX: number) => (svgX - ocx) * scale;\n const ty = (svgY: number) => (svgY - ocy) * scale;\n\n function rawCmdsToPathCommands(cmds: Array<{ cmd: string; args: number[] }>): PathCommand[] {\n const out: PathCommand[] = [];\n for (const { cmd, args: a } of cmds) {\n switch (cmd) {\n case 'M': out.push({ type: 'M', x: tx(a[0]), y: ty(a[1]) }); break;\n case 'L': out.push({ type: 'L', x: tx(a[0]), y: ty(a[1]) }); break;\n case 'Q': out.push({ type: 'Q', x1: tx(a[0]), y1: ty(a[1]), x: tx(a[2]), y: ty(a[3]) }); break;\n case 'C': out.push({ type: 'C', x1: tx(a[0]), y1: ty(a[1]), x2: tx(a[2]), y2: ty(a[3]), x: tx(a[4]), y: ty(a[5]) }); break;\n case 'Z': out.push({ type: 'Z' }); break;\n }\n }\n return out;\n }\n\n const tokens: LatexToken[] = rawTokens.map(rt => ({\n token: rt.token,\n path: rawCmdsToPathCommands(rt.cmds),\n ...(rt.term !== undefined && { term: rt.term }),\n }));\n\n const commands = tokens.flatMap(t => t.path);\n\n // Shared center frame for all tokens, in token coordinate space. tx/ty map\n // the SVG bbox corners; this is the frame every token's path is laid out in.\n const bounds: [number, number, number, number] = [\n tx(minX), ty(minY), tx(maxX), ty(maxY),\n ];\n\n return { tokens, parts, commands, width: svgW * scale, height: svgH * scale, bounds };\n}\n\n// --- Parts ---\n\n// Spacing and grouping braces are how a source is written, not what it says:\n// `x^{2}` and `x^2` name one part.\nfunction partKey(latex: string): string {\n return latex.replace(/[\\s{}]/g, \"\");\n}\n\n/**\n * The sources of a formula's parts, each once, in the order written: what a\n * host offers to pick a part from. Empty for a formula that will not typeset.\n */\nexport function latexPartNames(source: string): string[] {\n if (source.trim() === \"\") return [];\n let parts: LatexPart[];\n try {\n parts = buildLatexPath(source, 16).parts;\n } catch {\n return [];\n }\n const seen = new Set<string>();\n const names: string[] = [];\n for (const part of parts) {\n const key = partKey(part.latex);\n if (part.to <= part.from || key === \"\" || seen.has(key)) continue;\n seen.add(key);\n names.push(part.latex);\n }\n return names;\n}\n\n/**\n * The token spans `selector` names in a formula, in source order: every part\n * whose source it is, and every run of neighbouring parts that spell it\n * together (`b^2 = c^2` in `a^2 + b^2 = c^2`). Empty when it names nothing.\n */\nexport function findLatexParts(parts: readonly LatexPart[], selector: string): Array<[from: number, to: number]> {\n const wanted = partKey(selector);\n if (wanted === \"\") return [];\n const found = new Map<string, [number, number]>();\n const keep = (from: number, to: number) => {\n if (to > from) found.set(`${from}:${to}`, [from, to]);\n };\n const children = new Map<number, number[]>();\n parts.forEach((part, i) => {\n if (partKey(part.latex) === wanted) keep(part.from, part.to);\n const siblings = children.get(part.parent);\n if (siblings) siblings.push(i);\n else children.set(part.parent, [i]);\n });\n for (const siblings of children.values()) {\n for (let a = 0; a < siblings.length; a++) {\n let spelled = \"\";\n for (let b = a; b < siblings.length && spelled.length < wanted.length; b++) {\n spelled += partKey(parts[siblings[b]].latex);\n if (b > a && spelled === wanted) keep(parts[siblings[a]].from, parts[siblings[b]].to);\n }\n }\n }\n return [...found.values()].sort((x, y) => x[0] - y[0] || x[1] - y[1]);\n}\n\n// --- SVG Path Utilities ---\n\ntype RawCmd = { cmd: string; args: number[] };\n\nfunction tokenisePath(d: string): RawCmd[] {\n const re = /([MmLlHhVvCcSsQqTtAaZz])|([+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)/g;\n const out: RawCmd[] = [];\n let cur: RawCmd | null = null;\n let m: RegExpExecArray | null;\n while ((m = re.exec(d)) !== null) {\n if (m[1]) { cur = { cmd: m[1], args: [] }; out.push(cur); }\n else if (cur) cur.args.push(parseFloat(m[2]));\n }\n return out;\n}\n\nfunction argCount(cmd: string): number {\n switch (cmd.toUpperCase()) {\n case 'M': return 2; case 'L': return 2; case 'H': return 1; case 'V': return 1;\n case 'C': return 6; case 'S': return 4; case 'Q': return 4; case 'T': return 2;\n case 'A': return 7; case 'Z': return 0; default: return 0;\n }\n}\n\ninterface Pt { x: number; y: number }\n\nfunction expandToAbsolute(raw: RawCmd[]): Array<{ cmd: string; args: number[] }> {\n const out: Array<{ cmd: string; args: number[] }> = [];\n let cx = 0, cy = 0;\n let mx = 0, my = 0;\n let prevCmd = '';\n let prevCtrl: Pt = { x: 0, y: 0 };\n\n for (const { cmd, args } of raw) {\n const up = cmd.toUpperCase();\n const rel = cmd === cmd.toLowerCase() && up !== 'Z';\n const n = argCount(up);\n const reps = n === 0 ? 1 : Math.max(1, Math.ceil(args.length / n));\n\n for (let r = 0; r < reps; r++) {\n const a = args.slice(r * n, r * n + n);\n const absX = (i: number) => rel ? a[i] + cx : a[i];\n const absY = (i: number) => rel ? a[i] + cy : a[i];\n\n switch (up) {\n case 'M': {\n const x = absX(0), y = absY(1);\n const emitCmd = r === 0 ? 'M' : 'L';\n out.push({ cmd: emitCmd, args: [x, y] });\n cx = x; cy = y;\n if (r === 0) { mx = x; my = y; }\n prevCmd = emitCmd;\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'Z':\n out.push({ cmd: 'Z', args: [] });\n cx = mx; cy = my;\n prevCmd = 'Z';\n break;\n case 'L': {\n const x = absX(0), y = absY(1);\n out.push({ cmd: 'L', args: [x, y] });\n cx = x; cy = y;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'H': {\n const x = rel ? a[0] + cx : a[0];\n out.push({ cmd: 'L', args: [x, cy] });\n cx = x;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'V': {\n const y = rel ? a[0] + cy : a[0];\n out.push({ cmd: 'L', args: [cx, y] });\n cy = y;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'C': {\n const x1 = absX(0), y1 = absY(1);\n const x2 = absX(2), y2 = absY(3);\n const x = absX(4), y = absY(5);\n out.push({ cmd: 'C', args: [x1, y1, x2, y2, x, y] });\n prevCtrl = { x: x2, y: y2 };\n cx = x; cy = y;\n prevCmd = 'C';\n break;\n }\n case 'S': {\n const x1 = prevCmd === 'C' || prevCmd === 'S' ? 2 * cx - prevCtrl.x : cx;\n const y1 = prevCmd === 'C' || prevCmd === 'S' ? 2 * cy - prevCtrl.y : cy;\n const x2 = absX(0), y2 = absY(1);\n const x = absX(2), y = absY(3);\n out.push({ cmd: 'C', args: [x1, y1, x2, y2, x, y] });\n prevCtrl = { x: x2, y: y2 };\n cx = x; cy = y;\n prevCmd = 'S';\n break;\n }\n case 'Q': {\n const x1 = absX(0), y1 = absY(1);\n const x = absX(2), y = absY(3);\n out.push({ cmd: 'Q', args: [x1, y1, x, y] });\n prevCtrl = { x: x1, y: y1 };\n cx = x; cy = y;\n prevCmd = 'Q';\n break;\n }\n case 'T': {\n const x1 = prevCmd === 'Q' || prevCmd === 'T' ? 2 * cx - prevCtrl.x : cx;\n const y1 = prevCmd === 'Q' || prevCmd === 'T' ? 2 * cy - prevCtrl.y : cy;\n const x = absX(0), y = absY(1);\n out.push({ cmd: 'Q', args: [x1, y1, x, y] });\n prevCtrl = { x: x1, y: y1 };\n cx = x; cy = y;\n prevCmd = 'T';\n break;\n }\n }\n }\n }\n\n if (out.length > 0 && out[out.length - 1].cmd !== 'Z') {\n out.push({ cmd: 'Z', args: [] });\n }\n\n return out;\n}\n\nfunction svgBBox(abs: Array<{ cmd: string; args: number[] }>): { minX: number; minY: number; maxX: number; maxY: number } {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n const touch = (x: number, y: number) => {\n if (x < minX) minX = x; if (x > maxX) maxX = x;\n if (y < minY) minY = y; if (y > maxY) maxY = y;\n };\n for (const { cmd, args } of abs) {\n switch (cmd) {\n case 'M': case 'L': touch(args[0], args[1]); break;\n case 'C': touch(args[0], args[1]); touch(args[2], args[3]); touch(args[4], args[5]); break;\n case 'Q': touch(args[0], args[1]); touch(args[2], args[3]); break;\n }\n }\n return { minX, minY, maxX, maxY };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/tex/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIlD,IAAI,OAAO,GAA0B,IAAI,CAAC;AAC1C,IAAI,OAAO,GAAyB,IAAI,CAAC;AACzC,2HAA2H;AAC3H,IAAI,OAAO,GAAQ,IAAI,CAAC;AA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AAC,CAAC;QAAC,IAAI,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;QAAC,IAAI,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;IACnD,CAAC,CAAC;IACF,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;QAC9B,QAAQ,GAAG,EAAE,CAAC;YACV,KAAK,GAAG,CAAC;YAAC,KAAK,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YACnD,KAAK,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;YAC3F,KAAK,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,MAAM;QACtE,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC","sourcesContent":["\nimport { PathCommand } from '@motionscript/sdk';\n\nimport { createBoundedCache } from '../kit/cache';\n\ntype MathJaxRuntime = typeof import('./mathjax');\n\nlet runtime: MathJaxRuntime | null = null;\nlet loading: Promise<void> | null = null;\n// MathJax's DOM, a real one or its own DOM-free tree: read only through its accessors, so its element type is opaque here.\nlet adaptor: any = null;\n\n/**\n * The asset key a node that typesets declares its loader under: the host waits\n * for it before laying the node out, and a scene with no formula never loads it.\n */\nexport const MATHJAX_LOADER = 'math:mathjax';\n\n/** Load MathJax, once. A host that typesets outside a scene (a tool, a test) awaits this first. */\nexport function loadMathJax(): Promise<void> {\n loading ??= import('./mathjax').then((module) => {\n runtime = module;\n adaptor = module.adaptor;\n });\n return loading;\n}\n\nexport function mathJaxLoaded(): boolean {\n return runtime !== null;\n}\n\n/** What a formula is before MathJax has loaded: nothing to draw, and nothing cached. */\nexport function blankLatex(): LatexPathResult {\n return { tokens: [], parts: [], width: 0, height: 0, bounds: [0, 0, 0, 0] };\n}\n\n/** MathJax is not loaded yet: what typesetting throws before {@link loadMathJax} has resolved. */\nexport class LatexNotLoaded extends Error {\n constructor() {\n super('MathJax is not loaded: declare the math:mathjax loader, or await loadMathJax(), before typesetting.');\n this.name = 'LatexNotLoaded';\n }\n}\n\n/**\n * A formula MathJax could not typeset. MathJax does not throw on malformed TeX:\n * it typesets an error box tagged `data-mjx-error`, so {@link buildLatexPath}\n * raises this instead, the same under both adaptors. `\\require` is an error too.\n */\nexport class LatexError extends Error {\n readonly latex: string;\n readonly reason: string;\n\n constructor(latex: string, reason: string) {\n super(`Cannot typeset \"${latex}\": ${reason}`);\n this.name = 'LatexError';\n this.latex = latex;\n this.reason = reason;\n }\n}\n\nexport interface LatexToken {\n /** The character, or a synthetic key (`__rect_N`, `__path_N`) for a rule or bare path. */\n token: string;\n path: PathCommand[];\n /** The source of the top-level term the token belongs to, `a^2` in `a^2 + b^2`; empty for none. */\n term?: string;\n}\n\n/**\n * A piece of a formula as its source wrote it: `x^2`, `\\frac{d}{dx}`, a lone\n * `+`. Every group the typesetter makes is one, so parts nest.\n */\nexport interface LatexPart {\n latex: string;\n /** The tokens it draws, as a span of the formula's token list: `from` up to, not including, `to`. */\n from: number;\n to: number;\n /** The index of the part it sits in, or -1 at the top. */\n parent: number;\n}\n\nexport interface LatexPathResult {\n tokens: LatexToken[];\n /** Every part of the formula, outermost first, in source order. */\n parts: LatexPart[];\n width: number;\n height: number;\n /** [minX, minY, maxX, maxY] over every token: the one centring frame they all share. */\n bounds: [number, number, number, number];\n}\n\n/**\n * A formula's glyph geometry before a type size is applied. Getting here is the\n * expensive part (MathJax, the SVG walk) and none of it depends on `fontSize`,\n * which arrives at the end as one uniform scale, so this is what gets cached.\n */\ninterface LatexGeometry {\n tokens: RawToken[];\n parts: LatexPart[];\n /** Box over every command, in the SVG's own coordinates. */\n box: { minX: number; minY: number; maxX: number; maxY: number };\n /** The formula's height in `ex`, as MathJax reported it. */\n heightEx: number;\n}\n\n/**\n * `geometryCache` is keyed by text alone and sized for a whole deck. `pathCache`\n * is keyed by text and size and kept small: an animated `fontSize` adds a key\n * every frame, and a miss there is only arithmetic over cached geometry.\n * Backward seeks and rebuilds re-ask for the same formulas hundreds of times.\n */\nconst geometryCache = createBoundedCache<LatexGeometry>(128);\nconst pathCache = createBoundedCache<LatexPathResult>(64);\n\nexport function buildLatexPath(text: string, fontSize: number): LatexPathResult {\n // NUL rather than a punctuation separator, so no formula can spell a key\n // belonging to another size.\n const key = `${fontSize}\\0${text}`;\n\n const hit = pathCache.get(key);\n if (hit) return lend(hit);\n\n let geometry = geometryCache.get(text);\n if (!geometry) {\n geometry = buildLatexGeometry(text);\n geometryCache.set(text, geometry);\n }\n\n const result = scaleLatexGeometry(geometry, fontSize);\n pathCache.set(key, result);\n return lend(result);\n}\n\n/** Typeset `text` and reduce the SVG MathJax returns to glyph geometry. */\nfunction buildLatexGeometry(text: string): LatexGeometry {\n if (!runtime) throw new LatexNotLoaded();\n const svgEl = adaptor.firstChild(runtime.convert(text));\n const failure = mathJaxError(svgEl);\n if (failure !== null) throw new LatexError(text, failure);\n\n const heightAttr = adaptor.getAttribute(svgEl, 'height') ?? '';\n\n return parseLatexSvg(svgEl, parseFloat(heightAttr) || 0);\n}\n\n/** MathJax's description of the error box in a typeset formula, or `null`; read through the adaptor so a real DOM and the DOM-free tree agree. */\nfunction mathJaxError(svgEl: unknown): string | null {\n for (const el of adaptor.tags(svgEl, 'g') as unknown[]) {\n const reason = adaptor.getAttribute(el, 'data-mjx-error');\n if (reason !== null && reason !== undefined) return String(reason) || 'unknown error';\n }\n return null;\n}\n\n/**\n * Tokens and their paths are shared, since nothing downstream writes to them.\n * `bounds` is copied: `Latex` stores it and hands it to the renderer as a\n * centring frame, and two nodes on one formula must not share an array.\n */\nfunction lend(result: LatexPathResult): LatexPathResult {\n const [minX, minY, maxX, maxY] = result.bounds;\n return { ...result, bounds: [minX, minY, maxX, maxY] };\n}\n\ntype Matrix = [number, number, number, number, number, number]; // [a, b, c, d, tx, ty]\nconst identityMatrix: Matrix = [1, 0, 0, 1, 0, 0];\n\nfunction multiplyMatrix(m1: Matrix, m2: Matrix): Matrix {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n}\n\nfunction parseTransform(str: string | null): Matrix {\n if (!str) return identityMatrix;\n let m: Matrix = [...identityMatrix];\n const re = /([a-z]+)\\(([^)]+)\\)/g;\n let match;\n while ((match = re.exec(str)) !== null) {\n const type = match[1];\n const args = match[2].split(/[ ,]+/).map(parseFloat);\n if (type === 'translate') {\n m = multiplyMatrix(m, [1, 0, 0, 1, args[0] || 0, args[1] || 0]);\n } else if (type === 'scale') {\n const sx = args[0] || 1;\n const sy = args[1] !== undefined ? args[1] : sx;\n m = multiplyMatrix(m, [sx, 0, 0, sy, 0, 0]);\n } else if (type === 'matrix') {\n m = multiplyMatrix(m, [args[0], args[1], args[2], args[3], args[4], args[5]]);\n }\n }\n return m;\n}\n\nfunction applyMatrix(x: number, y: number, m: Matrix): [number, number] {\n return [\n x * m[0] + y * m[2] + m[4],\n x * m[1] + y * m[3] + m[5],\n ];\n}\n\n/** A MathJax glyph id ends in the codepoint in hex: `MJX-1-TEX-I-1D465`. */\nfunction glyphIdToChar(id: string): string {\n const parts = id.split('-');\n const hex = parts[parts.length - 1];\n const cp = parseInt(hex, 16);\n if (!isNaN(cp)) {\n try { return String.fromCodePoint(cp); } catch { /* fall through */ }\n }\n return id;\n}\n\ntype RawToken = { token: string; cmds: Array<{ cmd: string; args: number[] }>; term?: string };\n\n/** The tag name of a node's parent, or \"\" at the root. */\nfunction parentKind(node: unknown): string {\n const parent = adaptor.parent(node);\n return parent ? String(adaptor.kind(parent)).toLowerCase() : \"\";\n}\n\n/**\n * The size-independent half. Walks MathJax's tree through the adaptor, not a\n * `DOMParser`, which Node lacks: a headless host could not render any formula.\n */\nfunction parseLatexSvg(svgEl: unknown, heightEx: number): LatexGeometry {\n // `tags` reaches the <path>s inside <defs> that the `use` elements reference.\n const glyphMap = new Map<string, Array<{ cmd: string; args: number[] }>>();\n for (const el of adaptor.tags(svgEl, 'path') as unknown[]) {\n const id = adaptor.getAttribute(el, 'id');\n const d = adaptor.getAttribute(el, 'd');\n if (id && d) {\n glyphMap.set(`#${id}`, expandToAbsolute(tokenisePath(d)));\n }\n }\n\n const rawTokens: RawToken[] = [];\n const parts: LatexPart[] = [];\n let synthIdx = 0;\n\n function pushCmds(token: string, cmds: Array<{ cmd: string; args: number[] }>) {\n rawTokens.push({ token, cmds });\n }\n\n function traverse(node: unknown, currentMatrix: Matrix, within: number) {\n let nodeMatrix = currentMatrix;\n\n const transformStr = adaptor.getAttribute(node, \"transform\");\n if (transformStr) {\n nodeMatrix = multiplyMatrix(nodeMatrix, parseTransform(transformStr));\n }\n\n const nodeName = String(adaptor.kind(node)).toLowerCase();\n\n // MathJax tags each group with the source it typeset; the root's is the whole formula.\n let part = within;\n const source = nodeName === \"g\" ? adaptor.getAttribute(node, \"data-latex\") : null;\n if (source && adaptor.getAttribute(node, \"data-mml-node\") !== \"math\") {\n part = parts.length;\n parts.push({ latex: String(source), from: rawTokens.length, to: rawTokens.length, parent: within });\n }\n\n if (nodeName === \"use\") {\n const href = adaptor.getAttribute(node, \"href\") || adaptor.getAttribute(node, \"xlink:href\");\n const x = parseFloat(adaptor.getAttribute(node, \"x\") || \"0\");\n const y = parseFloat(adaptor.getAttribute(node, \"y\") || \"0\");\n\n if (href && glyphMap.has(href)) {\n const glyphCommands = glyphMap.get(href)!;\n const cmds: Array<{ cmd: string; args: number[] }> = [];\n for (const gc of glyphCommands) {\n const shiftedArgs = [...gc.args];\n for (let j = 0; j < shiftedArgs.length; j += 2) {\n const [nx, ny] = applyMatrix(shiftedArgs[j] + x, shiftedArgs[j + 1] + y, nodeMatrix);\n shiftedArgs[j] = nx;\n shiftedArgs[j + 1] = ny;\n }\n cmds.push({ cmd: gc.cmd, args: shiftedArgs });\n }\n const rawId = href.startsWith('#') ? href.slice(1) : href;\n pushCmds(glyphIdToChar(rawId), cmds);\n }\n } else if (nodeName === \"rect\") {\n const x = parseFloat(adaptor.getAttribute(node, \"x\") || \"0\");\n const y = parseFloat(adaptor.getAttribute(node, \"y\") || \"0\");\n const w = parseFloat(adaptor.getAttribute(node, \"width\") || \"0\");\n const h = parseFloat(adaptor.getAttribute(node, \"height\") || \"0\");\n\n if (w > 0 && h > 0) {\n const pts = [[x, y], [x + w, y], [x + w, y + h], [x, y + h]];\n const tp = pts.map(p => applyMatrix(p[0], p[1], nodeMatrix));\n pushCmds(`__rect_${synthIdx++}`, [\n { cmd: 'M', args: [tp[0][0], tp[0][1]] },\n { cmd: 'L', args: [tp[1][0], tp[1][1]] },\n { cmd: 'L', args: [tp[2][0], tp[2][1]] },\n { cmd: 'L', args: [tp[3][0], tp[3][1]] },\n { cmd: 'Z', args: [] },\n ]);\n }\n } else if (nodeName === \"path\" && parentKind(node) !== \"defs\") {\n const d = adaptor.getAttribute(node, \"d\");\n if (d) {\n const abs = expandToAbsolute(tokenisePath(d));\n const cmds: Array<{ cmd: string; args: number[] }> = [];\n for (const gc of abs) {\n const shiftedArgs = [...gc.args];\n for (let j = 0; j < shiftedArgs.length; j += 2) {\n const [nx, ny] = applyMatrix(shiftedArgs[j], shiftedArgs[j + 1], nodeMatrix);\n shiftedArgs[j] = nx;\n shiftedArgs[j + 1] = ny;\n }\n cmds.push({ cmd: gc.cmd, args: shiftedArgs });\n }\n pushCmds(`__path_${synthIdx++}`, cmds);\n }\n }\n\n for (const child of adaptor.childNodes(node) as unknown[]) {\n // A text node's kind is \"#text\"; only elements carry geometry, and\n // <defs> holds the dictionary rather than anything drawn.\n const kind = String(adaptor.kind(child)).toLowerCase();\n if (kind.startsWith(\"#\") || kind === \"defs\") continue;\n traverse(child, nodeMatrix, part);\n }\n if (part !== within) parts[part].to = rawTokens.length;\n }\n\n traverse(svgEl, identityMatrix, -1);\n\n for (const part of parts) {\n if (part.parent !== -1) continue;\n for (let i = part.from; i < part.to; i++) rawTokens[i].term = part.latex;\n }\n\n const box = svgBBox(rawTokens.flatMap(t => t.cmds));\n return { tokens: rawTokens, parts, box, heightEx };\n}\n\n/** The size-dependent half: one uniform scale about the geometry's own centre. */\nfunction scaleLatexGeometry(geometry: LatexGeometry, fontSize: number): LatexPathResult {\n const { tokens: rawTokens, parts, box, heightEx } = geometry;\n if (rawTokens.length === 0) return { tokens: [], parts: [], width: 0, height: 0, bounds: [0, 0, 0, 0] };\n\n const { minX, minY, maxX, maxY } = box;\n const svgW = maxX - minX;\n const svgH = maxY - minY;\n\n let scale: number;\n if (heightEx > 0 && svgH > 0) {\n const exInCoords = svgH / heightEx;\n scale = fontSize / (2 * exInCoords);\n } else {\n scale = svgH > 0 ? fontSize / svgH : 1;\n }\n\n const ocx = (minX + maxX) / 2;\n const ocy = (minY + maxY) / 2;\n\n const tx = (svgX: number) => (svgX - ocx) * scale;\n const ty = (svgY: number) => (svgY - ocy) * scale;\n\n function rawCmdsToPathCommands(cmds: Array<{ cmd: string; args: number[] }>): PathCommand[] {\n const out: PathCommand[] = [];\n for (const { cmd, args: a } of cmds) {\n switch (cmd) {\n case 'M': out.push({ type: 'M', x: tx(a[0]), y: ty(a[1]) }); break;\n case 'L': out.push({ type: 'L', x: tx(a[0]), y: ty(a[1]) }); break;\n case 'Q': out.push({ type: 'Q', x1: tx(a[0]), y1: ty(a[1]), x: tx(a[2]), y: ty(a[3]) }); break;\n case 'C': out.push({ type: 'C', x1: tx(a[0]), y1: ty(a[1]), x2: tx(a[2]), y2: ty(a[3]), x: tx(a[4]), y: ty(a[5]) }); break;\n case 'Z': out.push({ type: 'Z' }); break;\n }\n }\n return out;\n }\n\n const tokens: LatexToken[] = rawTokens.map(rt => ({\n token: rt.token,\n path: rawCmdsToPathCommands(rt.cmds),\n ...(rt.term !== undefined && { term: rt.term }),\n }));\n\n const bounds: [number, number, number, number] = [\n tx(minX), ty(minY), tx(maxX), ty(maxY),\n ];\n\n return { tokens, parts, width: svgW * scale, height: svgH * scale, bounds };\n}\n\n// Spacing and grouping braces are how a source is written, not what it says:\n// `x^{2}` and `x^2` name one part.\nfunction partKey(latex: string): string {\n return latex.replace(/[\\s{}]/g, \"\");\n}\n\n/**\n * The sources of a formula's parts, each once, in the order written: what a\n * host offers to pick a part from. Empty for a formula that will not typeset.\n */\nexport function latexPartNames(source: string): string[] {\n if (source.trim() === \"\") return [];\n let parts: LatexPart[];\n try {\n parts = buildLatexPath(source, 16).parts;\n } catch {\n return [];\n }\n const seen = new Set<string>();\n const names: string[] = [];\n for (const part of parts) {\n const key = partKey(part.latex);\n if (part.to <= part.from || key === \"\" || seen.has(key)) continue;\n seen.add(key);\n names.push(part.latex);\n }\n return names;\n}\n\n/**\n * The token spans `selector` names in a formula, in source order: every part\n * whose source it is, and every run of neighbouring parts that spell it\n * together (`b^2 = c^2` in `a^2 + b^2 = c^2`). Empty when it names nothing.\n */\nexport function findLatexParts(parts: readonly LatexPart[], selector: string): Array<[from: number, to: number]> {\n const wanted = partKey(selector);\n if (wanted === \"\") return [];\n const found = new Map<string, [number, number]>();\n const keep = (from: number, to: number) => {\n if (to > from) found.set(`${from}:${to}`, [from, to]);\n };\n const children = new Map<number, number[]>();\n parts.forEach((part, i) => {\n if (partKey(part.latex) === wanted) keep(part.from, part.to);\n const siblings = children.get(part.parent);\n if (siblings) siblings.push(i);\n else children.set(part.parent, [i]);\n });\n for (const siblings of children.values()) {\n for (let a = 0; a < siblings.length; a++) {\n let spelled = \"\";\n for (let b = a; b < siblings.length && spelled.length < wanted.length; b++) {\n spelled += partKey(parts[siblings[b]].latex);\n if (b > a && spelled === wanted) keep(parts[siblings[a]].from, parts[siblings[b]].to);\n }\n }\n }\n return [...found.values()].sort((x, y) => x[0] - y[0] || x[1] - y[1]);\n}\n\ntype RawCmd = { cmd: string; args: number[] };\n\nfunction tokenisePath(d: string): RawCmd[] {\n const re = /([MmLlHhVvCcSsQqTtAaZz])|([+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)/g;\n const out: RawCmd[] = [];\n let cur: RawCmd | null = null;\n let m: RegExpExecArray | null;\n while ((m = re.exec(d)) !== null) {\n if (m[1]) { cur = { cmd: m[1], args: [] }; out.push(cur); }\n else if (cur) cur.args.push(parseFloat(m[2]));\n }\n return out;\n}\n\nfunction argCount(cmd: string): number {\n switch (cmd.toUpperCase()) {\n case 'M': return 2; case 'L': return 2; case 'H': return 1; case 'V': return 1;\n case 'C': return 6; case 'S': return 4; case 'Q': return 4; case 'T': return 2;\n case 'A': return 7; case 'Z': return 0; default: return 0;\n }\n}\n\ninterface Pt { x: number; y: number }\n\nfunction expandToAbsolute(raw: RawCmd[]): Array<{ cmd: string; args: number[] }> {\n const out: Array<{ cmd: string; args: number[] }> = [];\n let cx = 0, cy = 0;\n let mx = 0, my = 0;\n let prevCmd = '';\n let prevCtrl: Pt = { x: 0, y: 0 };\n\n for (const { cmd, args } of raw) {\n const up = cmd.toUpperCase();\n const rel = cmd === cmd.toLowerCase() && up !== 'Z';\n const n = argCount(up);\n const reps = n === 0 ? 1 : Math.max(1, Math.ceil(args.length / n));\n\n for (let r = 0; r < reps; r++) {\n const a = args.slice(r * n, r * n + n);\n const absX = (i: number) => rel ? a[i] + cx : a[i];\n const absY = (i: number) => rel ? a[i] + cy : a[i];\n\n switch (up) {\n case 'M': {\n const x = absX(0), y = absY(1);\n const emitCmd = r === 0 ? 'M' : 'L';\n out.push({ cmd: emitCmd, args: [x, y] });\n cx = x; cy = y;\n if (r === 0) { mx = x; my = y; }\n prevCmd = emitCmd;\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'Z':\n out.push({ cmd: 'Z', args: [] });\n cx = mx; cy = my;\n prevCmd = 'Z';\n break;\n case 'L': {\n const x = absX(0), y = absY(1);\n out.push({ cmd: 'L', args: [x, y] });\n cx = x; cy = y;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'H': {\n const x = rel ? a[0] + cx : a[0];\n out.push({ cmd: 'L', args: [x, cy] });\n cx = x;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'V': {\n const y = rel ? a[0] + cy : a[0];\n out.push({ cmd: 'L', args: [cx, y] });\n cy = y;\n prevCmd = 'L';\n prevCtrl = { x: cx, y: cy };\n break;\n }\n case 'C': {\n const x1 = absX(0), y1 = absY(1);\n const x2 = absX(2), y2 = absY(3);\n const x = absX(4), y = absY(5);\n out.push({ cmd: 'C', args: [x1, y1, x2, y2, x, y] });\n prevCtrl = { x: x2, y: y2 };\n cx = x; cy = y;\n prevCmd = 'C';\n break;\n }\n case 'S': {\n const x1 = prevCmd === 'C' || prevCmd === 'S' ? 2 * cx - prevCtrl.x : cx;\n const y1 = prevCmd === 'C' || prevCmd === 'S' ? 2 * cy - prevCtrl.y : cy;\n const x2 = absX(0), y2 = absY(1);\n const x = absX(2), y = absY(3);\n out.push({ cmd: 'C', args: [x1, y1, x2, y2, x, y] });\n prevCtrl = { x: x2, y: y2 };\n cx = x; cy = y;\n prevCmd = 'S';\n break;\n }\n case 'Q': {\n const x1 = absX(0), y1 = absY(1);\n const x = absX(2), y = absY(3);\n out.push({ cmd: 'Q', args: [x1, y1, x, y] });\n prevCtrl = { x: x1, y: y1 };\n cx = x; cy = y;\n prevCmd = 'Q';\n break;\n }\n case 'T': {\n const x1 = prevCmd === 'Q' || prevCmd === 'T' ? 2 * cx - prevCtrl.x : cx;\n const y1 = prevCmd === 'Q' || prevCmd === 'T' ? 2 * cy - prevCtrl.y : cy;\n const x = absX(0), y = absY(1);\n out.push({ cmd: 'Q', args: [x1, y1, x, y] });\n prevCtrl = { x: x1, y: y1 };\n cx = x; cy = y;\n prevCmd = 'T';\n break;\n }\n }\n }\n }\n\n if (out.length > 0 && out[out.length - 1].cmd !== 'Z') {\n out.push({ cmd: 'Z', args: [] });\n }\n\n return out;\n}\n\nfunction svgBBox(abs: Array<{ cmd: string; args: number[] }>): { minX: number; minY: number; maxX: number; maxY: number } {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n const touch = (x: number, y: number) => {\n if (x < minX) minX = x; if (x > maxX) maxX = x;\n if (y < minY) minY = y; if (y > maxY) maxY = y;\n };\n for (const { cmd, args } of abs) {\n switch (cmd) {\n case 'M': case 'L': touch(args[0], args[1]); break;\n case 'C': touch(args[0], args[1]); touch(args[2], args[3]); touch(args[4], args[5]); break;\n case 'Q': touch(args[0], args[1]); touch(args[2], args[3]); break;\n }\n }\n return { minX, minY, maxX, maxY };\n}\n"]}
|
package/dist/tex/mathjax.d.ts
CHANGED
|
@@ -14,19 +14,6 @@ import '@mathjax/mathjax-newcm-font/js/svg/dynamic/fraktur.js';
|
|
|
14
14
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/monospace.js';
|
|
15
15
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/sans-serif.js';
|
|
16
16
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/script.js';
|
|
17
|
-
/**
|
|
18
|
-
* MathJax, set up: the one module that imports it, loaded on demand by
|
|
19
|
-
* `loadMathJax` so a scene with no formula in it never downloads or parses it.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* MathJax needs a DOM to build its output in, and there isn't always one.
|
|
23
|
-
*
|
|
24
|
-
* `browserAdaptor()` reads `window` **as it is constructed**, at module scope —
|
|
25
|
-
* so importing this file at all threw in Node, and a project with one LaTeX
|
|
26
|
-
* scene could not be rendered headlessly no matter which scene was asked for.
|
|
27
|
-
* `liteAdaptor` is MathJax's own DOM-free implementation and produces the same
|
|
28
|
-
* SVG; we only ever read paths back out of it, never attach it to a page.
|
|
29
|
-
*/
|
|
30
17
|
export declare const adaptor: any;
|
|
31
18
|
/** Typeset `text` as display math and hand back MathJax's container, read through {@link adaptor}. */
|
|
32
19
|
export declare function convert(text: string): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.d.ts","sourceRoot":"","sources":["../../src/tex/mathjax.ts"],"names":[],"mappings":"AAOA,OAAO,qDAAqD,CAAC;AAC7D,OAAO,mDAAmD,CAAC;AAC3D,OAAO,iEAAiE,CAAC;AACzE,OAAO,iEAAiE,CAAC;AACzE,OAAO,yDAAyD,CAAC;AACjE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yDAAyD,CAAC;AACjE,OAAO,2DAA2D,CAAC;AACnE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+DAA+D,CAAC;AAGvE,OAAO,4DAA4D,CAAC;AACpE,OAAO,6DAA6D,CAAC;AACrE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yDAAyD,CAAC;AACjE,OAAO,0DAA0D,CAAC;AAClE,OAAO,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"mathjax.d.ts","sourceRoot":"","sources":["../../src/tex/mathjax.ts"],"names":[],"mappings":"AAOA,OAAO,qDAAqD,CAAC;AAC7D,OAAO,mDAAmD,CAAC;AAC3D,OAAO,iEAAiE,CAAC;AACzE,OAAO,iEAAiE,CAAC;AACzE,OAAO,yDAAyD,CAAC;AACjE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yDAAyD,CAAC;AACjE,OAAO,2DAA2D,CAAC;AACnE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+DAA+D,CAAC;AAGvE,OAAO,4DAA4D,CAAC;AACpE,OAAO,6DAA6D,CAAC;AACrE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yDAAyD,CAAC;AACjE,OAAO,0DAA0D,CAAC;AAClE,OAAO,sDAAsD,CAAC;AAI9D,eAAO,MAAM,OAAO,EAAE,GAEA,CAAC;AAqBvB,sGAAsG;AACtG,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO7C"}
|
package/dist/tex/mathjax.js
CHANGED
|
@@ -21,23 +21,8 @@ import '@mathjax/mathjax-newcm-font/js/svg/dynamic/fraktur.js';
|
|
|
21
21
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/monospace.js';
|
|
22
22
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/sans-serif.js';
|
|
23
23
|
import '@mathjax/mathjax-newcm-font/js/svg/dynamic/script.js';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* `loadMathJax` so a scene with no formula in it never downloads or parses it.
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* MathJax needs a DOM to build its output in, and there isn't always one.
|
|
30
|
-
*
|
|
31
|
-
* `browserAdaptor()` reads `window` **as it is constructed**, at module scope —
|
|
32
|
-
* so importing this file at all threw in Node, and a project with one LaTeX
|
|
33
|
-
* scene could not be rendered headlessly no matter which scene was asked for.
|
|
34
|
-
* `liteAdaptor` is MathJax's own DOM-free implementation and produces the same
|
|
35
|
-
* SVG; we only ever read paths back out of it, never attach it to a page.
|
|
36
|
-
*/
|
|
37
|
-
// The two adaptors are structurally different (a `LiteElement` tree vs. a real
|
|
38
|
-
// one) and MathJax's generics track that, but nothing here touches an element
|
|
39
|
-
// except through the adaptor's own accessors — so the element type is genuinely
|
|
40
|
-
// opaque to us, and pinning it to either concrete one would be a lie.
|
|
24
|
+
// `browserAdaptor()` reads `window` at construction, so it cannot run in Node; `liteAdaptor` is DOM-free.
|
|
25
|
+
// Elements are only touched through the adaptor's accessors, so their type is opaque.
|
|
41
26
|
export const adaptor = typeof window === 'undefined' && typeof document === 'undefined'
|
|
42
27
|
? liteAdaptor()
|
|
43
28
|
: browserAdaptor();
|
|
@@ -49,13 +34,8 @@ const texJax = new TeX({
|
|
|
49
34
|
'bbox', 'mathtools',
|
|
50
35
|
],
|
|
51
36
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* and `\mathscr`, imported above. MathJax fetches these asynchronously the first
|
|
55
|
-
* time a formula needs one, which a synchronous typesetter cannot wait for, so
|
|
56
|
-
* they are bundled and set up on the font before anything is typeset. The font
|
|
57
|
-
* class is passed explicitly so the one they register on is the one in use.
|
|
58
|
-
*/
|
|
37
|
+
// The font files behind the `mathcal`/`mathbb`/... alphabets. MathJax would fetch them asynchronously,
|
|
38
|
+
// which a synchronous typesetter cannot wait for, so they are bundled and set up before anything is typeset.
|
|
59
39
|
const BUNDLED_FONT_FILES = ['calligraphic', 'double-struck', 'fraktur', 'monospace', 'sans-serif', 'script'];
|
|
60
40
|
const svgJax = new SVG({ fontCache: 'local', fontData: MathJaxNewcmFont });
|
|
61
41
|
const fontFiles = MathJaxNewcmFont.dynamicFiles;
|
package/dist/tex/mathjax.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.js","sourceRoot":"","sources":["../../src/tex/mathjax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAA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AY;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;QACvB,OAAO,EAAE,IAAI;QACb,EAAE,EAAE,EAAE;QACN,EAAE,EAAE,CAAC;QACL,cAAc,EAAE,EAAE,GAAG,EAAE;KAC1B,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { mathjax } from '@mathjax/src/js/mathjax.js';\nimport { TeX } from '@mathjax/src/js/input/tex.js';\nimport { SVG } from '@mathjax/src/js/output/svg.js';\nimport { browserAdaptor } from '@mathjax/src/js/adaptors/browserAdaptor.js';\nimport { liteAdaptor } from '@mathjax/src/js/adaptors/liteAdaptor.js';\nimport { RegisterHTMLHandler } from '@mathjax/src/js/handlers/html.js';\n\nimport '@mathjax/src/js/input/tex/base/BaseConfiguration.js';\nimport '@mathjax/src/js/input/tex/ams/AmsConfiguration.js';\nimport '@mathjax/src/js/input/tex/boldsymbol/BoldsymbolConfiguration.js';\nimport '@mathjax/src/js/input/tex/newcommand/NewcommandConfiguration.js';\nimport '@mathjax/src/js/input/tex/cancel/CancelConfiguration.js';\nimport '@mathjax/src/js/input/tex/color/ColorConfiguration.js';\nimport '@mathjax/src/js/input/tex/mhchem/MhchemConfiguration.js';\nimport '@mathjax/src/js/input/tex/physics/PhysicsConfiguration.js';\nimport '@mathjax/src/js/input/tex/bbox/BboxConfiguration.js';\nimport '@mathjax/src/js/input/tex/mathtools/MathtoolsConfiguration.js';\nimport type { DynamicFileList } from '@mathjax/src/js/output/common/FontData.js';\nimport { MathJaxNewcmFont } from '@mathjax/mathjax-newcm-font/js/svg.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/calligraphic.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/double-struck.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/fraktur.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/monospace.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/sans-serif.js';\nimport '@mathjax/mathjax-newcm-font/js/svg/dynamic/script.js';\n\n// `browserAdaptor()` reads `window` at construction, so it cannot run in Node; `liteAdaptor` is DOM-free.\n// Elements are only touched through the adaptor's accessors, so their type is opaque.\nexport const adaptor: any = typeof window === 'undefined' && typeof document === 'undefined'\n ? liteAdaptor()\n : browserAdaptor();\nRegisterHTMLHandler(adaptor);\n\nconst texJax = new TeX({\n packages: [\n 'base', 'ams', 'boldsymbol', 'newcommand',\n 'cancel', 'color', 'mhchem', 'physics',\n 'bbox', 'mathtools',\n ],\n});\n\n// The font files behind the `mathcal`/`mathbb`/... alphabets. MathJax would fetch them asynchronously,\n// which a synchronous typesetter cannot wait for, so they are bundled and set up before anything is typeset.\nconst BUNDLED_FONT_FILES = ['calligraphic', 'double-struck', 'fraktur', 'monospace', 'sans-serif', 'script'];\n\nconst svgJax = new SVG({ fontCache: 'local', fontData: MathJaxNewcmFont });\nconst fontFiles = (MathJaxNewcmFont as unknown as { dynamicFiles: DynamicFileList }).dynamicFiles;\nfor (const file of BUNDLED_FONT_FILES) fontFiles[file].setup(svgJax.font);\n\nconst mjDoc = mathjax.document('', { InputJax: texJax, OutputJax: svgJax });\n\n/** Typeset `text` as display math and hand back MathJax's container, read through {@link adaptor}. */\nexport function convert(text: string): unknown {\n return mjDoc.convert(text, {\n display: true,\n em: 16,\n ex: 8,\n containerWidth: 80 * 16,\n });\n}\n"]}
|
package/dist/tex/matrix.d.ts
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { type NodeOf, type Alignment as _Alignment, type Fill as _Fill, type FillResolved as _FillResolved, type FlowMode as _FlowMode, type FlowResolved as _FlowResolved, type GapSize as _GapSize, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type Vector2 as _Vector2 } from "@motionscript/sdk";
|
|
2
|
-
import type { LatexProps } from "./node.js";
|
|
3
2
|
import { type Morphing } from "./typeset.js";
|
|
4
3
|
export type MatrixBrackets = "square" | "round" | "bar" | "double" | "curly" | "none";
|
|
5
|
-
export interface LatexMatrixProps extends LatexProps {
|
|
6
|
-
entries: string[][];
|
|
7
|
-
brackets: MatrixBrackets;
|
|
8
|
-
}
|
|
9
4
|
/** The LaTeX a matrix of `entries` is typeset from; empty for one with no entries. */
|
|
10
5
|
export declare function matrixSource(entries: readonly (readonly string[])[], brackets?: MatrixBrackets): string;
|
|
11
|
-
/**
|
|
12
|
-
* A matrix typeset from its entries, row by row, inside the brackets it is
|
|
13
|
-
* given. Each entry is a piece of LaTeX and is one of the formula's parts, so
|
|
14
|
-
* it can be painted, boxed or braced by its own source.
|
|
15
|
-
*/
|
|
6
|
+
/** A matrix typeset from its entries inside its brackets; each entry is a formula part, addressable by its source. */
|
|
16
7
|
export declare const LatexMatrix: import("@motionscript/sdk").Component<"latexMatrix", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
17
8
|
latex: import("@motionscript/sdk").Type<string, Morphing<string>, false>;
|
|
18
9
|
/** A list of rows is a whole value: mid-tween it holds both, and the morph draws the way there. */
|
package/dist/tex/matrix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../src/tex/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,MAAM,EAEX,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,QAAQ,IAAI,SAAS,EAC1B,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,OAAO,IAAI,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, animatable: false, lerp: lerpMorph,
|
|
34
34
|
}),
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
37
|
-
* A matrix typeset from its entries, row by row, inside the brackets it is
|
|
38
|
-
* given. Each entry is a piece of LaTeX and is one of the formula's parts, so
|
|
39
|
-
* it can be painted, boxed or braced by its own source.
|
|
40
|
-
*/
|
|
36
|
+
/** A matrix typeset from its entries inside its brackets; each entry is a formula part, addressable by its source. */
|
|
41
37
|
export const LatexMatrix = formula(component2d({
|
|
42
38
|
key: "latexMatrix",
|
|
43
39
|
state,
|
package/dist/tex/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/tex/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,KAAK,GAiBR,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/tex/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,KAAK,GAiBR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAEhI,MAAM,WAAW,CAAC;AAInB,MAAM,WAAW,GAAmC;IAChD,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAEhF,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,OAAuC,EAAE,WAA2B,QAAQ;IACrG,MAAM,IAAI,GAAG,OAAO,CAA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C;CACL,CAAC;AAEF,sHAAsH;AACtH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC3C,GAAG,EAAE,aAAa;IAClB,KAAK;IACL,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACzC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE;QACN,GAAG,gBAAgB;QACnB,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE;QAC5B,8EAA8E;QAC9E,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;KACnC;IACD,OAAO,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAChG,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,CAAC;IAC7D,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;CAC9F,CAAC,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import {\n component2d,\n Types,\n type EntryOptions,\n type NodeOf,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\nimport {\n drawFormula, formula, formulaFrame, layoutFormula, lerpMorph, loadFormula, measureFormula, morphOf, TYPESET, TYPESET_COMMANDS,\n type Morphing,\n} from \"./typeset\";\n\nexport type MatrixBrackets = \"square\" | \"round\" | \"bar\" | \"double\" | \"curly\" | \"none\";\n\nconst ENVIRONMENT: Record<MatrixBrackets, string> = {\n square: \"bmatrix\",\n round: \"pmatrix\",\n bar: \"vmatrix\",\n double: \"Vmatrix\",\n curly: \"Bmatrix\",\n none: \"matrix\",\n};\n\nconst BRACKETS = [\"square\", \"round\", \"bar\", \"double\", \"curly\", \"none\"] as const;\n\n/** The LaTeX a matrix of `entries` is typeset from; empty for one with no entries. */\nexport function matrixSource(entries: readonly (readonly string[])[], brackets: MatrixBrackets = \"square\"): string {\n const rows = entries.filter((row) => Array.isArray(row) && row.length > 0);\n if (rows.length === 0) return \"\";\n const environment = ENVIRONMENT[brackets] ?? ENVIRONMENT.square;\n return `\\\\begin{${environment}} ${rows.map((row) => row.join(\" & \")).join(\" \\\\\\\\ \")} \\\\end{${environment}}`;\n}\n\ninterface MatrixValues {\n readonly entries: Morphing<string[][]>;\n readonly brackets: Morphing<MatrixBrackets>;\n}\n\n/** The matrix's source now: mid-tween of its entries or its brackets, both ends of it. */\nfunction sourceOf(s: MatrixValues): Morphing<string> {\n return morphOf([s.entries, s.brackets], ([entries, brackets]) => matrixSource(entries as string[][], brackets as MatrixBrackets));\n}\n\nconst state = {\n ...TYPESET,\n // Unused by the matrix's own drawing: its entries say what it writes.\n latex: Types.custom<string, Morphing<string>, EntryOptions & { readonly kind: \"text\"; readonly multiline: true }>(\"\", {\n kind: \"text\", multiline: true, lerp: lerpMorph,\n }),\n /** A list of rows is a whole value: mid-tween it holds both, and the morph draws the way there. */\n entries: Types.custom<string[][], Morphing<string[][]>>([[\"a\", \"b\"], [\"c\", \"d\"]], { lerp: lerpMorph }),\n brackets: Types.custom<MatrixBrackets, Morphing<MatrixBrackets>, EntryOptions & { readonly options: typeof BRACKETS }>(\"square\", {\n options: BRACKETS, animatable: false, lerp: lerpMorph,\n }),\n};\n\n/** A matrix typeset from its entries inside its brackets; each entry is a formula part, addressable by its source. */\nexport const LatexMatrix = formula(component2d({\n key: \"latexMatrix\",\n state,\n defaults: { width: \"hug\", height: \"hug\" },\n load: (loader) => loadFormula(loader),\n commands: {\n ...TYPESET_COMMANDS,\n morphTo: { args: [\"latex\"] },\n /** Change the entries: the ones both matrices write travel, the rest fade. */\n entriesTo: { args: [\"entries\"] },\n },\n measure: (_measurer, s) => measureFormula(formulaFrame(sourceOf(s), s.fontSize, s.partFills), s),\n layout: (box, s, children) => layoutFormula(box, s, children),\n render: (ctx, s) => drawFormula(ctx, s, formulaFrame(sourceOf(s), s.fontSize, s.partFills)),\n}), sourceOf);\n\nexport type LatexMatrix = NodeOf<typeof LatexMatrix>;\n"]}
|
package/dist/tex/tween.d.ts
CHANGED
|
@@ -4,9 +4,7 @@ export interface AnimatedToken {
|
|
|
4
4
|
path: LatexToken["path"];
|
|
5
5
|
/** The top-level term it belongs to at rest; a morph matches on it. */
|
|
6
6
|
term?: string;
|
|
7
|
-
/** 0 = invisible, 1 = fully visible */
|
|
8
7
|
opacity: number;
|
|
9
|
-
/** Interpolated position offset applied during morph (x, y in formula space). */
|
|
10
8
|
x: number;
|
|
11
9
|
y: number;
|
|
12
10
|
/** Mid-morph: the index of the token it was in the formula left, and of the one it becomes. */
|
|
@@ -14,37 +12,18 @@ export interface AnimatedToken {
|
|
|
14
12
|
to?: number;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
|
-
* How a `Latex` node interpolates between two formulas:
|
|
18
|
-
*
|
|
19
|
-
* pure `t → AnimatedToken[]` frame function. `prepareLatexTween` below is the
|
|
20
|
-
* default implementation (exported as `defaultLatexMorph`) — pass a `morph`
|
|
21
|
-
* of this shape to `<Latex>` to replace it with your own.
|
|
15
|
+
* How a `Latex` node interpolates between two formulas: a pure `t -> tokens`
|
|
16
|
+
* frame function. {@link defaultLatexMorph} is the default; pass a `morph` to replace it.
|
|
22
17
|
*/
|
|
23
18
|
export type LatexMorphStrategy = (from: LatexToken[], to: LatexToken[]) => (t: number) => AnimatedToken[];
|
|
24
19
|
/**
|
|
25
|
-
* Precompute a formula-change morph
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* - Matched tokens are interpolated — place *and* size — across the full range
|
|
29
|
-
* of `t`.
|
|
30
|
-
* - Added tokens fade in over the second half of `t`.
|
|
20
|
+
* Precompute a formula-change morph as a pure `t -> tokens` frame function:
|
|
21
|
+
* deleted tokens fade out over the first half, matched tokens interpolate place
|
|
22
|
+
* and size across the whole range, added tokens fade in over the second half.
|
|
31
23
|
*
|
|
32
|
-
*
|
|
33
|
-
* at
|
|
34
|
-
*
|
|
35
|
-
* interpolation has to carry the glyph's *geometry*, not just where it sits.
|
|
36
|
-
* Sliding the target outline from one centroid to the other — which is all this
|
|
37
|
-
* used to do — put the whole size change between the last static frame and the
|
|
38
|
-
* morph's first one: a snap to the new size, then a smooth glide to the new
|
|
39
|
-
* place. Point-by-point lerping (see {@link lerpPath}) is that same
|
|
40
|
-
* interpolation generalised from a glyph's average point to all of them, and it
|
|
41
|
-
* costs nothing extra — the path was already being rebuilt every frame to apply
|
|
42
|
-
* the slide.
|
|
43
|
-
*
|
|
44
|
-
* `t` is normalized `[0, 1]` and already eased — the caller (a `Command`'s
|
|
45
|
-
* `at`) applies easing once, up front, the same eased value driving every
|
|
46
|
-
* concurrent aspect of the morph (props, intrinsic size, tokens) in lockstep.
|
|
24
|
+
* Size must be interpolated with place: a matched glyph is rarely the same size
|
|
25
|
+
* at both ends (the `2` of `b^2` against the `2` of `2a`), and sliding only the
|
|
26
|
+
* centroid would snap to the new size before the glide. `t` is already eased.
|
|
47
27
|
*/
|
|
48
|
-
export declare function
|
|
49
|
-
export { prepareLatexTween as defaultLatexMorph };
|
|
28
|
+
export declare function defaultLatexMorph(from: LatexToken[], to: LatexToken[]): (t: number) => AnimatedToken[];
|
|
50
29
|
//# sourceMappingURL=tween.d.ts.map
|
package/dist/tex/tween.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tex/tween.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACzB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tex/tween.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACzB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;AAuI1G;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,UAAU,EAAE,EAClB,EAAE,EAAE,UAAU,EAAE,GACjB,CAAC,CAAC,EAAE,MAAM,KAAK,aAAa,EAAE,CAsFhC"}
|