@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,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/systems/number-line.ts", "../../src/systems/number-plane.ts", "../../src/plots/points-plot.ts", "../../src/marks/plot-point.ts", "../../src/marks/vector-arrow.ts", "../../src/marks/curve-area.ts", "../../src/marks/riemann-sum.ts", "../../src/marks/tangent-line.ts", "../../src/marks/drop-lines.ts", "../../src/annotate/curly-brace.ts", "../../src/annotate/angle-mark.ts", "../../src/annotate/emphasis-mark.ts", "../../src/three/axes3d.ts", "../../src/three/surface-plot3d.ts", "../../src/three/curve-plot3d.ts", "../../src/three/plot-point3d.ts", "../../src/three/vector-arrow3d.ts", "../../src/systems/polar-plane.ts", "../../src/plots/vector-field.ts", "../../src/plots/stream-lines.ts", "../../src/plots/traced-path.ts", "../../src/structures/network-graph.ts", "../../src/structures/sample-space.ts", "../../src/nodes.ts"],
4
+ "sourcesContent": ["import {\r\n colorProperty,\r\n command,\r\n Graphics2D,\r\n node,\r\n property,\r\n strokeProperty,\r\n type AssetScope,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type Extents,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { cartesianMap, resolveInterval, type AxisScaling, type CoordinateMap, type Interval } from \"../kit/coords\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { CoordinateSystem } from \"../kit/system\";\r\nimport { formatTick, ticksFor } from \"../kit/ticks\";\r\nimport { along, AXIS_COLOR, drawLabels, drawn, lerpInterval, readInterval, withoutTips, type Label } from \"../kit/furniture\";\r\n\r\nexport interface NumberLineProps extends PaintProps {\r\n range?: Interval;\r\n step?: number;\r\n scaling?: AxisScaling;\r\n ticks?: boolean;\r\n tickSize?: number;\r\n longTicks?: number[];\r\n labels?: boolean;\r\n labelExclude?: number[];\r\n labelSide?: \"below\" | \"above\";\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/**\r\n * One axis with ticks and numbers. A child's `x` is a value on the line and its\r\n * `y` is pixels above it, so a dot or a label sits on a number.\r\n */\r\n@node({\r\n key: \"numberLine\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: true },\r\n seed: { width: 800, height: 120 },\r\n})\r\nexport class NumberLine extends CoordinateSystem<NumberLineProps> {\r\n @property({ default: [-5, 5], mapper: readInterval, tween: lerpInterval })\r\n declare range: Interval;\r\n\r\n /** The spacing of the ticks; zero picks a tidy one for the line's length. */\r\n @property({ default: 0, min: 0 }) declare step: number;\r\n @property({ default: \"linear\", options: [\"linear\", \"log\"], animatable: false }) declare scaling: AxisScaling;\r\n @property({ default: true, animatable: false }) declare ticks: boolean;\r\n @property({ default: 12, min: 0, unit: \"px\" }) declare tickSize: number;\r\n /** Values whose ticks are drawn twice as long. */\r\n @property({ default: [], animatable: false }) declare longTicks: number[];\r\n @property({ default: true, animatable: false }) declare labels: boolean;\r\n @property({ default: [], animatable: false }) declare labelExclude: number[];\r\n @property({ default: \"below\", options: [\"below\", \"above\"], animatable: false }) declare labelSide: \"below\" | \"above\";\r\n @property({ default: 18, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: AXIS_COLOR }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n @strokeProperty({ default: { weight: 2, fill: AXIS_COLOR, align: \"center\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<NumberLine, NumberLineProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Animate the span of values the line shows: a pan when both ends move alike, a zoom when they do not. */\r\n @command({ args: [\"range\"] })\r\n rangeTo(args: CommandArgs<{ range?: Interval }> & { duration: number }): Command<NumberLineProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n }\r\n\r\n protected mapFor(area: Extents): CoordinateMap {\r\n return cartesianMap({\r\n xRange: resolveInterval(this.range, this.scaling),\r\n yRange: [area.minY, area.maxY],\r\n area,\r\n xScaling: this.scaling,\r\n });\r\n }\r\n\r\n protected furniture(map: CoordinateMap): Graphics2D[] {\r\n const stroke = this.stroke as StrokeResolved[];\r\n const { start, end } = this;\r\n const [min, max] = map.xRange;\r\n const from = map.toPoint(min, 0);\r\n const to = map.toPoint(max, 0);\r\n const parts: Graphics2D[] = [];\r\n if (stroke.length > 0) parts.push(new Graphics2D().line({ points: [from, to], radius: 0, start, end }).stroke(stroke));\r\n\r\n const marks = ticksFor(map.xRange, this.step, to.x - from.x, this.scaling);\r\n const sign = this.labelSide === \"below\" ? -1 : 1;\r\n const tickMarks = new Graphics2D();\r\n const labels: Label[] = [];\r\n let ticked = false;\r\n for (const value of marks.values) {\r\n const at: Vector2 = map.toPoint(value, 0);\r\n if (!drawn(along(at, from, to), start, end)) continue;\r\n const half = this.longTicks.includes(value) ? this.tickSize : this.tickSize / 2;\r\n if (this.ticks && half > 0) {\r\n tickMarks.line({ points: [{ x: at.x, y: at.y - half }, { x: at.x, y: at.y + half }], radius: 0 });\r\n ticked = true;\r\n }\r\n if (this.labels && !this.labelExclude.includes(value)) {\r\n labels.push({\r\n text: formatTick(value, marks.step),\r\n at: { x: at.x, y: at.y + sign * (this.tickSize / 2 + this.labelSize * 0.9) },\r\n align: \"center\",\r\n });\r\n }\r\n }\r\n if (ticked && stroke.length > 0) parts.push(tickMarks.stroke(withoutTips(stroke)));\r\n parts.push(...drawLabels(labels, { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor }));\r\n return parts;\r\n }\r\n}\r\n", "import {\r\n command,\r\n Graphics2D,\r\n node,\r\n property,\r\n strokeProperty,\r\n type Command,\r\n type CommandArgs,\r\n type Extents,\r\n type NodeConfig,\r\n type Stroke,\r\n type StrokeResolved,\r\n} from \"@motionscript/sdk\";\r\nimport {\r\n isIdentityMatrix,\r\n lerpMatrix,\r\n lineThrough,\r\n readMatrix,\r\n transformedMap,\r\n warpedMap,\r\n type CoordinateMap,\r\n type Matrix2,\r\n type Warp,\r\n} from \"../kit/coords\";\r\nimport { fieldParams, parseField } from \"../kit/field\";\r\nimport { Axes2d, type Axes2dProps, type AxisLayout } from \"./axes2d\";\r\nimport { AXIS_COLOR } from \"../kit/furniture\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { lerpSource, readSource, type PlotSource } from \"../kit/source\";\r\n\r\nexport interface NumberPlaneProps extends Axes2dProps {\r\n grid?: boolean;\r\n gridStroke?: Stroke;\r\n minorStroke?: Stroke;\r\n minorDivisions?: number;\r\n matrix?: Matrix2 | readonly (readonly number[])[];\r\n warp?: string | PlotSource;\r\n ghost?: boolean;\r\n}\r\n\r\n/**\r\n * Axes over a full grid, with square units unless told otherwise: the plane\r\n * vectors and transformations are drawn on. Its `matrix` shears, turns or\r\n * squeezes the whole plane about its origin, and its `warp` bends it by a\r\n * function of its own points; the grid, the axes and everything on the plane\r\n * go with it.\r\n */\r\n@node({\r\n key: \"numberPlane\",\r\n parentKey: \"axes2d\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: true },\r\n seed: { width: 800, height: 500 },\r\n})\r\nexport class NumberPlane extends Axes2d<NumberPlaneProps> {\r\n @property({ default: true, animatable: false }) declare grid: boolean;\r\n /** The line at every tick. */\r\n @strokeProperty({ default: { weight: 1.5, fill: \"#3b4658\", align: \"center\" } }) declare gridStroke: Stroke;\r\n /** The lines between ticks. */\r\n @strokeProperty({ default: { weight: 1, fill: \"#232b38\", align: \"center\" } }) declare minorStroke: Stroke;\r\n /** How many parts the space between two ticks is cut into; one draws no line between them. */\r\n @property({ default: 2, min: 1, max: 10, step: 1 }) declare minorDivisions: number;\r\n\r\n /** A linear map of the plane, row by row: `[a, b, c, d]` sends `(x, y)` to `(ax + by, cx + dy)`. */\r\n @property({ default: [1, 0, 0, 1], mapper: readMatrix, tween: lerpMatrix }) declare matrix: Matrix2;\r\n /**\r\n * Where each point of the plane is sent, two parts in x and y:\r\n * `(x + sin(y), y + sin(x))`. Empty leaves the plane flat.\r\n */\r\n @property({ default: \"\", mapper: readSource, tween: lerpSource, kind: \"fieldEquation\" }) declare warp: PlotSource;\r\n /** Leave the plane as it was, faintly, behind one that has been transformed or warped. */\r\n @property({ default: true, animatable: false }) declare ghost: boolean;\r\n\r\n @property({ default: true, animatable: false }) declare squareUnits: boolean;\r\n @strokeProperty({ default: { weight: 2, fill: AXIS_COLOR, align: \"center\" } }) declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<NumberPlane, NumberPlaneProps>) {\r\n super((props ?? {}) as NodeConfig<Axes2d<NumberPlaneProps>, NumberPlaneProps>);\r\n // A transformed plane reaches past its box, and so does what is on it: both are kept in unless told otherwise.\r\n if (props?.clip === undefined) this.applyProp(\"clip\", () => this.coordinates.spills === true);\r\n }\r\n\r\n /** Send the plane through a matrix: a shear, a turn, a squeeze, a flip. */\r\n @command({ args: [\"matrix\"] })\r\n transformTo(args: CommandArgs<{ matrix: Matrix2 | readonly (readonly number[])[] }> & { duration: number }): Command<NumberPlaneProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Bend the plane, each point travelling to where the warp sends it; an empty one flattens it again. */\r\n @command({ args: [\"warp\"] })\r\n warpTo(args: CommandArgs<{ warp: string }> & { duration: number }): Command<NumberPlaneProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override mapFor(area: Extents): CoordinateMap {\r\n const flat = super.mapFor(area);\r\n this._flat = flat;\r\n const map = isIdentityMatrix(this.matrix) ? flat : transformedMap(flat, this.matrix);\r\n const { source, blend } = this.warp;\r\n const to = warpOf(source);\r\n if (!blend) return to ? warpedMap(map, to, source) : map;\r\n // Mid-warp each point is part of the way from where the old warp had it to where the new one sends it.\r\n const from = warpOf(blend.from);\r\n if (!from && !to) return map;\r\n const start = { x: 0, y: 0 };\r\n return warpedMap(\r\n map,\r\n (x, y, out) => {\r\n if (!(from ?? STAY)(x, y, start) || !(to ?? STAY)(x, y, out)) return false;\r\n out.x = start.x + (out.x - start.x) * blend.t;\r\n out.y = start.y + (out.y - start.y) * blend.t;\r\n return true;\r\n },\r\n `${blend.from}>${source}@${blend.t}`,\r\n );\r\n }\r\n\r\n protected override backdrop(map: CoordinateMap, x: AxisLayout, y: AxisLayout): Graphics2D[] {\r\n if (!this.grid) return [];\r\n const parts: Graphics2D[] = [];\r\n const flat = this._flat;\r\n if (this.ghost && flat && flat.revision !== map.revision) {\r\n const [gx, gy] = this.axes(flat);\r\n parts.push(...this._ruled(flat, gx, gy, true));\r\n }\r\n parts.push(...this._ruled(map, x, y, false));\r\n return parts;\r\n }\r\n\r\n private _flat: CoordinateMap | null = null;\r\n\r\n /** The grid of `map`: every line, or only the ones at a tick, in the fainter stroke, for a ghost. */\r\n private _ruled(map: CoordinateMap, x: AxisLayout, y: AxisLayout, ghost: boolean): Graphics2D[] {\r\n const { start, end } = this;\r\n const [xMin, xMax] = map.xRange;\r\n const [yMin, yMax] = map.yRange;\r\n const lines = (values: readonly number[], vertical: boolean): Graphics2D => {\r\n const g = new Graphics2D();\r\n for (const value of values) {\r\n g.line({\r\n points: vertical ? lineThrough(map, value, yMin, value, yMax) : lineThrough(map, xMin, value, xMax, value),\r\n radius: 0,\r\n start,\r\n end,\r\n });\r\n }\r\n return g;\r\n };\r\n const parts: Graphics2D[] = [];\r\n const minor = this.minorStroke as StrokeResolved[];\r\n if (ghost) {\r\n if (minor.length === 0) return parts;\r\n if (x.marks.values.length > 0) parts.push(lines(x.marks.values, true).stroke(minor));\r\n if (y.marks.values.length > 0) parts.push(lines(y.marks.values, false).stroke(minor));\r\n return parts;\r\n }\r\n const divisions = Math.round(this.minorDivisions);\r\n if (minor.length > 0 && divisions > 1) {\r\n const between = (axis: AxisLayout, [min, max]: readonly [number, number]): number[] => {\r\n const { step, values } = axis.marks;\r\n if (!(step > 0) || values.length === 0) return [];\r\n const out: number[] = [];\r\n for (let base = values[0] - step; base < max; base += step) {\r\n for (let i = 1; i < divisions; i++) {\r\n const value = base + (step * i) / divisions;\r\n if (value > min && value < max) out.push(value);\r\n }\r\n }\r\n return out;\r\n };\r\n const xs = between(x, map.xRange);\r\n const ys = between(y, map.yRange);\r\n if (xs.length > 0) parts.push(lines(xs, true).stroke(minor));\r\n if (ys.length > 0) parts.push(lines(ys, false).stroke(minor));\r\n }\r\n const major = this.gridStroke as StrokeResolved[];\r\n if (major.length > 0) {\r\n if (x.marks.values.length > 0) parts.push(lines(x.marks.values, true).stroke(major));\r\n if (y.marks.values.length > 0) parts.push(lines(y.marks.values, false).stroke(major));\r\n }\r\n return parts;\r\n }\r\n}\r\n\r\nconst STAY: Warp = (x, y, out) => {\r\n out.x = x;\r\n out.y = y;\r\n return true;\r\n};\r\n\r\n/** `source` as a warp, or `null` for text that is empty or not a field: the plane is then left as it is. */\r\nfunction warpOf(source: string): Warp | null {\r\n const field = source.trim() === \"\" ? null : parseField(source, fieldParams(source));\r\n if (!field || field instanceof Error) return null;\r\n const { x, y } = field;\r\n return (gx, gy, out) => {\r\n const wx = x(gx, gy);\r\n const wy = y(gx, gy);\r\n out.x = wx;\r\n out.y = wy;\r\n return Number.isFinite(wx) && Number.isFinite(wy);\r\n };\r\n}\r\n", "import {\r\n command,\r\n node,\r\n property,\r\n strokeProperty,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type PaintProps,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\n\r\nexport interface PointsPlotProps extends PaintProps {\r\n points?: Vector2[];\r\n closed?: boolean;\r\n smooth?: boolean;\r\n}\r\n\r\n// A shorter list is padded with its own last point, so a line grows new points out of its end.\r\nfunction lerpPoints(from: Vector2[], to: Vector2[], t: number): Vector2[] {\r\n const count = Math.max(from.length, to.length);\r\n if (from.length === 0 || to.length === 0) return t < 1 ? from : to;\r\n const out = new Array<Vector2>(count);\r\n for (let i = 0; i < count; i++) {\r\n const a = from[Math.min(i, from.length - 1)];\r\n const b = to[Math.min(i, to.length - 1)];\r\n out[i] = { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };\r\n }\r\n return out;\r\n}\r\n\r\n/** Points on the curve between each pair of a smooth line's points. */\r\nconst SMOOTH_STEPS = 16;\r\n\r\n/** A line through listed graph points: data, or a shape drawn in graph coordinates when closed, which is when it is filled. */\r\n@node({\r\n key: \"pointsPlot\",\r\n within: SYSTEMS,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { points: [{ x: -2, y: -1 }, { x: 0, y: 1 }, { x: 2, y: 0 }] },\r\n})\r\nexport class PointsPlot extends Mark<PointsPlotProps> {\r\n @property({ default: [], tween: lerpPoints }) declare points: Vector2[];\r\n /** Join the last point to the first. */\r\n @property({ default: false, animatable: false }) declare closed: boolean;\r\n /** Curve through the points instead of turning a corner at each. */\r\n @property({ default: false, animatable: false }) declare smooth: boolean;\r\n\r\n @strokeProperty({ default: { weight: 3, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<PointsPlot, PointsPlotProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Move the points to new places; extra ones grow from the line's end. */\r\n @command({ args: [\"points\"] })\r\n pointsTo(args: CommandArgs<{ points: Vector2[] }> & { duration: number }): Command<PointsPlotProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override isClosed(): boolean {\r\n return this.closed;\r\n }\r\n\r\n // An open line has no inside, so its fill waits until it is closed.\r\n protected override paintsFill(): boolean {\r\n return this.closed;\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const shift = this.shift();\r\n const pixels = this.points.map((p) => map.toPoint(p.x + shift.x, p.y + shift.y));\r\n if (pixels.length < 2) return [];\r\n return [this.smooth && pixels.length > 2 ? spline(pixels, this.closed) : pixels];\r\n }\r\n}\r\n\r\n// Catmull–Rom, so the curve passes through every point it was given.\r\nfunction spline(points: readonly Vector2[], closed: boolean): Vector2[] {\r\n const n = points.length;\r\n const at = (i: number): Vector2 => (closed ? points[((i % n) + n) % n] : points[Math.max(0, Math.min(n - 1, i))]);\r\n const out: Vector2[] = [];\r\n const spans = closed ? n : n - 1;\r\n for (let i = 0; i < spans; i++) {\r\n const p0 = at(i - 1), p1 = at(i), p2 = at(i + 1), p3 = at(i + 2);\r\n for (let s = 0; s < SMOOTH_STEPS; s++) {\r\n const t = s / SMOOTH_STEPS;\r\n const t2 = t * t;\r\n const t3 = t2 * t;\r\n out.push({\r\n x: 0.5 * (2 * p1.x + (p2.x - p0.x) * t + (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 + (3 * p1.x - p0.x - 3 * p2.x + p3.x) * t3),\r\n y: 0.5 * (2 * p1.y + (p2.y - p0.y) * t + (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 + (3 * p1.y - p0.y - 3 * p2.y + p3.y) * t3),\r\n });\r\n }\r\n }\r\n if (!closed) out.push(points[n - 1]);\r\n return out;\r\n}\r\n", "import {\r\n colorProperty,\r\n fillProperty,\r\n Graphics2D,\r\n node,\r\n PaintNode,\r\n property,\r\n withdraw,\r\n type AssetScope,\r\n type Color,\r\n type Fill,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type RenderContext2D,\r\n type Size2D,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { Anchored } from \"../kit/place\";\r\nimport { curveOf } from \"../kit/curve\";\r\nimport { declareFormulas, drawLabels, type Label } from \"../kit/furniture\";\r\nimport { SYSTEMS_AND_PLOT } from \"../kit/placement\";\r\nimport { OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport interface PlotPointProps extends PaintProps {\r\n on?: string;\r\n radius?: number;\r\n label?: string;\r\n labelSide?: \"above\" | \"below\" | \"left\" | \"right\";\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/**\r\n * A dot at graph coordinates, with an optional label. Named a plot in `on`, it\r\n * rides that curve: its `x` is where along it, and its height is the curve's.\r\n */\r\n@node({\r\n key: \"plotPoint\",\r\n within: SYSTEMS_AND_PLOT,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...OUTLINE_TRIM)\r\nexport class PlotPoint extends PaintNode<PlotPointProps> implements Anchored {\r\n /** The plot this point rides, by id; empty for a point that sits at its own `x`/`y`. */\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare on: string;\r\n @property({ default: 7, min: 0, unit: \"px\" }) declare radius: number;\r\n @property({ default: \"\", animatable: false }) declare label: string;\r\n @property({ default: \"above\", options: [\"above\", \"below\", \"left\", \"right\"], animatable: false })\r\n declare labelSide: \"above\" | \"below\" | \"left\" | \"right\";\r\n @property({ default: 18, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n @fillProperty({ default: \"#e5e7eb\" }) declare fill: Fill;\r\n\r\n constructor(props?: NodeConfig<PlotPoint, PlotPointProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** The graph height the point is at: the curve's when it rides one. */\r\n get value(): number {\r\n return this.anchorAt(this.x, this.y).y;\r\n }\r\n\r\n anchorAt(x: number, y: number): Vector2 {\r\n const height = curveOf(this, this.on)?.valueAt(x);\r\n // Off the end of its curve a point stays where its own `y` puts it rather than vanishing.\r\n return { x, y: height !== undefined && Number.isFinite(height) ? height : y };\r\n }\r\n\r\n override measure(): Partial<Size2D> {\r\n return { width: this.radius * 2, height: this.radius * 2 };\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.label !== \"\" && this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n declareFormulas(assets, [this.label]);\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D | null {\r\n const size = this.radius * 2;\r\n return size > 0 ? new Graphics2D().ellipse({ x: 0, y: 0, width: size, height: size }) : null;\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n super.renderSelf(ctx);\r\n if (this.label === \"\") return;\r\n const gap = this.radius + this.labelSize * 0.45;\r\n const side = this.labelSide;\r\n const horizontal = side === \"left\" || side === \"right\";\r\n const label: Label = {\r\n text: this.label,\r\n align: side === \"left\" ? \"right\" : side === \"right\" ? \"left\" : \"center\",\r\n at: {\r\n x: horizontal ? (side === \"left\" ? -1 : 1) * gap : 0,\r\n y: horizontal ? 0 : (side === \"below\" ? -1 : 1) * (gap + this.labelSize / 2),\r\n },\r\n };\r\n const style = { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor };\r\n for (const part of drawLabels([label], style)) ctx.draw(part);\r\n }\r\n}\r\n", "import {\r\n command,\r\n node,\r\n property,\r\n strokeProperty,\r\n vector2Property,\r\n withdraw,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type NodeHandle,\r\n type PaintProps,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\nimport { FILL_PAINT } from \"../kit/withdrawn\";\r\n\r\nexport interface VectorArrowProps extends PaintProps {\r\n tail?: Vector2;\r\n head?: Vector2;\r\n bend?: number;\r\n}\r\n\r\n/** Degrees of arc per drawn segment of a bent arrow. */\r\nconst BEND_STEP = 4;\r\n\r\n/**\r\n * An arrow from `tail` to `head`, two graph points. Its arrowhead is the stroke's\r\n * `endCap`, so a plain segment, a double arrow or a dashed one is a change of\r\n * stroke. (`from` and `to` are not its names because every node has a `to`.)\r\n */\r\n@node({\r\n key: \"vectorArrow\",\r\n within: SYSTEMS,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...FILL_PAINT)\r\nexport class VectorArrow extends Mark<VectorArrowProps> {\r\n @vector2Property() declare tail: Vector2;\r\n @vector2Property({ default: { x: 1, y: 1 } }) declare head: Vector2;\r\n /** The arc the arrow sweeps, in degrees: zero is straight, positive bows to its left. */\r\n @property({ default: 0, min: -180, max: 180, unit: \"°\" }) declare bend: number;\r\n\r\n @strokeProperty({ default: { weight: 4, fill: \"#e5e7eb\", align: \"center\", endCap: \"triangle\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<VectorArrow, VectorArrowProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Move either end, in graph coordinates. */\r\n @command({ args: [\"tail\", \"head\"] })\r\n endpointsTo(args: CommandArgs<{ tail?: Vector2; head?: Vector2 }> & { duration: number }): Command<VectorArrowProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const shift = this.shift();\r\n const a = map.toPoint(this.tail.x + shift.x, this.tail.y + shift.y);\r\n const b = map.toPoint(this.head.x + shift.x, this.head.y + shift.y);\r\n const sweep = (this.bend * Math.PI) / 180;\r\n const chord = Math.hypot(b.x - a.x, b.y - a.y);\r\n if (Math.abs(sweep) < 1e-3 || chord === 0) return [[a, b]];\r\n\r\n // The circle through both ends that subtends `sweep` at its centre.\r\n const radius = chord / (2 * Math.sin(Math.abs(sweep) / 2));\r\n const side = Math.sign(sweep);\r\n const reach = radius * Math.cos(sweep / 2);\r\n // The centre sits to the arrow's right for a positive sweep, so the arc bows to its left.\r\n const cx = (a.x + b.x) / 2 + (side * (b.y - a.y) * reach) / chord;\r\n const cy = (a.y + b.y) / 2 - (side * (b.x - a.x) * reach) / chord;\r\n const from = Math.atan2(a.y - cy, a.x - cx);\r\n const steps = Math.max(8, Math.ceil(Math.abs(this.bend) / BEND_STEP));\r\n const run: Vector2[] = [];\r\n for (let i = 0; i <= steps; i++) {\r\n const angle = from - (sweep * i) / steps;\r\n run.push({ x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) });\r\n }\r\n return [run];\r\n }\r\n\r\n override _handles(): readonly NodeHandle[] {\r\n return [\r\n { prop: \"tail\", at: this.ownPoint(this.tail) },\r\n { prop: \"head\", at: this.ownPoint(this.head) },\r\n ];\r\n }\r\n\r\n override _handleValue(prop: string, at: Vector2): Vector2 | null {\r\n return prop === \"tail\" || prop === \"head\" ? this.graphPoint(at) : null;\r\n }\r\n}\r\n", "import {\r\n command,\r\n fillProperty,\r\n node,\r\n property,\r\n withdraw,\r\n type Command,\r\n type CommandArgs,\r\n type Fill,\r\n type NodeConfig,\r\n type PaintProps,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap, Interval } from \"../kit/coords\";\r\nimport { clamp, stated } from \"../kit/geometry\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { curveNamed, curveOf } from \"../kit/curve\";\r\nimport { lerpInterval, PLOT_COLOR, readInterval } from \"../kit/furniture\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\nimport { OUTLINE_TRIM, STROKE_PAINT } from \"../kit/withdrawn\";\r\n\r\nexport interface CurveAreaProps extends PaintProps {\r\n on?: string;\r\n under?: string;\r\n domain?: Interval;\r\n}\r\n\r\n/**\r\n * The region between a plot and the x axis, or between two plots, over a span\r\n * of x. It sits beside the plots it reads rather than inside one: it may read\r\n * two, and it has a life of its own on the timeline, swept open or kept while\r\n * a curve changes.\r\n */\r\n@node({\r\n key: \"curveArea\",\r\n within: SYSTEMS,\r\n beside: [\"functionPlot\"],\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...STROKE_PAINT, ...OUTLINE_TRIM)\r\nexport class CurveArea extends Mark<CurveAreaProps> {\r\n /** The plot that bounds the area, by id. */\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare on: string;\r\n /** A second plot to fill down to, in place of the x axis. */\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare under: string;\r\n @property({ default: [0, 1], mapper: readInterval, tween: lerpInterval })\r\n declare domain: Interval;\r\n\r\n @fillProperty({ default: { type: \"solid\", color: PLOT_COLOR, opacity: 0.35 } }) declare fill: Fill;\r\n\r\n constructor(props?: NodeConfig<CurveArea, CurveAreaProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Animate the span of x that is filled: sweep an area open, or slide it along. */\r\n @command({ args: [\"domain\"] })\r\n domainTo(args: CommandArgs<{ domain: Interval }> & { duration: number }): Command<CurveAreaProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override isClosed(): boolean {\r\n return true;\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const top = curveOf(this, this.on);\r\n if (!top) return [];\r\n const floor = curveNamed(this, this.under);\r\n const [yMin, yMax] = map.yRange;\r\n const a = Math.max(this.domain[0], map.xRange[0]);\r\n const b = Math.min(this.domain[1], map.xRange[1]);\r\n if (!(b > a)) return [];\r\n\r\n const width = Math.abs(map.toPoint(b, 0).x - map.toPoint(a, 0).x);\r\n const steps = Math.max(8, Math.min(600, Math.round(width / 2)));\r\n // Held inside the system's range, and at the axis where a curve has no value.\r\n const height = (value: number) => (Number.isFinite(value) ? clamp(value, yMin, yMax) : clamp(0, yMin, yMax));\r\n const upper: Vector2[] = [];\r\n const lower: Vector2[] = [];\r\n for (let i = 0; i <= steps; i++) {\r\n const x = a + ((b - a) * i) / steps;\r\n upper.push(map.toPoint(x, height(top.valueAt(x))));\r\n lower.push(map.toPoint(x, height(floor ? floor.valueAt(x) : 0)));\r\n }\r\n return [[...upper, ...lower.reverse()]];\r\n }\r\n}\r\n", "import {\r\n command,\r\n fillProperty,\r\n node,\r\n property,\r\n strokeProperty,\r\n withdraw,\r\n type Command,\r\n type CommandArgs,\r\n type Fill,\r\n type NodeConfig,\r\n type PaintProps,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap, Interval } from \"../kit/coords\";\r\nimport { clamp, stated } from \"../kit/geometry\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { curveOf } from \"../kit/curve\";\r\nimport { lerpInterval, PLOT_COLOR, readInterval } from \"../kit/furniture\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\nimport { OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport type RiemannSample = \"left\" | \"right\" | \"center\";\r\n\r\nexport interface RiemannSumProps extends PaintProps {\r\n on?: string;\r\n domain?: Interval;\r\n dx?: number;\r\n sample?: RiemannSample;\r\n}\r\n\r\n/** More rectangles than this is a filled area with extra steps. */\r\nconst MAX_RECTANGLES = 2000;\r\n\r\n/** Rectangles under a plot, each `dx` wide and as tall as the curve where it is sampled. */\r\n@node({\r\n key: \"riemannSum\",\r\n within: SYSTEMS,\r\n beside: [\"functionPlot\"],\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...OUTLINE_TRIM)\r\nexport class RiemannSum extends Mark<RiemannSumProps> {\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare on: string;\r\n @property({ default: [0, 1], mapper: readInterval, tween: lerpInterval })\r\n declare domain: Interval;\r\n /** Each rectangle's width, in graph units. */\r\n @property({ default: 0.25, min: 0.001 }) declare dx: number;\r\n /** Where in its width a rectangle reads the curve's height. */\r\n @property({ default: \"left\", options: [\"left\", \"right\", \"center\"], animatable: false }) declare sample: RiemannSample;\r\n\r\n @fillProperty({ default: { type: \"solid\", color: PLOT_COLOR, opacity: 0.35 } }) declare fill: Fill;\r\n @strokeProperty({ default: { weight: 1.5, fill: PLOT_COLOR, align: \"center\", join: \"round\" } }) declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<RiemannSum, RiemannSumProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Animate the rectangles' width: narrower is the sum closing in on the area. */\r\n @command({ args: [\"dx\"] })\r\n refineTo(args: CommandArgs<{ dx: number }> & { duration: number }): Command<RiemannSumProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the span of x the rectangles cover. */\r\n @command({ args: [\"domain\"] })\r\n domainTo(args: CommandArgs<{ domain: Interval }> & { duration: number }): Command<RiemannSumProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override isClosed(): boolean {\r\n return true;\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const plot = curveOf(this, this.on);\r\n const [a, b] = this.domain;\r\n const dx = this.dx;\r\n if (!plot || !(b > a) || !(dx > 0)) return [];\r\n const [yMin, yMax] = map.yRange;\r\n const base = clamp(0, yMin, yMax);\r\n const at = this.sample === \"left\" ? 0 : this.sample === \"right\" ? 1 : 0.5;\r\n const count = Math.min(MAX_RECTANGLES, Math.ceil((b - a) / dx - 1e-9));\r\n const runs: Vector2[][] = [];\r\n for (let i = 0; i < count; i++) {\r\n const left = a + i * dx;\r\n const right = Math.min(b, left + dx);\r\n const value = plot.valueAt(left + (right - left) * at);\r\n if (!Number.isFinite(value)) continue;\r\n const height = clamp(value, yMin, yMax);\r\n runs.push([map.toPoint(left, base), map.toPoint(left, height), map.toPoint(right, height), map.toPoint(right, base)]);\r\n }\r\n return runs;\r\n }\r\n}\r\n", "import {\r\n node,\r\n property,\r\n strokeProperty,\r\n withdraw,\r\n type NodeConfig,\r\n type PaintProps,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { curveOf, type Curve } from \"../kit/curve\";\r\nimport { FILL_PAINT } from \"../kit/withdrawn\";\r\n\r\nexport interface TangentLineProps extends PaintProps {\r\n on?: string;\r\n length?: number;\r\n dx?: number;\r\n legs?: boolean;\r\n}\r\n\r\n/** The step a slope is measured over, as a share of the system's width. */\r\nconst SLOPE_STEP = 1e-4;\r\n\r\n/**\r\n * The tangent to a plot at this node's `x`, a fixed length on screen. With a\r\n * `dx` it is the secant through `x` and `x + dx` instead, and `legs` draws that\r\n * secant's run and rise.\r\n */\r\n@node({\r\n key: \"tangentLine\",\r\n within: [\"functionPlot\"],\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...FILL_PAINT)\r\nexport class TangentLine extends Mark<TangentLineProps> {\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare on: string;\r\n @property({ default: 260, min: 0, unit: \"px\" }) declare length: number;\r\n /** The second point's distance along x; zero is the tangent itself. */\r\n @property({ default: 0, min: 0 }) declare dx: number;\r\n @property({ default: false, animatable: false }) declare legs: boolean;\r\n\r\n @strokeProperty({ default: { weight: 3, fill: \"#f59e0b\", align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<TangentLine, TangentLineProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** The slope drawn, in graph units: the curve's at `x`, or the secant's when there is a `dx`. */\r\n get slope(): number {\r\n const plot = curveOf(this, this.on);\r\n if (!plot) return NaN;\r\n if (this.dx > 0) return (plot.valueAt(this.x + this.dx) - plot.valueAt(this.x)) / this.dx;\r\n return slopeAt(plot, this.x, 1e-6 * Math.max(1, Math.abs(this.x)));\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const plot = curveOf(this, this.on);\r\n if (!plot) return [];\r\n const x = this.x;\r\n const y = plot.valueAt(x);\r\n if (!Number.isFinite(y)) return [];\r\n const half = this.length / 2;\r\n\r\n if (this.dx > 0) {\r\n const y2 = plot.valueAt(x + this.dx);\r\n if (!Number.isFinite(y2)) return [];\r\n const a = map.toPoint(x, y);\r\n const b = map.toPoint(x + this.dx, y2);\r\n const span = Math.hypot(b.x - a.x, b.y - a.y);\r\n if (span === 0) return [];\r\n const reach = Math.max(half, span / 2 + 16);\r\n const ux = (b.x - a.x) / span;\r\n const uy = (b.y - a.y) / span;\r\n const mx = (a.x + b.x) / 2;\r\n const my = (a.y + b.y) / 2;\r\n const secant = [{ x: mx - ux * reach, y: my - uy * reach }, { x: mx + ux * reach, y: my + uy * reach }];\r\n return this.legs ? [secant, [a, map.toPoint(x + this.dx, y), b]] : [secant];\r\n }\r\n\r\n const [xMin, xMax] = map.xRange;\r\n const h = Number.isFinite(xMax - xMin) ? (xMax - xMin) * SLOPE_STEP : 1e-4;\r\n const before = plot.valueAt(x - h);\r\n const after = plot.valueAt(x + h);\r\n if (!Number.isFinite(before) || !Number.isFinite(after)) return [];\r\n const p = map.toPoint(x, y);\r\n const a = map.toPoint(x - h, before);\r\n const b = map.toPoint(x + h, after);\r\n const span = Math.hypot(b.x - a.x, b.y - a.y);\r\n if (span === 0) return [];\r\n const ux = (b.x - a.x) / span;\r\n const uy = (b.y - a.y) / span;\r\n return [[{ x: p.x - ux * half, y: p.y - uy * half }, { x: p.x + ux * half, y: p.y + uy * half }]];\r\n }\r\n}\r\n\r\nfunction slopeAt(plot: Curve, x: number, h: number): number {\r\n return (plot.valueAt(x + h) - plot.valueAt(x - h)) / (2 * h);\r\n}\r\n", "import {\r\n node,\r\n property,\r\n strokeProperty,\r\n withdraw,\r\n type NodeConfig,\r\n type PaintProps,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { clamp } from \"../kit/geometry\";\r\nimport { Mark } from \"../kit/mark\";\r\nimport { curveOf } from \"../kit/curve\";\r\nimport { AXIS_COLOR } from \"../kit/furniture\";\r\nimport { SYSTEMS_AND_PLOT } from \"../kit/placement\";\r\nimport { FILL_PAINT } from \"../kit/withdrawn\";\r\n\r\nexport type DropAxis = \"x\" | \"y\" | \"both\";\r\n\r\nexport interface DropLinesProps extends PaintProps {\r\n on?: string;\r\n axis?: DropAxis;\r\n}\r\n\r\n/**\r\n * Guide lines from a graph point to the axes, reading its coordinates off them.\r\n * The point is this node's `x`/`y`, or the point of a plot above its `x`.\r\n */\r\n@node({\r\n key: \"dropLines\",\r\n within: SYSTEMS_AND_PLOT,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...FILL_PAINT)\r\nexport class DropLines extends Mark<DropLinesProps> {\r\n /** A plot to take the point's height from, by id. */\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"functionPlot\"], animatable: false }) declare on: string;\r\n /** Which axis to drop to: `x` draws the vertical line, `y` the horizontal one. */\r\n @property({ default: \"both\", options: [\"x\", \"y\", \"both\"], animatable: false }) declare axis: DropAxis;\r\n\r\n @strokeProperty({ default: { weight: 2, fill: AXIS_COLOR, align: \"center\", dash: [8, 6] } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<DropLines, DropLinesProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n protected trace(map: CoordinateMap): Vector2[][] {\r\n const x = this.x;\r\n const plot = curveOf(this, this.on);\r\n const y = plot ? plot.valueAt(x) : this.y;\r\n if (!Number.isFinite(y)) return [];\r\n const at = map.toPoint(x, y);\r\n const runs: Vector2[][] = [];\r\n // Each line starts on its axis, so drawing it on grows it towards the point.\r\n if (this.axis !== \"y\") runs.push([map.toPoint(x, clamp(0, map.yRange[0], map.yRange[1])), at]);\r\n if (this.axis !== \"x\") runs.push([map.toPoint(clamp(0, map.xRange[0], map.xRange[1]), y), at]);\r\n return runs;\r\n }\r\n}\r\n", "import {\r\n colorProperty,\r\n node,\r\n property,\r\n strokeProperty,\r\n vector2Property,\r\n type AssetScope,\r\n type Color,\r\n type NodeConfig,\r\n type NodeHandle,\r\n type NormalizedColor,\r\n type PathCommand,\r\n type RenderContext2D,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { braceOutline } from \"../kit/brace\";\r\nimport { add, between, followed, FollowMark, heading, type FollowProps, type Quad } from \"../kit/follow\";\r\nimport { declareFormulas, drawLabels } from \"../kit/furniture\";\r\n\r\nexport type BraceSide = \"below\" | \"above\" | \"left\" | \"right\";\r\n\r\nexport interface CurlyBraceProps extends FollowProps {\r\n side?: BraceSide;\r\n tail?: Vector2;\r\n head?: Vector2;\r\n clearance?: number;\r\n reach?: number;\r\n label?: string;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/** The edge of a target a brace runs along, as two corner indexes of its quad, read with the brace's bulge to the left. */\r\nconst EDGE: Record<BraceSide, [number, number]> = {\r\n below: [2, 3],\r\n above: [0, 1],\r\n left: [3, 0],\r\n right: [1, 2],\r\n};\r\n\r\n/**\r\n * A curly brace along one side of a node or of a part of a formula, or between\r\n * two points when it names neither, with an optional label at its tip. A label\r\n * written between dollar signs is typeset.\r\n */\r\n@node({\r\n key: \"curlyBrace\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\nexport class CurlyBrace extends FollowMark<CurlyBraceProps> {\r\n @property({ default: \"below\", options: [\"below\", \"above\", \"left\", \"right\"], animatable: false }) declare side: BraceSide;\r\n /** The two ends of a brace that follows nothing, from the brace's own position. It bulges to the left of tail to head. */\r\n @vector2Property({ default: { x: -80, y: 0 } }) declare tail: Vector2;\r\n @vector2Property({ default: { x: 80, y: 0 } }) declare head: Vector2;\r\n /** The room between the target and the brace. (`gap` is a layout's.) */\r\n @property({ default: 8, min: 0, unit: \"px\" }) declare clearance: number;\r\n /** How far the brace reaches from its ends to its tip. (`depth` is a node's place in 3D.) */\r\n @property({ default: 18, min: 2, unit: \"px\" }) declare reach: number;\r\n\r\n @property({ default: \"\", animatable: false }) declare label: string;\r\n @property({ default: 28, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n @strokeProperty({ default: { weight: 3, fill: \"#e5e7eb\", align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<CurlyBrace, CurlyBraceProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.label !== \"\" && this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n declareFormulas(assets, [this.label]);\r\n }\r\n\r\n protected override quad(): Quad | null {\r\n // No target: the span itself, as an edge with nothing above it.\r\n return this._spans() ? [this.head, this.tail, this.tail, this.head] : super.quad();\r\n }\r\n\r\n /** Whether the brace follows nothing, and so spans its own two points. */\r\n private _spans(): boolean {\r\n return !this.retarget && followed(this, this.on) === null;\r\n }\r\n\r\n protected outline(quad: Quad): PathCommand[] {\r\n const { from, to, out } = this._span(quad);\r\n return braceOutline(from, to, out, this.reach);\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n super.renderSelf(ctx);\r\n if (this.label === \"\") return;\r\n const quad = this.quad();\r\n if (!quad) return;\r\n const { from, to, out } = this._span(quad);\r\n const reach = Math.min(this.reach, heading(from, to).length / 2) + this.labelSize * 0.75;\r\n const at = add(between(from, to), out, reach);\r\n const align = out.x > 0.5 ? \"left\" : out.x < -0.5 ? \"right\" : \"center\";\r\n const style = { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor };\r\n for (const part of drawLabels([{ text: this.label, at, align }], style)) ctx.draw(part);\r\n }\r\n\r\n /** The edge the brace runs along, pushed out by the gap, and the way it bulges. */\r\n private _span(quad: Quad): { from: Vector2; to: Vector2; out: Vector2 } {\r\n const [i, j] = this._spans() ? [1, 0] : EDGE[this.side];\r\n const { unit } = heading(quad[i], quad[j]);\r\n // Left of the edge's own direction, in a y-up frame.\r\n const out = { x: -unit.y, y: unit.x };\r\n return { from: add(quad[i], out, this.clearance), to: add(quad[j], out, this.clearance), out };\r\n }\r\n\r\n override _handles(): readonly NodeHandle[] {\r\n return this._spans() ? [{ prop: \"tail\", at: this.tail }, { prop: \"head\", at: this.head }] : [];\r\n }\r\n\r\n override _handleValue(prop: string, at: Vector2): Vector2 | null {\r\n return this._spans() && (prop === \"tail\" || prop === \"head\") ? { x: at.x, y: at.y } : null;\r\n }\r\n}\r\n", "import {\r\n colorProperty,\r\n command,\r\n Graphics2D,\r\n node,\r\n PaintNode,\r\n pathOps,\r\n property,\r\n strokeProperty,\r\n withdraw,\r\n type AssetScope,\r\n type BoxBounds,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type PathCommand,\r\n type RenderContext2D,\r\n type Size2D,\r\n type Stroke,\r\n} from \"@motionscript/sdk\";\r\nimport { declareFormulas, drawLabels } from \"../kit/furniture\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { FILL_PAINT } from \"../kit/withdrawn\";\r\n\r\nexport interface AngleMarkProps extends PaintProps {\r\n fromAngle?: number;\r\n toAngle?: number;\r\n radius?: number;\r\n corner?: \"arc\" | \"square\" | \"auto\";\r\n label?: string;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\nconst OWN_FRAME: [number, number, number, number] = [-1, -1, 1, 1];\r\n/** Degrees of arc per drawn segment. */\r\nconst ARC_STEP = 4;\r\n/** How close to a right angle `auto` draws the square. */\r\nconst RIGHT_SLOP = 0.5;\r\n\r\nconst point = (radius: number, degrees: number) => {\r\n const turn = (degrees * Math.PI) / 180;\r\n return { x: radius * Math.cos(turn), y: radius * Math.sin(turn) };\r\n};\r\n\r\n/**\r\n * The mark of an angle at the node's own position: an arc from one direction\r\n * to another, or the small square of a right angle, with an optional label.\r\n * Directions are degrees counter-clockwise from the right, so binding one to a\r\n * variable opens and closes the angle. A label of `°` shows the angle's size.\r\n */\r\n@node({\r\n key: \"angleMark\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\n@withdraw(...FILL_PAINT)\r\nexport class AngleMark extends PaintNode<AngleMarkProps> {\r\n @property({ default: 0, unit: \"°\" }) declare fromAngle: number;\r\n @property({ default: 60, unit: \"°\" }) declare toAngle: number;\r\n @property({ default: 48, min: 0, unit: \"px\" }) declare radius: number;\r\n /** `auto` draws the square where the angle is a right one. */\r\n @property({ default: \"auto\", options: [\"auto\", \"arc\", \"square\"], animatable: false }) declare corner: \"arc\" | \"square\" | \"auto\";\r\n\r\n /** Text, a formula between dollar signs, or `°` for the angle's own size. */\r\n @property({ default: \"\", animatable: false }) declare label: string;\r\n @property({ default: 24, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n @strokeProperty({ default: { weight: 3, fill: \"#e5e7eb\", align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<AngleMark, AngleMarkProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Grow or shrink the mark. */\r\n @command({ args: [\"radius\"] })\r\n radiusTo(args: CommandArgs<{ radius: number }> & { duration: number }): Command<AngleMarkProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** The angle marked, in degrees: positive counter-clockwise. */\r\n get value(): number {\r\n return this.toAngle - this.fromAngle;\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.label !== \"\" && this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n declareFormulas(assets, [this.label]);\r\n }\r\n\r\n override measure(): Partial<Size2D> {\r\n return { width: 0, height: 0 };\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D | null {\r\n const data = this._outline();\r\n return data.length === 0 ? null : new Graphics2D().path({ data, centerBounds: OWN_FRAME, start: this.start, end: this.end });\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n super.renderSelf(ctx);\r\n if (this.label === \"\" || this.radius <= 0) return;\r\n const text = this.label === \"°\" ? `${Math.round(Math.abs(this.value) * 10) / 10}°` : this.label;\r\n const at = point(this.radius + this.labelSize * 0.9, (this.fromAngle + this.toAngle) / 2);\r\n const style = { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor };\r\n for (const part of drawLabels([{ text, at, align: \"center\" }], style)) ctx.draw(part);\r\n }\r\n\r\n override _localBounds(): BoxBounds {\r\n const ink = pathOps.bounds(this._outline());\r\n if (!ink) return { x: 0, y: 0, width: 0, height: 0 };\r\n return { x: (ink.minX + ink.maxX) / 2, y: (ink.minY + ink.maxY) / 2, width: ink.maxX - ink.minX, height: ink.maxY - ink.minY };\r\n }\r\n\r\n private _outline(): PathCommand[] {\r\n const { fromAngle, toAngle, radius } = this;\r\n const sweep = toAngle - fromAngle;\r\n if (radius <= 0 || sweep === 0) return [];\r\n const square = this.corner === \"square\" || (this.corner === \"auto\" && Math.abs(Math.abs(sweep) - 90) < RIGHT_SLOP);\r\n if (square) {\r\n const side = radius * 0.6;\r\n const a = point(side, fromAngle);\r\n const b = point(side, toAngle);\r\n return [\r\n { type: \"M\", x: a.x, y: a.y },\r\n { type: \"L\", x: a.x + b.x, y: a.y + b.y },\r\n { type: \"L\", x: b.x, y: b.y },\r\n ];\r\n }\r\n const steps = Math.max(2, Math.ceil(Math.abs(sweep) / ARC_STEP));\r\n const out: PathCommand[] = [];\r\n for (let i = 0; i <= steps; i++) {\r\n const p = point(radius, fromAngle + (sweep * i) / steps);\r\n out.push({ type: i === 0 ? \"M\" : \"L\", x: p.x, y: p.y });\r\n }\r\n return out;\r\n }\r\n}\r\n", "import {\r\n node,\r\n property,\r\n strokeProperty,\r\n type NodeConfig,\r\n type PathCommand,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { add, between, FollowMark, grown, heading, type FollowProps, type Quad } from \"../kit/follow\";\r\n\r\nexport type EmphasisShape = \"box\" | \"circle\" | \"underline\" | \"cross\";\r\n\r\nexport interface EmphasisMarkProps extends FollowProps {\r\n shape?: EmphasisShape;\r\n clearance?: number;\r\n}\r\n\r\n/** How far a cubic's handle reaches to draw a quarter of an ellipse. */\r\nconst QUARTER = 0.5523;\r\n\r\nconst line = (a: Vector2, b: Vector2): PathCommand[] => [\r\n { type: \"M\", x: a.x, y: a.y },\r\n { type: \"L\", x: b.x, y: b.y },\r\n];\r\n\r\nconst SHAPES: Record<EmphasisShape, (quad: Quad, gap: number) => PathCommand[]> = {\r\n box: (quad, gap) => {\r\n const [tl, tr, br, bl] = grown(quad, gap);\r\n return [{ type: \"M\", x: tl.x, y: tl.y }, ...[tr, br, bl].map((p): PathCommand => ({ type: \"L\", x: p.x, y: p.y })), { type: \"Z\" }];\r\n },\r\n // The ellipse through the grown box's corners.\r\n circle: (quad, gap) => {\r\n const [tl, tr, br, bl] = grown(quad, gap);\r\n const centre = between(tl, br);\r\n const across = { x: ((tr.x - tl.x) / 2) * Math.SQRT2, y: ((tr.y - tl.y) / 2) * Math.SQRT2 };\r\n const up = { x: ((tl.x - bl.x) / 2) * Math.SQRT2, y: ((tl.y - bl.y) / 2) * Math.SQRT2 };\r\n const at = (a: number, u: number) => add(add(centre, across, a), up, u);\r\n const arc = (c1: Vector2, c2: Vector2, end: Vector2): PathCommand => ({\r\n type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y,\r\n });\r\n const k = QUARTER;\r\n const start = at(0, 1);\r\n return [\r\n { type: \"M\", x: start.x, y: start.y },\r\n arc(at(k, 1), at(1, k), at(1, 0)),\r\n arc(at(1, -k), at(k, -1), at(0, -1)),\r\n arc(at(-k, -1), at(-1, -k), at(-1, 0)),\r\n arc(at(-1, k), at(-k, 1), start),\r\n { type: \"Z\" },\r\n ];\r\n },\r\n underline: (quad, gap) => {\r\n const [, , br, bl] = quad;\r\n const down = heading(quad[0], bl).unit;\r\n return line(add(bl, down, gap), add(br, down, gap));\r\n },\r\n cross: (quad, gap) => {\r\n const [tl, tr, br, bl] = grown(quad, gap);\r\n return [...line(tl, br), ...line(bl, tr)];\r\n },\r\n};\r\n\r\n/**\r\n * A box, a circle, an underline or a cross drawn on a node, or on one part of\r\n * a formula. `progressTo` draws it on, and `retargetTo` slides it to another.\r\n */\r\n@node({\r\n key: \"emphasisMark\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n})\r\nexport class EmphasisMark extends FollowMark<EmphasisMarkProps> {\r\n @property({ default: \"box\", options: [\"box\", \"circle\", \"underline\", \"cross\"], animatable: false }) declare shape: EmphasisShape;\r\n /** The room between the target and the mark. (`gap` is a layout's.) */\r\n @property({ default: 10, unit: \"px\" }) declare clearance: number;\r\n\r\n @strokeProperty({ default: { weight: 3, fill: \"#facc15\", align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<EmphasisMark, EmphasisMarkProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n protected outline(quad: Quad): PathCommand[] {\r\n return SHAPES[this.shape](quad, this.clearance);\r\n }\r\n}\r\n", "import {\r\n Canvas3D,\r\n colorProperty,\r\n command,\r\n Geo,\r\n Graphics3D,\r\n Mat,\r\n node,\r\n property,\r\n type AssetScope,\r\n type Canvas3DProps,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Scene3D,\r\n type Transform3D,\r\n type Vector3,\r\n type Vector3Input,\r\n} from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\nimport { AXIS_COLOR, lerpInterval, readInterval } from \"../kit/furniture\";\r\nimport { clamp, stated } from \"../kit/geometry\";\r\nimport { formatTick, ticksFor } from \"../kit/ticks\";\r\nimport { drawLabel3D, type LabelStyle3D } from \"./label3d\";\r\nimport { graphSpace, type GraphSpace } from \"./space\";\r\n\r\nexport interface Axes3dProps extends Canvas3DProps {\r\n xRange?: Interval;\r\n yRange?: Interval;\r\n zRange?: Interval;\r\n xLength?: number;\r\n yLength?: number;\r\n zLength?: number;\r\n xStep?: number;\r\n yStep?: number;\r\n zStep?: number;\r\n color?: Color;\r\n thickness?: number;\r\n tips?: boolean;\r\n ticks?: boolean;\r\n tickSize?: number;\r\n grid?: boolean;\r\n gridLineColor?: Color;\r\n labels?: boolean;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n xLabel?: string;\r\n yLabel?: string;\r\n zLabel?: string;\r\n}\r\n\r\n/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */\r\nconst UNIT_AS_PIXELS = 64;\r\n\r\ntype AxisName = \"x\" | \"y\" | \"z\";\r\n\r\n/** The turn that lays a shape built along the scene's +y along each graph axis. */\r\nconst ALONG: Record<AxisName, Vector3Input> = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };\r\n\r\n/** The graph axis each axis's tick marks lie along. */\r\nconst TICK_ALONG: Record<AxisName, AxisName> = { x: \"y\", y: \"x\", z: \"y\" };\r\n\r\n/**\r\n * A 3D graph: three axes through a box of graph coordinates, z up, seen through\r\n * a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`\r\n * does. Its 3D children sit in its graph coordinates: a surface, a space curve,\r\n * a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.\r\n */\r\n@node({\r\n key: \"axes3d\",\r\n parentKey: \"canvas3d\",\r\n forkable: true,\r\n layout: { defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: true },\r\n seed: { width: 800, height: 500 },\r\n})\r\nexport class Axes3d<P extends Axes3dProps = Axes3dProps> extends Canvas3D<P> {\r\n @property({ default: [-3, 3], mapper: readInterval, tween: lerpInterval }) declare xRange: Interval;\r\n @property({ default: [-3, 3], mapper: readInterval, tween: lerpInterval }) declare yRange: Interval;\r\n @property({ default: [-2, 2], mapper: readInterval, tween: lerpInterval }) declare zRange: Interval;\r\n\r\n /** How long each axis is drawn, in scene units. */\r\n @property({ default: 6, min: 0.01, step: 0.1 }) declare xLength: number;\r\n @property({ default: 6, min: 0.01, step: 0.1 }) declare yLength: number;\r\n @property({ default: 4, min: 0.01, step: 0.1 }) declare zLength: number;\r\n\r\n /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */\r\n @property({ default: 0, min: 0 }) declare xStep: number;\r\n @property({ default: 0, min: 0 }) declare yStep: number;\r\n @property({ default: 0, min: 0 }) declare zStep: number;\r\n\r\n @colorProperty({ default: AXIS_COLOR }) declare color: Color;\r\n /** The radius of an axis line, in scene units. */\r\n @property({ default: 0.02, min: 0, step: 0.005 }) declare thickness: number;\r\n @property({ default: true, animatable: false }) declare tips: boolean;\r\n @property({ default: true, animatable: false }) declare ticks: boolean;\r\n @property({ default: 0.16, min: 0, step: 0.01 }) declare tickSize: number;\r\n\r\n /** Lines across the plane the x and y axes lie in, at each of their ticks. */\r\n @property({ default: false, animatable: false }) declare grid: boolean;\r\n /** (`gridColor` is the viewport's own reference grid.) */\r\n @colorProperty({ default: \"#374151\" }) declare gridLineColor: Color;\r\n\r\n /** A number at each tick. */\r\n @property({ default: false, animatable: false }) declare labels: boolean;\r\n /** The height of a label's text, in scene units. */\r\n @property({ default: 0.26, min: 0.01, step: 0.01 }) declare labelSize: number;\r\n @colorProperty({ default: AXIS_COLOR }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n /** A title at the positive end of each axis. */\r\n @property({ default: \"x\", animatable: false }) declare xLabel: string;\r\n @property({ default: \"y\", animatable: false }) declare yLabel: string;\r\n @property({ default: \"z\", animatable: false }) declare zLabel: string;\r\n\r\n constructor(props?: NodeConfig<Axes3d<P>, P>) {\r\n super((props ?? {}) as NodeConfig<Canvas3D<P>, P>);\r\n }\r\n\r\n /** Animate the window of values the axes show; everything drawn in them follows. */\r\n @command({ args: [\"xRange\", \"yRange\", \"zRange\"] })\r\n rangeTo(args: CommandArgs<{ xRange?: Interval; yRange?: Interval; zRange?: Interval }> & { duration: number }): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n }\r\n\r\n /** @internal */\r\n override _spaceOf(): GraphSpace {\r\n return this._graphSpace();\r\n }\r\n\r\n /** @internal */\r\n _graphSpace(): GraphSpace {\r\n const { xRange, yRange, zRange, xLength, yLength, zLength } = this;\r\n const key = [xRange, yRange, zRange, xLength, yLength, zLength].join(\"|\");\r\n if (key !== this._spaceKey) {\r\n this._space = graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength });\r\n this._spaceKey = key;\r\n }\r\n return this._space!;\r\n }\r\n\r\n protected override buildScene3D(): Scene3D {\r\n const scene = super.buildScene3D();\r\n scene.draw(this._furniture());\r\n return scene;\r\n }\r\n\r\n private _space: GraphSpace | null = null;\r\n private _spaceKey = \"\";\r\n\r\n /** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */\r\n private _furniture(): Graphics3D {\r\n const space = this._graphSpace();\r\n const g3 = new Graphics3D();\r\n const ranges: Record<AxisName, Interval> = { x: space.xRange, y: space.yRange, z: space.zRange };\r\n const lengths: Record<AxisName, number> = { x: this.xLength, y: this.yLength, z: this.zLength };\r\n const steps: Record<AxisName, number> = { x: this.xStep, y: this.yStep, z: this.zStep };\r\n const titles: Record<AxisName, string> = { x: this.xLabel, y: this.yLabel, z: this.zLabel };\r\n // Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.\r\n const cross: Record<AxisName, number> = {\r\n x: clamp(0, ranges.x[0], ranges.x[1]),\r\n y: clamp(0, ranges.y[0], ranges.y[1]),\r\n z: clamp(0, ranges.z[0], ranges.z[1]),\r\n };\r\n const at = (axis: AxisName, value: number, shift: Partial<Record<AxisName, number>> = {}): Vector3 => {\r\n const point = { ...cross, [axis]: value };\r\n const local = space.toLocal(point.x, point.y, point.z);\r\n const moved = space.offset(0, 0, 0);\r\n for (const key of [\"x\", \"y\", \"z\"] as const) {\r\n const by = shift[key];\r\n if (by === undefined) continue;\r\n // A shift is in scene units, along the graph axis it names.\r\n if (key === \"x\") moved.z += by;\r\n else if (key === \"y\") moved.x += by;\r\n else moved.y += by;\r\n }\r\n return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };\r\n };\r\n\r\n const { thickness, tickSize } = this;\r\n const paint = Mat.basic({ color: this.color });\r\n const style: LabelStyle3D = { size: this.labelSize, color: this.labelColor, fontFamily: this.fontFamily };\r\n const tipLength = this.tips ? thickness * 9 : 0;\r\n const marks: Transform3D[] = [];\r\n const plane: Vector3[] = [];\r\n\r\n for (const axis of [\"x\", \"y\", \"z\"] as const) {\r\n const [min, max] = ranges[axis];\r\n const length = lengths[axis];\r\n if (!(max > min) || !(length > 0)) continue;\r\n\r\n if (thickness > 0) {\r\n const from = at(axis, min);\r\n const to = at(axis, max);\r\n g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {\r\n position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },\r\n rotation: ALONG[axis],\r\n });\r\n if (this.tips) {\r\n g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {\r\n position: at(axis, max, { [axis]: tipLength / 2 }),\r\n rotation: ALONG[axis],\r\n });\r\n }\r\n }\r\n\r\n const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);\r\n const side = TICK_ALONG[axis];\r\n for (const value of ticks.values) {\r\n // The crossing is marked by the other axes, and the far end by the tip.\r\n if (Math.abs(value - cross[axis]) < 1e-9 || (this.tips && Math.abs(value - max) < 1e-9)) continue;\r\n if (this.ticks && tickSize > 0) marks.push({ position: at(axis, value), rotation: ALONG[side] });\r\n if (this.labels) {\r\n drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);\r\n }\r\n }\r\n drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);\r\n\r\n if (this.grid && axis !== \"z\") {\r\n const other = axis === \"x\" ? \"y\" : \"x\";\r\n for (const value of ticks.values) {\r\n const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };\r\n const b = { ...a, [other]: ranges[other][1] };\r\n plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));\r\n }\r\n }\r\n }\r\n\r\n if (marks.length > 0) {\r\n g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);\r\n }\r\n if (plane.length > 0) g3.line({ points: plane, segments: true, stroke: { fill: this.gridLineColor } });\r\n return g3;\r\n }\r\n}\r\n", "import {\n colorOps,\n command,\n Geo,\n Graphics3D,\n Mat,\n Mesh3D,\n node,\n property,\n type ChildSpace3D,\n type Color,\n type Command,\n type CommandArgs,\n type Geometry3D,\n type Material3D,\n type MaterialShorthand3D,\n type Mesh3DProps,\n type NodeConfig,\n type NormalizedColor,\n type Vector3,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { parseSurface, surfaceParams, type SurfaceEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp, stated } from \"../kit/geometry\";\nimport { colorAt, lerpScale, readScale } from \"../kit/scale\";\nimport { lerpDomain, lerpParams, lerpSource, readSource, revisionOf, scopeFor, type PlotSource } from \"../kit/source\";\nimport { spaceOf, type GraphSpace } from \"./space\";\n\nexport interface SurfacePlot3dProps extends Mesh3DProps {\n expression?: string | PlotSource;\n uDomain?: Interval | null;\n vDomain?: Interval | null;\n params?: ExpressionScope;\n segments?: number;\n colorScale?: Color[];\n meshLines?: number;\n meshColor?: Color;\n floorShadow?: number;\n}\n\n/** A graph point for grid coordinate `(u, v)`, both 0 to 1, written into `out`. */\ntype SurfaceSampler = (u: number, v: number, out: Vector3) => void;\n\n/**\n * A surface in a 3D graph: a height over x and y (`sin(x) * cos(y)`), or three\n * parts in u and v. A point put inside it rides it.\n */\n@node({\n key: \"surfacePlot3d\",\n within: [\"axes3d\"],\n closed: true,\n forkable: true,\n layout: { acceptsChildren: true },\n seed: { expression: \"sin(x) * cos(y)\", fill: PLOT_COLOR },\n})\nexport class SurfacePlot3d extends Mesh3D<SurfacePlot3dProps> {\n @property({ default: \"\", mapper: readSource, tween: lerpSource, kind: \"surfaceEquation\" })\n declare expression: PlotSource;\n\n /**\n * The span of each variable that is drawn: x and y for a height, which run\n * the width of the axes when left out, u and v for a parametric surface,\n * which run from 0 to 1.\n */\n @property({ default: null, tween: lerpDomain, kind: \"range\", defaultMin: -3, defaultMax: 3 }) declare uDomain: Interval | null;\n @property({ default: null, tween: lerpDomain, kind: \"range\", defaultMin: -3, defaultMax: 3 }) declare vDomain: Interval | null;\n\n /** The equation's named values: any name in it that is not a variable, a function or a constant. */\n @property({ default: {}, tween: lerpParams }) declare params: ExpressionScope;\n\n /** How finely the surface is sampled, each way. */\n @property({ default: 48, min: 2, max: 256, step: 1, animatable: false }) declare segments: number;\n\n /** Colours by height, lowest first, over the axes' z range. Empty paints the surface in its fill. */\n @property({ default: [], mapper: readScale, tween: lerpScale, kind: \"vector\" }) declare colorScale: Color[];\n\n /** How many lines are drawn across the surface each way; zero leaves it bare. */\n @property({ default: 12, min: 0, max: 64, step: 1, animatable: false }) declare meshLines: number;\n @property({ default: \"#0b1220\", kind: \"color\" }) declare meshColor: Color;\n\n /** The opacity of the surface's shadow, laid flat on the floor of the axes and coloured by height; zero draws none. */\n @property({ default: 0, min: 0, max: 1, step: 0.01 }) declare floorShadow: number;\n\n constructor(props?: NodeConfig<SurfacePlot3d, SurfacePlot3dProps>) {\n super(props ?? {});\n if (props?.fill === undefined) this.applyProp(\"fill\", PLOT_COLOR);\n }\n\n /** Change the equation, the surface bending from the one into the other. */\n @command({ args: [\"expression\"] })\n morphTo(args: CommandArgs<{ expression: string }> & { duration: number }): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /** Animate the equation's named values. */\n @command({ args: [\"params\"] })\n paramsTo(args: CommandArgs<{ params: ExpressionScope }> & { duration: number }): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /** Animate the spans that are drawn. */\n @command({ args: [\"uDomain\", \"vDomain\"] })\n domainTo(\n args: CommandArgs<{ uDomain?: Interval | null; vDomain?: Interval | null }> & { duration: number },\n ): Command<SurfacePlot3dProps> {\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\n }\n\n /**\n * The surface's height above its own origin at graph `(x, y)`, or `NaN`\n * where it has none or is not a height. What a point riding it reads.\n */\n valueAt(x: number, y: number): number {\n const { source, blend } = this.expression;\n const value = this._heightOf(source, x, y);\n if (!blend) return value;\n const from = this._heightOf(blend.from, x, y);\n return from + (value - from) * blend.t;\n }\n\n /** @internal */\n override _spaceOf(): ChildSpace3D | null {\n const space = spaceOf(this);\n if (!space) return null;\n return {\n toLocal: (x, y, z) => {\n const height = this.valueAt(x, y);\n return space.offset(x, y, Number.isFinite(height) ? height : z);\n },\n };\n }\n\n protected override buildGeometry(): Geometry3D | undefined {\n const space = spaceOf(this);\n const sample = space && this._sampler(space);\n if (!space || !sample) return undefined;\n const scale = this.colorScale as unknown as NormalizedColor[];\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const low = space.offset(0, 0, space.zRange[0] - this.z).y;\n const high = space.offset(0, 0, space.zRange[1] - this.z).y;\n return Geo.parametric({\n segments: Math.max(2, Math.round(this.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n },\n ...(scale.length > 0\n ? { color: (_u, _v, position) => colorAt(scale, high > low ? (position.y - low) / (high - low) : 0) }\n : {}),\n computeNormals: true,\n revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}`),\n });\n }\n\n protected override materialShorthand(): MaterialShorthand3D {\n const own = super.materialShorthand();\n const scaled = (this.colorScale as unknown as NormalizedColor[]).length > 0;\n // A surface is seen from both sides; a vertex colour multiplies the fill, so a scale is shown on white.\n return { faces: \"both\", ...own, ...(scaled ? { vertexColors: true, fill: \"white\" } : {}) };\n }\n\n protected override buildGraphics3D(): Graphics3D {\n const g3 = new Graphics3D();\n const space = spaceOf(this);\n const lines = space ? this._meshLines(space) : [];\n for (const op of super.buildGraphics3D().ops()) {\n if (op.kind !== \"mesh\") continue;\n g3.mesh(op.geometry, mapMaterials(op.material, (material) => ({\n ...material,\n // Pushed back a hair so the lines drawn on it are not fought for, and blended rather than a hole when faded.\n ...(lines.length > 0 ? { polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1 } : {}),\n ...((this.opacity ?? 1) < 1 ? { depthWrite: false } : {}),\n } as Material3D)), op.transform);\n }\n if (lines.length > 0) {\n const color = colorOps.resolve(this.meshColor);\n g3.line({ points: lines, segments: true, stroke: { fill: color }, opacity: color[3] * (this.opacity ?? 1) });\n }\n const shadow = space && this.floorShadow > 0 ? this._floorShadow(space) : undefined;\n if (shadow) {\n const scaled = (this.colorScale as unknown as NormalizedColor[]).length > 0;\n g3.mesh(shadow, Mat.basic({\n color: scaled ? \"white\" : PLOT_COLOR,\n vertexColors: scaled,\n opacity: this.floorShadow * (this.opacity ?? 1),\n transparent: true,\n // Translucent and under everything: writing depth would hide the floor's grid lines behind it.\n depthWrite: false,\n faces: \"both\",\n }));\n }\n return g3;\n }\n\n private _linesKey = \"\";\n private _lines: Vector3[] = [];\n\n private _heightOf(source: string, x: number, y: number): number {\n const equation = equationOf(source);\n if (equation?.kind !== \"height\") return NaN;\n return equation.f(x, y, scopeFor(surfaceParams(source), this.params));\n }\n\n private _key(space: GraphSpace): string {\n const { source, blend } = this.expression;\n return [source, blend?.from, blend?.t, space.revision, this.uDomain, this.vDomain, JSON.stringify(this.params), this.x, this.y, this.z].join(\"|\");\n }\n\n private _sampler(space: GraphSpace): SurfaceSampler | null {\n const { source, blend } = this.expression;\n const to = this._surface(source, space);\n if (!to || !blend) return to;\n const from = this._surface(blend.from, space);\n if (!from) return to;\n const start: Vector3 = { x: 0, y: 0, z: 0 };\n return (u, v, out) => {\n from(u, v, start);\n to(u, v, out);\n out.x = start.x + (out.x - start.x) * blend.t;\n out.y = start.y + (out.y - start.y) * blend.t;\n out.z = start.z + (out.z - start.z) * blend.t;\n };\n }\n\n /** `source` as graph points, measured from this node's own position. */\n private _surface(source: string, space: GraphSpace): SurfaceSampler | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(surfaceParams(source), this.params);\n if (equation.kind === \"parametric\") {\n const [u0, u1] = this.uDomain ?? [0, 1];\n const [v0, v1] = this.vDomain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, v, out) => {\n const a = u0 + (u1 - u0) * u;\n const b = v0 + (v1 - v0) * v;\n out.x = finite(x(a, b, params));\n out.y = finite(y(a, b, params));\n out.z = finite(z(a, b, params));\n };\n }\n const [x0, x1] = this.uDomain ?? [space.xRange[0] - this.x, space.xRange[1] - this.x];\n const [y0, y1] = this.vDomain ?? [space.yRange[0] - this.y, space.yRange[1] - this.y];\n // Held inside the axes: a pole would otherwise stretch one triangle across the scene.\n const low = space.zRange[0] - this.z;\n const high = space.zRange[1] - this.z;\n const { f } = equation;\n return (u, v, out) => {\n out.x = x0 + (x1 - x0) * u;\n out.y = y0 + (y1 - y0) * v;\n out.z = clamp(finite(f(out.x, out.y, params)), low, high);\n };\n }\n\n private _floorShadow(space: GraphSpace): Geometry3D | undefined {\n const sample = this._sampler(space);\n if (!sample) return undefined;\n const scale = this.colorScale as unknown as NormalizedColor[];\n const [low, high] = space.zRange;\n const floor = low - this.z;\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n return Geo.parametric({\n segments: Math.max(2, Math.round(this.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, floor);\n },\n ...(scale.length > 0\n ? {\n color: (u: number, v: number) => {\n sample(u, v, point);\n return colorAt(scale, high > low ? (point.z + this.z - low) / (high - low) : 0);\n },\n }\n : {}),\n revision: revisionOf(`${this._key(space)}|${JSON.stringify(scale)}|floor`),\n });\n }\n\n private _meshLines(space: GraphSpace): Vector3[] {\n const count = Math.round(this.meshLines);\n const sample = count > 0 ? this._sampler(space) : null;\n if (!sample) return [];\n const steps = Math.max(2, Math.round(this.segments));\n const key = `${this._key(space)}|${count}|${steps}`;\n if (key === this._linesKey) return this._lines;\n const lines: Vector3[] = [];\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const at = (u: number, v: number): Vector3 => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n };\n for (let i = 0; i <= count; i++) {\n const fixed = i / count;\n for (let j = 0; j < steps; j++) {\n lines.push(at(fixed, j / steps), at(fixed, (j + 1) / steps));\n lines.push(at(j / steps, fixed), at((j + 1) / steps, fixed));\n }\n }\n this._lines = lines;\n this._linesKey = key;\n return lines;\n }\n}\n\nfunction equationOf(source: string): SurfaceEquation | null {\n const equation = parseSurface(source, surfaceParams(source));\n return equation instanceof Error ? null : equation;\n}\n\n// A hole in the data is drawn flat rather than as a hole in the mesh.\nfunction finite(value: number): number {\n return Number.isFinite(value) ? value : 0;\n}\n\nfunction mapMaterials(\n material: Material3D | readonly Material3D[],\n change: (material: Material3D) => Material3D,\n): Material3D | readonly Material3D[] {\n return Array.isArray(material) ? (material as readonly Material3D[]).map(change) : change(material as Material3D);\n}\n", "import {\r\n command,\r\n Geo,\r\n Mesh3D,\r\n node,\r\n property,\r\n type Command,\r\n type CommandArgs,\r\n type Geometry3D,\r\n type Mesh3DProps,\r\n type NodeConfig,\r\n type Vector3,\r\n} from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\nimport { parseSpaceCurve, spaceCurveParams, type SpaceCurveEquation } from \"../kit/equation3d\";\r\nimport type { ExpressionScope } from \"../kit/expression\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { clamp, stated } from \"../kit/geometry\";\r\nimport { lerpDomain, lerpParams, lerpSource, readSource, scopeFor, type PlotSource } from \"../kit/source\";\r\nimport { spaceOf, type GraphSpace } from \"./space\";\r\n\r\nexport interface CurvePlot3dProps extends Mesh3DProps {\r\n expression?: string | PlotSource;\r\n domain?: Interval | null;\r\n params?: ExpressionScope;\r\n samples?: number;\r\n thickness?: number;\r\n start?: number;\r\n end?: number;\r\n}\r\n\r\n/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */\r\n@node({\r\n key: \"curvePlot3d\",\r\n within: [\"axes3d\"],\r\n forkable: true,\r\n layout: { acceptsChildren: false },\r\n seed: { expression: \"(2cos(t), 2sin(t), t / 4)\", domain: [-6.28, 6.28], fill: PLOT_COLOR },\r\n})\r\nexport class CurvePlot3d extends Mesh3D<CurvePlot3dProps> {\r\n @property({ default: \"\", mapper: readSource, tween: lerpSource, kind: \"spaceCurveEquation\" })\r\n declare expression: PlotSource;\r\n\r\n /** The span of `t` that is drawn; 0 to 1 when left out. */\r\n @property({ default: null, tween: lerpDomain, kind: \"range\", defaultMin: 0, defaultMax: 1 }) declare domain: Interval | null;\r\n\r\n @property({ default: {}, tween: lerpParams }) declare params: ExpressionScope;\r\n\r\n /** How many points the curve is drawn through. */\r\n @property({ default: 160, min: 2, max: 2000, step: 1, animatable: false }) declare samples: number;\r\n /** The radius of the line, in scene units. */\r\n @property({ default: 0.04, min: 0.001, step: 0.005 }) declare thickness: number;\r\n\r\n /** The part of the curve that is drawn, as shares of its length in `t`. */\r\n @property({ default: 0, min: 0, max: 1, step: 0.01 }) declare start: number;\r\n @property({ default: 1, min: 0, max: 1, step: 0.01 }) declare end: number;\r\n\r\n constructor(props?: NodeConfig<CurvePlot3d, CurvePlot3dProps>) {\r\n super(props ?? {});\r\n if (props?.fill === undefined) this.applyProp(\"fill\", PLOT_COLOR);\r\n }\r\n\r\n /** Change the equation, the curve bending from the one into the other. */\r\n @command({ args: [\"expression\"] })\r\n morphTo(args: CommandArgs<{ expression: string }> & { duration: number }): Command<CurvePlot3dProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the equation's named values. */\r\n @command({ args: [\"params\"] })\r\n paramsTo(args: CommandArgs<{ params: ExpressionScope }> & { duration: number }): Command<CurvePlot3dProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the span of `t` that is drawn. */\r\n @command({ args: [\"domain\"] })\r\n domainTo(args: CommandArgs<{ domain: Interval | null }> & { duration: number }): Command<CurvePlot3dProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Draw the curve on, or wipe it off: animates `start` and `end`. */\r\n @command({ args: [\"start\", \"end\"] })\r\n progressTo(args: CommandArgs<{ start?: number; end?: number }> & { duration: number }): Command<CurvePlot3dProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override buildGeometry(): Geometry3D | undefined {\r\n const space = spaceOf(this);\r\n if (!space) return undefined;\r\n const points = this._points(space);\r\n if (points.length < 2) return undefined;\r\n return Geo.tube({ points, radius: this.thickness, segments: [points.length - 1, 8] });\r\n }\r\n\r\n private _key = \"\";\r\n private _run: Vector3[] = [];\r\n\r\n private _points(space: GraphSpace): Vector3[] {\r\n const { source, blend } = this.expression;\r\n const start = clamp(this.start, 0, 1);\r\n const end = clamp(this.end, 0, 1);\r\n const samples = Math.max(2, Math.round(this.samples));\r\n const key = [source, blend?.from, blend?.t, space.revision, this.domain, JSON.stringify(this.params), start, end, samples].join(\"|\");\r\n if (key === this._key) return this._run;\r\n this._key = key;\r\n this._run = [];\r\n const to = this._curve(source);\r\n if (!to || !(end > start)) return this._run;\r\n const from = blend ? this._curve(blend.from) : null;\r\n const steps = Math.max(1, Math.round(samples * (end - start)));\r\n const a: Vector3 = { x: 0, y: 0, z: 0 };\r\n const b: Vector3 = { x: 0, y: 0, z: 0 };\r\n for (let i = 0; i <= steps; i++) {\r\n const u = start + ((end - start) * i) / steps;\r\n if (!to(u, b)) continue;\r\n if (from && blend) {\r\n if (!from(u, a)) continue;\r\n b.x = a.x + (b.x - a.x) * blend.t;\r\n b.y = a.y + (b.y - a.y) * blend.t;\r\n b.z = a.z + (b.z - a.z) * blend.t;\r\n }\r\n this._run.push(space.offset(b.x, b.y, b.z));\r\n }\r\n return this._run;\r\n }\r\n\r\n /** `source` as a graph point for a share `u` of its span, or `false` where it has none. */\r\n private _curve(source: string): ((u: number, out: Vector3) => boolean) | null {\r\n const equation = equationOf(source);\r\n if (!equation) return null;\r\n const params = scopeFor(spaceCurveParams(source), this.params);\r\n const [t0, t1] = this.domain ?? [0, 1];\r\n const { x, y, z } = equation;\r\n return (u, out) => {\r\n const t = t0 + (t1 - t0) * u;\r\n out.x = x(t, 0, params);\r\n out.y = y(t, 0, params);\r\n out.z = z(t, 0, params);\r\n return Number.isFinite(out.x) && Number.isFinite(out.y) && Number.isFinite(out.z);\r\n };\r\n }\r\n}\r\n\r\nfunction equationOf(source: string): SpaceCurveEquation | null {\r\n const equation = parseSpaceCurve(source, spaceCurveParams(source));\r\n return equation instanceof Error ? null : equation;\r\n}\r\n", "import {\r\n colorProperty,\r\n Geo,\r\n Graphics3D,\r\n Mesh3D,\r\n node,\r\n property,\r\n type AssetScope,\r\n type Color,\r\n type Geometry3D,\r\n type Mesh3DProps,\r\n type NodeConfig,\r\n} from \"@motionscript/sdk\";\r\nimport { drawLabel3D } from \"./label3d\";\r\n\r\nexport interface PlotPoint3dProps extends Mesh3DProps {\r\n radius?: number;\r\n label?: string;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/**\r\n * A dot at graph coordinates in a 3D graph, with an optional label. Put inside\r\n * a surface it rides it: its `x` and `y` say where, and its height is the surface's.\r\n */\r\n@node({\r\n key: \"plotPoint3d\",\r\n within: [\"axes3d\", \"surfacePlot3d\"],\r\n forkable: true,\r\n layout: { acceptsChildren: false },\r\n seed: { fill: \"#facc15\" },\r\n})\r\nexport class PlotPoint3d extends Mesh3D<PlotPoint3dProps> {\r\n /** In scene units, so a point is the same size whatever the axes show. */\r\n @property({ default: 0.1, min: 0, step: 0.01 }) declare radius: number;\r\n @property({ default: \"\", animatable: false }) declare label: string;\r\n /** The height of the label's text, in scene units. */\r\n @property({ default: 0.26, min: 0.01, step: 0.01 }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n constructor(props?: NodeConfig<PlotPoint3d, PlotPoint3dProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n }\r\n\r\n protected override buildGeometry(): Geometry3D | undefined {\r\n return this.radius > 0 ? Geo.sphere({ radius: this.radius, segments: [24, 16] }) : undefined;\r\n }\r\n\r\n protected override buildGraphics3D(): Graphics3D {\r\n const g3 = super.buildGraphics3D();\r\n drawLabel3D(g3, this.label, { x: 0, y: this.radius + this.labelSize * 0.85, z: 0 }, {\r\n size: this.labelSize,\r\n color: this.labelColor,\r\n fontFamily: this.fontFamily,\r\n });\r\n return g3;\r\n }\r\n}\r\n", "import {\r\n command,\r\n Graphics3D,\r\n lerpVector3,\r\n Mesh3D,\r\n node,\r\n property,\r\n resolveVector3,\r\n type Command,\r\n type CommandArgs,\r\n type Mesh3DProps,\r\n type NodeConfig,\r\n type Vector3,\r\n type Vector3Input,\r\n} from \"@motionscript/sdk\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { aim, spaceOf } from \"./space\";\r\n\r\nexport interface VectorArrow3dProps extends Mesh3DProps {\r\n tail?: Vector3Input;\r\n head?: Vector3Input;\r\n thickness?: number;\r\n tip?: boolean;\r\n}\r\n\r\n/** An arrow between two points of a 3D graph: a vector from the origin by default. */\r\n@node({\r\n key: \"vectorArrow3d\",\r\n within: [\"axes3d\"],\r\n forkable: true,\r\n layout: { acceptsChildren: false },\r\n seed: { head: { x: 2, y: 1, z: 1.5 }, fill: \"#f97316\" },\r\n})\r\nexport class VectorArrow3d extends Mesh3D<VectorArrow3dProps> {\r\n @property({ default: { x: 0, y: 0, z: 0 }, mapper: resolveVector3, tween: lerpVector3, kind: \"vector3\" }) declare tail: Vector3;\r\n @property({ default: { x: 1, y: 1, z: 1 }, mapper: resolveVector3, tween: lerpVector3, kind: \"vector3\" }) declare head: Vector3;\r\n /** The radius of the shaft, in scene units; the tip is sized from it. */\r\n @property({ default: 0.035, min: 0.001, step: 0.005 }) declare thickness: number;\r\n @property({ default: true, animatable: false }) declare tip: boolean;\r\n\r\n constructor(props?: NodeConfig<VectorArrow3d, VectorArrow3dProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Animate either end, or both. */\r\n @command({ args: [\"tail\", \"head\"] })\r\n endpointsTo(args: CommandArgs<{ tail?: Vector3Input; head?: Vector3Input }> & { duration: number }): Command<VectorArrow3dProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override buildGraphics3D(): Graphics3D {\r\n const g3 = new Graphics3D();\r\n const space = spaceOf(this);\r\n const { tail, head, thickness } = this;\r\n // Outside a graph an arrow is drawn in the scene's own units.\r\n const from = space ? space.offset(tail.x, tail.y, tail.z) : tail;\r\n const to = space ? space.offset(head.x, head.y, head.z) : head;\r\n const along: Vector3 = { x: to.x - from.x, y: to.y - from.y, z: to.z - from.z };\r\n const length = Math.hypot(along.x, along.y, along.z);\r\n if (!(length > 0)) return g3;\r\n\r\n const paint = this.materialShorthand();\r\n const quaternion = aim(along);\r\n const tipLength = this.tip ? Math.min(thickness * 8, length) : 0;\r\n const shaft = length - tipLength;\r\n const at = (distance: number): Vector3 => ({\r\n x: from.x + (along.x * distance) / length,\r\n y: from.y + (along.y * distance) / length,\r\n z: from.z + (along.z * distance) / length,\r\n });\r\n if (shaft > 0) g3.cylinder({ ...paint, radius: thickness, height: shaft, segments: [12, 1], position: at(shaft / 2), quaternion });\r\n if (tipLength > 0) {\r\n g3.cone({ ...paint, radius: thickness * 2.8, height: tipLength, segments: [20, 1], position: at(shaft + tipLength / 2), quaternion });\r\n }\r\n return g3;\r\n }\r\n}\r\n", "import {\r\n colorProperty,\r\n command,\r\n Graphics2D,\r\n node,\r\n property,\r\n strokeProperty,\r\n type AssetScope,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type Extents,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type Stroke,\r\n type StrokeResolved,\r\n} from \"@motionscript/sdk\";\r\nimport { cartesianMap, type CoordinateMap } from \"../kit/coords\";\r\nimport { AXIS_COLOR, drawLabels, type Label } from \"../kit/furniture\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { CoordinateSystem } from \"../kit/system\";\r\nimport { formatTick, ticksFor } from \"../kit/ticks\";\r\n\r\nexport interface PolarPlaneProps extends PaintProps {\r\n radius?: number;\r\n ringStep?: number;\r\n spokes?: number;\r\n angleUnit?: \"degrees\" | \"radians\";\r\n gridStroke?: Stroke;\r\n labels?: boolean;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/** How much room, in label sizes, the angles written round the outer ring take from the plane. */\r\nconst LABEL_ROOM = 2.2;\r\n\r\n/**\r\n * Rings and spokes about an origin: the plane a polar curve is read on.\r\n * Children sit in its graph coordinates, x and y in the units its rings count,\r\n * so a plot of `r = 1 + cos(theta)`, a point or an arrow goes on it as on axes.\r\n */\r\n@node({\r\n key: \"polarPlane\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: true },\r\n seed: { width: 560, height: 560 },\r\n})\r\nexport class PolarPlane extends CoordinateSystem<PolarPlaneProps> {\r\n /** The radius of the outermost ring, in graph units. */\r\n @property({ default: 4, min: 0.0001, step: 0.5 }) declare radius: number;\r\n /** The spacing of the rings; zero picks a tidy one for the plane's size. */\r\n @property({ default: 0, min: 0 }) declare ringStep: number;\r\n /** How many spokes divide the turn; zero draws none. */\r\n @property({ default: 12, min: 0, max: 72, step: 1, animatable: false }) declare spokes: number;\r\n @property({ default: \"degrees\", options: [\"degrees\", \"radians\"], animatable: false }) declare angleUnit: \"degrees\" | \"radians\";\r\n\r\n /** The inner rings and the spokes. */\r\n @strokeProperty({ default: { weight: 1.25, fill: \"#3b4658\", align: \"center\" } }) declare gridStroke: Stroke;\r\n /** The outer ring and the two lines through the origin. */\r\n @strokeProperty({ default: { weight: 2, fill: AXIS_COLOR, align: \"center\" } }) declare stroke: Stroke;\r\n\r\n /** A number at each ring, and an angle at each spoke. */\r\n @property({ default: true, animatable: false }) declare labels: boolean;\r\n @property({ default: 16, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: AXIS_COLOR }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n constructor(props?: NodeConfig<PolarPlane, PolarPlaneProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Animate how far out the plane reaches: a zoom about its origin. */\r\n @command({ args: [\"radius\"] })\r\n rangeTo(args: CommandArgs<{ radius: number }> & { duration: number }): Command<PolarPlaneProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n }\r\n\r\n protected mapFor(area: Extents): CoordinateMap {\r\n const width = area.maxX - area.minX;\r\n const height = area.maxY - area.minY;\r\n // The outer ring fits the shorter side, less the room its angles are written in; units are square.\r\n const reach = Math.max(1, Math.min(width, height) / 2 - (this.labels ? this.labelSize * LABEL_ROOM : 0));\r\n const unit = reach / Math.max(this.radius, 1e-9);\r\n return cartesianMap({\r\n xRange: [-width / 2 / unit, width / 2 / unit],\r\n yRange: [-height / 2 / unit, height / 2 / unit],\r\n area,\r\n });\r\n }\r\n\r\n protected furniture(map: CoordinateMap): Graphics2D[] {\r\n const stroke = this.stroke as StrokeResolved[];\r\n const grid = this.gridStroke as StrokeResolved[];\r\n const { start, end, radius } = this;\r\n const centre = map.toPoint(0, 0);\r\n const reach = map.toPoint(radius, 0).x - centre.x;\r\n if (!(reach > 0)) return [];\r\n const at = (r: number, degrees: number) => {\r\n const angle = (degrees * Math.PI) / 180;\r\n return map.toPoint(r * Math.cos(angle), r * Math.sin(angle));\r\n };\r\n const ring = (g: Graphics2D, r: number): Graphics2D => {\r\n const size = (map.toPoint(r, 0).x - centre.x) * 2;\r\n return g.ellipse({ x: centre.x, y: centre.y, width: size, height: size, start, end });\r\n };\r\n\r\n const parts: Graphics2D[] = [];\r\n const marks = ticksFor([0, radius], this.ringStep, reach);\r\n const rings = marks.values.filter((r) => r > 0 && r < radius * (1 - 1e-9));\r\n const count = Math.round(this.spokes);\r\n const turns = Array.from({ length: count }, (_, i) => (360 * i) / count);\r\n\r\n if (grid.length > 0) {\r\n const inner = new Graphics2D();\r\n for (const r of rings) ring(inner, r);\r\n // The four along the axes are drawn with them.\r\n for (const degrees of turns) {\r\n if (degrees % 90 !== 0) inner.line({ points: [centre, at(radius, degrees)], radius: 0, start, end });\r\n }\r\n if (rings.length > 0 || turns.some((degrees) => degrees % 90 !== 0)) parts.push(inner.stroke(grid));\r\n }\r\n if (stroke.length > 0) {\r\n parts.push(\r\n ring(new Graphics2D(), radius)\r\n .line({ points: [at(radius, 180), at(radius, 0)], radius: 0, start, end })\r\n .line({ points: [at(radius, 270), at(radius, 90)], radius: 0, start, end })\r\n .stroke(stroke),\r\n );\r\n }\r\n if (!this.labels) return parts;\r\n\r\n const size = this.labelSize;\r\n const labels: Label[] = [];\r\n for (const r of [...rings, radius]) {\r\n const p = map.toPoint(r, 0);\r\n labels.push({ text: formatTick(r, marks.step), at: { x: p.x - size * 0.2, y: p.y - size * 0.95 }, align: \"right\" });\r\n }\r\n for (const degrees of turns) {\r\n const p = at(radius, degrees);\r\n const cos = Math.cos((degrees * Math.PI) / 180);\r\n const sin = Math.sin((degrees * Math.PI) / 180);\r\n labels.push({\r\n text: this.angleUnit === \"degrees\" ? `${formatTick(degrees, 1)}°` : radians(degrees),\r\n at: { x: p.x + cos * size * 0.6, y: p.y + sin * size * 1.05 },\r\n align: cos > 0.3 ? \"left\" : cos < -0.3 ? \"right\" : \"center\",\r\n });\r\n }\r\n parts.push(...drawLabels(labels, { fontSize: size, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor }));\r\n return parts;\r\n }\r\n}\r\n\r\n/** An angle in degrees as a fraction of π: 90 is `π/2`, 240 is `4π/3`. */\r\nfunction radians(degrees: number): string {\r\n if (degrees === 0) return \"0\";\r\n let numerator = Math.round(degrees);\r\n let denominator = 180;\r\n for (let a = numerator, b = denominator; ; [a, b] = [b, a % b]) {\r\n if (b === 0) {\r\n numerator /= a;\r\n denominator /= a;\r\n break;\r\n }\r\n }\r\n const top = numerator === 1 ? \"π\" : `${numerator}π`;\r\n return denominator === 1 ? top : `${top}/${denominator}`;\r\n}\r\n", "import { node, property, strokeProperty, type NodeConfig, type Stroke, type Vector2 } from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { FieldMark, type FieldProps, type FieldSampler, type FieldStroke } from \"../kit/field-mark\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\n\r\nexport interface VectorFieldProps extends FieldProps {\r\n spacing?: number;\r\n arrowScale?: number;\r\n}\r\n\r\n/** Past this many arrows the spacing is widened, so a field over a huge range is still a field and not a wash. */\r\nconst MAX_ARROWS = 2400;\r\n/** An arrow's head, as a share of its length and in pixels at most, and the half-angle it opens to. */\r\nconst HEAD_SHARE = 0.38;\r\nconst HEAD_MAX = 11;\r\nconst HEAD_ANGLE = (26 * Math.PI) / 180;\r\n\r\n/**\r\n * A grid of arrows showing a vector field, two parts in x and y: `(-y, x)`.\r\n * Each arrow is centred on its point and is as long as the field is strong\r\n * there, up to the spacing.\r\n */\r\n@node({\r\n key: \"vectorField\",\r\n within: SYSTEMS,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { expression: \"(-y, x)\" },\r\n})\r\nexport class VectorField extends FieldMark<VectorFieldProps> {\r\n /** How far apart the arrows stand, in graph units. */\r\n @property({ default: 1, min: 0.01, step: 0.1 }) declare spacing: number;\r\n /** How long an arrow is drawn for a vector of length one, in graph units. */\r\n @property({ default: 0.4, min: 0, step: 0.05 }) declare arrowScale: number;\r\n\r\n @strokeProperty({ default: { weight: 2.5, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<VectorField, VectorFieldProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n protected own(): string {\r\n return `${this.spacing}|${this.arrowScale}`;\r\n }\r\n\r\n protected strokes(map: CoordinateMap, field: FieldSampler): FieldStroke[] {\r\n const [x0, x1] = map.xRange;\r\n const [y0, y1] = map.yRange;\r\n let spacing = Math.max(this.spacing, 1e-6);\r\n const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);\r\n while (count() > MAX_ARROWS) spacing *= 2;\r\n\r\n const drawn: FieldStroke[] = [];\r\n const v: Vector2 = { x: 0, y: 0 };\r\n const longest = spacing * 0.9;\r\n for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {\r\n for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {\r\n const gx = i * spacing;\r\n const gy = j * spacing;\r\n if (!field(gx, gy, v)) continue;\r\n const magnitude = Math.hypot(v.x, v.y);\r\n const length = Math.min(magnitude * this.arrowScale, longest);\r\n if (!(length > 0)) continue;\r\n const hx = ((v.x / magnitude) * length) / 2;\r\n const hy = ((v.y / magnitude) * length) / 2;\r\n const tail = map.toPoint(gx - hx, gy - hy);\r\n const head = map.toPoint(gx + hx, gy + hy);\r\n drawn.push({ runs: arrow(tail, head), magnitude });\r\n }\r\n }\r\n return drawn;\r\n }\r\n}\r\n\r\n/** A shaft and the two barbs of its head, in pixels. */\r\nfunction arrow(tail: Vector2, head: Vector2): Vector2[][] {\r\n const dx = head.x - tail.x;\r\n const dy = head.y - tail.y;\r\n const length = Math.hypot(dx, dy);\r\n if (!(length > 0)) return [];\r\n const barb = Math.min(length * HEAD_SHARE, HEAD_MAX);\r\n const back = Math.atan2(dy, dx) + Math.PI;\r\n const at = (angle: number): Vector2 => ({ x: head.x + Math.cos(angle) * barb, y: head.y + Math.sin(angle) * barb });\r\n return [[tail, head], [at(back - HEAD_ANGLE), head, at(back + HEAD_ANGLE)]];\r\n}\r\n", "import {\r\n command,\r\n node,\r\n property,\r\n strokeProperty,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Stroke,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { FieldMark, type FieldProps, type FieldSampler, type FieldStroke } from \"../kit/field-mark\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { clamp, stated } from \"../kit/geometry\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\n\r\nexport interface StreamLinesProps extends FieldProps {\r\n spacing?: number;\r\n length?: number;\r\n window?: number;\r\n phase?: number;\r\n}\r\n\r\nconst MAX_LINES = 1600;\r\n/** Steps a line takes across one spacing: what keeps a tight swirl round. */\r\nconst STEPS_PER_SPACING = 8;\r\nconst MAX_STEPS = 600;\r\n\r\n/**\r\n * The lines a vector field carries a point along, one from each point of a\r\n * grid: `(-y, x)` draws circles. With a `window` below one, each line shows\r\n * only a stretch of itself, and `flowTo` sends those stretches along.\r\n */\r\n@node({\r\n key: \"streamLines\",\r\n within: SYSTEMS,\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { expression: \"(sin(y), cos(x))\" },\r\n})\r\nexport class StreamLines extends FieldMark<StreamLinesProps> {\r\n /** How far apart the lines start, in graph units. */\r\n @property({ default: 1, min: 0.01, step: 0.1 }) declare spacing: number;\r\n /** How far each line runs from where it starts, in graph units along itself. */\r\n @property({ default: 3, min: 0, step: 0.1 }) declare length: number;\r\n /** The share of each line that is shown at once; one shows all of it. */\r\n @property({ default: 1, min: 0.01, max: 1, step: 0.01 }) declare window: number;\r\n /** Where along its line each shown stretch is: one turn of it runs every line from end to end. */\r\n @property({ default: 0, step: 0.01 }) declare phase: number;\r\n\r\n @strokeProperty({ default: { weight: 2, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" } })\r\n declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<StreamLines, StreamLinesProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Send the shown stretches along their lines: a whole number runs each line that many times over. */\r\n @command({ args: [\"phase\"] })\r\n flowTo(args: CommandArgs<{ phase: number }> & { duration: number }): Command<StreamLinesProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected own(): string {\r\n return `${this.spacing}|${this.length}|${this.window}|${this.phase}`;\r\n }\r\n\r\n protected strokes(map: CoordinateMap, field: FieldSampler): FieldStroke[] {\r\n const [x0, x1] = map.xRange;\r\n const [y0, y1] = map.yRange;\r\n let spacing = Math.max(this.spacing, 1e-6);\r\n const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);\r\n while (count() > MAX_LINES) spacing *= 2;\r\n const step = spacing / STEPS_PER_SPACING;\r\n const steps = Math.min(MAX_STEPS, Math.round(this.length / step));\r\n if (steps < 1) return [];\r\n // A line is followed a little past what is shown, so it leaves the box rather than stopping at its edge.\r\n const inside = (x: number, y: number) => x >= x0 - spacing && x <= x1 + spacing && y >= y0 - spacing && y <= y1 + spacing;\r\n const window = clamp(this.window, 0, 1);\r\n\r\n const drawn: FieldStroke[] = [];\r\n let index = 0;\r\n for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {\r\n for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {\r\n const line = follow(field, i * spacing, j * spacing, step, steps, inside);\r\n index++;\r\n if (line.points.length < 2) continue;\r\n const shown = window >= 1 ? line.points : stretch(line.points, window, this.phase + stagger(index));\r\n if (shown.length < 2) continue;\r\n drawn.push({ runs: [shown.map((p) => map.toPoint(p.x, p.y))], magnitude: line.magnitude });\r\n }\r\n }\r\n return drawn;\r\n }\r\n}\r\n\r\n/** The graph points a field carries a point through from `(x, y)`, at an even pace, and how strong it was on the way. */\r\nfunction follow(\r\n field: FieldSampler,\r\n x: number,\r\n y: number,\r\n step: number,\r\n steps: number,\r\n inside: (x: number, y: number) => boolean,\r\n): { points: Vector2[]; magnitude: number } {\r\n const points: Vector2[] = [{ x, y }];\r\n const v: Vector2 = { x: 0, y: 0 };\r\n let strength = 0;\r\n let read = 0;\r\n // The field's direction at a point, as a unit step; `false` where it has none or is at rest.\r\n const heading = (px: number, py: number, out: Vector2): boolean => {\r\n if (!field(px, py, v)) return false;\r\n const magnitude = Math.hypot(v.x, v.y);\r\n if (!(magnitude > 1e-9)) return false;\r\n out.x = v.x / magnitude;\r\n out.y = v.y / magnitude;\r\n strength += magnitude;\r\n read++;\r\n return true;\r\n };\r\n const a: Vector2 = { x: 0, y: 0 };\r\n const b: Vector2 = { x: 0, y: 0 };\r\n for (let i = 0; i < steps; i++) {\r\n // Midpoint rule: the direction half a step on is the one the whole step takes.\r\n if (!heading(x, y, a) || !heading(x + (a.x * step) / 2, y + (a.y * step) / 2, b)) break;\r\n x += b.x * step;\r\n y += b.y * step;\r\n if (!inside(x, y)) break;\r\n points.push({ x, y });\r\n }\r\n return { points, magnitude: read > 0 ? strength / read : 0 };\r\n}\r\n\r\n/** The part of `points` a window `share` long shows at `phase`: it enters at one end and leaves by the other. */\r\nfunction stretch(points: Vector2[], share: number, phase: number): Vector2[] {\r\n const turn = phase - Math.floor(phase);\r\n const end = turn * (1 + share);\r\n const from = Math.max(0, end - share);\r\n const to = Math.min(1, end);\r\n if (!(to > from)) return [];\r\n const last = points.length - 1;\r\n return points.slice(Math.floor(from * last), Math.ceil(to * last) + 1);\r\n}\r\n\r\n/** A share of a turn that differs from line to line and never from frame to frame, so the stretches do not march in step. */\r\nfunction stagger(index: number): number {\r\n const mixed = Math.sin(index * 12.9898) * 43758.5453;\r\n return mixed - Math.floor(mixed);\r\n}\r\n", "import { command, node, property, withdraw, type Command, type CommandArgs, type NodeConfig } from \"@motionscript/sdk\";\r\nimport type { Interval } from \"../kit/coords\";\r\nimport { stated } from \"../kit/geometry\";\r\nimport { SYSTEMS } from \"../kit/placement\";\r\nimport { FunctionPlot, type FunctionPlotProps } from \"./function-plot\";\r\nimport { OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport interface TracedPathProps extends FunctionPlotProps {\r\n from?: number;\r\n value?: number;\r\n tail?: number;\r\n}\r\n\r\n/**\r\n * The trail a point leaves as a value changes: the curve of its equation from\r\n * where the value began to where it is now. Bind `value` to a variable\r\n * (`\"=[t]\"`) and the trail grows as the variable is driven, or drive it with\r\n * `traceTo`; a `tail` keeps only its most recent stretch.\r\n */\r\n@node({\r\n key: \"tracedPath\",\r\n within: SYSTEMS,\r\n parentKey: \"functionPlot\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"hug\", defaultHeightMode: \"hug\", acceptsChildren: false },\r\n seed: { expression: \"(2cos(t), sin(2t))\", value: 6.28 },\r\n})\r\n@withdraw(...OUTLINE_TRIM)\r\nexport class TracedPath extends FunctionPlot<TracedPathProps> {\r\n /** The value the trail starts at. */\r\n @property({ default: 0, step: 0.1 }) declare from: number;\r\n /** The value the point is at now: where the trail ends. */\r\n @property({ default: 0, step: 0.1 }) declare value: number;\r\n /** How much of the trail is kept, in the value's own units; zero keeps all of it. */\r\n @property({ default: 0, min: 0, step: 0.1 }) declare tail: number;\r\n\r\n constructor(props?: NodeConfig<TracedPath, TracedPathProps>) {\r\n super((props ?? {}) as NodeConfig<FunctionPlot<TracedPathProps>, TracedPathProps>);\r\n }\r\n\r\n /** Carry the point on to another value, the trail following it. */\r\n @command({ args: [\"value\"] })\r\n traceTo(args: CommandArgs<{ value: number }> & { duration: number }): Command<TracedPathProps> {\r\n return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });\r\n }\r\n\r\n protected override span(): Interval | null {\r\n const { from, value, tail } = this;\r\n const kept = tail > 0 ? Math.min(Math.abs(value - from), tail) : Math.abs(value - from);\r\n return value >= from ? [value - kept, value] : [value, value + kept];\r\n }\r\n}\r\n", "import {\r\n colorProperty,\r\n command,\r\n fillProperty,\r\n Graphics2D,\r\n node,\r\n PaintNode,\r\n property,\r\n strokeProperty,\r\n type AssetScope,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type Fill,\r\n type FillResolved,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type RenderContext2D,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { declareFormulas, drawLabels, type Label } from \"../kit/furniture\";\r\nimport { lerpPartFills, partPaint, readPartFills, withPartFill, type PartFill, type PartFillResolved } from \"../kit/part-fills\";\r\nimport { GRAPH_LAYOUTS, layOut, type GraphEdge, type GraphLayout } from \"./graph-layout\";\r\n\r\n/** A vertex placed by hand, in the graph's box from -1 to 1 each way, y up. */\r\nexport interface GraphPosition {\r\n vertex: string;\r\n x: number;\r\n y: number;\r\n}\r\n\r\nexport interface NetworkGraphProps extends PaintProps {\r\n vertices?: string[];\r\n edges?: GraphEdge[];\r\n directed?: boolean;\r\n arrangement?: GraphLayout;\r\n root?: string;\r\n positions?: GraphPosition[];\r\n vertexRadius?: number;\r\n vertexStroke?: Stroke;\r\n labels?: boolean;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n partFills?: PartFill[];\r\n}\r\n\r\n// Every list keeps each entry as it was written, a blank or a repeat included, so\r\n// an editor showing the list shows the row it just added. What is drawn skips\r\n// what is not complete yet (`_names`, `_links`).\r\n\r\nfunction readVertices(value: readonly unknown[] | undefined): string[] {\r\n return (Array.isArray(value) ? value : []).map((name) => String(name ?? \"\"));\r\n}\r\n\r\n// An edge reads from `{ from, to }` or a pair, so a list written by hand is as good as one from a table.\r\nfunction readEdges(value: readonly unknown[] | undefined): GraphEdge[] {\r\n return (Array.isArray(value) ? value : []).map((edge) => {\r\n const [from, to] = Array.isArray(edge) ? edge : [(edge as GraphEdge)?.from, (edge as GraphEdge)?.to];\r\n return { from: String(from ?? \"\"), to: String(to ?? \"\") };\r\n });\r\n}\r\n\r\nfunction readPositions(value: readonly GraphPosition[] | undefined): GraphPosition[] {\r\n const at = (n: unknown) => (typeof n === \"number\" && Number.isFinite(n) ? n : 0);\r\n return (Array.isArray(value) ? value : []).map((entry) => ({ vertex: String(entry?.vertex ?? \"\"), x: at(entry?.x), y: at(entry?.y) }));\r\n}\r\n\r\n/** How far a directed edge and the one back between the same two vertices bow apart, as a share of their length. */\r\nconst BOW = 0.12;\r\n\r\n/**\r\n * Vertices and the edges between them, arranged by a rule: in a circle, by\r\n * springs, as a tree from `root`, or in a grid. Its `fill` is the vertices and\r\n * its `stroke` the edges, with an arrowhead each when `directed`. `arrangeTo`\r\n * moves every vertex to where another rule places it; `partFillTo` paints a\r\n * vertex, or an edge written `a-b`. (`layout` is every node's own box.)\r\n */\r\n@node({\r\n key: \"networkGraph\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: false },\r\n seed: {\r\n width: 560,\r\n height: 400,\r\n vertices: [\"1\", \"2\", \"3\", \"4\", \"5\"],\r\n edges: [{ from: \"1\", to: \"2\" }, { from: \"2\", to: \"3\" }, { from: \"3\", to: \"4\" }, { from: \"4\", to: \"5\" }, { from: \"5\", to: \"1\" }, { from: \"1\", to: \"3\" }],\r\n },\r\n})\r\nexport class NetworkGraph extends PaintNode<NetworkGraphProps> {\r\n @property({ default: [], mapper: readVertices, animatable: false, kind: \"vector\" }) declare vertices: string[];\r\n @property({ default: [], mapper: readEdges, animatable: false, kind: \"vector\" }) declare edges: GraphEdge[];\r\n /** Draw each edge as an arrow from its `from` to its `to`. */\r\n @property({ default: false, animatable: false }) declare directed: boolean;\r\n @property({ default: \"circular\", options: GRAPH_LAYOUTS, animatable: false }) declare arrangement: GraphLayout;\r\n /** The vertex a tree hangs from; left empty, the first. */\r\n @property({ default: \"\", animatable: false }) declare root: string;\r\n /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */\r\n @property({ default: [], mapper: readPositions, animatable: false, kind: \"vector\" }) declare positions: GraphPosition[];\r\n\r\n @property({ default: 18, min: 0, unit: \"px\" }) declare vertexRadius: number;\r\n @strokeProperty({ default: [] }) declare vertexStroke: Stroke;\r\n @property({ default: true, animatable: false }) declare labels: boolean;\r\n @property({ default: 18, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: \"#111827\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */\r\n @property({ default: [], mapper: readPartFills, tween: lerpPartFills, kind: \"vector\" }) declare partFills: PartFill[];\r\n\r\n @fillProperty({ default: \"#e5e7eb\" }) declare fill: Fill;\r\n @strokeProperty({ default: { weight: 3, fill: \"#9ca3af\", align: \"center\", cap: \"round\" } }) declare stroke: Stroke;\r\n\r\n declare private _layoutFrom: string;\r\n declare private _layoutMix: number;\r\n\r\n constructor(props?: NodeConfig<NetworkGraph, NetworkGraphProps>) {\r\n super(props ?? {});\r\n this.applyProp(\"_layoutFrom\", \"\");\r\n this.applyProp(\"_layoutMix\", 1);\r\n }\r\n\r\n /** Move every vertex to where another arrangement places it. */\r\n @command({ args: [\"arrangement\"] })\r\n arrangeTo(args: CommandArgs<{ arrangement: GraphLayout }> & { duration: number }): Command<NetworkGraphProps> {\r\n const from = this.arrangement;\r\n const to = args.data?.arrangement ?? from;\r\n return this.command<NetworkGraphProps>(\r\n (t) => ({ arrangement: to, _layoutFrom: from, _layoutMix: t }) as Partial<NetworkGraphProps>,\r\n args.duration,\r\n args.easing,\r\n );\r\n }\r\n\r\n /** Paint one part of the graph: a vertex by its name, or an edge written `a-b`. */\r\n @command({\r\n args: [\r\n { key: \"part\", kind: \"text\", default: \"\" },\r\n { key: \"fill\", kind: \"fills\", default: \"#facc15\" },\r\n ],\r\n })\r\n partFillTo(args: CommandArgs<{ part: string; fill: Fill }> & { duration: number }): Command<NetworkGraphProps> {\r\n const { part, fill } = args.data ?? {};\r\n if (!part || fill == null) return this.to({ data: {}, duration: args.duration, easing: args.easing });\r\n return this.to({\r\n data: { partFills: withPartFill(this.partFills as unknown as PartFillResolved[], { part, fill }) } as Partial<NetworkGraphProps>,\r\n duration: args.duration,\r\n easing: args.easing,\r\n });\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n if (this.labels) declareFormulas(assets, this._names());\r\n }\r\n\r\n /** Where each vertex is drawn, in pixels from the node's centre, y up. */\r\n vertexPoints(): Map<string, Vector2> {\r\n const { width, height } = this.layoutBounds;\r\n const room = this.vertexRadius + Math.max(2, this.labelSize * 0.2);\r\n const halfX = Math.max(0, width / 2 - room);\r\n const halfY = Math.max(0, height / 2 - room);\r\n const to = this._placed(this.arrangement);\r\n const from = this._layoutMix < 1 && this._layoutFrom !== \"\" ? this._placed(this._layoutFrom as GraphLayout) : null;\r\n const t = this._layoutMix;\r\n const out = new Map<string, Vector2>();\r\n for (const [name, p] of to) {\r\n const q = from?.get(name) ?? p;\r\n out.set(name, { x: (q.x + (p.x - q.x) * t) * halfX, y: (q.y + (p.y - q.y) * t) * halfY });\r\n }\r\n return out;\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n const points = this.vertexPoints();\r\n if (points.size === 0) return;\r\n const parts = new Map((this.partFills as unknown as PartFillResolved[]).map((entry) => [entry.part, entry]));\r\n this._drawEdges(ctx, points, parts);\r\n this._drawVertices(ctx, points, parts);\r\n }\r\n\r\n // The edges are drawn under the vertices, in `renderSelf`; there is no outline of the node's own.\r\n protected override renderStroke(): void {}\r\n\r\n private _layouts = new Map<string, Map<string, Vector2>>();\r\n\r\n /** Each vertex's place under `layout`, from -1 to 1, a hand-placed one where it is. */\r\n private _placed(layout: GraphLayout): Map<string, Vector2> {\r\n const vertices = this._names();\r\n const edges = this._links();\r\n const key = [layout, this.root, vertices.join(\"\\u0000\"), JSON.stringify(edges), JSON.stringify(this.positions)].join(\"|\");\r\n let placed = this._layouts.get(key);\r\n if (!placed) {\r\n placed = layOut(layout, vertices, edges, this.root.trim());\r\n for (const { vertex, x, y } of this.positions) {\r\n const name = vertex.trim();\r\n if (placed.has(name)) placed.set(name, { x, y });\r\n }\r\n // Two layouts are held at once while one becomes the other.\r\n if (this._layouts.size > 4) this._layouts.clear();\r\n this._layouts.set(key, placed);\r\n }\r\n return placed;\r\n }\r\n\r\n private _drawEdges(ctx: RenderContext2D, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\r\n const stroke = this.stroke as StrokeResolved[];\r\n if (stroke.length === 0) return;\r\n const r = this.vertexRadius;\r\n const links = this._links();\r\n const pairs = new Set(links.map(({ from, to }) => `${from}\\u0000${to}`));\r\n const plain = new Graphics2D();\r\n let drawnPlain = false;\r\n for (const { from, to } of links) {\r\n const a = points.get(from);\r\n const b = points.get(to);\r\n if (!a || !b) continue;\r\n const run = from === to ? loop(a, r) : edge(a, b, r, this.directed && pairs.has(`${to}\\u0000${from}`) ? BOW : 0);\r\n if (run.length < 2) continue;\r\n const paint = parts.get(`${from}-${to}`) ?? (this.directed ? undefined : parts.get(`${to}-${from}`));\r\n const own = this.directed || paint !== undefined;\r\n const g = own ? new Graphics2D() : plain;\r\n g.line({ points: run, radius: 0, start: this.start, end: this.end });\r\n if (!own) {\r\n drawnPlain = true;\r\n continue;\r\n }\r\n let layers = stroke;\r\n if (paint) layers = layers.map((layer) => ({ ...layer, fill: partPaint(layer.fill, paint) }));\r\n if (this.directed && from !== to) layers = layers.map((layer) => ({ ...layer, endCap: layer.endCap ?? \"triangle\" }));\r\n ctx.draw(g.stroke(layers));\r\n }\r\n if (drawnPlain) ctx.draw(plain.stroke(stroke));\r\n }\r\n\r\n private _drawVertices(ctx: RenderContext2D, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\r\n const r = this.vertexRadius;\r\n const fill = this.fill as FillResolved[];\r\n const outline = this.vertexStroke as StrokeResolved[];\r\n const labels: Label[] = [];\r\n for (const [name, p] of points) {\r\n if (r > 0) {\r\n const paint = partPaint(fill, parts.get(name));\r\n const disc = new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 });\r\n ctx.draw(disc.shadow(this.shadow).fill(paint));\r\n if (outline.length > 0) ctx.draw(new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 }).stroke(outline));\r\n }\r\n if (this.labels) labels.push({ text: name, at: { x: p.x, y: p.y }, align: \"center\" });\r\n }\r\n for (const part of drawLabels(labels, { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor })) {\r\n ctx.draw(part);\r\n }\r\n }\r\n\r\n /** The vertices drawn: each name once, trimmed, the blank ones left out. */\r\n private _names(): string[] {\r\n return [...new Set(this.vertices.map((name) => name.trim()).filter((name) => name !== \"\"))];\r\n }\r\n\r\n /** The edges drawn: both ends named. */\r\n private _links(): GraphEdge[] {\r\n return this.edges.flatMap(({ from, to }) => {\r\n const a = from.trim();\r\n const b = to.trim();\r\n return a === \"\" || b === \"\" ? [] : [{ from: a, to: b }];\r\n });\r\n }\r\n}\r\n\r\n/** An edge from one vertex's rim to the other's, straight or bowed to its left. */\r\nfunction edge(a: Vector2, b: Vector2, r: number, bow: number): Vector2[] {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const length = Math.hypot(dx, dy);\r\n if (!(length > 2 * r)) return [];\r\n if (bow === 0) {\r\n const ux = dx / length;\r\n const uy = dy / length;\r\n return [{ x: a.x + ux * r, y: a.y + uy * r }, { x: b.x - ux * r, y: b.y - uy * r }];\r\n }\r\n const mid = { x: (a.x + b.x) / 2 - (dy / length) * bow * length, y: (a.y + b.y) / 2 + (dx / length) * bow * length };\r\n const run: Vector2[] = [];\r\n for (let i = 0; i <= 16; i++) {\r\n const t = i / 16;\r\n const u = 1 - t;\r\n run.push({ x: u * u * a.x + 2 * u * t * mid.x + t * t * b.x, y: u * u * a.y + 2 * u * t * mid.y + t * t * b.y });\r\n }\r\n // Trimmed back to the rims along the curve.\r\n const outside = (p: Vector2, c: Vector2) => Math.hypot(p.x - c.x, p.y - c.y) >= r;\r\n return run.filter((p) => outside(p, a) && outside(p, b));\r\n}\r\n\r\n/** An edge from a vertex to itself: a small loop above it. */\r\nfunction loop(c: Vector2, r: number): Vector2[] {\r\n const run: Vector2[] = [];\r\n const radius = Math.max(r * 0.8, 6);\r\n const cy = c.y + r + radius * 0.6;\r\n for (let i = 0; i <= 24; i++) {\r\n const angle = -Math.PI / 2 + (2 * Math.PI * i) / 24;\r\n const p = { x: c.x + Math.cos(angle) * radius, y: cy + Math.sin(angle) * radius };\r\n if (Math.hypot(p.x - c.x, p.y - c.y) >= r) run.push(p);\r\n }\r\n return run;\r\n}\r\n", "import {\r\n colorProperty,\r\n command,\r\n fillOps,\r\n Graphics2D,\r\n node,\r\n PaintNode,\r\n property,\r\n strokeProperty,\r\n withdraw,\r\n type AssetScope,\r\n type Color,\r\n type Command,\r\n type CommandArgs,\r\n type Fill,\r\n type FillResolved,\r\n type NodeConfig,\r\n type NormalizedColor,\r\n type PaintProps,\r\n type RenderContext2D,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\nimport { braceOutline } from \"../kit/brace\";\r\nimport { declareFormulas, drawLabels, type Label } from \"../kit/furniture\";\r\nimport { lerpFillScale, readFillScale } from \"../kit/scale\";\r\nimport { formatTick } from \"../kit/ticks\";\r\nimport { FILL_PAINT, OUTLINE_TRIM } from \"../kit/withdrawn\";\r\n\r\nexport interface SampleSpaceProps extends PaintProps {\r\n columnShares?: number[];\r\n rowShares?: number[];\r\n columnFills?: Fill[];\r\n columnLabels?: string[];\r\n rowLabels?: string[];\r\n values?: boolean;\r\n labelSize?: number;\r\n labelColor?: Color;\r\n fontFamily?: string;\r\n}\r\n\r\n/** The parts' paints until told otherwise, a column each, round again past the last. */\r\nconst PALETTE = [\"#58a6ff\", \"#f59e0b\", \"#4ade80\", \"#f472b6\", \"#a78bfa\", \"#2dd4bf\"];\r\n\r\n/** How strongly the lower part of a split column shows its paint. */\r\nconst LOWER = 0.45;\r\n\r\nfunction readShares(value: readonly number[] | undefined): number[] {\r\n return (Array.isArray(value) ? value : []).map((share) => (Number.isFinite(share) && share > 0 ? share : 0));\r\n}\r\n\r\n// Shares tween one by one; a different count has nothing to pair with, and changes at the end.\r\nfunction lerpShares(from: number[], to: number[], t: number): number[] {\r\n if (from.length !== to.length) return t < 1 ? from : to;\r\n return to.map((share, i) => from[i] + (share - from[i]) * t);\r\n}\r\n\r\n/**\r\n * A probability's whole, as a box cut into columns by `columnShares` (shares of\r\n * the whole, P(A) and P(not A)) and each column cut again by its `rowShares` entry\r\n * (P(B | A) above, the rest below): each part's area is its probability.\r\n * Braces name the columns below and the rows on the left; `divideTo` moves the\r\n * cuts.\r\n */\r\n@node({\r\n key: \"sampleSpace\",\r\n parentKey: \"shape\",\r\n forkable: true,\r\n layout: { children: \"freeform\", defaultWidthMode: \"fixed\", defaultHeightMode: \"fixed\", acceptsChildren: false },\r\n seed: { width: 520, height: 420, columnShares: [0.4, 0.6], rowShares: [0.7, 0.25], columnLabels: [\"A\", \"not A\"], rowLabels: [\"B\", \"not B\"] },\r\n})\r\n@withdraw(...FILL_PAINT, ...OUTLINE_TRIM)\r\nexport class SampleSpace extends PaintNode<SampleSpaceProps> {\r\n /** How the whole is shared across, left to right; any numbers, read as shares of their sum. */\r\n @property({ default: [1], mapper: readShares, tween: lerpShares, kind: \"vector\" }) declare columnShares: number[];\r\n /** Each column's upper share, 0 to 1; a column without one is not cut across. */\r\n @property({ default: [], mapper: readShares, tween: lerpShares, kind: \"vector\" }) declare rowShares: number[];\r\n /** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */\r\n @property({ default: [], mapper: readFillScale, tween: lerpFillScale, kind: \"vector\" }) declare columnFills: Fill[];\r\n @property({ default: [], animatable: false, kind: \"vector\" }) declare columnLabels: string[];\r\n /** The upper part's name and the lower's, written on the left. */\r\n @property({ default: [], animatable: false, kind: \"vector\" }) declare rowLabels: string[];\r\n /** Write each part's probability in it. */\r\n @property({ default: false, animatable: false }) declare values: boolean;\r\n @property({ default: 20, min: 1, unit: \"px\" }) declare labelSize: number;\r\n @colorProperty({ default: \"#e5e7eb\" }) declare labelColor: Color;\r\n @property({ default: \"\", animatable: false }) declare fontFamily: string;\r\n\r\n @strokeProperty({ default: { weight: 2, fill: \"#0b0d12\", align: \"center\" } }) declare stroke: Stroke;\r\n\r\n constructor(props?: NodeConfig<SampleSpace, SampleSpaceProps>) {\r\n super(props ?? {});\r\n }\r\n\r\n /** Move the cuts: the columns' shares, each column's upper share, or both. */\r\n @command({ args: [\"columnShares\", \"rowShares\"] })\r\n divideTo(args: CommandArgs<{ columnShares?: number[]; rowShares?: number[] }> & { duration: number }): Command<SampleSpaceProps> {\r\n const data: Partial<SampleSpaceProps> = {};\r\n if (args.data?.columnShares !== undefined) data.columnShares = args.data.columnShares;\r\n if (args.data?.rowShares !== undefined) data.rowShares = args.data.rowShares;\r\n return this.to({ data, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (this.fontFamily !== \"\") assets.font(this.fontFamily);\r\n declareFormulas(assets, [...this.columnLabels, ...this.rowLabels]);\r\n }\r\n\r\n /** Each part's box in pixels from the node's centre, y up, and its probability: columns left to right, upper part first. */\r\n parts(): { x: number; y: number; width: number; height: number; probability: number; column: number; upper: boolean }[] {\r\n const box = this._box();\r\n const shares = this.columnShares;\r\n const total = shares.reduce((sum, share) => sum + share, 0);\r\n if (!(total > 0) || box.width <= 0 || box.height <= 0) return [];\r\n const out: ReturnType<SampleSpace[\"parts\"]> = [];\r\n let left = box.x - box.width / 2;\r\n shares.forEach((share, column) => {\r\n const width = (box.width * share) / total;\r\n const p = share / total;\r\n const cut = this.rowShares[column];\r\n const top = box.y + box.height / 2;\r\n if (cut === undefined) {\r\n out.push({ x: left + width / 2, y: box.y, width, height: box.height, probability: p, column, upper: true });\r\n } else {\r\n const upper = Math.min(1, Math.max(0, cut));\r\n const h = box.height * upper;\r\n out.push({ x: left + width / 2, y: top - h / 2, width, height: h, probability: p * upper, column, upper: true });\r\n out.push({ x: left + width / 2, y: top - h - (box.height - h) / 2, width, height: box.height - h, probability: p * (1 - upper), column, upper: false });\r\n }\r\n left += width;\r\n });\r\n return out;\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n const parts = this.parts();\r\n if (parts.length === 0) return;\r\n const fills = this.columnFills as unknown as FillResolved[][];\r\n const stroke = this.stroke as StrokeResolved[];\r\n const labels: Label[] = [];\r\n for (const part of parts) {\r\n if (!(part.width > 0) || !(part.height > 0)) continue;\r\n const base = fills.length > 0 ? fills[part.column % fills.length] : fillOps.resolve(PALETTE[part.column % PALETTE.length]);\r\n const paint = part.upper ? base : base.map((layer) => ({ ...layer, opacity: (layer.opacity ?? 1) * LOWER }));\r\n const g = new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height });\r\n ctx.draw(g.shadow(this.shadow).fill(paint));\r\n if (stroke.length > 0) ctx.draw(new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height }).stroke(stroke));\r\n if (this.values && part.height > this.labelSize && part.width > this.labelSize) {\r\n labels.push({ text: formatTick(Math.round(part.probability * 1000) / 1000, 0.001), at: { x: part.x, y: part.y }, align: \"center\" });\r\n }\r\n }\r\n labels.push(...this._braces(ctx, parts));\r\n const style = { fontSize: this.labelSize, fontFamily: this.fontFamily, color: this.labelColor as NormalizedColor };\r\n for (const part of drawLabels(labels, style)) ctx.draw(part);\r\n }\r\n\r\n // The outlines are drawn with the parts, and there is no outline of the node's own.\r\n protected override renderStroke(): void {}\r\n\r\n /** Room for the braces and their names, below and on the left, taken from the box. */\r\n private _box(): { x: number; y: number; width: number; height: number } {\r\n const { width, height } = this.layoutBounds;\r\n const room = this.labelSize * 2.6;\r\n const below = this.columnLabels.some((label) => label !== \"\") ? room : 0;\r\n const left = this.rowLabels.some((label) => label !== \"\") ? room * 1.6 : 0;\r\n return { x: left / 2, y: below / 2, width: Math.max(0, width - left), height: Math.max(0, height - below) };\r\n }\r\n\r\n /** Braces under each column and beside the first column's parts, and the labels that name them. */\r\n private _braces(ctx: RenderContext2D, parts: ReturnType<SampleSpace[\"parts\"]>): Label[] {\r\n const box = this._box();\r\n const reach = this.labelSize * 0.8;\r\n const gap = 6;\r\n const runs = new Graphics2D();\r\n const labels: Label[] = [];\r\n let drawn = false;\r\n const brace = (from: Vector2, to: Vector2, out: Vector2, text: string, align: Label[\"align\"]) => {\r\n if (text === \"\") return;\r\n // A frame centred on the node's own centre, so the path is drawn where it is and not moved onto it.\r\n runs.path({ data: braceOutline(from, to, out, reach), centerBounds: [-1, -1, 1, 1] });\r\n drawn = true;\r\n const mid = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };\r\n const far = reach + this.labelSize * 0.75;\r\n labels.push({ text, at: { x: mid.x + out.x * far, y: mid.y + out.y * far }, align });\r\n };\r\n const bottom = box.y - box.height / 2 - gap;\r\n for (const part of parts) {\r\n if (!part.upper && this.rowShares[part.column] !== undefined) continue;\r\n const text = this.columnLabels[part.column] ?? \"\";\r\n // Left to right along the bottom, so the bulge, to the edge's right, points down.\r\n brace({ x: part.x + part.width / 2, y: bottom }, { x: part.x - part.width / 2, y: bottom }, { x: 0, y: -1 }, text, \"center\");\r\n }\r\n const first = parts.filter((part) => part.column === 0);\r\n const left = box.x - box.width / 2 - gap;\r\n if (this.rowShares[0] !== undefined) {\r\n first.forEach((part) => {\r\n const text = this.rowLabels[part.upper ? 0 : 1] ?? \"\";\r\n brace({ x: left, y: part.y - part.height / 2 }, { x: left, y: part.y + part.height / 2 }, { x: -1, y: 0 }, text, \"right\");\r\n });\r\n }\r\n if (drawn) {\r\n const fill = fillOps.resolve({ type: \"solid\", color: this.labelColor as NormalizedColor });\r\n ctx.draw(runs.stroke({ weight: 2, fill, align: \"center\", cap: \"round\", join: \"round\" }));\r\n }\r\n return labels;\r\n }\r\n}\r\n", "import { AngleMark } from \"./annotate/angle-mark\";\r\nimport { CurlyBrace } from \"./annotate/curly-brace\";\r\nimport { EmphasisMark } from \"./annotate/emphasis-mark\";\r\nimport { CurveArea } from \"./marks/curve-area\";\r\nimport { DropLines } from \"./marks/drop-lines\";\r\nimport { PlotPoint } from \"./marks/plot-point\";\r\nimport { RiemannSum } from \"./marks/riemann-sum\";\r\nimport { TangentLine } from \"./marks/tangent-line\";\r\nimport { VectorArrow } from \"./marks/vector-arrow\";\r\nimport { FunctionPlot } from \"./plots/function-plot\";\r\nimport { PointsPlot } from \"./plots/points-plot\";\r\nimport { StreamLines } from \"./plots/stream-lines\";\r\nimport { TracedPath } from \"./plots/traced-path\";\r\nimport { VectorField } from \"./plots/vector-field\";\r\nimport { Axes2d } from \"./systems/axes2d\";\r\nimport { NumberLine } from \"./systems/number-line\";\r\nimport { NumberPlane } from \"./systems/number-plane\";\r\nimport { PolarPlane } from \"./systems/polar-plane\";\r\nimport { NetworkGraph } from \"./structures/network-graph\";\r\nimport { SampleSpace } from \"./structures/sample-space\";\r\nimport { LatexMatrix } from \"./tex/matrix\";\r\nimport { Latex } from \"./tex/node\";\r\nimport { Axes3d } from \"./three/axes3d\";\r\nimport { CurvePlot3d } from \"./three/curve-plot3d\";\r\nimport { PlotPoint3d } from \"./three/plot-point3d\";\r\nimport { SurfacePlot3d } from \"./three/surface-plot3d\";\r\nimport { VectorArrow3d } from \"./three/vector-arrow3d\";\r\n\r\n/**\r\n * Every node type this package publishes. A host registers them by handing the\r\n * array to an engine (`nodes: NODES`); `@node()` only declares each key. Class\r\n * values rather than side-effect imports, because the package is\r\n * `sideEffects: false` and a document names a type by string.\r\n */\r\nexport const NODES = [\r\n Latex,\r\n LatexMatrix,\r\n NumberLine,\r\n Axes2d,\r\n NumberPlane,\r\n FunctionPlot,\r\n PointsPlot,\r\n PlotPoint,\r\n VectorArrow,\r\n CurveArea,\r\n RiemannSum,\r\n TangentLine,\r\n DropLines,\r\n CurlyBrace,\r\n AngleMark,\r\n EmphasisMark,\r\n Axes3d,\r\n SurfacePlot3d,\r\n CurvePlot3d,\r\n PlotPoint3d,\r\n VectorArrow3d,\r\n PolarPlane,\r\n VectorField,\r\n StreamLines,\r\n TracedPath,\r\n NetworkGraph,\r\n SampleSpace,\r\n];\r\n"],
5
+ "mappings": "i/BAAA,OACI,iBAAAA,GACA,WAAAC,GACA,cAAAC,GACA,QAAAC,GACA,YAAAC,EACA,kBAAAC,OAYG,8VAiCMC,EAAN,cAAyBC,EAAiC,CAqB7D,YAAYC,EAA+C,CACvD,MAAMA,GAAS,CAAA,CAAE,CACrB,CAIA,QAAQC,EAA8D,CAClE,OAAO,KAAK,GAAG,CAAE,KAAMC,EAAOD,EAAK,IAAI,EAAG,SAAUA,EAAK,SAAU,OAAQA,EAAK,MAAM,CAAE,CAC5F,CAES,cAAcE,EAAkB,CACrC,MAAM,cAAcA,CAAM,EACtB,KAAK,aAAe,IAAIA,EAAO,KAAK,KAAK,UAAU,CAC3D,CAEU,OAAOC,EAAa,CAC1B,OAAOC,GAAa,CAChB,OAAQC,GAAgB,KAAK,MAAO,KAAK,OAAO,EAChD,OAAQ,CAACF,EAAK,KAAMA,EAAK,IAAI,EAC7B,KAAAA,EACA,SAAU,KAAK,QAClB,CACL,CAEU,UAAUG,EAAkB,CAClC,IAAMC,EAAS,KAAK,OACd,CAAE,MAAAC,EAAO,IAAAC,CAAG,EAAK,KACjB,CAACC,EAAKC,CAAG,EAAIL,EAAI,OACjBM,EAAON,EAAI,QAAQI,EAAK,CAAC,EACzBG,EAAKP,EAAI,QAAQK,EAAK,CAAC,EACvBG,EAAsB,CAAA,EACxBP,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B9D,CAAW,ECvCjB,IAAM+D,GAAQ,CACjBC,GACAC,GACAC,EACAC,GACAC,EACAC,GACAC,GACAC,EACAC,GACAC,GACAC,EACAC,GACAC,GACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,GACAC,GACAC,EACAC,GACAC,GACAC,GACAC,EACAC",
6
+ "names": ["colorProperty", "command", "Graphics2D", "node", "property", "strokeProperty", "NumberLine", "CoordinateSystem", "props", "args", "stated", "assets", "area", "cartesianMap", "resolveInterval", "map", "stroke", "start", "end", "min", "max", "from", "to", "parts", "Graphics2D", "marks", "ticksFor", "sign", "tickMarks", "labels", "ticked", "value", "at", "drawn", "along", "half", "formatTick", "withoutTips", "drawLabels", "__decorate", "property", "readInterval", "lerpInterval", "colorProperty", "AXIS_COLOR", "strokeProperty", "command", "node", "command", "Graphics2D", "node", "property", "strokeProperty", "NumberPlane", "Axes2d", "props", "args", "stated", "area", "flat", "map", "isIdentityMatrix", "transformedMap", "source", "blend", "to", "warpOf", "warpedMap", "from", "start", "x", "y", "out", "STAY", "parts", "gx", "gy", "ghost", "end", "xMin", "xMax", "yMin", "yMax", "lines", "values", "vertical", "g", "Graphics2D", "value", "lineThrough", "minor", "divisions", "between", "axis", "min", "max", "step", "base", "i", "xs", "ys", "major", "__decorate", "property", "strokeProperty", "readMatrix", "lerpMatrix", "readSource", "lerpSource", "AXIS_COLOR", "command", "node", "STAY", "x", "y", "out", "warpOf", "source", "field", "parseField", "fieldParams", "gx", "gy", "wx", "wy", "command", "node", "property", "strokeProperty", "lerpPoints", "from", "to", "t", "count", "out", "i", "a", "b", "SMOOTH_STEPS", "PointsPlot", "Mark", "props", "args", "stated", "map", "shift", "pixels", "p", "spline", "__decorate", "property", "strokeProperty", "PLOT_COLOR", "command", "node", "SYSTEMS", "spline", "points", "closed", "n", "at", "i", "out", "spans", "p0", "p1", "p2", "p3", "s", "SMOOTH_STEPS", "t", "t2", "t3", "colorProperty", "fillProperty", "Graphics2D", "node", "PaintNode", "property", "withdraw", "PlotPoint", "PaintNode", "props", "x", "y", "height", "curveOf", "assets", "declareFormulas", "size", "Graphics2D", "ctx", "gap", "side", "horizontal", "label", "style", "part", "drawLabels", "__decorate", "property", "colorProperty", "fillProperty", "node", "SYSTEMS_AND_PLOT", "withdraw", "OUTLINE_TRIM", "command", "node", "property", "strokeProperty", "vector2Property", "withdraw", "BEND_STEP", "VectorArrow", "Mark", "props", "args", "stated", "map", "shift", "a", "b", "sweep", "chord", "radius", "side", "reach", "cx", "cy", "from", "steps", "run", "i", "angle", "prop", "at", "__decorate", "vector2Property", "property", "strokeProperty", "command", "node", "SYSTEMS", "withdraw", "FILL_PAINT", "command", "fillProperty", "node", "property", "withdraw", "CurveArea", "Mark", "props", "args", "stated", "map", "top", "curveOf", "floor", "curveNamed", "yMin", "yMax", "a", "b", "width", "steps", "height", "value", "clamp", "upper", "lower", "i", "x", "__decorate", "property", "readInterval", "lerpInterval", "fillProperty", "PLOT_COLOR", "command", "node", "SYSTEMS", "withdraw", "STROKE_PAINT", "OUTLINE_TRIM", "command", "fillProperty", "node", "property", "strokeProperty", "withdraw", "MAX_RECTANGLES", "RiemannSum", "Mark", "props", "args", "stated", "map", "plot", "curveOf", "a", "b", "dx", "yMin", "yMax", "base", "clamp", "at", "count", "runs", "i", "left", "right", "value", "height", "__decorate", "property", "readInterval", "lerpInterval", "fillProperty", "PLOT_COLOR", "strokeProperty", "command", "node", "SYSTEMS", "withdraw", "OUTLINE_TRIM", "node", "property", "strokeProperty", "withdraw", "SLOPE_STEP", "TangentLine", "Mark", "props", "plot", "curveOf", "slopeAt", "map", "x", "y", "half", "y2", "a", "b", "span", "reach", "ux", "uy", "mx", "my", "secant", "xMin", "xMax", "h", "before", "after", "p", "__decorate", "property", "strokeProperty", "node", "withdraw", "FILL_PAINT", "slopeAt", "plot", "x", "h", "node", "property", "strokeProperty", "withdraw", "DropLines", "Mark", "props", "map", "x", "plot", "curveOf", "y", "at", "runs", "clamp", "__decorate", "property", "strokeProperty", "AXIS_COLOR", "node", "SYSTEMS_AND_PLOT", "withdraw", "FILL_PAINT", "colorProperty", "node", "property", "strokeProperty", "vector2Property", "EDGE", "CurlyBrace", "FollowMark", "props", "assets", "declareFormulas", "followed", "quad", "from", "to", "out", "braceOutline", "ctx", "reach", "heading", "at", "add", "between", "align", "style", "part", "drawLabels", "i", "j", "unit", "prop", "__decorate", "property", "vector2Property", "colorProperty", "strokeProperty", "node", "colorProperty", "command", "Graphics2D", "node", "PaintNode", "pathOps", "property", "strokeProperty", "withdraw", "OWN_FRAME", "ARC_STEP", "RIGHT_SLOP", "point", "radius", "degrees", "turn", "AngleMark", "PaintNode", "props", "args", "stated", "assets", "declareFormulas", "data", "Graphics2D", "ctx", "text", "at", "style", "part", "drawLabels", "ink", "pathOps", "fromAngle", "toAngle", "sweep", "side", "a", "b", "steps", "out", "i", "p", "__decorate", "property", "colorProperty", "strokeProperty", "command", "node", "withdraw", "FILL_PAINT", "node", "property", "strokeProperty", "QUARTER", "line", "a", "b", "SHAPES", "quad", "gap", "tl", "tr", "br", "bl", "grown", "p", "centre", "between", "across", "up", "at", "u", "add", "arc", "c1", "c2", "end", "k", "start", "down", "heading", "EmphasisMark", "FollowMark", "props", "__decorate", "property", "strokeProperty", "node", "Canvas3D", "colorProperty", "command", "Geo", "Graphics3D", "Mat", "node", "property", "UNIT_AS_PIXELS", "ALONG", "TICK_ALONG", "Axes3d", "Canvas3D", "props", "args", "stated", "assets", "xRange", "yRange", "zRange", "xLength", "yLength", "zLength", "key", "graphSpace", "scene", "space", "g3", "Graphics3D", "ranges", "lengths", "steps", "titles", "cross", "clamp", "at", "axis", "value", "shift", "point", "local", "moved", "by", "thickness", "tickSize", "paint", "Mat", "style", "tipLength", "marks", "plane", "min", "max", "length", "from", "to", "Geo", "ticks", "ticksFor", "side", "drawLabel3D", "formatTick", "other", "a", "b", "__decorate", "property", "readInterval", "lerpInterval", "colorProperty", "AXIS_COLOR", "command", "node", "colorOps", "command", "Geo", "Graphics3D", "Mat", "Mesh3D", "node", "property", "SurfacePlot3d", "Mesh3D", "props", "PLOT_COLOR", "args", "stated", "x", "y", "source", "blend", "value", "from", "space", "spaceOf", "z", "height", "sample", "scale", "point", "low", "high", "Geo", "u", "v", "_u", "_v", "position", "colorAt", "revisionOf", "own", "scaled", "g3", "Graphics3D", "lines", "op", "mapMaterials", "material", "color", "colorOps", "shadow", "Mat", "equation", "equationOf", "scopeFor", "surfaceParams", "to", "start", "out", "params", "u0", "u1", "v0", "v1", "a", "b", "finite", "x0", "x1", "y0", "y1", "clamp", "floor", "count", "steps", "key", "at", "i", "fixed", "j", "__decorate", "property", "readSource", "lerpSource", "lerpDomain", "lerpParams", "readScale", "lerpScale", "command", "node", "equationOf", "source", "equation", "parseSurface", "surfaceParams", "finite", "value", "mapMaterials", "material", "change", "command", "Geo", "Mesh3D", "node", "property", "CurvePlot3d", "Mesh3D", "props", "PLOT_COLOR", "args", "stated", "space", "spaceOf", "points", "Geo", "source", "blend", "start", "clamp", "end", "samples", "key", "to", "from", "steps", "a", "b", "i", "u", "equation", "equationOf", "params", "scopeFor", "spaceCurveParams", "t0", "t1", "x", "y", "z", "out", "t", "__decorate", "property", "readSource", "lerpSource", "lerpDomain", "lerpParams", "command", "node", "equationOf", "source", "equation", "parseSpaceCurve", "spaceCurveParams", "colorProperty", "Geo", "Mesh3D", "node", "property", "PlotPoint3d", "Mesh3D", "props", "assets", "Geo", "g3", "drawLabel3D", "__decorate", "property", "colorProperty", "node", "command", "Graphics3D", "lerpVector3", "Mesh3D", "node", "property", "resolveVector3", "VectorArrow3d", "Mesh3D", "props", "args", "stated", "g3", "Graphics3D", "space", "spaceOf", "tail", "head", "thickness", "from", "to", "along", "length", "paint", "quaternion", "aim", "tipLength", "shaft", "at", "distance", "__decorate", "property", "resolveVector3", "lerpVector3", "command", "node", "colorProperty", "command", "Graphics2D", "node", "property", "strokeProperty", "LABEL_ROOM", "PolarPlane", "CoordinateSystem", "props", "args", "stated", "assets", "area", "width", "height", "unit", "cartesianMap", "map", "stroke", "grid", "start", "end", "radius", "centre", "reach", "at", "r", "degrees", "angle", "ring", "g", "size", "parts", "marks", "ticksFor", "rings", "count", "turns", "_", "i", "inner", "Graphics2D", "labels", "p", "formatTick", "cos", "sin", "radians", "drawLabels", "__decorate", "property", "strokeProperty", "AXIS_COLOR", "colorProperty", "command", "node", "radians", "degrees", "numerator", "denominator", "a", "b", "top", "node", "property", "strokeProperty", "MAX_ARROWS", "HEAD_SHARE", "HEAD_MAX", "HEAD_ANGLE", "VectorField", "FieldMark", "props", "map", "field", "x0", "x1", "y0", "y1", "spacing", "count", "drawn", "v", "longest", "i", "j", "gx", "gy", "magnitude", "length", "hx", "hy", "tail", "head", "arrow", "__decorate", "property", "strokeProperty", "PLOT_COLOR", "node", "SYSTEMS", "arrow", "tail", "head", "dx", "dy", "length", "barb", "HEAD_SHARE", "HEAD_MAX", "back", "at", "angle", "HEAD_ANGLE", "command", "node", "property", "strokeProperty", "MAX_LINES", "STEPS_PER_SPACING", "MAX_STEPS", "StreamLines", "FieldMark", "props", "args", "stated", "map", "field", "x0", "x1", "y0", "y1", "spacing", "count", "step", "steps", "inside", "x", "y", "window", "clamp", "drawn", "index", "i", "j", "line", "follow", "shown", "stretch", "stagger", "p", "__decorate", "property", "strokeProperty", "PLOT_COLOR", "command", "node", "SYSTEMS", "follow", "field", "x", "y", "step", "steps", "inside", "points", "v", "strength", "read", "heading", "px", "py", "out", "magnitude", "a", "b", "i", "stretch", "share", "phase", "end", "from", "to", "last", "stagger", "index", "mixed", "command", "node", "property", "withdraw", "TracedPath", "FunctionPlot", "props", "args", "stated", "from", "value", "tail", "kept", "__decorate", "property", "command", "node", "SYSTEMS", "withdraw", "OUTLINE_TRIM", "colorProperty", "command", "fillProperty", "Graphics2D", "node", "PaintNode", "property", "strokeProperty", "readVertices", "value", "name", "readEdges", "edge", "from", "to", "readPositions", "at", "n", "entry", "BOW", "NetworkGraph", "PaintNode", "props", "args", "t", "part", "fill", "withPartFill", "assets", "declareFormulas", "width", "height", "room", "halfX", "halfY", "out", "p", "q", "ctx", "points", "parts", "layout", "vertices", "edges", "key", "placed", "layOut", "vertex", "x", "y", "stroke", "r", "links", "pairs", "plain", "Graphics2D", "drawnPlain", "a", "b", "run", "loop", "paint", "own", "g", "layers", "layer", "partPaint", "outline", "labels", "disc", "drawLabels", "__decorate", "property", "GRAPH_LAYOUTS", "strokeProperty", "colorProperty", "readPartFills", "lerpPartFills", "fillProperty", "command", "node", "edge", "a", "b", "r", "bow", "dx", "dy", "length", "ux", "uy", "mid", "run", "i", "t", "outside", "p", "c", "loop", "radius", "cy", "angle", "colorProperty", "command", "fillOps", "Graphics2D", "node", "PaintNode", "property", "strokeProperty", "withdraw", "PALETTE", "LOWER", "readShares", "value", "share", "lerpShares", "from", "to", "t", "SampleSpace", "PaintNode", "props", "args", "data", "assets", "declareFormulas", "box", "shares", "total", "sum", "out", "left", "column", "width", "p", "cut", "top", "upper", "h", "ctx", "parts", "fills", "stroke", "labels", "part", "base", "fillOps", "paint", "layer", "g", "Graphics2D", "formatTick", "style", "drawLabels", "height", "room", "below", "label", "reach", "gap", "runs", "drawn", "brace", "text", "align", "braceOutline", "mid", "far", "bottom", "first", "fill", "__decorate", "property", "readFillScale", "lerpFillScale", "colorProperty", "strokeProperty", "command", "node", "withdraw", "FILL_PAINT", "OUTLINE_TRIM", "NODES", "Latex", "LatexMatrix", "NumberLine", "Axes2d", "NumberPlane", "FunctionPlot", "PointsPlot", "PlotPoint", "VectorArrow", "CurveArea", "RiemannSum", "TangentLine", "DropLines", "CurlyBrace", "AngleMark", "EmphasisMark", "Axes3d", "SurfacePlot3d", "CurvePlot3d", "PlotPoint3d", "VectorArrow3d", "PolarPlane", "VectorField", "StreamLines", "TracedPath", "NetworkGraph", "SampleSpace"]
7
+ }