@motionscript/math 0.1.0-alpha.5 → 0.1.0-alpha.6

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 (233) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +39 -33
  3. package/dist/annotate/angle-mark.d.ts +52 -27
  4. package/dist/annotate/angle-mark.d.ts.map +1 -1
  5. package/dist/annotate/angle-mark.js +80 -115
  6. package/dist/annotate/angle-mark.js.map +1 -1
  7. package/dist/annotate/curly-brace.d.ts +59 -25
  8. package/dist/annotate/curly-brace.d.ts.map +1 -1
  9. package/dist/annotate/curly-brace.js +85 -100
  10. package/dist/annotate/curly-brace.js.map +1 -1
  11. package/dist/annotate/emphasis-mark.d.ts +43 -9
  12. package/dist/annotate/emphasis-mark.d.ts.map +1 -1
  13. package/dist/annotate/emphasis-mark.js +33 -34
  14. package/dist/annotate/emphasis-mark.js.map +1 -1
  15. package/dist/browser/chunks/chunk-ABYBW64J.js +2 -0
  16. package/dist/browser/chunks/chunk-ABYBW64J.js.map +7 -0
  17. package/dist/browser/chunks/chunk-K77KLQX4.js +2 -0
  18. package/dist/browser/chunks/chunk-K77KLQX4.js.map +7 -0
  19. package/dist/browser/index.js +1 -1
  20. package/dist/browser/index.js.map +3 -3
  21. package/dist/browser/kit.js +1 -1
  22. package/dist/browser/manifest.json +1 -1
  23. package/dist/browser/tex.js +1 -1
  24. package/dist/browser/tex.js.map +2 -2
  25. package/dist/engine.d.ts +26 -19
  26. package/dist/engine.d.ts.map +1 -1
  27. package/dist/engine.js +17 -14
  28. package/dist/engine.js.map +1 -1
  29. package/dist/kit/component.d.ts +51 -0
  30. package/dist/kit/component.d.ts.map +1 -0
  31. package/dist/kit/component.js +30 -0
  32. package/dist/kit/component.js.map +1 -0
  33. package/dist/kit/curve.d.ts +22 -11
  34. package/dist/kit/curve.d.ts.map +1 -1
  35. package/dist/kit/curve.js +25 -18
  36. package/dist/kit/curve.js.map +1 -1
  37. package/dist/kit/field-mark.d.ts +58 -35
  38. package/dist/kit/field-mark.d.ts.map +1 -1
  39. package/dist/kit/field-mark.js +100 -120
  40. package/dist/kit/field-mark.js.map +1 -1
  41. package/dist/kit/follow.d.ts +67 -29
  42. package/dist/kit/follow.d.ts.map +1 -1
  43. package/dist/kit/follow.js +114 -110
  44. package/dist/kit/follow.js.map +1 -1
  45. package/dist/kit/furniture.d.ts +3 -1
  46. package/dist/kit/furniture.d.ts.map +1 -1
  47. package/dist/kit/furniture.js +5 -0
  48. package/dist/kit/furniture.js.map +1 -1
  49. package/dist/kit/graph.d.ts +46 -0
  50. package/dist/kit/graph.d.ts.map +1 -0
  51. package/dist/kit/graph.js +90 -0
  52. package/dist/kit/graph.js.map +1 -0
  53. package/dist/kit/mark.d.ts +64 -39
  54. package/dist/kit/mark.d.ts.map +1 -1
  55. package/dist/kit/mark.js +80 -96
  56. package/dist/kit/mark.js.map +1 -1
  57. package/dist/kit/place.d.ts +10 -8
  58. package/dist/kit/place.d.ts.map +1 -1
  59. package/dist/kit/place.js +28 -30
  60. package/dist/kit/place.js.map +1 -1
  61. package/dist/kit/system.d.ts +27 -29
  62. package/dist/kit/system.d.ts.map +1 -1
  63. package/dist/kit/system.js +62 -58
  64. package/dist/kit/system.js.map +1 -1
  65. package/dist/kit/withdrawn.d.ts +3 -3
  66. package/dist/kit/withdrawn.js +3 -3
  67. package/dist/kit/withdrawn.js.map +1 -1
  68. package/dist/marks/curve-area.d.ts +24 -18
  69. package/dist/marks/curve-area.d.ts.map +1 -1
  70. package/dist/marks/curve-area.js +50 -73
  71. package/dist/marks/curve-area.js.map +1 -1
  72. package/dist/marks/drop-lines.d.ts +28 -10
  73. package/dist/marks/drop-lines.d.ts.map +1 -1
  74. package/dist/marks/drop-lines.js +37 -52
  75. package/dist/marks/drop-lines.js.map +1 -1
  76. package/dist/marks/plot-point.d.ts +37 -20
  77. package/dist/marks/plot-point.d.ts.map +1 -1
  78. package/dist/marks/plot-point.js +65 -91
  79. package/dist/marks/plot-point.js.map +1 -1
  80. package/dist/marks/riemann-sum.d.ts +30 -26
  81. package/dist/marks/riemann-sum.d.ts.map +1 -1
  82. package/dist/marks/riemann-sum.js +57 -85
  83. package/dist/marks/riemann-sum.js.map +1 -1
  84. package/dist/marks/tangent-line.d.ts +38 -14
  85. package/dist/marks/tangent-line.d.ts.map +1 -1
  86. package/dist/marks/tangent-line.js +73 -87
  87. package/dist/marks/tangent-line.js.map +1 -1
  88. package/dist/marks/vector-arrow.d.ts +30 -20
  89. package/dist/marks/vector-arrow.d.ts.map +1 -1
  90. package/dist/marks/vector-arrow.js +58 -78
  91. package/dist/marks/vector-arrow.js.map +1 -1
  92. package/dist/nodes.d.ts +13 -5
  93. package/dist/nodes.d.ts.map +1 -1
  94. package/dist/nodes.js +0 -6
  95. package/dist/nodes.js.map +1 -1
  96. package/dist/plots/function-plot.d.ts +107 -43
  97. package/dist/plots/function-plot.d.ts.map +1 -1
  98. package/dist/plots/function-plot.js +146 -177
  99. package/dist/plots/function-plot.js.map +1 -1
  100. package/dist/plots/points-plot.d.ts +34 -19
  101. package/dist/plots/points-plot.d.ts.map +1 -1
  102. package/dist/plots/points-plot.js +31 -58
  103. package/dist/plots/points-plot.js.map +1 -1
  104. package/dist/plots/stream-lines.d.ts +38 -19
  105. package/dist/plots/stream-lines.d.ts.map +1 -1
  106. package/dist/plots/stream-lines.js +60 -79
  107. package/dist/plots/stream-lines.js.map +1 -1
  108. package/dist/plots/traced-path.d.ts +34 -15
  109. package/dist/plots/traced-path.d.ts.map +1 -1
  110. package/dist/plots/traced-path.js +33 -48
  111. package/dist/plots/traced-path.js.map +1 -1
  112. package/dist/plots/vector-field.d.ts +31 -11
  113. package/dist/plots/vector-field.d.ts.map +1 -1
  114. package/dist/plots/vector-field.js +50 -64
  115. package/dist/plots/vector-field.js.map +1 -1
  116. package/dist/structures/network-graph.d.ts +99 -49
  117. package/dist/structures/network-graph.d.ts.map +1 -1
  118. package/dist/structures/network-graph.js +168 -217
  119. package/dist/structures/network-graph.js.map +1 -1
  120. package/dist/structures/sample-space.d.ts +69 -38
  121. package/dist/structures/sample-space.d.ts.map +1 -1
  122. package/dist/structures/sample-space.js +132 -170
  123. package/dist/structures/sample-space.js.map +1 -1
  124. package/dist/systems/axes2d.d.ts +126 -37
  125. package/dist/systems/axes2d.d.ts.map +1 -1
  126. package/dist/systems/axes2d.js +147 -183
  127. package/dist/systems/axes2d.js.map +1 -1
  128. package/dist/systems/number-line.d.ts +51 -28
  129. package/dist/systems/number-line.d.ts.map +1 -1
  130. package/dist/systems/number-line.js +82 -118
  131. package/dist/systems/number-line.js.map +1 -1
  132. package/dist/systems/number-plane.d.ts +92 -31
  133. package/dist/systems/number-plane.d.ts.map +1 -1
  134. package/dist/systems/number-plane.js +142 -149
  135. package/dist/systems/number-plane.js.map +1 -1
  136. package/dist/systems/polar-plane.d.ts +47 -26
  137. package/dist/systems/polar-plane.d.ts.map +1 -1
  138. package/dist/systems/polar-plane.js +107 -133
  139. package/dist/systems/polar-plane.js.map +1 -1
  140. package/dist/tex/index.d.ts.map +1 -1
  141. package/dist/tex/index.js +1 -0
  142. package/dist/tex/index.js.map +1 -1
  143. package/dist/tex/matrix.d.ts +56 -18
  144. package/dist/tex/matrix.d.ts.map +1 -1
  145. package/dist/tex/matrix.js +33 -50
  146. package/dist/tex/matrix.js.map +1 -1
  147. package/dist/tex/node.d.ts +55 -201
  148. package/dist/tex/node.d.ts.map +1 -1
  149. package/dist/tex/node.js +23 -593
  150. package/dist/tex/node.js.map +1 -1
  151. package/dist/tex/typeset.d.ts +133 -0
  152. package/dist/tex/typeset.d.ts.map +1 -0
  153. package/dist/tex/typeset.js +403 -0
  154. package/dist/tex/typeset.js.map +1 -0
  155. package/dist/three/axes3d.d.ts +140 -54
  156. package/dist/three/axes3d.d.ts.map +1 -1
  157. package/dist/three/axes3d.js +159 -204
  158. package/dist/three/axes3d.js.map +1 -1
  159. package/dist/three/curve-plot3d.d.ts +70 -42
  160. package/dist/three/curve-plot3d.d.ts.map +1 -1
  161. package/dist/three/curve-plot3d.js +97 -132
  162. package/dist/three/curve-plot3d.js.map +1 -1
  163. package/dist/three/entries.d.ts +17 -0
  164. package/dist/three/entries.d.ts.map +1 -0
  165. package/dist/three/entries.js +15 -0
  166. package/dist/three/entries.js.map +1 -0
  167. package/dist/three/plot-point3d.d.ts +57 -12
  168. package/dist/three/plot-point3d.d.ts.map +1 -1
  169. package/dist/three/plot-point3d.js +27 -53
  170. package/dist/three/plot-point3d.js.map +1 -1
  171. package/dist/three/space.d.ts +17 -2
  172. package/dist/three/space.d.ts.map +1 -1
  173. package/dist/three/space.js +19 -8
  174. package/dist/three/space.js.map +1 -1
  175. package/dist/three/surface-plot3d.d.ts +131 -49
  176. package/dist/three/surface-plot3d.d.ts.map +1 -1
  177. package/dist/three/surface-plot3d.js +227 -261
  178. package/dist/three/surface-plot3d.js.map +1 -1
  179. package/dist/three/vector-arrow3d.d.ts +58 -16
  180. package/dist/three/vector-arrow3d.d.ts.map +1 -1
  181. package/dist/three/vector-arrow3d.js +48 -67
  182. package/dist/three/vector-arrow3d.js.map +1 -1
  183. package/package.json +4 -4
  184. package/src/annotate/angle-mark.ts +95 -105
  185. package/src/annotate/curly-brace.ts +107 -85
  186. package/src/annotate/emphasis-mark.ts +55 -26
  187. package/src/engine.ts +35 -21
  188. package/src/kit/component.ts +57 -0
  189. package/src/kit/curve.ts +38 -20
  190. package/src/kit/field-mark.ts +124 -108
  191. package/src/kit/follow.ts +146 -120
  192. package/src/kit/furniture.ts +6 -1
  193. package/src/kit/graph.ts +116 -0
  194. package/src/kit/mark.ts +135 -114
  195. package/src/kit/place.ts +32 -56
  196. package/src/kit/system.ts +77 -71
  197. package/src/kit/withdrawn.ts +3 -3
  198. package/src/marks/curve-area.ts +65 -65
  199. package/src/marks/drop-lines.ts +50 -42
  200. package/src/marks/plot-point.ts +77 -82
  201. package/src/marks/riemann-sum.ts +73 -72
  202. package/src/marks/tangent-line.ts +87 -71
  203. package/src/marks/vector-arrow.ts +73 -73
  204. package/src/nodes.ts +41 -5
  205. package/src/plots/function-plot.ts +155 -171
  206. package/src/plots/points-plot.ts +46 -50
  207. package/src/plots/stream-lines.ts +75 -66
  208. package/src/plots/traced-path.ts +51 -33
  209. package/src/plots/vector-field.ts +68 -49
  210. package/src/structures/network-graph.ts +168 -185
  211. package/src/structures/sample-space.ts +149 -148
  212. package/src/systems/axes2d.ts +165 -156
  213. package/src/systems/number-line.ts +91 -92
  214. package/src/systems/number-plane.ts +149 -120
  215. package/src/systems/polar-plane.ts +117 -116
  216. package/src/tex/index.ts +2 -1
  217. package/src/tex/matrix.ts +62 -40
  218. package/src/tex/node.ts +54 -621
  219. package/src/tex/typeset.ts +461 -0
  220. package/src/three/axes3d.ts +182 -161
  221. package/src/three/curve-plot3d.ts +107 -110
  222. package/src/three/entries.ts +42 -0
  223. package/src/three/plot-point3d.ts +42 -45
  224. package/src/three/space.ts +34 -9
  225. package/src/three/surface-plot3d.ts +312 -323
  226. package/src/three/vector-arrow3d.ts +65 -54
  227. package/dist/browser/chunks/chunk-3GJB6AVO.js +0 -2
  228. package/dist/browser/chunks/chunk-3GJB6AVO.js.map +0 -7
  229. package/dist/browser/chunks/chunk-D5WHCVBC.js +0 -2
  230. package/dist/browser/chunks/chunk-D5WHCVBC.js.map +0 -7
  231. package/dist/browser/chunks/chunk-WL4KEX7Y.js +0 -2
  232. package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +0 -7
  233. package/src/kit/placement.ts +0 -8
@@ -1,6 +1,5 @@
1
- import { type NodeConfig, type Stroke } from "@motionscript/sdk";
2
- import type { CoordinateMap } from "../kit/coords.js";
3
- import { FieldMark, type FieldProps, type FieldSampler, type FieldStroke } from "../kit/field-mark.js";
1
+ import { type NodeOf, type Fill as _Fill, type FillResolved as _FillResolved, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved } from "@motionscript/sdk";
2
+ import { type FieldProps } from "../kit/field-mark.js";
4
3
  export interface VectorFieldProps extends FieldProps {
5
4
  spacing?: number;
6
5
  arrowScale?: number;
@@ -10,14 +9,35 @@ export interface VectorFieldProps extends FieldProps {
10
9
  * Each arrow is centred on its point and is as long as the field is strong
11
10
  * there, up to the spacing.
12
11
  */
13
- export declare class VectorField extends FieldMark<VectorFieldProps> {
12
+ export declare const VectorField: import("@motionscript/sdk").Component<"vectorField", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
14
13
  /** How far apart the arrows stand, in graph units. */
15
- spacing: number;
14
+ spacing: import("@motionscript/sdk").Type<number, number, false>;
16
15
  /** How long an arrow is drawn for a vector of length one, in graph units. */
17
- arrowScale: number;
18
- stroke: Stroke;
19
- constructor(props?: NodeConfig<VectorField, VectorFieldProps>);
20
- protected own(): string;
21
- protected strokes(map: CoordinateMap, field: FieldSampler): FieldStroke[];
22
- }
16
+ arrowScale: import("@motionscript/sdk").Type<number, number, false>;
17
+ expression: import("@motionscript/sdk").Type<string | import("../index.js").PlotSource, import("../index.js").PlotSource, false>;
18
+ params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
19
+ strengthFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
20
+ maxMagnitude: import("@motionscript/sdk").Type<number, number, false>;
21
+ graph: import("@motionscript/sdk").Type<import("../index.js").GraphPlane | null, import("../index.js").GraphPlane | null, true>;
22
+ stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
23
+ shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
24
+ }>, {
25
+ morphTo: readonly ["expression"];
26
+ paramsTo: readonly ["params"];
27
+ strokeTo: readonly ["stroke"];
28
+ shadowTo: readonly ["shadow"];
29
+ }, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
30
+ /** How far apart the arrows stand, in graph units. */
31
+ spacing: import("@motionscript/sdk").Type<number, number, false>;
32
+ /** How long an arrow is drawn for a vector of length one, in graph units. */
33
+ arrowScale: import("@motionscript/sdk").Type<number, number, false>;
34
+ expression: import("@motionscript/sdk").Type<string | import("../index.js").PlotSource, import("../index.js").PlotSource, false>;
35
+ params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
36
+ strengthFills: import("@motionscript/sdk").Type<_Fill[], _FillResolved[][], false>;
37
+ maxMagnitude: import("@motionscript/sdk").Type<number, number, false>;
38
+ graph: import("@motionscript/sdk").Type<import("../index.js").GraphPlane | null, import("../index.js").GraphPlane | null, true>;
39
+ stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
40
+ shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
41
+ }>, null>>;
42
+ export type VectorField = NodeOf<typeof VectorField>;
23
43
  //# sourceMappingURL=vector-field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vector-field.d.ts","sourceRoot":"","sources":["../../src/plots/vector-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,UAAU,EAAE,KAAK,MAAM,EAAgB,MAAM,mBAAmB,CAAC;AAC/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIpG,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AASD;;;;GAIG;AACH,qBAQa,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACxD,sDAAsD;IACE,OAAO,EAAE,MAAM,CAAC;IACxE,6EAA6E;IACrB,UAAU,EAAE,MAAM,CAAC;IAGnE,MAAM,EAAE,MAAM,CAAC;gBAEX,KAAK,CAAC,EAAE,UAAU,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAI7D,SAAS,CAAC,GAAG,IAAI,MAAM;IAIvB,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,GAAG,WAAW,EAAE;CA2B5E"}
1
+ {"version":3,"file":"vector-field.d.ts","sourceRoot":"","sources":["../../src/plots/vector-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,MAAM,EAGX,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACzC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAyE,KAAK,UAAU,EAAyD,MAAM,mBAAmB,CAAC;AAIlL,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA6BD;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAvBpB,sDAAsD;;IAEtD,6EAA6E;;;;;;;;;;;;;;;IAF7E,sDAAsD;;IAEtD,6EAA6E;;;;;;;;;UA4BX,CAAC;AAEvE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -1,81 +1,67 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { node, property, strokeProperty } from "@motionscript/sdk";
8
- import { FieldMark } from "../kit/field-mark.js";
1
+ import { component2d, Types, } from "@motionscript/sdk";
2
+ import { drawField, FIELD_COMMANDS, FIELD_STATE, traceField } from "../kit/field-mark.js";
9
3
  import { PLOT_COLOR } from "../kit/furniture.js";
10
- import { SYSTEMS } from "../kit/placement.js";
4
+ import { inkSize, reading, traced } from "../kit/mark.js";
11
5
  /** Past this many arrows the spacing is widened, so a field over a huge range is still a field and not a wash. */
12
6
  const MAX_ARROWS = 2400;
13
7
  /** An arrow's head, as a share of its length and in pixels at most, and the half-angle it opens to. */
14
8
  const HEAD_SHARE = 0.38;
15
9
  const HEAD_MAX = 11;
16
10
  const HEAD_ANGLE = (26 * Math.PI) / 180;
11
+ const state = {
12
+ ...FIELD_STATE,
13
+ /** How far apart the arrows stand, in graph units. */
14
+ spacing: Types.number(1, { min: 0.01, step: 0.1 }),
15
+ /** How long an arrow is drawn for a vector of length one, in graph units. */
16
+ arrowScale: Types.number(0.4, { min: 0, step: 0.05 }),
17
+ };
18
+ const ARROWS = {
19
+ own: (s) => `${s.spacing}|${s.arrowScale}`,
20
+ strokes: (s, map, field) => arrows(s, map, field),
21
+ };
22
+ const traceArrows = (s, read) => traceField("vectorField", ARROWS, s, read);
17
23
  /**
18
24
  * A grid of arrows showing a vector field, two parts in x and y: `(-y, x)`.
19
25
  * Each arrow is centred on its point and is as long as the field is strong
20
26
  * there, up to the spacing.
21
27
  */
22
- let VectorField = class VectorField extends FieldMark {
23
- constructor(props) {
24
- super(props ?? {});
25
- }
26
- own() {
27
- return `${this.spacing}|${this.arrowScale}`;
28
- }
29
- strokes(map, field) {
30
- const [x0, x1] = map.xRange;
31
- const [y0, y1] = map.yRange;
32
- let spacing = Math.max(this.spacing, 1e-6);
33
- const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);
34
- while (count() > MAX_ARROWS)
35
- spacing *= 2;
36
- const drawn = [];
37
- const v = { x: 0, y: 0 };
38
- const longest = spacing * 0.9;
39
- for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {
40
- for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {
41
- const gx = i * spacing;
42
- const gy = j * spacing;
43
- if (!field(gx, gy, v))
44
- continue;
45
- const magnitude = Math.hypot(v.x, v.y);
46
- const length = Math.min(magnitude * this.arrowScale, longest);
47
- if (!(length > 0))
48
- continue;
49
- const hx = ((v.x / magnitude) * length) / 2;
50
- const hy = ((v.y / magnitude) * length) / 2;
51
- const tail = map.toPoint(gx - hx, gy - hy);
52
- const head = map.toPoint(gx + hx, gy + hy);
53
- drawn.push({ runs: arrow(tail, head), magnitude });
54
- }
28
+ export const VectorField = traced(component2d({
29
+ key: "vectorField",
30
+ state,
31
+ defaults: { stroke: { weight: 2.5, fill: PLOT_COLOR, align: "center", cap: "round", join: "round" }, width: "hug", height: "hug" },
32
+ commands: FIELD_COMMANDS,
33
+ measure: (_measurer, s) => inkSize(traceArrows(s, reading(s)).runs),
34
+ render: (ctx, s) => drawField(ctx, s, traceArrows(s, reading(s))),
35
+ }), (s, read) => traceArrows(s, read).runs);
36
+ function arrows(s, map, field) {
37
+ const [x0, x1] = map.xRange;
38
+ const [y0, y1] = map.yRange;
39
+ let spacing = Math.max(s.spacing, 1e-6);
40
+ const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);
41
+ while (count() > MAX_ARROWS)
42
+ spacing *= 2;
43
+ const drawn = [];
44
+ const v = { x: 0, y: 0 };
45
+ const longest = spacing * 0.9;
46
+ for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {
47
+ for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {
48
+ const gx = i * spacing;
49
+ const gy = j * spacing;
50
+ if (!field(gx, gy, v))
51
+ continue;
52
+ const magnitude = Math.hypot(v.x, v.y);
53
+ const length = Math.min(magnitude * s.arrowScale, longest);
54
+ if (!(length > 0))
55
+ continue;
56
+ const hx = ((v.x / magnitude) * length) / 2;
57
+ const hy = ((v.y / magnitude) * length) / 2;
58
+ const tail = map.toPoint(gx - hx, gy - hy);
59
+ const head = map.toPoint(gx + hx, gy + hy);
60
+ drawn.push({ runs: arrow(tail, head), magnitude });
55
61
  }
56
- return drawn;
57
62
  }
58
- };
59
- __decorate([
60
- property({ default: 1, min: 0.01, step: 0.1 })
61
- ], VectorField.prototype, "spacing", void 0);
62
- __decorate([
63
- property({ default: 0.4, min: 0, step: 0.05 })
64
- ], VectorField.prototype, "arrowScale", void 0);
65
- __decorate([
66
- strokeProperty({ default: { weight: 2.5, fill: PLOT_COLOR, align: "center", cap: "round", join: "round" } })
67
- ], VectorField.prototype, "stroke", void 0);
68
- VectorField = __decorate([
69
- node({
70
- key: "vectorField",
71
- within: SYSTEMS,
72
- parentKey: "shape",
73
- forkable: true,
74
- layout: { children: "freeform", defaultWidthMode: "hug", defaultHeightMode: "hug", acceptsChildren: false },
75
- seed: { expression: "(-y, x)" },
76
- })
77
- ], VectorField);
78
- export { VectorField };
63
+ return drawn;
64
+ }
79
65
  /** A shaft and the two barbs of its head, in pixels. */
80
66
  function arrow(tail, head) {
81
67
  const dx = head.x - tail.x;
@@ -1 +1 @@
1
- {"version":3,"file":"vector-field.js","sourceRoot":"","sources":["../../src/plots/vector-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAA8C,MAAM,mBAAmB,CAAC;AAE/G,OAAO,EAAE,SAAS,EAAwD,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,k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CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1C,MAAM,EAAE,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACpH,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC","sourcesContent":["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"]}
1
+ {"version":3,"file":"vector-field.js","sourceRoot":"","sources":["../../src/plots/vector-field.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,KAAK,GAYR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAA6F,MAAM,mBAAmB,CAAC;AAClL,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AAOzE,kHAAkH;AAClH,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,uGAAuG;AACvG,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,UAAU,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AAExC,MAAM,KAAK,GAAG;IACV,GAAG,WAAW;IACd,sDAAsD;IACtD,OAAO,EAAE,KAAK,CAAC,MAAM,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E,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1C,MAAM,EAAE,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACpH,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import {\r\n component2d,\r\n Types,\r\n type NodeOf,\r\n type Vector2,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Fill as _Fill,\r\n type FillResolved as _FillResolved,\r\n type Node2D as _Node2D,\r\n type Node2DProps as _Node2DProps,\r\n type Shadow as _Shadow,\r\n type ShadowResolved as _ShadowResolved,\r\n type Stroke as _Stroke,\r\n type StrokeResolved as _StrokeResolved,\r\n} from \"@motionscript/sdk\";\r\nimport type { CoordinateMap } from \"../kit/coords\";\r\nimport { drawField, FIELD_COMMANDS, FIELD_STATE, traceField, type FieldDrawing, type FieldProps, type FieldValues, type FieldSampler, type FieldStroke } from \"../kit/field-mark\";\r\nimport { PLOT_COLOR } from \"../kit/furniture\";\r\nimport { inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\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\nconst state = {\r\n ...FIELD_STATE,\r\n /** How far apart the arrows stand, in graph units. */\r\n spacing: Types.number(1, { min: 0.01, step: 0.1 }),\r\n /** How long an arrow is drawn for a vector of length one, in graph units. */\r\n arrowScale: Types.number(0.4, { min: 0, step: 0.05 }),\r\n};\r\n\r\ninterface ArrowsValues extends FieldValues {\r\n readonly spacing: number;\r\n readonly arrowScale: number;\r\n}\r\n\r\nconst ARROWS: FieldDrawing<ArrowsValues> = {\r\n own: (s) => `${s.spacing}|${s.arrowScale}`,\r\n strokes: (s, map, field) => arrows(s, map, field),\r\n};\r\n\r\nconst traceArrows = (s: ArrowsValues, read: MarkReading) => traceField(\"vectorField\", ARROWS, s, read);\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\nexport const VectorField = traced(component2d({\r\n key: \"vectorField\",\r\n state,\r\n defaults: { stroke: { weight: 2.5, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\r\n commands: FIELD_COMMANDS,\r\n measure: (_measurer, s) => inkSize(traceArrows(s, reading(s)).runs),\r\n render: (ctx, s) => drawField(ctx, s, traceArrows(s, reading(s))),\r\n}), (s: ArrowsValues, read: MarkReading) => traceArrows(s, read).runs);\r\n\r\nexport type VectorField = NodeOf<typeof VectorField>;\r\n\r\nfunction arrows(s: ArrowsValues, 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(s.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 * s.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/** 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"]}
@@ -1,5 +1,5 @@
1
- import { PaintNode, type AssetScope, type Color, type Command, type CommandArgs, type Fill, type NodeConfig, type PaintProps, type RenderContext2D, type Stroke, type Vector2 } from "@motionscript/sdk";
2
- import { type PartFill } from "../kit/part-fills.js";
1
+ import { type Color, type Fill, type FillResolved, type NodeOf, type NormalizedColor, type PaintProps, type ShadowResolved, type Size2D, type Stroke, type StrokeResolved, type Values, type Vector2, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Shadow as _Shadow } from "@motionscript/sdk";
2
+ import { type PartFill, type PartFillResolved } from "../kit/part-fills.js";
3
3
  import { type GraphEdge, type GraphLayout } from "./graph-layout.js";
4
4
  /** A vertex placed by hand, in the graph's box from -1 to 1 each way, y up. */
5
5
  export interface GraphPosition {
@@ -22,6 +22,35 @@ export interface NetworkGraphProps extends PaintProps {
22
22
  fontFamily?: string;
23
23
  partFills?: PartFill[];
24
24
  }
25
+ declare const state: {
26
+ vertices: import("@motionscript/sdk").Type<string[], string[], false>;
27
+ edges: import("@motionscript/sdk").Type<GraphEdge[], GraphEdge[], false>;
28
+ /** Draw each edge as an arrow from its `from` to its `to`. */
29
+ directed: import("@motionscript/sdk").Type<boolean, boolean, false>;
30
+ arrangement: import("@motionscript/sdk").Type<GraphLayout, GraphLayout, false>;
31
+ /** The vertex a tree hangs from; left empty, the first. */
32
+ root: import("@motionscript/sdk").Type<string, string, false>;
33
+ /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */
34
+ positions: import("@motionscript/sdk").Type<GraphPosition[], GraphPosition[], false>;
35
+ vertexRadius: import("@motionscript/sdk").Type<number, number, false>;
36
+ vertexStroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
37
+ labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
38
+ labelSize: import("@motionscript/sdk").Type<number, number, false>;
39
+ labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
40
+ fontFamily: import("@motionscript/sdk").Type<string, string, false>;
41
+ /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */
42
+ partFills: import("@motionscript/sdk").Type<PartFill[], PartFillResolved[], false>;
43
+ /** The arrangement an `arrangeTo` is leaving, and how far it is towards the new one. */
44
+ layoutFrom: import("@motionscript/sdk").Type<string, string, true>;
45
+ layoutMix: import("@motionscript/sdk").Type<number, number, true>;
46
+ fill: import("@motionscript/sdk").Attribute<Fill, FillResolved[]>;
47
+ stroke: import("@motionscript/sdk").Attribute<Stroke, StrokeResolved[]>;
48
+ shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
49
+ start: import("@motionscript/sdk").Type<number, number, false>;
50
+ end: import("@motionscript/sdk").Type<number, number, false>;
51
+ };
52
+ /** What a graph is drawn from: its own entries, as its fields and its node both read them. */
53
+ export type GraphValues = Values<typeof state>;
25
54
  /**
26
55
  * Vertices and the edges between them, arranged by a rule: in a circle, by
27
56
  * springs, as a tree from `root`, or in a grid. Its `fill` is the vertices and
@@ -29,55 +58,76 @@ export interface NetworkGraphProps extends PaintProps {
29
58
  * moves every vertex to where another rule places it; `partFillTo` paints a
30
59
  * vertex, or an edge written `a-b`. (`layout` is every node's own box.)
31
60
  */
32
- export declare class NetworkGraph extends PaintNode<NetworkGraphProps> {
33
- vertices: string[];
34
- edges: GraphEdge[];
61
+ export declare const NetworkGraph: import("@motionscript/sdk").Component<"networkGraph", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
62
+ vertices: import("@motionscript/sdk").Type<string[], string[], false>;
63
+ edges: import("@motionscript/sdk").Type<GraphEdge[], GraphEdge[], false>;
35
64
  /** Draw each edge as an arrow from its `from` to its `to`. */
36
- directed: boolean;
37
- arrangement: GraphLayout;
65
+ directed: import("@motionscript/sdk").Type<boolean, boolean, false>;
66
+ arrangement: import("@motionscript/sdk").Type<GraphLayout, GraphLayout, false>;
38
67
  /** The vertex a tree hangs from; left empty, the first. */
39
- root: string;
68
+ root: import("@motionscript/sdk").Type<string, string, false>;
40
69
  /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */
41
- positions: GraphPosition[];
42
- vertexRadius: number;
43
- vertexStroke: Stroke;
44
- labels: boolean;
45
- labelSize: number;
46
- labelColor: Color;
47
- fontFamily: string;
70
+ positions: import("@motionscript/sdk").Type<GraphPosition[], GraphPosition[], false>;
71
+ vertexRadius: import("@motionscript/sdk").Type<number, number, false>;
72
+ vertexStroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
73
+ labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
74
+ labelSize: import("@motionscript/sdk").Type<number, number, false>;
75
+ labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
76
+ fontFamily: import("@motionscript/sdk").Type<string, string, false>;
48
77
  /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */
49
- partFills: PartFill[];
50
- fill: Fill;
51
- stroke: Stroke;
52
- private _layoutFrom;
53
- private _layoutMix;
54
- constructor(props?: NodeConfig<NetworkGraph, NetworkGraphProps>);
55
- /** Move every vertex to where another arrangement places it. */
56
- arrangeTo(args: CommandArgs<{
57
- arrangement: GraphLayout;
58
- }> & {
59
- duration: number;
60
- }): Command<NetworkGraphProps>;
61
- /** Paint one part of the graph: a vertex by its name, or an edge written `a-b`. */
62
- partFillTo(args: CommandArgs<{
63
- part: string;
64
- fill: Fill;
65
- }> & {
66
- duration: number;
67
- }): Command<NetworkGraphProps>;
68
- declareAssets(assets: AssetScope): void;
69
- /** Where each vertex is drawn, in pixels from the node's centre, y up. */
70
- vertexPoints(): Map<string, Vector2>;
71
- protected renderSelf(ctx: RenderContext2D): void;
72
- protected renderStroke(): void;
73
- private _layouts;
74
- /** Each vertex's place under `layout`, from -1 to 1, a hand-placed one where it is. */
75
- private _placed;
76
- private _drawEdges;
77
- private _drawVertices;
78
- /** The vertices drawn: each name once, trimmed, the blank ones left out. */
79
- private _names;
80
- /** The edges drawn: both ends named. */
81
- private _links;
82
- }
78
+ partFills: import("@motionscript/sdk").Type<PartFill[], PartFillResolved[], false>;
79
+ /** The arrangement an `arrangeTo` is leaving, and how far it is towards the new one. */
80
+ layoutFrom: import("@motionscript/sdk").Type<string, string, true>;
81
+ layoutMix: import("@motionscript/sdk").Type<number, number, true>;
82
+ fill: import("@motionscript/sdk").Attribute<Fill, FillResolved[]>;
83
+ stroke: import("@motionscript/sdk").Attribute<Stroke, StrokeResolved[]>;
84
+ shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
85
+ start: import("@motionscript/sdk").Type<number, number, false>;
86
+ end: import("@motionscript/sdk").Type<number, number, false>;
87
+ }>, {
88
+ readonly arrangeTo: {
89
+ readonly arrangement: import("@motionscript/sdk").Type<GraphLayout | undefined, GraphLayout | undefined, false>;
90
+ };
91
+ readonly partFillTo: {
92
+ readonly part: import("@motionscript/sdk").Type<string, string, false>;
93
+ readonly fill: import("@motionscript/sdk").Type<Fill, Fill, false>;
94
+ };
95
+ readonly fillTo: readonly ["fill"];
96
+ readonly strokeTo: readonly ["stroke"];
97
+ readonly shadowTo: readonly ["shadow"];
98
+ readonly progressTo: readonly ["start", "end"];
99
+ readonly flash: {
100
+ readonly portion: import("@motionscript/sdk").Type<number, number, false>;
101
+ };
102
+ }, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
103
+ vertices: import("@motionscript/sdk").Type<string[], string[], false>;
104
+ edges: import("@motionscript/sdk").Type<GraphEdge[], GraphEdge[], false>;
105
+ /** Draw each edge as an arrow from its `from` to its `to`. */
106
+ directed: import("@motionscript/sdk").Type<boolean, boolean, false>;
107
+ arrangement: import("@motionscript/sdk").Type<GraphLayout, GraphLayout, false>;
108
+ /** The vertex a tree hangs from; left empty, the first. */
109
+ root: import("@motionscript/sdk").Type<string, string, false>;
110
+ /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */
111
+ positions: import("@motionscript/sdk").Type<GraphPosition[], GraphPosition[], false>;
112
+ vertexRadius: import("@motionscript/sdk").Type<number, number, false>;
113
+ vertexStroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
114
+ labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
115
+ labelSize: import("@motionscript/sdk").Type<number, number, false>;
116
+ labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
117
+ fontFamily: import("@motionscript/sdk").Type<string, string, false>;
118
+ /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */
119
+ partFills: import("@motionscript/sdk").Type<PartFill[], PartFillResolved[], false>;
120
+ /** The arrangement an `arrangeTo` is leaving, and how far it is towards the new one. */
121
+ layoutFrom: import("@motionscript/sdk").Type<string, string, true>;
122
+ layoutMix: import("@motionscript/sdk").Type<number, number, true>;
123
+ fill: import("@motionscript/sdk").Attribute<Fill, FillResolved[]>;
124
+ stroke: import("@motionscript/sdk").Attribute<Stroke, StrokeResolved[]>;
125
+ shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
126
+ start: import("@motionscript/sdk").Type<number, number, false>;
127
+ end: import("@motionscript/sdk").Type<number, number, false>;
128
+ }>, null>>;
129
+ export type NetworkGraph = NodeOf<typeof NetworkGraph>;
130
+ /** Where each vertex is drawn in a graph of `size`, in pixels from its centre, y up. */
131
+ export declare function vertexPoints(graph: GraphValues, size: Size2D): Map<string, Vector2>;
132
+ export {};
83
133
  //# sourceMappingURL=network-graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"network-graph.d.ts","sourceRoot":"","sources":["../../src/structures/network-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,SAAS,EAGT,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,MAAM,EAEX,KAAK,OAAO,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAyD,KAAK,QAAQ,EAAyB,MAAM,mBAAmB,CAAC;AACh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