@motionscript/math 0.0.0-stage → 0.1.0-alpha.5

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.
Files changed (322) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +48 -0
  4. package/README.md +385 -3
  5. package/dist/annotate/angle-mark.d.ts +46 -0
  6. package/dist/annotate/angle-mark.d.ts.map +1 -0
  7. package/dist/annotate/angle-mark.js +132 -0
  8. package/dist/annotate/angle-mark.js.map +1 -0
  9. package/dist/annotate/curly-brace.d.ts +46 -0
  10. package/dist/annotate/curly-brace.d.ts.map +1 -0
  11. package/dist/annotate/curly-brace.js +114 -0
  12. package/dist/annotate/curly-brace.js.map +1 -0
  13. package/dist/annotate/emphasis-mark.d.ts +20 -0
  14. package/dist/annotate/emphasis-mark.d.ts.map +1 -0
  15. package/dist/annotate/emphasis-mark.js +81 -0
  16. package/dist/annotate/emphasis-mark.js.map +1 -0
  17. package/dist/browser/THIRD_PARTY_LICENSES.txt +420 -0
  18. package/dist/browser/chunks/chunk-3GJB6AVO.js +2 -0
  19. package/dist/browser/chunks/chunk-3GJB6AVO.js.map +7 -0
  20. package/dist/browser/chunks/chunk-D5WHCVBC.js +2 -0
  21. package/dist/browser/chunks/chunk-D5WHCVBC.js.map +7 -0
  22. package/dist/browser/chunks/chunk-WL4KEX7Y.js +2 -0
  23. package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +7 -0
  24. package/dist/browser/chunks/mathjax-DNP3YRES.js +61 -0
  25. package/dist/browser/chunks/mathjax-DNP3YRES.js.map +7 -0
  26. package/dist/browser/index.js +2 -0
  27. package/dist/browser/index.js.map +7 -0
  28. package/dist/browser/kit.js +2 -0
  29. package/dist/browser/kit.js.map +7 -0
  30. package/dist/browser/manifest.json +30 -0
  31. package/dist/browser/tex.js +2 -0
  32. package/dist/browser/tex.js.map +7 -0
  33. package/dist/engine.d.ts +64 -0
  34. package/dist/engine.d.ts.map +1 -0
  35. package/dist/engine.js +42 -0
  36. package/dist/engine.js.map +1 -0
  37. package/dist/index.d.ts +30 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +30 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/kit/brace.d.ts +8 -0
  42. package/dist/kit/brace.d.ts.map +1 -0
  43. package/dist/kit/brace.js +36 -0
  44. package/dist/kit/brace.js.map +1 -0
  45. package/dist/kit/cache.d.ts +30 -0
  46. package/dist/kit/cache.d.ts.map +1 -0
  47. package/dist/kit/cache.js +53 -0
  48. package/dist/kit/cache.js.map +1 -0
  49. package/dist/kit/contour.d.ts +8 -0
  50. package/dist/kit/contour.d.ts.map +1 -0
  51. package/dist/kit/contour.js +93 -0
  52. package/dist/kit/contour.js.map +1 -0
  53. package/dist/kit/coords.d.ts +69 -0
  54. package/dist/kit/coords.d.ts.map +1 -0
  55. package/dist/kit/coords.js +224 -0
  56. package/dist/kit/coords.js.map +1 -0
  57. package/dist/kit/curve.d.ts +17 -0
  58. package/dist/kit/curve.d.ts.map +1 -0
  59. package/dist/kit/curve.js +22 -0
  60. package/dist/kit/curve.js.map +1 -0
  61. package/dist/kit/equation.d.ts +61 -0
  62. package/dist/kit/equation.d.ts.map +1 -0
  63. package/dist/kit/equation.js +168 -0
  64. package/dist/kit/equation.js.map +1 -0
  65. package/dist/kit/equation3d.d.ts +50 -0
  66. package/dist/kit/equation3d.d.ts.map +1 -0
  67. package/dist/kit/equation3d.js +103 -0
  68. package/dist/kit/equation3d.js.map +1 -0
  69. package/dist/kit/expression.d.ts +35 -0
  70. package/dist/kit/expression.d.ts.map +1 -0
  71. package/dist/kit/expression.js +124 -0
  72. package/dist/kit/expression.js.map +1 -0
  73. package/dist/kit/field-mark.d.ts +58 -0
  74. package/dist/kit/field-mark.d.ts.map +1 -0
  75. package/dist/kit/field-mark.js +129 -0
  76. package/dist/kit/field-mark.js.map +1 -0
  77. package/dist/kit/field.d.ts +14 -0
  78. package/dist/kit/field.d.ts.map +1 -0
  79. package/dist/kit/field.js +46 -0
  80. package/dist/kit/field.js.map +1 -0
  81. package/dist/kit/follow.d.ts +71 -0
  82. package/dist/kit/follow.d.ts.map +1 -0
  83. package/dist/kit/follow.js +159 -0
  84. package/dist/kit/follow.js.map +1 -0
  85. package/dist/kit/furniture.d.ts +30 -0
  86. package/dist/kit/furniture.d.ts.map +1 -0
  87. package/dist/kit/furniture.js +87 -0
  88. package/dist/kit/furniture.js.map +1 -0
  89. package/dist/kit/geometry.d.ts +13 -0
  90. package/dist/kit/geometry.d.ts.map +1 -0
  91. package/dist/kit/geometry.js +54 -0
  92. package/dist/kit/geometry.js.map +1 -0
  93. package/dist/kit/mark.d.ts +47 -0
  94. package/dist/kit/mark.d.ts.map +1 -0
  95. package/dist/kit/mark.js +103 -0
  96. package/dist/kit/mark.js.map +1 -0
  97. package/dist/kit/part-fills.d.ts +23 -0
  98. package/dist/kit/part-fills.d.ts.map +1 -0
  99. package/dist/kit/part-fills.js +46 -0
  100. package/dist/kit/part-fills.js.map +1 -0
  101. package/dist/kit/place.d.ts +18 -0
  102. package/dist/kit/place.d.ts.map +1 -0
  103. package/dist/kit/place.js +68 -0
  104. package/dist/kit/place.js.map +1 -0
  105. package/dist/kit/placement.d.ts +8 -0
  106. package/dist/kit/placement.d.ts.map +1 -0
  107. package/dist/kit/placement.js +8 -0
  108. package/dist/kit/placement.js.map +1 -0
  109. package/dist/kit/sampler.d.ts +17 -0
  110. package/dist/kit/sampler.d.ts.map +1 -0
  111. package/dist/kit/sampler.js +250 -0
  112. package/dist/kit/sampler.js.map +1 -0
  113. package/dist/kit/scale.d.ts +12 -0
  114. package/dist/kit/scale.d.ts.map +1 -0
  115. package/dist/kit/scale.js +37 -0
  116. package/dist/kit/scale.js.map +1 -0
  117. package/dist/kit/source.d.ts +22 -0
  118. package/dist/kit/source.d.ts.map +1 -0
  119. package/dist/kit/source.js +45 -0
  120. package/dist/kit/source.js.map +1 -0
  121. package/dist/kit/system.d.ts +33 -0
  122. package/dist/kit/system.d.ts.map +1 -0
  123. package/dist/kit/system.js +67 -0
  124. package/dist/kit/system.js.map +1 -0
  125. package/dist/kit/ticks.d.ts +19 -0
  126. package/dist/kit/ticks.d.ts.map +1 -0
  127. package/dist/kit/ticks.js +78 -0
  128. package/dist/kit/ticks.js.map +1 -0
  129. package/dist/kit/withdrawn.d.ts +9 -0
  130. package/dist/kit/withdrawn.d.ts.map +1 -0
  131. package/dist/kit/withdrawn.js +9 -0
  132. package/dist/kit/withdrawn.js.map +1 -0
  133. package/dist/marks/curve-area.d.ts +32 -0
  134. package/dist/marks/curve-area.d.ts.map +1 -0
  135. package/dist/marks/curve-area.js +82 -0
  136. package/dist/marks/curve-area.js.map +1 -0
  137. package/dist/marks/drop-lines.d.ts +22 -0
  138. package/dist/marks/drop-lines.d.ts.map +1 -0
  139. package/dist/marks/drop-lines.js +58 -0
  140. package/dist/marks/drop-lines.js.map +1 -0
  141. package/dist/marks/plot-point.d.ts +35 -0
  142. package/dist/marks/plot-point.d.ts.map +1 -0
  143. package/dist/marks/plot-point.js +97 -0
  144. package/dist/marks/plot-point.js.map +1 -0
  145. package/dist/marks/riemann-sum.d.ts +37 -0
  146. package/dist/marks/riemann-sum.d.ts.map +1 -0
  147. package/dist/marks/riemann-sum.js +91 -0
  148. package/dist/marks/riemann-sum.js.map +1 -0
  149. package/dist/marks/tangent-line.d.ts +27 -0
  150. package/dist/marks/tangent-line.d.ts.map +1 -0
  151. package/dist/marks/tangent-line.js +103 -0
  152. package/dist/marks/tangent-line.js.map +1 -0
  153. package/dist/marks/vector-arrow.d.ts +32 -0
  154. package/dist/marks/vector-arrow.d.ts.map +1 -0
  155. package/dist/marks/vector-arrow.js +87 -0
  156. package/dist/marks/vector-arrow.js.map +1 -0
  157. package/dist/nodes.d.ts +35 -0
  158. package/dist/nodes.d.ts.map +1 -0
  159. package/dist/nodes.js +63 -0
  160. package/dist/nodes.js.map +1 -0
  161. package/dist/plots/function-plot.d.ts +67 -0
  162. package/dist/plots/function-plot.d.ts.map +1 -0
  163. package/dist/plots/function-plot.js +215 -0
  164. package/dist/plots/function-plot.js.map +1 -0
  165. package/dist/plots/points-plot.d.ts +28 -0
  166. package/dist/plots/points-plot.d.ts.map +1 -0
  167. package/dist/plots/points-plot.js +99 -0
  168. package/dist/plots/points-plot.js.map +1 -0
  169. package/dist/plots/stream-lines.d.ts +35 -0
  170. package/dist/plots/stream-lines.d.ts.map +1 -0
  171. package/dist/plots/stream-lines.js +141 -0
  172. package/dist/plots/stream-lines.js.map +1 -0
  173. package/dist/plots/traced-path.d.ts +31 -0
  174. package/dist/plots/traced-path.d.ts.map +1 -0
  175. package/dist/plots/traced-path.js +56 -0
  176. package/dist/plots/traced-path.js.map +1 -0
  177. package/dist/plots/vector-field.d.ts +23 -0
  178. package/dist/plots/vector-field.d.ts.map +1 -0
  179. package/dist/plots/vector-field.js +91 -0
  180. package/dist/plots/vector-field.js.map +1 -0
  181. package/dist/structures/graph-layout.d.ts +11 -0
  182. package/dist/structures/graph-layout.d.ts.map +1 -0
  183. package/dist/structures/graph-layout.js +135 -0
  184. package/dist/structures/graph-layout.js.map +1 -0
  185. package/dist/structures/network-graph.d.ts +83 -0
  186. package/dist/structures/network-graph.d.ts.map +1 -0
  187. package/dist/structures/network-graph.js +289 -0
  188. package/dist/structures/network-graph.js.map +1 -0
  189. package/dist/structures/sample-space.d.ts +62 -0
  190. package/dist/structures/sample-space.d.ts.map +1 -0
  191. package/dist/structures/sample-space.js +199 -0
  192. package/dist/structures/sample-space.js.map +1 -0
  193. package/dist/systems/axes2d.d.ts +75 -0
  194. package/dist/systems/axes2d.d.ts.map +1 -0
  195. package/dist/systems/axes2d.js +193 -0
  196. package/dist/systems/axes2d.js.map +1 -0
  197. package/dist/systems/number-line.d.ts +49 -0
  198. package/dist/systems/number-line.d.ts.map +1 -0
  199. package/dist/systems/number-line.js +127 -0
  200. package/dist/systems/number-line.js.map +1 -0
  201. package/dist/systems/number-plane.d.ts +59 -0
  202. package/dist/systems/number-plane.d.ts.map +1 -0
  203. package/dist/systems/number-plane.js +193 -0
  204. package/dist/systems/number-plane.js.map +1 -0
  205. package/dist/systems/polar-plane.d.ts +48 -0
  206. package/dist/systems/polar-plane.d.ts.map +1 -0
  207. package/dist/systems/polar-plane.js +165 -0
  208. package/dist/systems/polar-plane.js.map +1 -0
  209. package/dist/tex/geometry.d.ts +85 -0
  210. package/dist/tex/geometry.d.ts.map +1 -0
  211. package/dist/tex/geometry.js +632 -0
  212. package/dist/tex/geometry.js.map +1 -0
  213. package/dist/tex/index.d.ts +11 -0
  214. package/dist/tex/index.d.ts.map +1 -0
  215. package/dist/tex/index.js +9 -0
  216. package/dist/tex/index.js.map +1 -0
  217. package/dist/tex/mathjax.d.ts +33 -0
  218. package/dist/tex/mathjax.d.ts.map +1 -0
  219. package/dist/tex/mathjax.js +74 -0
  220. package/dist/tex/mathjax.js.map +1 -0
  221. package/dist/tex/matrix.d.ts +31 -0
  222. package/dist/tex/matrix.d.ts.map +1 -0
  223. package/dist/tex/matrix.js +73 -0
  224. package/dist/tex/matrix.js.map +1 -0
  225. package/dist/tex/node.d.ts +215 -0
  226. package/dist/tex/node.d.ts.map +1 -0
  227. package/dist/tex/node.js +595 -0
  228. package/dist/tex/node.js.map +1 -0
  229. package/dist/tex/tween.d.ts +50 -0
  230. package/dist/tex/tween.d.ts.map +1 -0
  231. package/dist/tex/tween.js +253 -0
  232. package/dist/tex/tween.js.map +1 -0
  233. package/dist/three/axes3d.d.ts +87 -0
  234. package/dist/three/axes3d.d.ts.map +1 -0
  235. package/dist/three/axes3d.js +228 -0
  236. package/dist/three/axes3d.js.map +1 -0
  237. package/dist/three/curve-plot3d.d.ts +60 -0
  238. package/dist/three/curve-plot3d.d.ts.map +1 -0
  239. package/dist/three/curve-plot3d.js +143 -0
  240. package/dist/three/curve-plot3d.js.map +1 -0
  241. package/dist/three/label3d.d.ts +11 -0
  242. package/dist/three/label3d.d.ts.map +1 -0
  243. package/dist/three/label3d.js +40 -0
  244. package/dist/three/label3d.js.map +1 -0
  245. package/dist/three/plot-point3d.d.ts +26 -0
  246. package/dist/three/plot-point3d.d.ts.map +1 -0
  247. package/dist/three/plot-point3d.js +60 -0
  248. package/dist/three/plot-point3d.js.map +1 -0
  249. package/dist/three/space.d.ts +28 -0
  250. package/dist/three/space.d.ts.map +1 -0
  251. package/dist/three/space.js +47 -0
  252. package/dist/three/space.js.map +1 -0
  253. package/dist/three/surface-plot3d.d.ts +80 -0
  254. package/dist/three/surface-plot3d.d.ts.map +1 -0
  255. package/dist/three/surface-plot3d.js +290 -0
  256. package/dist/three/surface-plot3d.js.map +1 -0
  257. package/dist/three/vector-arrow3d.d.ts +25 -0
  258. package/dist/three/vector-arrow3d.d.ts.map +1 -0
  259. package/dist/three/vector-arrow3d.js +72 -0
  260. package/dist/three/vector-arrow3d.js.map +1 -0
  261. package/package.json +79 -3
  262. package/registry.json +251 -0
  263. package/src/annotate/angle-mark.ts +147 -0
  264. package/src/annotate/curly-brace.ts +126 -0
  265. package/src/annotate/emphasis-mark.ts +89 -0
  266. package/src/engine.ts +72 -0
  267. package/src/index.ts +29 -0
  268. package/src/kit/brace.ts +37 -0
  269. package/src/kit/cache.ts +61 -0
  270. package/src/kit/contour.ts +94 -0
  271. package/src/kit/coords.ts +278 -0
  272. package/src/kit/curve.ts +29 -0
  273. package/src/kit/equation.ts +181 -0
  274. package/src/kit/equation3d.ts +137 -0
  275. package/src/kit/expression.ts +159 -0
  276. package/src/kit/field-mark.ts +155 -0
  277. package/src/kit/field.ts +50 -0
  278. package/src/kit/follow.ts +203 -0
  279. package/src/kit/furniture.ts +108 -0
  280. package/src/kit/geometry.ts +49 -0
  281. package/src/kit/mark.ts +131 -0
  282. package/src/kit/part-fills.ts +61 -0
  283. package/src/kit/place.ts +101 -0
  284. package/src/kit/placement.ts +8 -0
  285. package/src/kit/sampler.ts +281 -0
  286. package/src/kit/scale.ts +39 -0
  287. package/src/kit/source.ts +57 -0
  288. package/src/kit/system.ts +99 -0
  289. package/src/kit/ticks.ts +85 -0
  290. package/src/kit/withdrawn.ts +8 -0
  291. package/src/marks/curve-area.ts +89 -0
  292. package/src/marks/drop-lines.ts +63 -0
  293. package/src/marks/plot-point.ts +107 -0
  294. package/src/marks/riemann-sum.ts +98 -0
  295. package/src/marks/tangent-line.ts +103 -0
  296. package/src/marks/vector-arrow.ts +98 -0
  297. package/src/nodes.ts +63 -0
  298. package/src/plots/function-plot.ts +236 -0
  299. package/src/plots/points-plot.ts +107 -0
  300. package/src/plots/stream-lines.ts +151 -0
  301. package/src/plots/traced-path.ts +52 -0
  302. package/src/plots/vector-field.ts +88 -0
  303. package/src/structures/graph-layout.ts +145 -0
  304. package/src/structures/network-graph.ts +308 -0
  305. package/src/structures/sample-space.ts +209 -0
  306. package/src/systems/axes2d.ts +217 -0
  307. package/src/systems/number-line.ts +131 -0
  308. package/src/systems/number-plane.ts +203 -0
  309. package/src/systems/polar-plane.ts +176 -0
  310. package/src/tex/geometry.ts +703 -0
  311. package/src/tex/index.ts +14 -0
  312. package/src/tex/mathjax.ts +82 -0
  313. package/src/tex/matrix.ts +75 -0
  314. package/src/tex/node.ts +641 -0
  315. package/src/tex/tween.ts +308 -0
  316. package/src/three/axes3d.ts +240 -0
  317. package/src/three/curve-plot3d.ts +147 -0
  318. package/src/three/label3d.ts +50 -0
  319. package/src/three/plot-point3d.ts +66 -0
  320. package/src/three/space.ts +67 -0
  321. package/src/three/surface-plot3d.ts +323 -0
  322. package/src/three/vector-arrow3d.ts +77 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/tex/node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACc,UAAU,EAAkB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAc,OAAO,EAAE,SAAS,EAChE,YAAY,EAAkB,QAAQ,EAAE,cAAc,EAC5E,YAAY,EAAE,OAAO,EAAE,QAAQ,GAElD,MAAM,mBAAmB,CAAC;AAC3B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C,IAAI,GAAG,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACnC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;YAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,CAAC;QAClE,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;YAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,CAAC;QAClE,OAAO,OAAO,CAAC;IACnB,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {\r\n RenderContext2D, Graphics2D, EasingFunction, command, node, lerpNumber, NodeConfig, pathOps, ShapeNode, ShapeProps,\r\n InsetsProps, Size2D, SizeConstraints, toPathString, InsetsResolved, property, insetsProperty, FillResolved, ShadowResolved,\r\n StrokeResolved, driveCommand, fillOps, withdraw, type AssetScope, type BoxBounds, type Command, type CommandArgs, type Fill,\r\n type TweenStepper,\r\n} from \"@motionscript/sdk\";\r\n// From each module, never the `../engine` barrel: it re-exports this file, so a\r\n// load that enters through the barrel runs this class's decorators before\r\n// `OUTLINE_TRIM` exists and the kit fails to import.\r\nimport {\r\n blankLatex, buildLatexPath, findLatexParts, LatexNotLoaded, loadMathJax, MATHJAX_LOADER,\r\n type LatexPart, type LatexToken,\r\n} from \"./geometry\";\r\nimport { defaultLatexMorph, type AnimatedToken, type LatexMorphStrategy } from \"./tween\";\r\nimport {\r\n lerpPartFills, partPaint, readPartFills, withPartFill, type PartFill, type PartFillResolved,\r\n} from \"../kit/part-fills\";\r\nimport { OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport interface LatexProps extends ShapeProps {\r\n latex: string;\r\n fontSize: number;\r\n padding: InsetsProps;\r\n partFills: PartFill[];\r\n written: number;\r\n}\r\n\r\n/** How much of one glyph's writing overlaps the next one's. */\r\nconst WRITE_OVERLAP = 0.6;\r\n/** The outline a glyph is written with, as a share of the type size. */\r\nconst WRITE_STROKE = 1 / 32;\r\n\r\n/**\r\n * Construction-time-only options: pluggable engine behavior, set once when\r\n * the node is created. Deliberately *not* part of {@link LatexProps} — every\r\n * `@property` field accepts either a value or a zero-arg reactive binding\r\n * (`value | (() => value)`, see `PropInputs`), and the node's own reactive\r\n * write path (`_writeProp`) treats any function value as the latter. A\r\n * strategy *is* a function, so it can't be told apart from a binding that\r\n * computes one — it has to stay outside the reactive prop system entirely.\r\n */\r\nexport interface LatexStrategies {\r\n /** How the node morphs between two formulas. Defaults to `defaultLatexMorph`. */\r\n morph?: LatexMorphStrategy;\r\n}\r\n\r\n@node({\r\n key: \"latex\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: {\r\n children: \"freeform\",\r\n defaultWidthMode: \"hug\",\r\n defaultHeightMode: \"hug\",\r\n acceptsChildren: true,\r\n },\r\n seed: {\r\n fill: [\r\n {\r\n type: \"solid\",\r\n color: [\r\n 0.412,\r\n 0.565,\r\n 0.867,\r\n 1,\r\n ],\r\n opacity: 1,\r\n enabled: true,\r\n },\r\n ],\r\n },\r\n})\r\n@withdraw(...OUTLINE_TRIM)\r\nexport class Latex extends ShapeNode<LatexProps> {\r\n @property({ default: \"\" }) declare readonly latex: string;\r\n @property({ default: 16 }) declare readonly fontSize: number;\r\n @insetsProperty() declare readonly padding: InsetsResolved;\r\n\r\n /** Paints for parts of the formula, named by their source. Later entries win where two name a glyph. */\r\n @property({ default: [], mapper: readPartFills, tween: lerpPartFills, kind: \"vector\" }) declare partFills: PartFill[];\r\n\r\n /**\r\n * How much of the formula is written, 0 to 1: its glyphs are drawn one after\r\n * another, each outlined and then filled.\r\n */\r\n @property({ default: 1, min: 0, max: 1, step: 0.01 }) declare written: number;\r\n\r\n /**\r\n * How this node morphs between two formulas. Construction-time-only (see\r\n * {@link LatexStrategies}) — resolved once here rather than left as\r\n * `?? defaultLatexMorph` at every call site.\r\n */\r\n private readonly morph: LatexMorphStrategy;\r\n\r\n private _intrinsicWidth: number = 0;\r\n private _intrinsicHeight: number = 0;\r\n\r\n /**\r\n * Shared center frame for all current tokens, [minX, minY, maxX, maxY] in\r\n * token space. Passed to every per-token path so glyphs keep their relative\r\n * layout instead of each centering on its own bbox.\r\n */\r\n private _bounds: [number, number, number, number] = [0, 0, 0, 0];\r\n\r\n /** Current tokens to render. Each has its own opacity for tween transitions. */\r\n private _tokens: AnimatedToken[] = [];\r\n\r\n /** The parts of the formula `_tokens` was built from; empty while a morph holds the tokens. */\r\n private _parts: LatexPart[] = [];\r\n\r\n /** While a morph holds the tokens: each end's colours by token, and how far between them it is. */\r\n private _morphFills: { from: TokenFills; to: TokenFills; t: number } | null = null;\r\n\r\n /**\r\n * How far through a morph the playhead is, in `(0, 1)` while one is\r\n * driving frames and `0` otherwise: the node's own signal, not a prop an\r\n * author states.\r\n *\r\n * A prop rather than a field because it is the one thing the timeline\r\n * restores. The morph writes the tokens, the box and the intrinsic size\r\n * straight onto the node, so nothing else says whether what is on screen is\r\n * a morph frame; and a seek from inside a morph to a time before it\r\n * evaluates no command at all. Restored to `0` with every other prop, this\r\n * is how the node learns the playhead has left the morph.\r\n */\r\n @property({ default: 0, animatable: false }) declare morphProgress: number;\r\n\r\n /** Suppresses retokenization while a custom to() is driving frames. */\r\n private _animating: boolean = false;\r\n\r\n /** The `fontSize|latex` the live tokens were built from. See {@link _ensureTokens}. */\r\n private _tokenizedFrom: string | null = null;\r\n\r\n constructor(props?: NodeConfig<Latex, LatexProps> & LatexStrategies) {\r\n super(props);\r\n this.morph = props?.morph ?? defaultLatexMorph;\r\n this.applyProp(\"width\", props?.width ?? \"hug\");\r\n this.applyProp(\"height\", props?.height ?? \"hug\");\r\n\r\n this._ensureTokens();\r\n }\r\n\r\n /**\r\n * Rebuild the token list when the formula or size has moved since it last\r\n * was built.\r\n *\r\n * Pulled from every reader rather than pushed from a prop write, because\r\n * `latex` can be a binding — and a binding has no write to hang a\r\n * subscription on. The key is what the current tokens were built from;\r\n * `_animating` hands ownership to the morph command for its open interval.\r\n */\r\n private _ensureTokens(): void {\r\n if (this._animating) {\r\n if (this.morphProgress > 0 && this.morphProgress < 1) return;\r\n // The playhead left the morph without it committing either end (a seek\r\n // back to before it evaluates no command), so what is held is a stale\r\n // morph frame. Hand the tokens back to the props.\r\n this._animating = false;\r\n this._morphFills = null;\r\n this._tokenizedFrom = null;\r\n }\r\n const key = `${this.fontSize}|${this._source()}`;\r\n if (key === this._tokenizedFrom) return;\r\n // Recorded once the tokens are built, so a formula that cannot be\r\n // typeset fails on every read instead of the first and then reads as\r\n // blank. Before MathJax is here the node is blank, and is asked again.\r\n try {\r\n this._updateTokens();\r\n } catch (error) {\r\n if (!(error instanceof LatexNotLoaded)) throw error;\r\n this._clearTokens();\r\n return;\r\n }\r\n this._tokenizedFrom = key;\r\n }\r\n\r\n /** MathJax, before this node is laid out: a scene with no formula in it never loads it. */\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n assets.loader(MATHJAX_LOADER, loadMathJax, { gate: \"layout\" });\r\n }\r\n\r\n /** @internal The formula typeset once `next` is laid over the node's own props: `latex` here, a subclass's own props there. */\r\n _source(next: Partial<LatexProps> = {}): string {\r\n return next.latex ?? this.latex;\r\n }\r\n\r\n /** @internal The props that state the formula, as `next` leaves them: what a morph commits at its end. */\r\n _sourceProps(next: Partial<LatexProps> = {}): Partial<LatexProps> {\r\n return { latex: this._source(next) };\r\n }\r\n\r\n /** @internal Whether `next` re-sets the glyphs, and so is a morph rather than an ordinary tween. */\r\n _resets(next: Partial<LatexProps>): boolean {\r\n return next.latex !== undefined || next.fontSize !== undefined;\r\n }\r\n\r\n private _updateTokens() {\r\n const source = this._source();\r\n if (source) {\r\n const result = buildLatexPath(source, this.fontSize);\r\n this._intrinsicWidth = result.width;\r\n this._intrinsicHeight = result.height;\r\n this._bounds = result.bounds;\r\n this._parts = result.parts;\r\n this._tokens = result.tokens.map(t => ({\r\n token: t.token,\r\n path: t.path,\r\n term: t.term,\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n }));\r\n } else {\r\n this._clearTokens();\r\n }\r\n }\r\n\r\n private _clearTokens(): void {\r\n this._tokens = [];\r\n this._parts = [];\r\n this._intrinsicWidth = 0;\r\n this._intrinsicHeight = 0;\r\n this._bounds = [0, 0, 0, 0];\r\n }\r\n\r\n override measure(constraints: SizeConstraints): Partial<Size2D> {\r\n this._ensureTokens();\r\n const pad = this.padding;\r\n const wm = this.width;\r\n const hm = this.height;\r\n\r\n const resolvedW = typeof wm === \"number\"\r\n ? wm\r\n : wm === \"hug\"\r\n ? this._intrinsicWidth + pad.left + pad.right\r\n : constraints.maxWidth ?? 0;\r\n\r\n const resolvedH = typeof hm === \"number\"\r\n ? hm\r\n : hm === \"hug\"\r\n ? this._intrinsicHeight + pad.top + pad.bottom\r\n : constraints.maxHeight ?? 0;\r\n\r\n return { width: resolvedW, height: resolvedH };\r\n }\r\n\r\n /**\r\n * A LaTeX morph — one {@link Command}, like every other `to()`.\r\n *\r\n * Sequence two of them with `sequence(...)` rather than chaining: the chain\r\n * builder this used to return existed only so `latexRef().to(a, 1).to(b, 1)`\r\n * would read as two steps, and it could not compose with anything that was\r\n * not another Latex morph.\r\n */\r\n override to<D extends Partial<LatexProps> = Partial<LatexProps>>(args: CommandArgs<D> & { duration: number }): Command<LatexProps> {\r\n const data: Partial<LatexProps> = args.data ?? {};\r\n // Only a new formula or size re-sets the glyphs; anything else is an ordinary tween.\r\n if (!this._resets(data)) return super.to(args) as Command<LatexProps>;\r\n return this._buildMorph(data, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Morph this formula into another — a document-facing name for {@link to},\r\n * which already routes through {@link _buildMorph}.\r\n */\r\n @command({ args: [{ key: \"latex\", kind: \"text\", multiline: true }] })\r\n morphTo(args: CommandArgs<{ latex: string }> & { duration: number }): Command<LatexProps> {\r\n return this.to({ data: { latex: args.data?.latex } as Partial<LatexProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Write the formula on, or off: its glyphs one after another, each outlined and then filled. */\r\n @command({ args: [\"written\"] })\r\n writeTo(args: CommandArgs<{ written: number }> & { duration: number }): Command<LatexProps> {\r\n const written = args.data?.written;\r\n return super.to({ data: written === undefined ? {} : { written }, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Paint one part of the formula, leaving the rest as it is. */\r\n @command({\r\n args: [\r\n { key: \"part\", kind: \"text\", default: \"\" },\r\n { key: \"fill\", kind: \"fills\", default: \"#facc15\" },\r\n { key: \"occurrence\", kind: \"number\", min: 0, step: 1, default: 0 },\r\n ],\r\n })\r\n partFillTo(args: CommandArgs<{ part: string; fill: Fill; occurrence?: number }> & { duration: number }): Command<LatexProps> {\r\n const { part, fill, occurrence = 0 } = args.data ?? {};\r\n if (!part || fill == null) return super.to({ data: {}, duration: args.duration, easing: args.easing });\r\n const partFills = withPartFill(this.partFills as unknown as PartFillResolved[], { part, fill, occurrence });\r\n return super.to({ data: { partFills }, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * The box around one part of the formula, centred on the node's own centre\r\n * and y-up, or `null` when the formula does not write `part`. `occurrence`\r\n * counts from 1.\r\n */\r\n partBounds(part: string, occurrence = 1): BoxBounds | null {\r\n this._ensureTokens();\r\n const span = findLatexParts(this._parts, part)[Math.max(1, Math.round(occurrence)) - 1];\r\n if (!span) return null;\r\n const box = pathOps.bounds(this._tokens.slice(span[0], span[1]).flatMap((token) => token.path));\r\n if (!box) return null;\r\n const [minX, minY, maxX, maxY] = this._bounds;\r\n const cx = (minX + maxX) / 2;\r\n const cy = (minY + maxY) / 2;\r\n return {\r\n x: (box.minX + box.maxX) / 2 - cx,\r\n y: cy - (box.minY + box.maxY) / 2,\r\n width: box.maxX - box.minX,\r\n height: box.maxY - box.minY,\r\n };\r\n }\r\n\r\n /**\r\n * Build a single LaTeX morph as a {@link Command}: every ordinary\r\n * `ShapeProps` field (via the inherited `_prepareStep`), plus the\r\n * intrinsic size, shared center frame and per-glyph token list — state a\r\n * plain `set()` can't reach — driven together by one eased `t`, matching\r\n * the concurrent `parallel` the generator version ran.\r\n *\r\n * The \"from\" snapshot (`fromTokens`, `fromLatex`, …) is captured\r\n * **lazily, on the command's first evaluation**, not when this is called.\r\n * That is what lets two morphs be sequenced: `commandSequence` settles each\r\n * prior step before evaluating the next, so a second morph's \"from\" reads\r\n * the first one's end state rather than whatever the node held before either\r\n * of them ran.\r\n *\r\n * `_animating` suppresses {@link _ensureTokens} for the open interval, and\r\n * both ends commit: `t === 1`\r\n * lands on the target formula, `t === 0` restores the source one — the same\r\n * \"membership for the open interval, commit at either end\" shape\r\n * `packages/components/code`'s `runTransition` uses, so seeking into either\r\n * side of the morph (not just running it forward) shows the right thing.\r\n *\r\n * `@internal` — the entry point for authors is {@link to}.\r\n */\r\n _buildMorph(to: Partial<LatexProps>, duration: number, easing?: EasingFunction): Command<LatexProps> {\r\n // Not in a tree: no box, no timeline. The command keeps its length and\r\n // writes nothing, as every command built through `Node` does.\r\n if (!this.mounted) return driveCommand(duration, () => { }) as Command<LatexProps>;\r\n let setupDone = false;\r\n let fromAnimTokens: AnimatedToken[] = [];\r\n let fromLatex = \"\";\r\n let fromProps: Partial<LatexProps> = {};\r\n let fromFontSize = 0;\r\n let fromWidth = 0;\r\n let fromHeight = 0;\r\n let fromBounds: [number, number, number, number] = [0, 0, 0, 0];\r\n let fromParts: LatexPart[] = [];\r\n let fromFills: TokenFills = [];\r\n let toFills: TokenFills = [];\r\n let toFontSize = 0;\r\n let toLatex = \"\";\r\n let toResult: ReturnType<typeof buildLatexPath>;\r\n let propStep: TweenStepper;\r\n let latexFrame: (t: number) => AnimatedToken[];\r\n\r\n const setup = (): void => {\r\n setupDone = true;\r\n this._ensureTokens();\r\n const fromTokens: LatexToken[] = this._tokens.map(t => ({ token: t.token, path: t.path, term: t.term }));\r\n fromAnimTokens = this._tokens.map(t => ({ ...t }));\r\n fromLatex = this._source();\r\n fromProps = this._sourceProps();\r\n fromFontSize = this.fontSize;\r\n fromWidth = this._intrinsicWidth;\r\n fromHeight = this._intrinsicHeight;\r\n fromBounds = this._bounds;\r\n fromParts = this._parts;\r\n\r\n toFontSize = to.fontSize !== undefined ? to.fontSize : this.fontSize;\r\n toLatex = this._source(to);\r\n try {\r\n toResult = buildLatexPath(toLatex, toFontSize);\r\n } catch (error) {\r\n if (!(error instanceof LatexNotLoaded)) throw error;\r\n toResult = blankLatex();\r\n }\r\n\r\n propStep = this._prepareStep(to, duration);\r\n latexFrame = this.morph(fromTokens, toResult.tokens);\r\n const partFills = this.partFills as unknown as PartFillResolved[];\r\n fromFills = fillsByToken(partFills, fromParts, fromTokens.length);\r\n toFills = fillsByToken(partFills, toResult.parts, toResult.tokens.length);\r\n };\r\n\r\n return driveCommand(duration, (t) => {\r\n if (!setupDone) setup();\r\n const toBounds = toResult.bounds;\r\n\r\n this._animating = true;\r\n this.morphProgress = t;\r\n propStep.seek(t * duration);\r\n this.set({ fontSize: lerpNumber(fromFontSize, toFontSize, t) });\r\n // Track the measured size so a hugging box grows/shrinks smoothly\r\n // across the morph rather than jumping when the end commits.\r\n this._intrinsicWidth = lerpNumber(fromWidth, toResult.width, t);\r\n this._intrinsicHeight = lerpNumber(fromHeight, toResult.height, t);\r\n // Interpolate the shared center frame in lockstep so glyphs stay\r\n // centered within the resizing box.\r\n this._bounds = [\r\n lerpNumber(fromBounds[0], toBounds[0], t),\r\n lerpNumber(fromBounds[1], toBounds[1], t),\r\n lerpNumber(fromBounds[2], toBounds[2], t),\r\n lerpNumber(fromBounds[3], toBounds[3], t),\r\n ];\r\n this._tokens = latexFrame(t);\r\n this._parts = [];\r\n this._morphFills = { from: fromFills, to: toFills, t };\r\n\r\n if (t >= 1) {\r\n this.set({ ...this._sourceProps(to), fontSize: toFontSize });\r\n this._parts = toResult.parts;\r\n this._tokens = toResult.tokens.map(tok => ({ token: tok.token, path: tok.path, term: tok.term, opacity: 1, x: 0, y: 0 }));\r\n this._intrinsicWidth = toResult.width;\r\n this._intrinsicHeight = toResult.height;\r\n this._bounds = toResult.bounds;\r\n this._animating = false;\r\n this._morphFills = null;\r\n this.morphProgress = 0;\r\n this._tokenizedFrom = `${toFontSize}|${toLatex}`;\r\n } else if (t <= 0) {\r\n this.set({ ...fromProps, fontSize: fromFontSize });\r\n this._parts = fromParts;\r\n this._tokens = fromAnimTokens;\r\n this._intrinsicWidth = fromWidth;\r\n this._intrinsicHeight = fromHeight;\r\n this._bounds = fromBounds;\r\n this._animating = false;\r\n this._morphFills = null;\r\n this.morphProgress = 0;\r\n this._tokenizedFrom = `${fromFontSize}|${fromLatex}`;\r\n }\r\n }, easing) as Command<LatexProps>;\r\n }\r\n\r\n /**\r\n * The shadow op comes **first**, as it does on every other painted node.\r\n *\r\n * The renderer does not draw a shadow when it sees one: `.shadow()` stores\r\n * it pending and the *next* fill or stroke op casts it (`_shadow` →\r\n * `storePendingShadows`, `_fill`/`_stroke` → `takePendingShadows`). Appended\r\n * last, it was stored by every token and then thrown away by the reset at\r\n * the end of the draw — a shadow set on a LaTeX node simply never appeared,\r\n * with no error to say why. Same failure {@link PaintedNode.renderStroke}\r\n * documents for a fill-less stroked shape, and the same one-op fix.\r\n *\r\n * Order also carries the fill-less case for free: an empty fill returns\r\n * before it takes the pending shadow, so the stroke below casts it from the\r\n * glyph outlines instead — which is what `castsShadowFromStroke` arranges on\r\n * a plain shape.\r\n */\r\n protected renderSelf(ctx: RenderContext2D): void {\r\n const fills = this.fill as FillResolved[];\r\n const shadows = this.shadow as ShadowResolved[];\r\n const partOf = this._tokenFills();\r\n const writing = this._writing();\r\n this.eachToken(ctx, (graphics, opacity, index, token) => {\r\n const fill = partPaint(fills, partOf(index, token));\r\n const pen = writing?.(index);\r\n if (!pen) {\r\n return graphics\r\n .shadow(scaleShadowOpacity(shadows, opacity))\r\n .fill(scaleFillopacity(fill, opacity))\r\n .stroke(this.stroke);\r\n }\r\n if (pen.filled <= 0) return null;\r\n return graphics\r\n .shadow(scaleShadowOpacity(shadows, opacity * pen.filled))\r\n .fill(scaleFillopacity(fill, opacity * pen.filled))\r\n .stroke(this.stroke);\r\n });\r\n if (!writing) return;\r\n // The pen's line: each glyph's outline, in its own colour, ahead of its fill.\r\n const own = this.stroke as StrokeResolved[];\r\n this.eachToken(ctx, (graphics, opacity, index, token) => {\r\n const pen = writing(index);\r\n if (!pen || pen.filled >= 1 || pen.outlined <= 0) return null;\r\n const fill = scaleFillopacity(partPaint(fills, partOf(index, token)), opacity * (1 - pen.filled));\r\n return graphics.stroke(own.length > 0 ? own : penStroke(this.fontSize * WRITE_STROKE, fill));\r\n }, (index) => writing(index)?.outlined ?? 1);\r\n }\r\n\r\n /** Each token's part fill: by its place in the formula at rest, by both ends' mid-morph. */\r\n private _tokenFills(): (index: number, token: AnimatedToken) => PartFillResolved | undefined {\r\n const morph = this._morphFills;\r\n if (morph) {\r\n return (_index, token) => {\r\n const a = token.from === undefined ? undefined : morph.from[token.from];\r\n const b = token.to === undefined ? undefined : morph.to[token.to];\r\n if (a && b) return { ...b, fill: fillOps.lerp(a.fill, b.fill, morph.t), mix: lerpNumber(a.mix, b.mix, morph.t) };\r\n if (a) return token.to === undefined ? a : { ...a, mix: a.mix * (1 - morph.t) };\r\n if (b) return token.from === undefined ? b : { ...b, mix: b.mix * morph.t };\r\n return undefined;\r\n };\r\n }\r\n const partFills = this.partFills as unknown as PartFillResolved[];\r\n if (partFills.length === 0) return () => undefined;\r\n const byToken = fillsByToken(partFills, this._parts, this._tokens.length);\r\n return (index) => byToken[index];\r\n }\r\n\r\n /**\r\n * How far each glyph is written at the node's `written`: its outline first,\r\n * then its fill, each glyph starting before the one ahead of it is done.\r\n * `null` once the whole formula is.\r\n */\r\n private _writing(): ((index: number) => { outlined: number; filled: number }) | null {\r\n const written = this.written;\r\n if (written >= 1) return null;\r\n const count = this._tokens.length;\r\n const lead = 1 - WRITE_OVERLAP;\r\n const span = 1 / (1 + Math.max(0, count - 1) * lead);\r\n return (index) => {\r\n const p = Math.min(1, Math.max(0, (written - index * span * lead) / span));\r\n return { outlined: Math.min(1, p * 2), filled: Math.max(0, p * 2 - 1) };\r\n };\r\n }\r\n\r\n /**\r\n * The overlay, painted *through* the glyphs.\r\n *\r\n * `ShapeNode`'s inherited overlay pass fills whatever {@link\r\n * ShapeNode.shapeGraphics} describes, and this node describes nothing there:\r\n * a formula has no single fillable silhouette — its silhouette *is* the list\r\n * of token paths, which is why `renderSelf` is overridden rather than a\r\n * `shapeGraphics` supplied. So the generic pass drew nothing and an overlay\r\n * set on a LaTeX node simply never appeared, with no error to say why.\r\n *\r\n * Painted the same way the fill is: one `Graphics2D` per token, all sharing the\r\n * centre frame, each scaled by its token's animated opacity — so a morph\r\n * carries the overlay along with the glyph it is laid over instead of leaving\r\n * a wash hanging over glyphs that have faded out.\r\n *\r\n * The stroke is *not* re-drawn here. `renderSelf` already strokes each token\r\n * (there is no silhouette for the deferred {@link ShapeNode.renderStroke} to\r\n * outline), so it is painted under the overlay rather than over it — the one\r\n * place this node's draw order differs from a plain shape's, and the price of\r\n * a stroke that follows glyphs rather than a box.\r\n */\r\n protected override renderOverlay(ctx: RenderContext2D): void {\r\n const overlay = this.overlay as FillResolved[];\r\n if (overlay.length === 0) return;\r\n const writing = this._writing();\r\n this.eachToken(ctx, (graphics, opacity, index) => {\r\n const filled = writing?.(index).filled ?? 1;\r\n return filled <= 0 ? null : graphics.fill(scaleFillopacity(overlay, opacity * filled));\r\n });\r\n }\r\n\r\n /**\r\n * Draws every visible token's path once, handing each one to `paint` to have\r\n * its paint ops appended.\r\n *\r\n * A fresh `Graphics2D` per token per pass, because `.fill()`/`.stroke()` push\r\n * onto one op list and return `this` — a silhouette shared between the fill\r\n * pass and the overlay pass would accumulate both.\r\n */\r\n private eachToken(\r\n ctx: RenderContext2D,\r\n paint: (graphics: Graphics2D, opacity: number, index: number, token: AnimatedToken) => Graphics2D | null,\r\n drawn: (index: number) => number = () => 1,\r\n ): void {\r\n // The one funnel every paint pass goes through, so the tokens a frame\r\n // draws cannot be older than the formula it holds.\r\n this._ensureTokens();\r\n this._tokens.forEach((token, index) => {\r\n if (token.opacity <= 0) return;\r\n\r\n // Translate the path by token's interpolated position offset\r\n const pathStr = token.x !== 0 || token.y !== 0\r\n ? toPathString(offsetPath(token.path, token.x, token.y))\r\n : toPathString(token.path);\r\n\r\n const painted = paint(new Graphics2D()\r\n .path({\r\n data: pathStr,\r\n start: this.start,\r\n end: this.end * drawn(index),\r\n // All tokens share one center frame so they keep their relative\r\n // layout — without this each glyph centers on its own bbox and\r\n // they all stack on the origin.\r\n centerBounds: this._bounds,\r\n }), token.opacity, index, token);\r\n if (painted) ctx.draw(painted);\r\n });\r\n }\r\n\r\n}\r\n\r\nfunction penStroke(weight: number, fill: FillResolved[]): StrokeResolved[] {\r\n return [{ weight, fill, dashOffset: 0, align: 0, cap: \"round\", capScale: 4, join: \"round\", miterLimit: 4 }];\r\n}\r\n\r\n/** One part fill per token, or none: the last entry that names it. */\r\ntype TokenFills = (PartFillResolved | undefined)[];\r\n\r\nfunction fillsByToken(partFills: readonly PartFillResolved[], parts: readonly LatexPart[], count: number): TokenFills {\r\n const out: TokenFills = new Array(count);\r\n for (const entry of partFills) {\r\n if (entry.part.trim() === \"\") continue;\r\n const spans = findLatexParts(parts, entry.part);\r\n for (const [from, to] of entry.occurrence > 0 ? spans.slice(entry.occurrence - 1, entry.occurrence) : spans) {\r\n for (let i = from; i < to && i < count; i++) out[i] = entry;\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction scaleFillopacity(fills: FillResolved[], opacity: number): FillResolved[] {\r\n if (opacity >= 1) return fills;\r\n return fills.map(f => ({ ...f, opacity: (f.opacity ?? 1) * opacity }));\r\n}\r\n\r\n/**\r\n * A morphing token fades, and its shadow has to fade with it — the paints are\r\n * scaled the same way the fill's are, so a half-faded glyph casts a half-strength\r\n * shadow rather than sitting over a shadow at full weight.\r\n */\r\nfunction scaleShadowOpacity(shadows: ShadowResolved[], opacity: number): ShadowResolved[] {\r\n if (opacity >= 1) return shadows;\r\n return shadows.map(s => ({ ...s, fill: scaleFillopacity(s.fill, opacity) }));\r\n}\r\n\r\nfunction offsetPath(\r\n path: LatexToken[\"path\"],\r\n dx: number,\r\n dy: number,\r\n): LatexToken[\"path\"] {\r\n return path.map(cmd => {\r\n const c = cmd as any;\r\n const shifted: any = { ...c };\r\n if (\"x\" in c) shifted.x = c.x + dx;\r\n if (\"y\" in c) shifted.y = c.y + dy;\r\n if (\"x1\" in c) { shifted.x1 = c.x1 + dx; shifted.y1 = c.y1 + dy; }\r\n if (\"x2\" in c) { shifted.x2 = c.x2 + dx; shifted.y2 = c.y2 + dy; }\r\n return shifted;\r\n });\r\n}\r\n"]}
@@ -0,0 +1,50 @@
1
+ import type { LatexToken } from "./geometry.js";
2
+ export interface AnimatedToken {
3
+ token: string;
4
+ path: LatexToken["path"];
5
+ /** The top-level term it belongs to at rest; a morph matches on it. */
6
+ term?: string;
7
+ /** 0 = invisible, 1 = fully visible */
8
+ opacity: number;
9
+ /** Interpolated position offset applied during morph (x, y in formula space). */
10
+ x: number;
11
+ y: number;
12
+ /** Mid-morph: the index of the token it was in the formula left, and of the one it becomes. */
13
+ from?: number;
14
+ to?: number;
15
+ }
16
+ /**
17
+ * How a `Latex` node interpolates between two formulas: given the tokens it
18
+ * currently holds and the tokens the target formula resolves to, return a
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.
22
+ */
23
+ export type LatexMorphStrategy = (from: LatexToken[], to: LatexToken[]) => (t: number) => AnimatedToken[];
24
+ /**
25
+ * Precompute a formula-change morph and return a pure `t → AnimatedToken[]`
26
+ * frame function:
27
+ * - Deleted tokens fade out over the first half of `t`.
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`.
31
+ *
32
+ * A matched glyph is rarely the same size at both ends: the `2` of `b^2` is set
33
+ * at script size and the `2` of `2a` at full size, and a `\frac`'s arguments
34
+ * come back a step smaller than the same symbols on a baseline. So the
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.
47
+ */
48
+ export declare function prepareLatexTween(from: LatexToken[], to: LatexToken[]): (t: number) => AnimatedToken[];
49
+ export { prepareLatexTween as defaultLatexMorph };
50
+ //# sourceMappingURL=tween.d.ts.map
@@ -0,0 +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,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,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;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;AAgK1G;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,UAAU,EAAE,EAClB,EAAE,EAAE,UAAU,EAAE,GACjB,CAAC,CAAC,EAAE,MAAM,KAAK,aAAa,EAAE,CA6FhC;AAED,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,253 @@
1
+ import { lerpNumber } from "@motionscript/sdk";
2
+ /** The coordinate pairs a `PathCommand` can carry, as (x, y) field names. */
3
+ const POINT_FIELDS = [["x", "y"], ["x1", "y1"], ["x2", "y2"]];
4
+ /**
5
+ * Compute the centroid of a token's path for position-based interpolation.
6
+ */
7
+ function centroid(path) {
8
+ let sx = 0, sy = 0, n = 0;
9
+ for (const cmd of path) {
10
+ if ("x" in cmd && "y" in cmd) {
11
+ sx += cmd.x;
12
+ sy += cmd.y;
13
+ n++;
14
+ }
15
+ }
16
+ return n > 0 ? { x: sx / n, y: sy / n } : { x: 0, y: 0 };
17
+ }
18
+ /**
19
+ * A glyph's on-screen extent, as the diagonal of its control-point bbox.
20
+ *
21
+ * Only ever used as a *ratio* between the two ends of a match, so the fact that
22
+ * control points overshoot the true outline doesn't matter: both ends overshoot
23
+ * by the same proportion, because they are the same outline.
24
+ */
25
+ function extent(path) {
26
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
27
+ for (const cmd of path) {
28
+ const c = cmd;
29
+ for (const [kx, ky] of POINT_FIELDS) {
30
+ if (kx in c) {
31
+ if (c[kx] < minX)
32
+ minX = c[kx];
33
+ if (c[kx] > maxX)
34
+ maxX = c[kx];
35
+ if (c[ky] < minY)
36
+ minY = c[ky];
37
+ if (c[ky] > maxY)
38
+ maxY = c[ky];
39
+ }
40
+ }
41
+ }
42
+ if (minX > maxX)
43
+ return 0;
44
+ return Math.hypot(maxX - minX, maxY - minY);
45
+ }
46
+ /**
47
+ * Whether two paths can be interpolated point by point: same command count,
48
+ * same command types in the same order.
49
+ *
50
+ * For a matched pair this is the overwhelmingly common case, and not by luck.
51
+ * Tokens are matched on the character their MathJax glyph id decodes to, and
52
+ * that id *is* the key into the `<defs>` dictionary — so the same character in
53
+ * two formulas is the same outline, emitted twice under two different
54
+ * transforms. Same commands, different numbers.
55
+ */
56
+ function isPointwiseCompatible(from, to) {
57
+ if (from.length !== to.length)
58
+ return false;
59
+ for (let i = 0; i < from.length; i++) {
60
+ if (from[i].type !== to[i].type)
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+ /**
66
+ * Lerp two structurally identical paths point by point.
67
+ *
68
+ * When the two ends are the same outline under two affine transforms — which is
69
+ * what a matched glyph is — this is exact at both ends *and* correct in
70
+ * between: `(1-t)·A·q + t·B·q = ((1-t)A + tB)·q`, and a blend of two
71
+ * uniform-scale-plus-translate transforms is another one. The intermediate is a
72
+ * properly formed glyph at an intermediate size, not a smeared one.
73
+ */
74
+ function lerpPath(from, to, t) {
75
+ const out = new Array(from.length);
76
+ for (let i = 0; i < from.length; i++) {
77
+ const f = from[i];
78
+ const g = to[i];
79
+ const c = { ...g };
80
+ for (const [kx, ky] of POINT_FIELDS) {
81
+ if (kx in g && kx in f) {
82
+ c[kx] = lerpNumber(f[kx], g[kx], t);
83
+ c[ky] = lerpNumber(f[ky], g[ky], t);
84
+ }
85
+ }
86
+ out[i] = c;
87
+ }
88
+ return out;
89
+ }
90
+ /**
91
+ * Scale a path uniformly about (cx, cy), then translate by (dx, dy).
92
+ *
93
+ * The fallback for a matched pair whose paths *aren't* structurally identical —
94
+ * a stretchy delimiter assembled from a different number of pieces at the two
95
+ * sizes, say. Point-by-point lerping is impossible there, so the target outline
96
+ * is shrunk to the source's size instead and grown back over the morph: the
97
+ * size still changes continuously, which is the whole point, at the cost of
98
+ * showing the target's shape from the start.
99
+ */
100
+ function scaleAbout(path, cx, cy, s, dx, dy) {
101
+ return path.map(cmd => {
102
+ const c = { ...cmd };
103
+ for (const [kx, ky] of POINT_FIELDS) {
104
+ if (kx in c) {
105
+ c[kx] = cx + (c[kx] - cx) * s + dx;
106
+ c[ky] = cy + (c[ky] - cy) * s + dy;
107
+ }
108
+ }
109
+ return c;
110
+ });
111
+ }
112
+ /**
113
+ * Match tokens from `from` to `to` by character key, a term that both formulas
114
+ * write first: the `x^2` of `x^2 + 1` travels to the `x^2` of `y = x^2` as
115
+ * one, instead of lending its `2` to whichever `2` comes first. What is left
116
+ * is matched greedily by character alone.
117
+ * Returns three lists: matched pairs, deleted tokens (only in from), added tokens (only in to).
118
+ */
119
+ function matchTokens(from, to) {
120
+ const remaining = [...to];
121
+ const partner = new Map();
122
+ // Synthetic shapes (rects/paths) have no natural token key.
123
+ const keyed = (t) => !t.token.startsWith("__");
124
+ const pair = (same) => {
125
+ for (const ft of from) {
126
+ if (!keyed(ft) || partner.has(ft))
127
+ continue;
128
+ const idx = remaining.findIndex(t => keyed(t) && same(ft, t));
129
+ if (idx === -1)
130
+ continue;
131
+ partner.set(ft, remaining[idx]);
132
+ remaining.splice(idx, 1);
133
+ }
134
+ };
135
+ pair((f, t) => f.token === t.token && f.term !== undefined && f.term === t.term);
136
+ pair((f, t) => f.token === t.token);
137
+ const matched = [];
138
+ const deleted = [];
139
+ for (const ft of from) {
140
+ const tt = partner.get(ft);
141
+ if (tt)
142
+ matched.push({ from: ft, to: tt });
143
+ else
144
+ deleted.push(ft);
145
+ }
146
+ return { matched, deleted, added: remaining };
147
+ }
148
+ /**
149
+ * Precompute a formula-change morph and return a pure `t → AnimatedToken[]`
150
+ * frame function:
151
+ * - Deleted tokens fade out over the first half of `t`.
152
+ * - Matched tokens are interpolated — place *and* size — across the full range
153
+ * of `t`.
154
+ * - Added tokens fade in over the second half of `t`.
155
+ *
156
+ * A matched glyph is rarely the same size at both ends: the `2` of `b^2` is set
157
+ * at script size and the `2` of `2a` at full size, and a `\frac`'s arguments
158
+ * come back a step smaller than the same symbols on a baseline. So the
159
+ * interpolation has to carry the glyph's *geometry*, not just where it sits.
160
+ * Sliding the target outline from one centroid to the other — which is all this
161
+ * used to do — put the whole size change between the last static frame and the
162
+ * morph's first one: a snap to the new size, then a smooth glide to the new
163
+ * place. Point-by-point lerping (see {@link lerpPath}) is that same
164
+ * interpolation generalised from a glyph's average point to all of them, and it
165
+ * costs nothing extra — the path was already being rebuilt every frame to apply
166
+ * the slide.
167
+ *
168
+ * `t` is normalized `[0, 1]` and already eased — the caller (a `Command`'s
169
+ * `at`) applies easing once, up front, the same eased value driving every
170
+ * concurrent aspect of the morph (props, intrinsic size, tokens) in lockstep.
171
+ */
172
+ export function prepareLatexTween(from, to) {
173
+ const { matched, deleted, added } = matchTokens(from, to);
174
+ // Per-match interpolation data. Structure compatibility, and the centroids
175
+ // and extents behind the fallback, are properties of the pair rather than
176
+ // of `t`, so they are settled once here instead of at every frame.
177
+ const fromIndex = new Map(from.map((token, i) => [token, i]));
178
+ const toIndex = new Map(to.map((token, i) => [token, i]));
179
+ const matchedData = matched.map(({ from: f, to: t }) => {
180
+ const toExtent = extent(t.path);
181
+ return {
182
+ from: fromIndex.get(f),
183
+ to: toIndex.get(t),
184
+ pointwise: isPointwiseCompatible(f.path, t.path),
185
+ fromPath: f.path,
186
+ toPath: t.path,
187
+ token: t.token,
188
+ fromCenter: centroid(f.path),
189
+ toCenter: centroid(t.path),
190
+ /** Only the fallback needs it, and only as a ratio. */
191
+ fromScale: toExtent > 0 ? extent(f.path) / toExtent : 1,
192
+ };
193
+ });
194
+ return (t) => {
195
+ const tokens = [];
196
+ // Matched tokens: interpolate place and size across the full duration.
197
+ for (const m of matchedData) {
198
+ if (m.pointwise) {
199
+ tokens.push({
200
+ token: m.token,
201
+ path: lerpPath(m.fromPath, m.toPath, t),
202
+ opacity: 1,
203
+ // Baked into the path above: the lerp carries every point,
204
+ // which includes where the glyph sits.
205
+ x: 0,
206
+ y: 0,
207
+ from: m.from,
208
+ to: m.to,
209
+ });
210
+ continue;
211
+ }
212
+ const s = lerpNumber(m.fromScale, 1, t);
213
+ const cx = lerpNumber(m.fromCenter.x, m.toCenter.x, t);
214
+ const cy = lerpNumber(m.fromCenter.y, m.toCenter.y, t);
215
+ tokens.push({
216
+ token: m.token,
217
+ path: scaleAbout(m.toPath, m.toCenter.x, m.toCenter.y, s, cx - m.toCenter.x, cy - m.toCenter.y),
218
+ opacity: 1,
219
+ x: 0,
220
+ y: 0,
221
+ from: m.from,
222
+ to: m.to,
223
+ });
224
+ }
225
+ // Deleted tokens: fade out over the first half, gone by t=0.5
226
+ for (const d of deleted) {
227
+ const fadeT = Math.min(t * 2, 1);
228
+ tokens.push({
229
+ token: d.token,
230
+ path: d.path,
231
+ opacity: lerpNumber(1, 0, fadeT),
232
+ x: 0,
233
+ y: 0,
234
+ from: fromIndex.get(d),
235
+ });
236
+ }
237
+ // Added tokens: fade in over the second half, starting at t=0.5
238
+ for (const a of added) {
239
+ const fadeT = Math.max(t * 2 - 1, 0);
240
+ tokens.push({
241
+ token: a.token,
242
+ path: a.path,
243
+ opacity: lerpNumber(0, 1, fadeT),
244
+ x: 0,
245
+ y: 0,
246
+ to: toIndex.get(a),
247
+ });
248
+ }
249
+ return tokens;
250
+ };
251
+ }
252
+ export { prepareLatexTween as defaultLatexMorph };
253
+ //# sourceMappingURL=tween.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tween.js","sourceRoot":"","sources":["../../src/tex/tween.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AA2BjE,6EAA6E;AAC7E,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAU,CAAC;AAEvE;;GAEG;AACH,SAAS,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AE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;gBAChC,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;aACrB,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC;AAED,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,CAAC","sourcesContent":["import { lerpNumber, type PathCommand } from \"@motionscript/sdk\";\r\nimport type { LatexToken } from \"./geometry\";\r\n\r\nexport interface AnimatedToken {\r\n token: string;\r\n path: LatexToken[\"path\"];\r\n /** The top-level term it belongs to at rest; a morph matches on it. */\r\n term?: string;\r\n /** 0 = invisible, 1 = fully visible */\r\n opacity: number;\r\n /** Interpolated position offset applied during morph (x, y in formula space). */\r\n x: number;\r\n y: number;\r\n /** Mid-morph: the index of the token it was in the formula left, and of the one it becomes. */\r\n from?: number;\r\n to?: number;\r\n}\r\n\r\n/**\r\n * How a `Latex` node interpolates between two formulas: given the tokens it\r\n * currently holds and the tokens the target formula resolves to, return a\r\n * pure `t → AnimatedToken[]` frame function. `prepareLatexTween` below is the\r\n * default implementation (exported as `defaultLatexMorph`) — pass a `morph`\r\n * of this shape to `<Latex>` to replace it with your own.\r\n */\r\nexport type LatexMorphStrategy = (from: LatexToken[], to: LatexToken[]) => (t: number) => AnimatedToken[];\r\n\r\n/** The coordinate pairs a `PathCommand` can carry, as (x, y) field names. */\r\nconst POINT_FIELDS = [[\"x\", \"y\"], [\"x1\", \"y1\"], [\"x2\", \"y2\"]] as const;\r\n\r\n/**\r\n * Compute the centroid of a token's path for position-based interpolation.\r\n */\r\nfunction centroid(path: LatexToken[\"path\"]): { x: number; y: number } {\r\n let sx = 0, sy = 0, n = 0;\r\n for (const cmd of path) {\r\n if (\"x\" in cmd && \"y\" in cmd) {\r\n sx += (cmd as any).x;\r\n sy += (cmd as any).y;\r\n n++;\r\n }\r\n }\r\n return n > 0 ? { x: sx / n, y: sy / n } : { x: 0, y: 0 };\r\n}\r\n\r\n/**\r\n * A glyph's on-screen extent, as the diagonal of its control-point bbox.\r\n *\r\n * Only ever used as a *ratio* between the two ends of a match, so the fact that\r\n * control points overshoot the true outline doesn't matter: both ends overshoot\r\n * by the same proportion, because they are the same outline.\r\n */\r\nfunction extent(path: LatexToken[\"path\"]): number {\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n for (const cmd of path) {\r\n const c = cmd as any;\r\n for (const [kx, ky] of POINT_FIELDS) {\r\n if (kx in c) {\r\n if (c[kx] < minX) minX = c[kx];\r\n if (c[kx] > maxX) maxX = c[kx];\r\n if (c[ky] < minY) minY = c[ky];\r\n if (c[ky] > maxY) maxY = c[ky];\r\n }\r\n }\r\n }\r\n if (minX > maxX) return 0;\r\n return Math.hypot(maxX - minX, maxY - minY);\r\n}\r\n\r\n/**\r\n * Whether two paths can be interpolated point by point: same command count,\r\n * same command types in the same order.\r\n *\r\n * For a matched pair this is the overwhelmingly common case, and not by luck.\r\n * Tokens are matched on the character their MathJax glyph id decodes to, and\r\n * that id *is* the key into the `<defs>` dictionary — so the same character in\r\n * two formulas is the same outline, emitted twice under two different\r\n * transforms. Same commands, different numbers.\r\n */\r\nfunction isPointwiseCompatible(from: PathCommand[], to: PathCommand[]): boolean {\r\n if (from.length !== to.length) return false;\r\n for (let i = 0; i < from.length; i++) {\r\n if (from[i].type !== to[i].type) return false;\r\n }\r\n return true;\r\n}\r\n\r\n/**\r\n * Lerp two structurally identical paths point by point.\r\n *\r\n * When the two ends are the same outline under two affine transforms — which is\r\n * what a matched glyph is — this is exact at both ends *and* correct in\r\n * between: `(1-t)·A·q + t·B·q = ((1-t)A + tB)·q`, and a blend of two\r\n * uniform-scale-plus-translate transforms is another one. The intermediate is a\r\n * properly formed glyph at an intermediate size, not a smeared one.\r\n */\r\nfunction lerpPath(from: PathCommand[], to: PathCommand[], t: number): PathCommand[] {\r\n const out: PathCommand[] = new Array(from.length);\r\n for (let i = 0; i < from.length; i++) {\r\n const f = from[i] as any;\r\n const g = to[i] as any;\r\n const c: any = { ...g };\r\n for (const [kx, ky] of POINT_FIELDS) {\r\n if (kx in g && kx in f) {\r\n c[kx] = lerpNumber(f[kx], g[kx], t);\r\n c[ky] = lerpNumber(f[ky], g[ky], t);\r\n }\r\n }\r\n out[i] = c as PathCommand;\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Scale a path uniformly about (cx, cy), then translate by (dx, dy).\r\n *\r\n * The fallback for a matched pair whose paths *aren't* structurally identical —\r\n * a stretchy delimiter assembled from a different number of pieces at the two\r\n * sizes, say. Point-by-point lerping is impossible there, so the target outline\r\n * is shrunk to the source's size instead and grown back over the morph: the\r\n * size still changes continuously, which is the whole point, at the cost of\r\n * showing the target's shape from the start.\r\n */\r\nfunction scaleAbout(\r\n path: PathCommand[],\r\n cx: number,\r\n cy: number,\r\n s: number,\r\n dx: number,\r\n dy: number,\r\n): PathCommand[] {\r\n return path.map(cmd => {\r\n const c: any = { ...(cmd as any) };\r\n for (const [kx, ky] of POINT_FIELDS) {\r\n if (kx in c) {\r\n c[kx] = cx + (c[kx] - cx) * s + dx;\r\n c[ky] = cy + (c[ky] - cy) * s + dy;\r\n }\r\n }\r\n return c as PathCommand;\r\n });\r\n}\r\n\r\n/**\r\n * Match tokens from `from` to `to` by character key, a term that both formulas\r\n * write first: the `x^2` of `x^2 + 1` travels to the `x^2` of `y = x^2` as\r\n * one, instead of lending its `2` to whichever `2` comes first. What is left\r\n * is matched greedily by character alone.\r\n * Returns three lists: matched pairs, deleted tokens (only in from), added tokens (only in to).\r\n */\r\nfunction matchTokens(\r\n from: LatexToken[],\r\n to: LatexToken[],\r\n): {\r\n matched: Array<{ from: LatexToken; to: LatexToken }>;\r\n deleted: LatexToken[];\r\n added: LatexToken[];\r\n} {\r\n const remaining = [...to];\r\n const partner = new Map<LatexToken, LatexToken>();\r\n // Synthetic shapes (rects/paths) have no natural token key.\r\n const keyed = (t: LatexToken) => !t.token.startsWith(\"__\");\r\n const pair = (same: (f: LatexToken, t: LatexToken) => boolean) => {\r\n for (const ft of from) {\r\n if (!keyed(ft) || partner.has(ft)) continue;\r\n const idx = remaining.findIndex(t => keyed(t) && same(ft, t));\r\n if (idx === -1) continue;\r\n partner.set(ft, remaining[idx]);\r\n remaining.splice(idx, 1);\r\n }\r\n };\r\n pair((f, t) => f.token === t.token && f.term !== undefined && f.term === t.term);\r\n pair((f, t) => f.token === t.token);\r\n\r\n const matched: Array<{ from: LatexToken; to: LatexToken }> = [];\r\n const deleted: LatexToken[] = [];\r\n for (const ft of from) {\r\n const tt = partner.get(ft);\r\n if (tt) matched.push({ from: ft, to: tt });\r\n else deleted.push(ft);\r\n }\r\n\r\n return { matched, deleted, added: remaining };\r\n}\r\n\r\n/**\r\n * Precompute a formula-change morph and return a pure `t → AnimatedToken[]`\r\n * frame function:\r\n * - Deleted tokens fade out over the first half of `t`.\r\n * - Matched tokens are interpolated — place *and* size — across the full range\r\n * of `t`.\r\n * - Added tokens fade in over the second half of `t`.\r\n *\r\n * A matched glyph is rarely the same size at both ends: the `2` of `b^2` is set\r\n * at script size and the `2` of `2a` at full size, and a `\\frac`'s arguments\r\n * come back a step smaller than the same symbols on a baseline. So the\r\n * interpolation has to carry the glyph's *geometry*, not just where it sits.\r\n * Sliding the target outline from one centroid to the other — which is all this\r\n * used to do — put the whole size change between the last static frame and the\r\n * morph's first one: a snap to the new size, then a smooth glide to the new\r\n * place. Point-by-point lerping (see {@link lerpPath}) is that same\r\n * interpolation generalised from a glyph's average point to all of them, and it\r\n * costs nothing extra — the path was already being rebuilt every frame to apply\r\n * the slide.\r\n *\r\n * `t` is normalized `[0, 1]` and already eased — the caller (a `Command`'s\r\n * `at`) applies easing once, up front, the same eased value driving every\r\n * concurrent aspect of the morph (props, intrinsic size, tokens) in lockstep.\r\n */\r\nexport function prepareLatexTween(\r\n from: LatexToken[],\r\n to: LatexToken[],\r\n): (t: number) => AnimatedToken[] {\r\n const { matched, deleted, added } = matchTokens(from, to);\r\n\r\n // Per-match interpolation data. Structure compatibility, and the centroids\r\n // and extents behind the fallback, are properties of the pair rather than\r\n // of `t`, so they are settled once here instead of at every frame.\r\n const fromIndex = new Map(from.map((token, i) => [token, i]));\r\n const toIndex = new Map(to.map((token, i) => [token, i]));\r\n const matchedData = matched.map(({ from: f, to: t }) => {\r\n const toExtent = extent(t.path);\r\n return {\r\n from: fromIndex.get(f),\r\n to: toIndex.get(t),\r\n pointwise: isPointwiseCompatible(f.path, t.path),\r\n fromPath: f.path,\r\n toPath: t.path,\r\n token: t.token,\r\n fromCenter: centroid(f.path),\r\n toCenter: centroid(t.path),\r\n /** Only the fallback needs it, and only as a ratio. */\r\n fromScale: toExtent > 0 ? extent(f.path) / toExtent : 1,\r\n };\r\n });\r\n\r\n return (t: number): AnimatedToken[] => {\r\n const tokens: AnimatedToken[] = [];\r\n\r\n // Matched tokens: interpolate place and size across the full duration.\r\n for (const m of matchedData) {\r\n if (m.pointwise) {\r\n tokens.push({\r\n token: m.token,\r\n path: lerpPath(m.fromPath, m.toPath, t),\r\n opacity: 1,\r\n // Baked into the path above: the lerp carries every point,\r\n // which includes where the glyph sits.\r\n x: 0,\r\n y: 0,\r\n from: m.from,\r\n to: m.to,\r\n });\r\n continue;\r\n }\r\n\r\n const s = lerpNumber(m.fromScale, 1, t);\r\n const cx = lerpNumber(m.fromCenter.x, m.toCenter.x, t);\r\n const cy = lerpNumber(m.fromCenter.y, m.toCenter.y, t);\r\n tokens.push({\r\n token: m.token,\r\n path: scaleAbout(\r\n m.toPath,\r\n m.toCenter.x,\r\n m.toCenter.y,\r\n s,\r\n cx - m.toCenter.x,\r\n cy - m.toCenter.y,\r\n ),\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n from: m.from,\r\n to: m.to,\r\n });\r\n }\r\n\r\n // Deleted tokens: fade out over the first half, gone by t=0.5\r\n for (const d of deleted) {\r\n const fadeT = Math.min(t * 2, 1);\r\n tokens.push({\r\n token: d.token,\r\n path: d.path,\r\n opacity: lerpNumber(1, 0, fadeT),\r\n x: 0,\r\n y: 0,\r\n from: fromIndex.get(d),\r\n });\r\n }\r\n\r\n // Added tokens: fade in over the second half, starting at t=0.5\r\n for (const a of added) {\r\n const fadeT = Math.max(t * 2 - 1, 0);\r\n tokens.push({\r\n token: a.token,\r\n path: a.path,\r\n opacity: lerpNumber(0, 1, fadeT),\r\n x: 0,\r\n y: 0,\r\n to: toIndex.get(a),\r\n });\r\n }\r\n\r\n return tokens;\r\n };\r\n}\r\n\r\nexport { prepareLatexTween as defaultLatexMorph };\r\n"]}
@@ -0,0 +1,87 @@
1
+ import { Canvas3D, type AssetScope, type Canvas3DProps, type Color, type Command, type CommandArgs, type NodeConfig, type Scene3D } from "@motionscript/sdk";
2
+ import type { Interval } from "../kit/coords.js";
3
+ import { type GraphSpace } from "./space.js";
4
+ export interface Axes3dProps extends Canvas3DProps {
5
+ xRange?: Interval;
6
+ yRange?: Interval;
7
+ zRange?: Interval;
8
+ xLength?: number;
9
+ yLength?: number;
10
+ zLength?: number;
11
+ xStep?: number;
12
+ yStep?: number;
13
+ zStep?: number;
14
+ color?: Color;
15
+ thickness?: number;
16
+ tips?: boolean;
17
+ ticks?: boolean;
18
+ tickSize?: number;
19
+ grid?: boolean;
20
+ gridLineColor?: Color;
21
+ labels?: boolean;
22
+ labelSize?: number;
23
+ labelColor?: Color;
24
+ fontFamily?: string;
25
+ xLabel?: string;
26
+ yLabel?: string;
27
+ zLabel?: string;
28
+ }
29
+ /**
30
+ * A 3D graph: three axes through a box of graph coordinates, z up, seen through
31
+ * a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
32
+ * does. Its 3D children sit in its graph coordinates: a surface, a space curve,
33
+ * a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
34
+ */
35
+ export declare class Axes3d<P extends Axes3dProps = Axes3dProps> extends Canvas3D<P> {
36
+ xRange: Interval;
37
+ yRange: Interval;
38
+ zRange: Interval;
39
+ /** How long each axis is drawn, in scene units. */
40
+ xLength: number;
41
+ yLength: number;
42
+ zLength: number;
43
+ /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
44
+ xStep: number;
45
+ yStep: number;
46
+ zStep: number;
47
+ color: Color;
48
+ /** The radius of an axis line, in scene units. */
49
+ thickness: number;
50
+ tips: boolean;
51
+ ticks: boolean;
52
+ tickSize: number;
53
+ /** Lines across the plane the x and y axes lie in, at each of their ticks. */
54
+ grid: boolean;
55
+ /** (`gridColor` is the viewport's own reference grid.) */
56
+ gridLineColor: Color;
57
+ /** A number at each tick. */
58
+ labels: boolean;
59
+ /** The height of a label's text, in scene units. */
60
+ labelSize: number;
61
+ labelColor: Color;
62
+ fontFamily: string;
63
+ /** A title at the positive end of each axis. */
64
+ xLabel: string;
65
+ yLabel: string;
66
+ zLabel: string;
67
+ constructor(props?: NodeConfig<Axes3d<P>, P>);
68
+ /** Animate the window of values the axes show; everything drawn in them follows. */
69
+ rangeTo(args: CommandArgs<{
70
+ xRange?: Interval;
71
+ yRange?: Interval;
72
+ zRange?: Interval;
73
+ }> & {
74
+ duration: number;
75
+ }): Command<P>;
76
+ declareAssets(assets: AssetScope): void;
77
+ /** @internal */
78
+ _spaceOf(): GraphSpace;
79
+ /** @internal */
80
+ _graphSpace(): GraphSpace;
81
+ protected buildScene3D(): Scene3D;
82
+ private _space;
83
+ private _spaceKey;
84
+ /** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */
85
+ private _furniture;
86
+ }
87
+ //# sourceMappingURL=axes3d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAQR,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,OAAO,EAIf,M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