@motionscript/math 0.0.0-stage → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +389 -2
- package/dist/annotate/angle-mark.d.ts +96 -0
- package/dist/annotate/angle-mark.d.ts.map +1 -0
- package/dist/annotate/angle-mark.js +97 -0
- package/dist/annotate/angle-mark.js.map +1 -0
- package/dist/annotate/curly-brace.d.ts +115 -0
- package/dist/annotate/curly-brace.d.ts.map +1 -0
- package/dist/annotate/curly-brace.js +99 -0
- package/dist/annotate/curly-brace.js.map +1 -0
- package/dist/annotate/emphasis-mark.d.ts +80 -0
- package/dist/annotate/emphasis-mark.d.ts.map +1 -0
- package/dist/annotate/emphasis-mark.js +80 -0
- package/dist/annotate/emphasis-mark.js.map +1 -0
- package/dist/browser/THIRD_PARTY_LICENSES.txt +420 -0
- package/dist/browser/chunks/chunk-IRZCG6PM.js +2 -0
- package/dist/browser/chunks/chunk-IRZCG6PM.js.map +7 -0
- package/dist/browser/chunks/chunk-WMVW6ZIV.js +2 -0
- package/dist/browser/chunks/chunk-WMVW6ZIV.js.map +7 -0
- package/dist/browser/chunks/mathjax-WV55AC2P.js +61 -0
- package/dist/browser/chunks/mathjax-WV55AC2P.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +30 -0
- package/dist/browser/tex.js +2 -0
- package/dist/browser/tex.js.map +7 -0
- package/dist/engine.d.ts +71 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +45 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/brace.d.ts +8 -0
- package/dist/kit/brace.d.ts.map +1 -0
- package/dist/kit/brace.js +36 -0
- package/dist/kit/brace.js.map +1 -0
- package/dist/kit/cache.d.ts +30 -0
- package/dist/kit/cache.d.ts.map +1 -0
- package/dist/kit/cache.js +53 -0
- package/dist/kit/cache.js.map +1 -0
- package/dist/kit/component.d.ts +51 -0
- package/dist/kit/component.d.ts.map +1 -0
- package/dist/kit/component.js +30 -0
- package/dist/kit/component.js.map +1 -0
- package/dist/kit/contour.d.ts +8 -0
- package/dist/kit/contour.d.ts.map +1 -0
- package/dist/kit/contour.js +93 -0
- package/dist/kit/contour.js.map +1 -0
- package/dist/kit/coords.d.ts +69 -0
- package/dist/kit/coords.d.ts.map +1 -0
- package/dist/kit/coords.js +224 -0
- package/dist/kit/coords.js.map +1 -0
- package/dist/kit/curve.d.ts +28 -0
- package/dist/kit/curve.d.ts.map +1 -0
- package/dist/kit/curve.js +29 -0
- package/dist/kit/curve.js.map +1 -0
- package/dist/kit/equation.d.ts +61 -0
- package/dist/kit/equation.d.ts.map +1 -0
- package/dist/kit/equation.js +168 -0
- package/dist/kit/equation.js.map +1 -0
- package/dist/kit/equation3d.d.ts +50 -0
- package/dist/kit/equation3d.d.ts.map +1 -0
- package/dist/kit/equation3d.js +103 -0
- package/dist/kit/equation3d.js.map +1 -0
- package/dist/kit/expression.d.ts +35 -0
- package/dist/kit/expression.d.ts.map +1 -0
- package/dist/kit/expression.js +124 -0
- package/dist/kit/expression.js.map +1 -0
- package/dist/kit/field-mark.d.ts +79 -0
- package/dist/kit/field-mark.d.ts.map +1 -0
- package/dist/kit/field-mark.js +109 -0
- package/dist/kit/field-mark.js.map +1 -0
- package/dist/kit/field.d.ts +14 -0
- package/dist/kit/field.d.ts.map +1 -0
- package/dist/kit/field.js +46 -0
- package/dist/kit/field.js.map +1 -0
- package/dist/kit/follow.d.ts +109 -0
- package/dist/kit/follow.d.ts.map +1 -0
- package/dist/kit/follow.js +163 -0
- package/dist/kit/follow.js.map +1 -0
- package/dist/kit/furniture.d.ts +32 -0
- package/dist/kit/furniture.d.ts.map +1 -0
- package/dist/kit/furniture.js +92 -0
- package/dist/kit/furniture.js.map +1 -0
- package/dist/kit/geometry.d.ts +13 -0
- package/dist/kit/geometry.d.ts.map +1 -0
- package/dist/kit/geometry.js +54 -0
- package/dist/kit/geometry.js.map +1 -0
- package/dist/kit/graph.d.ts +46 -0
- package/dist/kit/graph.d.ts.map +1 -0
- package/dist/kit/graph.js +90 -0
- package/dist/kit/graph.js.map +1 -0
- package/dist/kit/mark.d.ts +72 -0
- package/dist/kit/mark.d.ts.map +1 -0
- package/dist/kit/mark.js +87 -0
- package/dist/kit/mark.js.map +1 -0
- package/dist/kit/part-fills.d.ts +23 -0
- package/dist/kit/part-fills.d.ts.map +1 -0
- package/dist/kit/part-fills.js +46 -0
- package/dist/kit/part-fills.js.map +1 -0
- package/dist/kit/place.d.ts +20 -0
- package/dist/kit/place.d.ts.map +1 -0
- package/dist/kit/place.js +66 -0
- package/dist/kit/place.js.map +1 -0
- package/dist/kit/sampler.d.ts +17 -0
- package/dist/kit/sampler.d.ts.map +1 -0
- package/dist/kit/sampler.js +250 -0
- package/dist/kit/sampler.js.map +1 -0
- package/dist/kit/scale.d.ts +12 -0
- package/dist/kit/scale.d.ts.map +1 -0
- package/dist/kit/scale.js +37 -0
- package/dist/kit/scale.js.map +1 -0
- package/dist/kit/source.d.ts +22 -0
- package/dist/kit/source.d.ts.map +1 -0
- package/dist/kit/source.js +45 -0
- package/dist/kit/source.js.map +1 -0
- package/dist/kit/system.d.ts +31 -0
- package/dist/kit/system.d.ts.map +1 -0
- package/dist/kit/system.js +71 -0
- package/dist/kit/system.js.map +1 -0
- package/dist/kit/ticks.d.ts +19 -0
- package/dist/kit/ticks.d.ts.map +1 -0
- package/dist/kit/ticks.js +78 -0
- package/dist/kit/ticks.js.map +1 -0
- package/dist/kit/withdrawn.d.ts +9 -0
- package/dist/kit/withdrawn.d.ts.map +1 -0
- package/dist/kit/withdrawn.js +9 -0
- package/dist/kit/withdrawn.js.map +1 -0
- package/dist/marks/curve-area.d.ts +51 -0
- package/dist/marks/curve-area.d.ts.map +1 -0
- package/dist/marks/curve-area.js +59 -0
- package/dist/marks/curve-area.js.map +1 -0
- package/dist/marks/drop-lines.d.ts +57 -0
- package/dist/marks/drop-lines.d.ts.map +1 -0
- package/dist/marks/drop-lines.js +43 -0
- package/dist/marks/drop-lines.js.map +1 -0
- package/dist/marks/plot-point.d.ts +71 -0
- package/dist/marks/plot-point.d.ts.map +1 -0
- package/dist/marks/plot-point.js +71 -0
- package/dist/marks/plot-point.js.map +1 -0
- package/dist/marks/riemann-sum.d.ts +58 -0
- package/dist/marks/riemann-sum.d.ts.map +1 -0
- package/dist/marks/riemann-sum.js +63 -0
- package/dist/marks/riemann-sum.js.map +1 -0
- package/dist/marks/tangent-line.d.ts +71 -0
- package/dist/marks/tangent-line.d.ts.map +1 -0
- package/dist/marks/tangent-line.js +89 -0
- package/dist/marks/tangent-line.js.map +1 -0
- package/dist/marks/vector-arrow.d.ts +60 -0
- package/dist/marks/vector-arrow.d.ts.map +1 -0
- package/dist/marks/vector-arrow.js +67 -0
- package/dist/marks/vector-arrow.js.map +1 -0
- package/dist/nodes.d.ts +43 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +57 -0
- package/dist/nodes.js.map +1 -0
- package/dist/plots/function-plot.d.ts +159 -0
- package/dist/plots/function-plot.d.ts.map +1 -0
- package/dist/plots/function-plot.js +184 -0
- package/dist/plots/function-plot.js.map +1 -0
- package/dist/plots/points-plot.d.ts +64 -0
- package/dist/plots/points-plot.d.ts.map +1 -0
- package/dist/plots/points-plot.js +72 -0
- package/dist/plots/points-plot.js.map +1 -0
- package/dist/plots/stream-lines.d.ts +76 -0
- package/dist/plots/stream-lines.d.ts.map +1 -0
- package/dist/plots/stream-lines.js +122 -0
- package/dist/plots/stream-lines.js.map +1 -0
- package/dist/plots/traced-path.d.ts +70 -0
- package/dist/plots/traced-path.d.ts.map +1 -0
- package/dist/plots/traced-path.js +41 -0
- package/dist/plots/traced-path.js.map +1 -0
- package/dist/plots/vector-field.d.ts +60 -0
- package/dist/plots/vector-field.d.ts.map +1 -0
- package/dist/plots/vector-field.js +77 -0
- package/dist/plots/vector-field.js.map +1 -0
- package/dist/structures/graph-layout.d.ts +11 -0
- package/dist/structures/graph-layout.d.ts.map +1 -0
- package/dist/structures/graph-layout.js +135 -0
- package/dist/structures/graph-layout.js.map +1 -0
- package/dist/structures/network-graph.d.ts +174 -0
- package/dist/structures/network-graph.d.ts.map +1 -0
- package/dist/structures/network-graph.js +240 -0
- package/dist/structures/network-graph.js.map +1 -0
- package/dist/structures/sample-space.d.ts +114 -0
- package/dist/structures/sample-space.d.ts.map +1 -0
- package/dist/structures/sample-space.js +161 -0
- package/dist/structures/sample-space.js.map +1 -0
- package/dist/systems/axes2d.d.ts +197 -0
- package/dist/systems/axes2d.d.ts.map +1 -0
- package/dist/systems/axes2d.js +157 -0
- package/dist/systems/axes2d.js.map +1 -0
- package/dist/systems/number-line.d.ts +101 -0
- package/dist/systems/number-line.d.ts.map +1 -0
- package/dist/systems/number-line.js +91 -0
- package/dist/systems/number-line.js.map +1 -0
- package/dist/systems/number-plane.d.ts +168 -0
- package/dist/systems/number-plane.d.ts.map +1 -0
- package/dist/systems/number-plane.js +186 -0
- package/dist/systems/number-plane.js.map +1 -0
- package/dist/systems/polar-plane.d.ts +98 -0
- package/dist/systems/polar-plane.d.ts.map +1 -0
- package/dist/systems/polar-plane.js +139 -0
- package/dist/systems/polar-plane.js.map +1 -0
- package/dist/tex/geometry.d.ts +85 -0
- package/dist/tex/geometry.d.ts.map +1 -0
- package/dist/tex/geometry.js +632 -0
- package/dist/tex/geometry.js.map +1 -0
- package/dist/tex/index.d.ts +11 -0
- package/dist/tex/index.d.ts.map +1 -0
- package/dist/tex/index.js +10 -0
- package/dist/tex/index.js.map +1 -0
- package/dist/tex/mathjax.d.ts +33 -0
- package/dist/tex/mathjax.d.ts.map +1 -0
- package/dist/tex/mathjax.js +74 -0
- package/dist/tex/mathjax.js.map +1 -0
- package/dist/tex/matrix.d.ts +101 -0
- package/dist/tex/matrix.d.ts.map +1 -0
- package/dist/tex/matrix.js +56 -0
- package/dist/tex/matrix.js.map +1 -0
- package/dist/tex/node.d.ts +98 -0
- package/dist/tex/node.d.ts.map +1 -0
- package/dist/tex/node.js +25 -0
- package/dist/tex/node.js.map +1 -0
- package/dist/tex/tween.d.ts +50 -0
- package/dist/tex/tween.d.ts.map +1 -0
- package/dist/tex/tween.js +253 -0
- package/dist/tex/tween.js.map +1 -0
- package/dist/tex/typeset.d.ts +133 -0
- package/dist/tex/typeset.d.ts.map +1 -0
- package/dist/tex/typeset.js +403 -0
- package/dist/tex/typeset.js.map +1 -0
- package/dist/three/axes3d.d.ts +247 -0
- package/dist/three/axes3d.d.ts.map +1 -0
- package/dist/three/axes3d.js +187 -0
- package/dist/three/axes3d.js.map +1 -0
- package/dist/three/curve-plot3d.d.ts +126 -0
- package/dist/three/curve-plot3d.d.ts.map +1 -0
- package/dist/three/curve-plot3d.js +109 -0
- package/dist/three/curve-plot3d.js.map +1 -0
- package/dist/three/entries.d.ts +17 -0
- package/dist/three/entries.d.ts.map +1 -0
- package/dist/three/entries.js +15 -0
- package/dist/three/entries.js.map +1 -0
- package/dist/three/label3d.d.ts +11 -0
- package/dist/three/label3d.d.ts.map +1 -0
- package/dist/three/label3d.js +42 -0
- package/dist/three/label3d.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +99 -0
- package/dist/three/plot-point3d.d.ts.map +1 -0
- package/dist/three/plot-point3d.js +34 -0
- package/dist/three/plot-point3d.js.map +1 -0
- package/dist/three/space.d.ts +43 -0
- package/dist/three/space.d.ts.map +1 -0
- package/dist/three/space.js +58 -0
- package/dist/three/space.js.map +1 -0
- package/dist/three/surface-plot3d.d.ts +207 -0
- package/dist/three/surface-plot3d.d.ts.map +1 -0
- package/dist/three/surface-plot3d.js +261 -0
- package/dist/three/surface-plot3d.js.map +1 -0
- package/dist/three/vector-arrow3d.d.ts +96 -0
- package/dist/three/vector-arrow3d.d.ts.map +1 -0
- package/dist/three/vector-arrow3d.js +53 -0
- package/dist/three/vector-arrow3d.js.map +1 -0
- package/package.json +80 -3
- package/registry.json +251 -0
- package/src/annotate/angle-mark.ts +137 -0
- package/src/annotate/curly-brace.ts +148 -0
- package/src/annotate/emphasis-mark.ts +118 -0
- package/src/engine.ts +86 -0
- package/src/index.ts +29 -0
- package/src/kit/brace.ts +37 -0
- package/src/kit/cache.ts +61 -0
- package/src/kit/component.ts +57 -0
- package/src/kit/contour.ts +94 -0
- package/src/kit/coords.ts +278 -0
- package/src/kit/curve.ts +47 -0
- package/src/kit/equation.ts +181 -0
- package/src/kit/equation3d.ts +137 -0
- package/src/kit/expression.ts +159 -0
- package/src/kit/field-mark.ts +171 -0
- package/src/kit/field.ts +50 -0
- package/src/kit/follow.ts +229 -0
- package/src/kit/furniture.ts +113 -0
- package/src/kit/geometry.ts +49 -0
- package/src/kit/graph.ts +116 -0
- package/src/kit/mark.ts +152 -0
- package/src/kit/part-fills.ts +61 -0
- package/src/kit/place.ts +77 -0
- package/src/kit/sampler.ts +281 -0
- package/src/kit/scale.ts +39 -0
- package/src/kit/source.ts +57 -0
- package/src/kit/system.ts +105 -0
- package/src/kit/ticks.ts +85 -0
- package/src/kit/withdrawn.ts +8 -0
- package/src/marks/curve-area.ts +89 -0
- package/src/marks/drop-lines.ts +71 -0
- package/src/marks/plot-point.ts +102 -0
- package/src/marks/riemann-sum.ts +99 -0
- package/src/marks/tangent-line.ts +119 -0
- package/src/marks/vector-arrow.ts +98 -0
- package/src/nodes.ts +99 -0
- package/src/plots/function-plot.ts +220 -0
- package/src/plots/points-plot.ts +103 -0
- package/src/plots/stream-lines.ts +160 -0
- package/src/plots/traced-path.ts +70 -0
- package/src/plots/vector-field.ts +107 -0
- package/src/structures/graph-layout.ts +145 -0
- package/src/structures/network-graph.ts +291 -0
- package/src/structures/sample-space.ts +210 -0
- package/src/systems/axes2d.ts +226 -0
- package/src/systems/number-line.ts +130 -0
- package/src/systems/number-plane.ts +232 -0
- package/src/systems/polar-plane.ts +177 -0
- package/src/tex/geometry.ts +703 -0
- package/src/tex/index.ts +15 -0
- package/src/tex/mathjax.ts +82 -0
- package/src/tex/matrix.ts +97 -0
- package/src/tex/node.ts +74 -0
- package/src/tex/tween.ts +308 -0
- package/src/tex/typeset.ts +461 -0
- package/src/three/axes3d.ts +267 -0
- package/src/three/curve-plot3d.ts +146 -0
- package/src/three/entries.ts +42 -0
- package/src/three/label3d.ts +52 -0
- package/src/three/plot-point3d.ts +63 -0
- package/src/three/space.ts +92 -0
- package/src/three/surface-plot3d.ts +318 -0
- package/src/three/vector-arrow3d.ts +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-graph.js","sourceRoot":"","sources":["../../src/structures/network-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,UAAU,EACV,KAAK,GAkBR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAc,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAwC,MAAM,mBAAmB,CAAC;AAChI,OAAO,EAAE,aAAa,EAAE,MAAM,EAAoC,MAAM,gBAAgB,CAAC;AAyBzF,kFAAkF;AAClF,8EAA8E;AAC9E,+CAA+C;AAE/C,SAAS,YAAY,CAAC,KAAqC;IACvD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAA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AI,CAAC,CAAU,EAAE,CAAS;IAC/B,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACpD,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC;QAClF,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import {\n component2d,\n Graphics2D,\n Types,\n type Color,\n type Fill,\n type FillResolved,\n type NodeOf,\n type NormalizedColor,\n type PaintProps,\n type RenderContext,\n type ShadowResolved,\n type Size2D,\n type Stroke,\n type StrokeResolved,\n type Values,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n} from \"@motionscript/sdk\";\nimport { createBoundedCache } from \"../kit/cache\";\nimport { listed, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { drawLabels, loadFormulas, type Label } from \"../kit/furniture\";\nimport { lerpPartFills, partPaint, readPartFills, withPartFill, type PartFill, type PartFillResolved } from \"../kit/part-fills\";\nimport { GRAPH_LAYOUTS, layOut, type GraphEdge, type GraphLayout } from \"./graph-layout\";\n\n/** A vertex placed by hand, in the graph's box from -1 to 1 each way, y up. */\nexport interface GraphPosition {\n vertex: string;\n x: number;\n y: number;\n}\n\nexport interface NetworkGraphProps extends PaintProps {\n vertices?: string[];\n edges?: GraphEdge[];\n directed?: boolean;\n arrangement?: GraphLayout;\n root?: string;\n positions?: GraphPosition[];\n vertexRadius?: number;\n vertexStroke?: Stroke;\n labels?: boolean;\n labelSize?: number;\n labelColor?: Color;\n fontFamily?: string;\n partFills?: PartFill[];\n}\n\n// Every list keeps each entry as it was written, a blank or a repeat included, so\n// an editor showing the list shows the row it just added. What is drawn skips\n// what is not complete yet (`names`, `links`).\n\nfunction readVertices(value: readonly unknown[] | undefined): string[] {\n return (Array.isArray(value) ? value : []).map((name) => String(name ?? \"\"));\n}\n\n// An edge reads from `{ from, to }` or a pair, so a list written by hand is as good as one from a table.\nfunction readEdges(value: readonly unknown[] | undefined): GraphEdge[] {\n return (Array.isArray(value) ? value : []).map((edge) => {\n const [from, to] = Array.isArray(edge) ? edge : [(edge as GraphEdge)?.from, (edge as GraphEdge)?.to];\n return { from: String(from ?? \"\"), to: String(to ?? \"\") };\n });\n}\n\nfunction readPositions(value: readonly GraphPosition[] | undefined): GraphPosition[] {\n const at = (n: unknown) => (typeof n === \"number\" && Number.isFinite(n) ? n : 0);\n return (Array.isArray(value) ? value : []).map((entry) => ({ vertex: String(entry?.vertex ?? \"\"), x: at(entry?.x), y: at(entry?.y) }));\n}\n\n/** How far a directed edge and the one back between the same two vertices bow apart, as a share of their length. */\nconst BOW = 0.12;\n\nconst NUL = String.fromCharCode(0);\n\nconst state = {\n ...PAINT,\n vertices: Types.custom<string[]>([], { resolve: readVertices, animatable: false, kind: \"vector\" }),\n edges: Types.custom<GraphEdge[]>([], { resolve: readEdges, animatable: false, kind: \"vector\" }),\n /** Draw each edge as an arrow from its `from` to its `to`. */\n directed: Types.boolean(false, { animatable: false }),\n arrangement: listed(GRAPH_LAYOUTS, \"circular\", { animatable: false }),\n /** The vertex a tree hangs from; left empty, the first. */\n root: Types.text(\"\", { animatable: false }),\n /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */\n positions: Types.custom<GraphPosition[]>([], { resolve: readPositions, animatable: false, kind: \"vector\" }),\n vertexRadius: Types.number(18, { min: 0, unit: \"px\" }),\n vertexStroke: Types.stroke([]),\n labels: Types.boolean(true, { animatable: false }),\n labelSize: Types.number(18, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#111827\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */\n partFills: Types.custom<PartFill[], PartFillResolved[]>([], { resolve: readPartFills, lerp: lerpPartFills, kind: \"vector\" }),\n /** The arrangement an `arrangeTo` is leaving, and how far it is towards the new one. */\n layoutFrom: Types.text(\"\", { private: true }),\n layoutMix: Types.number(1, { private: true }),\n};\n\n/** What a graph is drawn from: its own entries, as its fields and its node both read them. */\nexport type GraphValues = Values<typeof state>;\n\n/**\n * Vertices and the edges between them, arranged by a rule: in a circle, by\n * springs, as a tree from `root`, or in a grid. Its `fill` is the vertices and\n * its `stroke` the edges, with an arrowhead each when `directed`. `arrangeTo`\n * moves every vertex to where another rule places it; `partFillTo` paints a\n * vertex, or an edge written `a-b`. (`layout` is every node's own box.)\n */\nexport const NetworkGraph = component2d({\n key: \"networkGraph\",\n state,\n defaults: {\n fill: \"#e5e7eb\",\n stroke: { weight: 3, fill: \"#9ca3af\", align: \"center\", cap: \"round\" },\n },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n if (s.labels) loadFormulas(loader, names(s));\n },\n commands: {\n ...PAINT_COMMANDS,\n /** Move every vertex to where another arrangement places it. */\n arrangeTo: {\n // No default: one left out keeps the arrangement the graph has.\n args: { arrangement: listed(GRAPH_LAYOUTS, undefined) },\n run: (timeline, s) => {\n const from = s.arrangement;\n const to = timeline.args.arrangement ?? from;\n return timeline.animate((t) => ({ arrangement: to, layoutFrom: from, layoutMix: t }));\n },\n },\n /** Paint one part of the graph: a vertex by its name, or an edge written `a-b`. */\n partFillTo: {\n args: { part: Types.text(\"\"), fill: Types.custom<Fill>(\"#facc15\", { kind: \"fills\" }) },\n run: (timeline, s) => {\n const { part, fill } = timeline.args;\n if (!part || fill == null) return timeline.tween({});\n return timeline.tween({ partFills: withPartFill(s.partFills, { part, fill }) });\n },\n },\n },\n render: (ctx, s) => painted(ctx, () => drawGraph(ctx, s)),\n});\n\nexport type NetworkGraph = NodeOf<typeof NetworkGraph>;\n\n/** Where each vertex is drawn in a graph of `size`, in pixels from its centre, y up. */\nexport function vertexPoints(graph: GraphValues, size: Size2D): Map<string, Vector2> {\n const room = graph.vertexRadius + Math.max(2, graph.labelSize * 0.2);\n const halfX = Math.max(0, size.width / 2 - room);\n const halfY = Math.max(0, size.height / 2 - room);\n const to = placed(graph, graph.arrangement);\n const from = graph.layoutMix < 1 && graph.layoutFrom !== \"\" ? placed(graph, graph.layoutFrom as GraphLayout) : null;\n const t = graph.layoutMix;\n const out = new Map<string, Vector2>();\n for (const [name, p] of to) {\n const q = from?.get(name) ?? p;\n out.set(name, { x: (q.x + (p.x - q.x) * t) * halfX, y: (q.y + (p.y - q.y) * t) * halfY });\n }\n return out;\n}\n\nfunction drawGraph(ctx: RenderContext, graph: GraphValues): void {\n const points = vertexPoints(graph, ctx.size);\n if (points.size === 0) return;\n const parts = new Map((graph.partFills as PartFillResolved[]).map((entry) => [entry.part, entry]));\n drawEdges(ctx, graph, points, parts);\n drawVertices(ctx, graph, points, parts);\n}\n\n// Two layouts are held at once while one becomes the other, and a scene may hold several graphs.\nconst layouts = createBoundedCache<Map<string, Vector2>>(32);\n\n/** Each vertex's place under `layout`, from -1 to 1, a hand-placed one where it is. */\nfunction placed(graph: GraphValues, layout: GraphLayout): Map<string, Vector2> {\n const vertices = names(graph);\n const edges = links(graph);\n const key = [layout, graph.root, vertices.join(NUL), JSON.stringify(edges), JSON.stringify(graph.positions)].join(\"|\");\n let at = layouts.get(key);\n if (!at) {\n at = layOut(layout, vertices, edges, graph.root.trim());\n for (const { vertex, x, y } of graph.positions) {\n const name = vertex.trim();\n if (at.has(name)) at.set(name, { x, y });\n }\n layouts.set(key, at);\n }\n return at;\n}\n\nfunction drawEdges(ctx: RenderContext, graph: GraphValues, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\n const stroke = graph.stroke as StrokeResolved[];\n if (stroke.length === 0) return;\n const r = graph.vertexRadius;\n const all = links(graph);\n const pairs = new Set(all.map(({ from, to }) => `${from}${NUL}${to}`));\n const plain = new Graphics2D();\n let drawnPlain = false;\n for (const { from, to } of all) {\n const a = points.get(from);\n const b = points.get(to);\n if (!a || !b) continue;\n const run = from === to ? loop(a, r) : edge(a, b, r, graph.directed && pairs.has(`${to}${NUL}${from}`) ? BOW : 0);\n if (run.length < 2) continue;\n const paint = parts.get(`${from}-${to}`) ?? (graph.directed ? undefined : parts.get(`${to}-${from}`));\n const own = graph.directed || paint !== undefined;\n const g = own ? new Graphics2D() : plain;\n g.line({ points: run, radius: 0, start: graph.start, end: graph.end });\n if (!own) {\n drawnPlain = true;\n continue;\n }\n let layers = stroke;\n if (paint) layers = layers.map((layer) => ({ ...layer, fill: partPaint(layer.fill, paint) }));\n if (graph.directed && from !== to) layers = layers.map((layer) => ({ ...layer, endCap: layer.endCap ?? \"triangle\" }));\n ctx.draw(g.stroke(layers));\n }\n if (drawnPlain) ctx.draw(plain.stroke(stroke));\n}\n\nfunction drawVertices(ctx: RenderContext, graph: GraphValues, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\n const r = graph.vertexRadius;\n const fill = graph.fill as FillResolved[];\n const outline = graph.vertexStroke as StrokeResolved[];\n const labels: Label[] = [];\n for (const [name, p] of points) {\n if (r > 0) {\n const paint = partPaint(fill, parts.get(name));\n const disc = new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 });\n ctx.draw(disc.shadow(graph.shadow as ShadowResolved[]).fill(paint));\n if (outline.length > 0) ctx.draw(new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 }).stroke(outline));\n }\n if (graph.labels) labels.push({ text: name, at: { x: p.x, y: p.y }, align: \"center\" });\n }\n for (const part of drawLabels(labels, { fontSize: graph.labelSize, fontFamily: graph.fontFamily, color: graph.labelColor as NormalizedColor })) {\n ctx.draw(part);\n }\n}\n\n/** The vertices drawn: each name once, trimmed, the blank ones left out. */\nfunction names(graph: Pick<GraphValues, \"vertices\">): string[] {\n return [...new Set(graph.vertices.map((name) => name.trim()).filter((name) => name !== \"\"))];\n}\n\n/** The edges drawn: both ends named. */\nfunction links(graph: Pick<GraphValues, \"edges\">): GraphEdge[] {\n return graph.edges.flatMap(({ from, to }) => {\n const a = from.trim();\n const b = to.trim();\n return a === \"\" || b === \"\" ? [] : [{ from: a, to: b }];\n });\n}\n\n/** An edge from one vertex's rim to the other's, straight or bowed to its left. */\nfunction edge(a: Vector2, b: Vector2, r: number, bow: number): Vector2[] {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const length = Math.hypot(dx, dy);\n if (!(length > 2 * r)) return [];\n if (bow === 0) {\n const ux = dx / length;\n const uy = dy / length;\n return [{ x: a.x + ux * r, y: a.y + uy * r }, { x: b.x - ux * r, y: b.y - uy * r }];\n }\n const mid = { x: (a.x + b.x) / 2 - (dy / length) * bow * length, y: (a.y + b.y) / 2 + (dx / length) * bow * length };\n const run: Vector2[] = [];\n for (let i = 0; i <= 16; i++) {\n const t = i / 16;\n const u = 1 - t;\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 });\n }\n // Trimmed back to the rims along the curve.\n const outside = (p: Vector2, c: Vector2) => Math.hypot(p.x - c.x, p.y - c.y) >= r;\n return run.filter((p) => outside(p, a) && outside(p, b));\n}\n\n/** An edge from a vertex to itself: a small loop above it. */\nfunction loop(c: Vector2, r: number): Vector2[] {\n const run: Vector2[] = [];\n const radius = Math.max(r * 0.8, 6);\n const cy = c.y + r + radius * 0.6;\n for (let i = 0; i <= 24; i++) {\n const angle = -Math.PI / 2 + (2 * Math.PI * i) / 24;\n const p = { x: c.x + Math.cos(angle) * radius, y: cy + Math.sin(angle) * radius };\n if (Math.hypot(p.x - c.x, p.y - c.y) >= r) run.push(p);\n }\n return run;\n}\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Color, type Fill, type FillResolved, type NodeOf, type NormalizedColor, type PaintProps, type ShadowResolved, type Size2D, type StrokeResolved, type Values, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Shadow as _Shadow, type Stroke as _Stroke } from "@motionscript/sdk";
|
|
2
|
+
export interface SampleSpaceProps extends PaintProps {
|
|
3
|
+
columnShares?: number[];
|
|
4
|
+
rowShares?: number[];
|
|
5
|
+
columnFills?: Fill[];
|
|
6
|
+
columnLabels?: string[];
|
|
7
|
+
rowLabels?: string[];
|
|
8
|
+
values?: boolean;
|
|
9
|
+
labelSize?: number;
|
|
10
|
+
labelColor?: Color;
|
|
11
|
+
fontFamily?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const state: {
|
|
14
|
+
/** How the whole is shared across, left to right; any numbers, read as shares of their sum. */
|
|
15
|
+
columnShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
16
|
+
/** Each column's upper share, 0 to 1; a column without one is not cut across. */
|
|
17
|
+
rowShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
18
|
+
/** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */
|
|
19
|
+
columnFills: import("@motionscript/sdk").Type<Fill[], FillResolved[][], false>;
|
|
20
|
+
columnLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
21
|
+
/** The upper part's name and the lower's, written on the left. */
|
|
22
|
+
rowLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
23
|
+
/** Write each part's probability in it. */
|
|
24
|
+
values: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
25
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
26
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
27
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
28
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
29
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
|
|
30
|
+
};
|
|
31
|
+
/** What a sample space is drawn from: its own entries, as its fields and its node both read them. */
|
|
32
|
+
export type SampleSpaceValues = Values<typeof state>;
|
|
33
|
+
/** One part of a sample space: its box in pixels from the node's centre, y up, and its probability. */
|
|
34
|
+
export interface SamplePart {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
probability: number;
|
|
40
|
+
column: number;
|
|
41
|
+
upper: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A probability's whole, as a box cut into columns by `columnShares` (shares of
|
|
45
|
+
* the whole, P(A) and P(not A)) and each column cut again by its `rowShares` entry
|
|
46
|
+
* (P(B | A) above, the rest below): each part's area is its probability.
|
|
47
|
+
* Braces name the columns below and the rows on the left; `divideTo` moves the
|
|
48
|
+
* cuts.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SampleSpace: import("@motionscript/sdk").Component<"sampleSpace", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
51
|
+
/** How the whole is shared across, left to right; any numbers, read as shares of their sum. */
|
|
52
|
+
columnShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
53
|
+
/** Each column's upper share, 0 to 1; a column without one is not cut across. */
|
|
54
|
+
rowShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
55
|
+
/** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */
|
|
56
|
+
columnFills: import("@motionscript/sdk").Type<Fill[], FillResolved[][], false>;
|
|
57
|
+
columnLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
58
|
+
/** The upper part's name and the lower's, written on the left. */
|
|
59
|
+
rowLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
60
|
+
/** Write each part's probability in it. */
|
|
61
|
+
values: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
62
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
63
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
64
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
65
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
66
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
|
|
67
|
+
}>, {
|
|
68
|
+
readonly divideTo: readonly ["columnShares", "rowShares"];
|
|
69
|
+
readonly strokeTo: readonly ["stroke"];
|
|
70
|
+
readonly shadowTo: readonly ["shadow"];
|
|
71
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
72
|
+
/** How the whole is shared across, left to right; any numbers, read as shares of their sum. */
|
|
73
|
+
columnShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
74
|
+
/** Each column's upper share, 0 to 1; a column without one is not cut across. */
|
|
75
|
+
rowShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
76
|
+
/** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */
|
|
77
|
+
columnFills: import("@motionscript/sdk").Type<Fill[], FillResolved[][], false>;
|
|
78
|
+
columnLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
79
|
+
/** The upper part's name and the lower's, written on the left. */
|
|
80
|
+
rowLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
81
|
+
/** Write each part's probability in it. */
|
|
82
|
+
values: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
83
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
84
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
85
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
86
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
87
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
|
|
88
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
89
|
+
/** How the whole is shared across, left to right; any numbers, read as shares of their sum. */
|
|
90
|
+
columnShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
91
|
+
/** Each column's upper share, 0 to 1; a column without one is not cut across. */
|
|
92
|
+
rowShares: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
93
|
+
/** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */
|
|
94
|
+
columnFills: import("@motionscript/sdk").Type<Fill[], FillResolved[][], false>;
|
|
95
|
+
columnLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
96
|
+
/** The upper part's name and the lower's, written on the left. */
|
|
97
|
+
rowLabels: import("@motionscript/sdk").Type<string[], string[], false>;
|
|
98
|
+
/** Write each part's probability in it. */
|
|
99
|
+
values: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
100
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
101
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
102
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
103
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
104
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, ShadowResolved[]>;
|
|
105
|
+
}>, {
|
|
106
|
+
readonly divideTo: readonly ["columnShares", "rowShares"];
|
|
107
|
+
readonly strokeTo: readonly ["stroke"];
|
|
108
|
+
readonly shadowTo: readonly ["shadow"];
|
|
109
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
110
|
+
export type SampleSpace = NodeOf<typeof SampleSpace>;
|
|
111
|
+
/** Each part of a sample space of `size`: columns left to right, upper part first. */
|
|
112
|
+
export declare function sampleParts(space: SampleSpaceValues, size: Size2D): SamplePart[];
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=sample-space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-space.d.ts","sourceRoot":"","sources":["../../src/structures/sample-space.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,UAAU,EAEf,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,MAAM,EAGX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,MAAM,IAAI,OAAO,EACzB,MAAM,mBAAmB,CAAC;AAO3B,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAkBD,QAAA,MAAM,KAAK;IAGP,+FAA+F;;IAE/F,iFAAiF;;IAEjF,sGAAsG;;;IAGtG,kEAAkE;;IAElE,2CAA2C;;;;;;;CAK9C,CAAC;AAEF,qGAAqG;AACrG,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,uGAAuG;AACvG,MAAM,WAAW,UAAU;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;IArCpB,+FAA+F;;IAE/F,iFAAiF;;IAEjF,sGAAsG;;;IAGtG,kEAAkE;;IAElE,2CAA2C;;;;;;;;;;;;IAT3C,+FAA+F;;IAE/F,iFAAiF;;IAEjF,sGAAsG;;;IAGtG,kEAAkE;;IAElE,2CAA2C;;;;;;;;IAT3C,+FAA+F;;IAE/F,iFAAiF;;IAEjF,sGAAsG;;;IAGtG,kEAAkE;;IAElE,2CAA2C;;;;;;;;;;;2BA0C7C,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAErD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAuBhF"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { component2d, fillOps, Graphics2D, Types, } from "@motionscript/sdk";
|
|
2
|
+
import { braceOutline } from "../kit/brace.js";
|
|
3
|
+
import { omit, PAINT, PAINT_COMMANDS, painted } from "../kit/component.js";
|
|
4
|
+
import { drawLabels, loadFormulas } from "../kit/furniture.js";
|
|
5
|
+
import { lerpFillScale, readFillScale } from "../kit/scale.js";
|
|
6
|
+
import { formatTick } from "../kit/ticks.js";
|
|
7
|
+
/** The parts' paints until told otherwise, a column each, round again past the last. */
|
|
8
|
+
const PALETTE = ["#58a6ff", "#f59e0b", "#4ade80", "#f472b6", "#a78bfa", "#2dd4bf"];
|
|
9
|
+
/** How strongly the lower part of a split column shows its paint. */
|
|
10
|
+
const LOWER = 0.45;
|
|
11
|
+
function readShares(value) {
|
|
12
|
+
return (Array.isArray(value) ? value : []).map((share) => (Number.isFinite(share) && share > 0 ? share : 0));
|
|
13
|
+
}
|
|
14
|
+
// Shares tween one by one; a different count has nothing to pair with, and changes at the end.
|
|
15
|
+
function lerpShares(from, to, t) {
|
|
16
|
+
if (from.length !== to.length)
|
|
17
|
+
return t < 1 ? from : to;
|
|
18
|
+
return to.map((share, i) => from[i] + (share - from[i]) * t);
|
|
19
|
+
}
|
|
20
|
+
const state = {
|
|
21
|
+
// Its parts are painted from `columnFills`, and it trims no outline of its own.
|
|
22
|
+
...omit(PAINT, "fill", "start", "end"),
|
|
23
|
+
/** How the whole is shared across, left to right; any numbers, read as shares of their sum. */
|
|
24
|
+
columnShares: Types.custom([1], { resolve: readShares, lerp: lerpShares, kind: "vector" }),
|
|
25
|
+
/** Each column's upper share, 0 to 1; a column without one is not cut across. */
|
|
26
|
+
rowShares: Types.custom([], { resolve: readShares, lerp: lerpShares, kind: "vector" }),
|
|
27
|
+
/** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */
|
|
28
|
+
columnFills: Types.custom([], { resolve: readFillScale, lerp: lerpFillScale, kind: "vector" }),
|
|
29
|
+
columnLabels: Types.custom([], { animatable: false, kind: "vector" }),
|
|
30
|
+
/** The upper part's name and the lower's, written on the left. */
|
|
31
|
+
rowLabels: Types.custom([], { animatable: false, kind: "vector" }),
|
|
32
|
+
/** Write each part's probability in it. */
|
|
33
|
+
values: Types.boolean(false, { animatable: false }),
|
|
34
|
+
labelSize: Types.number(20, { min: 1, unit: "px" }),
|
|
35
|
+
labelColor: Types.color("#e5e7eb"),
|
|
36
|
+
fontFamily: Types.text("", { animatable: false }),
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A probability's whole, as a box cut into columns by `columnShares` (shares of
|
|
40
|
+
* the whole, P(A) and P(not A)) and each column cut again by its `rowShares` entry
|
|
41
|
+
* (P(B | A) above, the rest below): each part's area is its probability.
|
|
42
|
+
* Braces name the columns below and the rows on the left; `divideTo` moves the
|
|
43
|
+
* cuts.
|
|
44
|
+
*/
|
|
45
|
+
export const SampleSpace = component2d({
|
|
46
|
+
key: "sampleSpace",
|
|
47
|
+
state,
|
|
48
|
+
defaults: { stroke: { weight: 2, fill: "#0b0d12", align: "center" } },
|
|
49
|
+
load: (loader, s) => {
|
|
50
|
+
if (s.fontFamily !== "")
|
|
51
|
+
loader.font(s.fontFamily);
|
|
52
|
+
loadFormulas(loader, [...s.columnLabels, ...s.rowLabels]);
|
|
53
|
+
},
|
|
54
|
+
commands: {
|
|
55
|
+
...omit(PAINT_COMMANDS, "fillTo", "progressTo", "flash"),
|
|
56
|
+
/** Move the cuts: the columns' shares, each column's upper share, or both. */
|
|
57
|
+
divideTo: { args: ["columnShares", "rowShares"] },
|
|
58
|
+
},
|
|
59
|
+
render: (ctx, s) => painted(ctx, () => drawSpace(ctx, s)),
|
|
60
|
+
});
|
|
61
|
+
/** Each part of a sample space of `size`: columns left to right, upper part first. */
|
|
62
|
+
export function sampleParts(space, size) {
|
|
63
|
+
const box = boxOf(space, size);
|
|
64
|
+
const shares = space.columnShares;
|
|
65
|
+
const total = shares.reduce((sum, share) => sum + share, 0);
|
|
66
|
+
if (!(total > 0) || box.width <= 0 || box.height <= 0)
|
|
67
|
+
return [];
|
|
68
|
+
const out = [];
|
|
69
|
+
let left = box.x - box.width / 2;
|
|
70
|
+
shares.forEach((share, column) => {
|
|
71
|
+
const width = (box.width * share) / total;
|
|
72
|
+
const p = share / total;
|
|
73
|
+
const cut = space.rowShares[column];
|
|
74
|
+
const top = box.y + box.height / 2;
|
|
75
|
+
if (cut === undefined) {
|
|
76
|
+
out.push({ x: left + width / 2, y: box.y, width, height: box.height, probability: p, column, upper: true });
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const upper = Math.min(1, Math.max(0, cut));
|
|
80
|
+
const h = box.height * upper;
|
|
81
|
+
out.push({ x: left + width / 2, y: top - h / 2, width, height: h, probability: p * upper, column, upper: true });
|
|
82
|
+
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 });
|
|
83
|
+
}
|
|
84
|
+
left += width;
|
|
85
|
+
});
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
function drawSpace(ctx, space) {
|
|
89
|
+
const parts = sampleParts(space, ctx.size);
|
|
90
|
+
if (parts.length === 0)
|
|
91
|
+
return;
|
|
92
|
+
const fills = space.columnFills;
|
|
93
|
+
const stroke = space.stroke;
|
|
94
|
+
const labels = [];
|
|
95
|
+
for (const part of parts) {
|
|
96
|
+
if (!(part.width > 0) || !(part.height > 0))
|
|
97
|
+
continue;
|
|
98
|
+
const base = fills.length > 0 ? fills[part.column % fills.length] : fillOps.resolve(PALETTE[part.column % PALETTE.length]);
|
|
99
|
+
const paint = part.upper ? base : base.map((layer) => ({ ...layer, opacity: (layer.opacity ?? 1) * LOWER }));
|
|
100
|
+
const g = new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height });
|
|
101
|
+
ctx.draw(g.shadow(space.shadow).fill(paint));
|
|
102
|
+
if (stroke.length > 0)
|
|
103
|
+
ctx.draw(new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height }).stroke(stroke));
|
|
104
|
+
if (space.values && part.height > space.labelSize && part.width > space.labelSize) {
|
|
105
|
+
labels.push({ text: formatTick(Math.round(part.probability * 1000) / 1000, 0.001), at: { x: part.x, y: part.y }, align: "center" });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
labels.push(...braces(ctx, space, parts));
|
|
109
|
+
const style = { fontSize: space.labelSize, fontFamily: space.fontFamily, color: space.labelColor };
|
|
110
|
+
for (const part of drawLabels(labels, style))
|
|
111
|
+
ctx.draw(part);
|
|
112
|
+
}
|
|
113
|
+
/** Room for the braces and their names, below and on the left, taken from the box. */
|
|
114
|
+
function boxOf(space, size) {
|
|
115
|
+
const { width, height } = size;
|
|
116
|
+
const room = space.labelSize * 2.6;
|
|
117
|
+
const below = space.columnLabels.some((label) => label !== "") ? room : 0;
|
|
118
|
+
const left = space.rowLabels.some((label) => label !== "") ? room * 1.6 : 0;
|
|
119
|
+
return { x: left / 2, y: below / 2, width: Math.max(0, width - left), height: Math.max(0, height - below) };
|
|
120
|
+
}
|
|
121
|
+
/** Braces under each column and beside the first column's parts, and the labels that name them. */
|
|
122
|
+
function braces(ctx, space, parts) {
|
|
123
|
+
const box = boxOf(space, ctx.size);
|
|
124
|
+
const reach = space.labelSize * 0.8;
|
|
125
|
+
const gap = 6;
|
|
126
|
+
const runs = new Graphics2D();
|
|
127
|
+
const labels = [];
|
|
128
|
+
let drawn = false;
|
|
129
|
+
const brace = (from, to, out, text, align) => {
|
|
130
|
+
if (text === "")
|
|
131
|
+
return;
|
|
132
|
+
// A frame centred on the node's own centre, so the path is drawn where it is and not moved onto it.
|
|
133
|
+
runs.path({ data: braceOutline(from, to, out, reach), centerBounds: [-1, -1, 1, 1] });
|
|
134
|
+
drawn = true;
|
|
135
|
+
const mid = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };
|
|
136
|
+
const far = reach + space.labelSize * 0.75;
|
|
137
|
+
labels.push({ text, at: { x: mid.x + out.x * far, y: mid.y + out.y * far }, align });
|
|
138
|
+
};
|
|
139
|
+
const bottom = box.y - box.height / 2 - gap;
|
|
140
|
+
for (const part of parts) {
|
|
141
|
+
if (!part.upper && space.rowShares[part.column] !== undefined)
|
|
142
|
+
continue;
|
|
143
|
+
const text = space.columnLabels[part.column] ?? "";
|
|
144
|
+
// Left to right along the bottom, so the bulge, to the edge's right, points down.
|
|
145
|
+
brace({ x: part.x + part.width / 2, y: bottom }, { x: part.x - part.width / 2, y: bottom }, { x: 0, y: -1 }, text, "center");
|
|
146
|
+
}
|
|
147
|
+
const first = parts.filter((part) => part.column === 0);
|
|
148
|
+
const left = box.x - box.width / 2 - gap;
|
|
149
|
+
if (space.rowShares[0] !== undefined) {
|
|
150
|
+
first.forEach((part) => {
|
|
151
|
+
const text = space.rowLabels[part.upper ? 0 : 1] ?? "";
|
|
152
|
+
brace({ x: left, y: part.y - part.height / 2 }, { x: left, y: part.y + part.height / 2 }, { x: -1, y: 0 }, text, "right");
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (drawn) {
|
|
156
|
+
const fill = fillOps.resolve({ type: "solid", color: space.labelColor });
|
|
157
|
+
ctx.draw(runs.stroke({ weight: 2, fill, align: "center", cap: "round", join: "round" }));
|
|
158
|
+
}
|
|
159
|
+
return labels;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=sample-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-space.js","sourceRoot":"","sources":["../../src/structures/sample-space.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,OAAO,EACP,UAAU,EACV,KAAK,GAkBR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAc,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAc1C,wFAAwF;AACxF,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,SAAS,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,OAAO,CAAC,CAAC;QAC9H,CAAC,CAAC,CAAC;IACP,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,UAA6B,EAAE,CAAC,CAAC;QAC5F,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import {\n component2d,\n fillOps,\n Graphics2D,\n Types,\n type Color,\n type Fill,\n type FillResolved,\n type NodeOf,\n type NormalizedColor,\n type PaintProps,\n type RenderContext,\n type ShadowResolved,\n type Size2D,\n type StrokeResolved,\n type Values,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type Stroke as _Stroke,\n} from \"@motionscript/sdk\";\nimport { braceOutline } from \"../kit/brace\";\nimport { omit, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { drawLabels, loadFormulas, type Label } from \"../kit/furniture\";\nimport { lerpFillScale, readFillScale } from \"../kit/scale\";\nimport { formatTick } from \"../kit/ticks\";\n\nexport interface SampleSpaceProps extends PaintProps {\n columnShares?: number[];\n rowShares?: number[];\n columnFills?: Fill[];\n columnLabels?: string[];\n rowLabels?: string[];\n values?: boolean;\n labelSize?: number;\n labelColor?: Color;\n fontFamily?: string;\n}\n\n/** The parts' paints until told otherwise, a column each, round again past the last. */\nconst PALETTE = [\"#58a6ff\", \"#f59e0b\", \"#4ade80\", \"#f472b6\", \"#a78bfa\", \"#2dd4bf\"];\n\n/** How strongly the lower part of a split column shows its paint. */\nconst LOWER = 0.45;\n\nfunction readShares(value: readonly number[] | undefined): number[] {\n return (Array.isArray(value) ? value : []).map((share) => (Number.isFinite(share) && share > 0 ? share : 0));\n}\n\n// Shares tween one by one; a different count has nothing to pair with, and changes at the end.\nfunction lerpShares(from: number[], to: number[], t: number): number[] {\n if (from.length !== to.length) return t < 1 ? from : to;\n return to.map((share, i) => from[i] + (share - from[i]) * t);\n}\n\nconst state = {\n // Its parts are painted from `columnFills`, and it trims no outline of its own.\n ...omit(PAINT, \"fill\", \"start\", \"end\"),\n /** How the whole is shared across, left to right; any numbers, read as shares of their sum. */\n columnShares: Types.custom<number[]>([1], { resolve: readShares, lerp: lerpShares, kind: \"vector\" }),\n /** Each column's upper share, 0 to 1; a column without one is not cut across. */\n rowShares: Types.custom<number[]>([], { resolve: readShares, lerp: lerpShares, kind: \"vector\" }),\n /** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */\n columnFills: Types.custom<Fill[], FillResolved[][]>([], { resolve: readFillScale, lerp: lerpFillScale, kind: \"vector\" }),\n columnLabels: Types.custom<string[]>([], { animatable: false, kind: \"vector\" }),\n /** The upper part's name and the lower's, written on the left. */\n rowLabels: Types.custom<string[]>([], { animatable: false, kind: \"vector\" }),\n /** Write each part's probability in it. */\n values: Types.boolean(false, { animatable: false }),\n labelSize: Types.number(20, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n};\n\n/** What a sample space is drawn from: its own entries, as its fields and its node both read them. */\nexport type SampleSpaceValues = Values<typeof state>;\n\n/** One part of a sample space: its box in pixels from the node's centre, y up, and its probability. */\nexport interface SamplePart {\n x: number;\n y: number;\n width: number;\n height: number;\n probability: number;\n column: number;\n upper: boolean;\n}\n\n/**\n * A probability's whole, as a box cut into columns by `columnShares` (shares of\n * the whole, P(A) and P(not A)) and each column cut again by its `rowShares` entry\n * (P(B | A) above, the rest below): each part's area is its probability.\n * Braces name the columns below and the rows on the left; `divideTo` moves the\n * cuts.\n */\nexport const SampleSpace = component2d({\n key: \"sampleSpace\",\n state,\n defaults: { stroke: { weight: 2, fill: \"#0b0d12\", align: \"center\" } },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n loadFormulas(loader, [...s.columnLabels, ...s.rowLabels]);\n },\n commands: {\n ...omit(PAINT_COMMANDS, \"fillTo\", \"progressTo\", \"flash\"),\n /** Move the cuts: the columns' shares, each column's upper share, or both. */\n divideTo: { args: [\"columnShares\", \"rowShares\"] },\n },\n render: (ctx, s) => painted(ctx, () => drawSpace(ctx, s)),\n});\n\nexport type SampleSpace = NodeOf<typeof SampleSpace>;\n\n/** Each part of a sample space of `size`: columns left to right, upper part first. */\nexport function sampleParts(space: SampleSpaceValues, size: Size2D): SamplePart[] {\n const box = boxOf(space, size);\n const shares = space.columnShares;\n const total = shares.reduce((sum, share) => sum + share, 0);\n if (!(total > 0) || box.width <= 0 || box.height <= 0) return [];\n const out: SamplePart[] = [];\n let left = box.x - box.width / 2;\n shares.forEach((share, column) => {\n const width = (box.width * share) / total;\n const p = share / total;\n const cut = space.rowShares[column];\n const top = box.y + box.height / 2;\n if (cut === undefined) {\n out.push({ x: left + width / 2, y: box.y, width, height: box.height, probability: p, column, upper: true });\n } else {\n const upper = Math.min(1, Math.max(0, cut));\n const h = box.height * upper;\n out.push({ x: left + width / 2, y: top - h / 2, width, height: h, probability: p * upper, column, upper: true });\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 });\n }\n left += width;\n });\n return out;\n}\n\nfunction drawSpace(ctx: RenderContext, space: SampleSpaceValues): void {\n const parts = sampleParts(space, ctx.size);\n if (parts.length === 0) return;\n const fills = space.columnFills;\n const stroke = space.stroke as StrokeResolved[];\n const labels: Label[] = [];\n for (const part of parts) {\n if (!(part.width > 0) || !(part.height > 0)) continue;\n const base = fills.length > 0 ? fills[part.column % fills.length] : fillOps.resolve(PALETTE[part.column % PALETTE.length]);\n const paint = part.upper ? base : base.map((layer) => ({ ...layer, opacity: (layer.opacity ?? 1) * LOWER }));\n const g = new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height });\n ctx.draw(g.shadow(space.shadow as ShadowResolved[]).fill(paint));\n if (stroke.length > 0) ctx.draw(new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height }).stroke(stroke));\n if (space.values && part.height > space.labelSize && part.width > space.labelSize) {\n labels.push({ text: formatTick(Math.round(part.probability * 1000) / 1000, 0.001), at: { x: part.x, y: part.y }, align: \"center\" });\n }\n }\n labels.push(...braces(ctx, space, parts));\n const style = { fontSize: space.labelSize, fontFamily: space.fontFamily, color: space.labelColor as NormalizedColor };\n for (const part of drawLabels(labels, style)) ctx.draw(part);\n}\n\n/** Room for the braces and their names, below and on the left, taken from the box. */\nfunction boxOf(space: SampleSpaceValues, size: Size2D): { x: number; y: number; width: number; height: number } {\n const { width, height } = size;\n const room = space.labelSize * 2.6;\n const below = space.columnLabels.some((label) => label !== \"\") ? room : 0;\n const left = space.rowLabels.some((label) => label !== \"\") ? room * 1.6 : 0;\n return { x: left / 2, y: below / 2, width: Math.max(0, width - left), height: Math.max(0, height - below) };\n}\n\n/** Braces under each column and beside the first column's parts, and the labels that name them. */\nfunction braces(ctx: RenderContext, space: SampleSpaceValues, parts: readonly SamplePart[]): Label[] {\n const box = boxOf(space, ctx.size);\n const reach = space.labelSize * 0.8;\n const gap = 6;\n const runs = new Graphics2D();\n const labels: Label[] = [];\n let drawn = false;\n const brace = (from: Vector2, to: Vector2, out: Vector2, text: string, align: Label[\"align\"]) => {\n if (text === \"\") return;\n // A frame centred on the node's own centre, so the path is drawn where it is and not moved onto it.\n runs.path({ data: braceOutline(from, to, out, reach), centerBounds: [-1, -1, 1, 1] });\n drawn = true;\n const mid = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };\n const far = reach + space.labelSize * 0.75;\n labels.push({ text, at: { x: mid.x + out.x * far, y: mid.y + out.y * far }, align });\n };\n const bottom = box.y - box.height / 2 - gap;\n for (const part of parts) {\n if (!part.upper && space.rowShares[part.column] !== undefined) continue;\n const text = space.columnLabels[part.column] ?? \"\";\n // Left to right along the bottom, so the bulge, to the edge's right, points down.\n brace({ x: part.x + part.width / 2, y: bottom }, { x: part.x - part.width / 2, y: bottom }, { x: 0, y: -1 }, text, \"center\");\n }\n const first = parts.filter((part) => part.column === 0);\n const left = box.x - box.width / 2 - gap;\n if (space.rowShares[0] !== undefined) {\n first.forEach((part) => {\n const text = space.rowLabels[part.upper ? 0 : 1] ?? \"\";\n brace({ x: left, y: part.y - part.height / 2 }, { x: left, y: part.y + part.height / 2 }, { x: -1, y: 0 }, text, \"right\");\n });\n }\n if (drawn) {\n const fill = fillOps.resolve({ type: \"solid\", color: space.labelColor as NormalizedColor });\n ctx.draw(runs.stroke({ weight: 2, fill, align: \"center\", cap: \"round\", join: \"round\" }));\n }\n return labels;\n}\n"]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Graphics2D, type Color, type Extents, type InsetsResolved, type Loader, type NodeOf, type NormalizedColor, type PaintProps, type StrokeResolved, type Values, type Vector2, 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 } from "@motionscript/sdk";
|
|
2
|
+
import { type AxisScaling, type CoordinateMap, type Interval } from "../kit/coords.js";
|
|
3
|
+
import { type Ticks } from "../kit/ticks.js";
|
|
4
|
+
export interface Axes2dProps extends PaintProps {
|
|
5
|
+
xRange?: Interval;
|
|
6
|
+
yRange?: Interval;
|
|
7
|
+
xStep?: number;
|
|
8
|
+
yStep?: number;
|
|
9
|
+
xScaling?: AxisScaling;
|
|
10
|
+
yScaling?: AxisScaling;
|
|
11
|
+
squareUnits?: boolean;
|
|
12
|
+
ticks?: boolean;
|
|
13
|
+
tickSize?: number;
|
|
14
|
+
labels?: boolean;
|
|
15
|
+
labelSize?: number;
|
|
16
|
+
labelColor?: Color;
|
|
17
|
+
fontFamily?: string;
|
|
18
|
+
xLabel?: string;
|
|
19
|
+
yLabel?: string;
|
|
20
|
+
}
|
|
21
|
+
/** One axis, as its furniture is drawn: its line's ends and what is marked along it. */
|
|
22
|
+
export interface AxisLayout {
|
|
23
|
+
from: Vector2;
|
|
24
|
+
to: Vector2;
|
|
25
|
+
/** The pixel points that draw its line: its two ends, or more where the system's map bends it. */
|
|
26
|
+
line: Vector2[];
|
|
27
|
+
marks: Ticks;
|
|
28
|
+
/** The value on this axis the other one crosses at, which is left unmarked. */
|
|
29
|
+
crossing: number;
|
|
30
|
+
/** A mark's pixel point. */
|
|
31
|
+
at(value: number): Vector2;
|
|
32
|
+
}
|
|
33
|
+
/** An x and a y axis's entries: what a number plane is built on too. */
|
|
34
|
+
export declare const AXES: {
|
|
35
|
+
xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
36
|
+
yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
37
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
38
|
+
xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
39
|
+
yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
40
|
+
xScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
41
|
+
yScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
42
|
+
/** Give a y unit the length of an x unit: `yRange` keeps its centre and takes the span that fits. */
|
|
43
|
+
squareUnits: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
44
|
+
ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
45
|
+
tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
|
+
labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
47
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
48
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
49
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
50
|
+
/** A title at the positive end of each axis. */
|
|
51
|
+
xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
52
|
+
yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
53
|
+
fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
54
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
55
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
56
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
57
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
58
|
+
};
|
|
59
|
+
/** The axes' own commands, beside a shape's paints. */
|
|
60
|
+
export declare const AXES_COMMANDS: {
|
|
61
|
+
/** Animate the window of values the axes show: a pan when a range's ends move alike, a zoom when they do not. */
|
|
62
|
+
rangeTo: {
|
|
63
|
+
args: readonly ["xRange", "yRange"];
|
|
64
|
+
};
|
|
65
|
+
fillTo: {
|
|
66
|
+
readonly args: readonly ["fill"];
|
|
67
|
+
readonly run?: undefined;
|
|
68
|
+
};
|
|
69
|
+
strokeTo: {
|
|
70
|
+
readonly args: readonly ["stroke"];
|
|
71
|
+
readonly run?: undefined;
|
|
72
|
+
};
|
|
73
|
+
shadowTo: {
|
|
74
|
+
readonly args: readonly ["shadow"];
|
|
75
|
+
readonly run?: undefined;
|
|
76
|
+
};
|
|
77
|
+
progressTo: {
|
|
78
|
+
readonly args: readonly ["start", "end"];
|
|
79
|
+
readonly run?: undefined;
|
|
80
|
+
};
|
|
81
|
+
flash: {
|
|
82
|
+
readonly args: {
|
|
83
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
84
|
+
};
|
|
85
|
+
run(timeline: any, state: any, children: any): import("@motionscript/sdk").Piece;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/** What axes are drawn from: their own entries, as a number plane's helpers read them too. */
|
|
89
|
+
export type AxesValues = Values<typeof AXES> & {
|
|
90
|
+
readonly padding: InsetsResolved;
|
|
91
|
+
readonly clip: boolean;
|
|
92
|
+
};
|
|
93
|
+
/** What axes declare before they are laid out: their face, and MathJax for a title written as a formula. */
|
|
94
|
+
export declare function loadAxes(loader: Loader, s: AxesValues): void;
|
|
95
|
+
/** How the axes' values land on a plot area. */
|
|
96
|
+
export declare function axesMap(area: Extents, s: AxesValues): CoordinateMap;
|
|
97
|
+
/** The two axes as laid out on `map`: where each runs, what it marks, and where the other crosses it. */
|
|
98
|
+
export declare function axesOf(map: CoordinateMap, s: AxesValues): [AxisLayout, AxisLayout];
|
|
99
|
+
/** What the axes draw of themselves on `map`, over what `backdrop` draws behind them (a number plane's grid). */
|
|
100
|
+
export declare function axesFurniture(map: CoordinateMap, s: AxesValues, backdrop?: (x: AxisLayout, y: AxisLayout) => Graphics2D[]): Graphics2D[];
|
|
101
|
+
/**
|
|
102
|
+
* An x and a y axis, crossing at the origin while it is in range and at the
|
|
103
|
+
* nearest edge otherwise. Children sit in its graph coordinates.
|
|
104
|
+
*/
|
|
105
|
+
export declare const Axes2d: import("@motionscript/sdk").Component<"axes2d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
106
|
+
xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
107
|
+
yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
108
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
109
|
+
xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
110
|
+
yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
111
|
+
xScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
112
|
+
yScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
113
|
+
/** Give a y unit the length of an x unit: `yRange` keeps its centre and takes the span that fits. */
|
|
114
|
+
squareUnits: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
115
|
+
ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
116
|
+
tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
|
+
labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
118
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
119
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
120
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
121
|
+
/** A title at the positive end of each axis. */
|
|
122
|
+
xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
123
|
+
yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
124
|
+
fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
125
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
126
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
127
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
128
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
129
|
+
}>, {
|
|
130
|
+
rangeTo: readonly ["xRange", "yRange"];
|
|
131
|
+
fillTo: readonly ["fill"];
|
|
132
|
+
strokeTo: readonly ["stroke"];
|
|
133
|
+
shadowTo: readonly ["shadow"];
|
|
134
|
+
progressTo: readonly ["start", "end"];
|
|
135
|
+
flash: {
|
|
136
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
137
|
+
};
|
|
138
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
139
|
+
xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
140
|
+
yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
141
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
142
|
+
xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
|
+
yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
144
|
+
xScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
145
|
+
yScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
146
|
+
/** Give a y unit the length of an x unit: `yRange` keeps its centre and takes the span that fits. */
|
|
147
|
+
squareUnits: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
148
|
+
ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
149
|
+
tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
150
|
+
labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
151
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
152
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
153
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
154
|
+
/** A title at the positive end of each axis. */
|
|
155
|
+
xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
156
|
+
yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
157
|
+
fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
158
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
159
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
160
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
161
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
162
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
163
|
+
xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
164
|
+
yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
165
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
166
|
+
xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
167
|
+
yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
168
|
+
xScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
169
|
+
yScaling: import("@motionscript/sdk").Type<"linear" | "log", "linear" | "log", false>;
|
|
170
|
+
/** Give a y unit the length of an x unit: `yRange` keeps its centre and takes the span that fits. */
|
|
171
|
+
squareUnits: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
172
|
+
ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
173
|
+
tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
174
|
+
labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
175
|
+
labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
176
|
+
labelColor: import("@motionscript/sdk").Type<Color, NormalizedColor, false>;
|
|
177
|
+
fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
178
|
+
/** A title at the positive end of each axis. */
|
|
179
|
+
xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
180
|
+
yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
181
|
+
fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
182
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, StrokeResolved[]>;
|
|
183
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
184
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
185
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
186
|
+
}>, {
|
|
187
|
+
rangeTo: readonly ["xRange", "yRange"];
|
|
188
|
+
fillTo: readonly ["fill"];
|
|
189
|
+
strokeTo: readonly ["stroke"];
|
|
190
|
+
shadowTo: readonly ["shadow"];
|
|
191
|
+
progressTo: readonly ["start", "end"];
|
|
192
|
+
flash: {
|
|
193
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
194
|
+
};
|
|
195
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
196
|
+
export type Axes2d = NodeOf<typeof Axes2d>;
|
|
197
|
+
//# sourceMappingURL=axes2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axes2d.d.ts","sourceRoot":"","sources":["../../src/systems/axes2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EAEV,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,OAAO,EAEZ,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,EACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA8C,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGhI,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAGhE,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAA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