compostjs 0.0.12 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/compost.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Compost_createSvg, EventHandler, HorizontalAlign, VerticalAlign, Derived_Bar, Derived_Column, Derived_Font, Derived_StrokeColor, Derived_FillColor, Shape, Scale, categorical, Value, continuous } from "./core.js";
1
+ import { Compost_createSvg, EventHandler, HorizontalAlign, VerticalAlign, Derived_Bar, Derived_Column, Derived_Font, Derived_StrokeColor, Derived_PreserveAspectRatio, Derived_FillColor, Shape, Scale, categorical, Value, continuous } from "./core.js";
2
2
  import { printf, toFail } from "./fable_modules/fable-library-js.4.28.0/String.js";
3
3
  import { map as map_1, item } from "./fable_modules/fable-library-js.4.28.0/Array.js";
4
4
  import { toList, map, delay, toArray } from "./fable_modules/fable-library-js.4.28.0/Seq.js";
@@ -45,37 +45,40 @@ export const scale = {
45
45
 
46
46
  export const compost = {
47
47
  scaleX(sc, sh) {
48
- return new Shape(3, [sc, undefined, sh]);
48
+ return new Shape(4, [sc, undefined, sh]);
49
49
  },
50
50
  scaleY(sc_1, sh_1) {
51
- return new Shape(3, [undefined, sc_1, sh_1]);
51
+ return new Shape(4, [undefined, sc_1, sh_1]);
52
52
  },
53
53
  scale(sx, sy, sh_2) {
54
- return new Shape(3, [sx, sy, sh_2]);
54
+ return new Shape(4, [sx, sy, sh_2]);
55
55
  },
56
56
  nestX(lx, hx, s) {
57
- return new Shape(4, [Helpers_parseValue(lx), Helpers_parseValue(hx), s]);
57
+ return new Shape(5, [Helpers_parseValue(lx), Helpers_parseValue(hx), s]);
58
58
  },
59
59
  nestY(ly, hy, s_1) {
60
- return new Shape(5, [Helpers_parseValue(ly), Helpers_parseValue(hy), s_1]);
60
+ return new Shape(6, [Helpers_parseValue(ly), Helpers_parseValue(hy), s_1]);
61
61
  },
62
62
  nest(lx_1, hx_1, ly_1, hy_1, s_2) {
63
- return new Shape(5, [Helpers_parseValue(ly_1), Helpers_parseValue(hy_1), new Shape(4, [Helpers_parseValue(lx_1), Helpers_parseValue(hx_1), s_2])]);
63
+ return new Shape(6, [Helpers_parseValue(ly_1), Helpers_parseValue(hy_1), new Shape(5, [Helpers_parseValue(lx_1), Helpers_parseValue(hx_1), s_2])]);
64
64
  },
65
65
  overlay(sh_3) {
66
- return new Shape(9, [ofArray(sh_3)]);
66
+ return new Shape(10, [ofArray(sh_3)]);
67
67
  },
68
68
  padding(t, r, b, l, s_3) {
69
- return new Shape(12, [[t, r, b, l], s_3]);
69
+ return new Shape(13, [[t, r, b, l], s_3]);
70
70
  },
71
71
  fillColor(c, s_4) {
72
72
  return Derived_FillColor(c, s_4);
73
73
  },
74
- strokeColor(c_1, s_5) {
75
- return Derived_StrokeColor(c_1, s_5);
74
+ preserveAspectRatio(pa, s_5) {
75
+ return Derived_PreserveAspectRatio(pa, s_5);
76
76
  },
77
- font(f, c_2, s_6) {
78
- return Derived_Font(f, c_2, s_6);
77
+ strokeColor(c_1, s_6) {
78
+ return Derived_StrokeColor(c_1, s_6);
79
+ },
80
+ font(f, c_2, s_7) {
81
+ return Derived_Font(f, c_2, s_7);
79
82
  },
80
83
  column(xp, yp) {
81
84
  return Derived_Column(new categorical(xp), new continuous(yp));
@@ -84,26 +87,29 @@ export const compost = {
84
87
  return Derived_Bar(new continuous(xp_1), new categorical(yp_1));
85
88
  },
86
89
  bubble(xp_2, yp_2, w, h) {
87
- return new Shape(7, [Helpers_parseValue(xp_2), Helpers_parseValue(yp_2), w, h]);
90
+ return new Shape(8, [Helpers_parseValue(xp_2), Helpers_parseValue(yp_2), w, h]);
88
91
  },
89
- text(xp_3, yp_3, t_1, s_7, r_1) {
92
+ text(xp_3, yp_3, t_1, s_8, r_1) {
90
93
  const r_2 = equals(r_1, defaultOf()) ? 0 : r_1;
91
- const s_8 = equals(s_7, defaultOf()) ? "" : s_7;
92
- const va = (s_8.indexOf("baseline") >= 0) ? (new VerticalAlign(0, [])) : ((s_8.indexOf("hanging") >= 0) ? (new VerticalAlign(2, [])) : (new VerticalAlign(1, [])));
93
- const ha = (s_8.indexOf("start") >= 0) ? (new HorizontalAlign(0, [])) : ((s_8.indexOf("end") >= 0) ? (new HorizontalAlign(2, [])) : (new HorizontalAlign(1, [])));
94
- return new Shape(1, [Helpers_parseValue(xp_3), Helpers_parseValue(yp_3), va, ha, r_2, t_1]);
94
+ const s_9 = equals(s_8, defaultOf()) ? "" : s_8;
95
+ const va = (s_9.indexOf("baseline") >= 0) ? (new VerticalAlign(0, [])) : ((s_9.indexOf("hanging") >= 0) ? (new VerticalAlign(2, [])) : (new VerticalAlign(1, [])));
96
+ const ha = (s_9.indexOf("start") >= 0) ? (new HorizontalAlign(0, [])) : ((s_9.indexOf("end") >= 0) ? (new HorizontalAlign(2, [])) : (new HorizontalAlign(1, [])));
97
+ return new Shape(2, [Helpers_parseValue(xp_3), Helpers_parseValue(yp_3), va, ha, r_2, t_1]);
95
98
  },
96
99
  shape(a) {
97
- return new Shape(8, [toList(delay(() => map((p) => [Helpers_parseValue(item(0, p)), Helpers_parseValue(item(1, p))], a)))]);
100
+ return new Shape(9, [toList(delay(() => map((p) => [Helpers_parseValue(item(0, p)), Helpers_parseValue(item(1, p))], a)))]);
98
101
  },
99
102
  line(a_1) {
100
- return new Shape(6, [toList(delay(() => map((p_1) => [Helpers_parseValue(item(0, p_1)), Helpers_parseValue(item(1, p_1))], a_1)))]);
103
+ return new Shape(7, [toList(delay(() => map((p_1) => [Helpers_parseValue(item(0, p_1)), Helpers_parseValue(item(1, p_1))], a_1)))]);
104
+ },
105
+ image(href, pt1, pt2) {
106
+ return new Shape(0, [href, [Helpers_parseValue(item(0, pt1)), Helpers_parseValue(item(1, pt1))], [Helpers_parseValue(item(0, pt2)), Helpers_parseValue(item(1, pt2))]]);
101
107
  },
102
- axes(a_2, s_9) {
103
- return new Shape(10, [a_2.indexOf("top") >= 0, a_2.indexOf("right") >= 0, a_2.indexOf("bottom") >= 0, a_2.indexOf("left") >= 0, s_9]);
108
+ axes(a_2, s_10) {
109
+ return new Shape(11, [a_2.indexOf("top") >= 0, a_2.indexOf("right") >= 0, a_2.indexOf("bottom") >= 0, a_2.indexOf("left") >= 0, s_10]);
104
110
  },
105
- on(o, s_10) {
106
- return new Shape(11, [toList(delay(() => map((k) => {
111
+ on(o, s_11) {
112
+ return new Shape(12, [toList(delay(() => map((k) => {
107
113
  let f_2;
108
114
  const f_1 = o[k];
109
115
  f_2 = ((args) => {
@@ -126,7 +132,7 @@ export const compost = {
126
132
  }])) : ((k === "touchend") ? (new EventHandler(6, [(me_7) => {
127
133
  f_2([me_7]);
128
134
  }])) : toFail(printf("Unsupported event type \'%s\' passed to the \'on\' primitive."))(k))))))));
129
- }, Object.keys(o)))), s_10]);
135
+ }, Object.keys(o)))), s_11]);
130
136
  },
131
137
  svg(w_1, h_1, shape) {
132
138
  return Compost_createSvg(false, false, w_1, h_1, shape);
@@ -149,9 +155,9 @@ export const compost = {
149
155
  return new DomNode(1, [defaultOf(), tag, attrs_1, children_1]);
150
156
  },
151
157
  interactive(id, init, update, render) {
152
- createVirtualDomApp(id, init, (t_2, s_12) => {
158
+ createVirtualDomApp(id, init, (t_2, s_13) => {
153
159
  const el = document.getElementById(id);
154
- const res = render(t_2, s_12);
160
+ const res = render(t_2, s_13);
155
161
  if (equals(res["constructor"], (new DomNode(0, [""]))["constructor"])) {
156
162
  return res;
157
163
  }
package/dist/core.js CHANGED
@@ -164,7 +164,7 @@ export function Scale_$reflection(gen0) {
164
164
  }
165
165
 
166
166
  export class Style extends Record {
167
- constructor(StrokeColor, StrokeWidth, StrokeDashArray, Fill, Animation, Font, Cursor, FormatAxisXLabel, FormatAxisYLabel) {
167
+ constructor(StrokeColor, StrokeWidth, StrokeDashArray, Fill, Animation, Font, Cursor, PreserveAspectRatio, FormatAxisXLabel, FormatAxisYLabel) {
168
168
  super();
169
169
  this.StrokeColor = StrokeColor;
170
170
  this.StrokeWidth = StrokeWidth;
@@ -173,13 +173,14 @@ export class Style extends Record {
173
173
  this.Animation = Animation;
174
174
  this.Font = Font;
175
175
  this.Cursor = Cursor;
176
+ this.PreserveAspectRatio = PreserveAspectRatio;
176
177
  this.FormatAxisXLabel = FormatAxisXLabel;
177
178
  this.FormatAxisYLabel = FormatAxisYLabel;
178
179
  }
179
180
  }
180
181
 
181
182
  export function Style_$reflection() {
182
- return record_type("Compost.Style", [], Style, () => [["StrokeColor", tuple_type(float64_type, Color_$reflection())], ["StrokeWidth", Width_$reflection()], ["StrokeDashArray", class_type("System.Collections.Generic.IEnumerable`1", [Number$_$reflection()])], ["Fill", FillStyle_$reflection()], ["Animation", option_type(tuple_type(int32_type, string_type, lambda_type(Style_$reflection(), Style_$reflection())))], ["Font", string_type], ["Cursor", string_type], ["FormatAxisXLabel", lambda_type(Scale_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), lambda_type(Value_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), string_type))], ["FormatAxisYLabel", lambda_type(Scale_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), lambda_type(Value_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), string_type))]]);
183
+ return record_type("Compost.Style", [], Style, () => [["StrokeColor", tuple_type(float64_type, Color_$reflection())], ["StrokeWidth", Width_$reflection()], ["StrokeDashArray", class_type("System.Collections.Generic.IEnumerable`1", [Number$_$reflection()])], ["Fill", FillStyle_$reflection()], ["Animation", option_type(tuple_type(int32_type, string_type, lambda_type(Style_$reflection(), Style_$reflection())))], ["Font", string_type], ["Cursor", string_type], ["PreserveAspectRatio", string_type], ["FormatAxisXLabel", lambda_type(Scale_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), lambda_type(Value_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), string_type))], ["FormatAxisYLabel", lambda_type(Scale_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), lambda_type(Value_$reflection(class_type("Microsoft.FSharp.Core.CompilerServices.MeasureOne")), string_type))]]);
183
184
  }
184
185
 
185
186
  export class EventHandler extends Union {
@@ -219,12 +220,12 @@ export class Shape extends Union {
219
220
  this.fields = fields;
220
221
  }
221
222
  cases() {
222
- return ["Style", "Text", "AutoScale", "InnerScale", "NestX", "NestY", "Line", "Bubble", "Shape", "Layered", "Axes", "Interactive", "Padding", "Offset"];
223
+ return ["Image", "Style", "Text", "AutoScale", "InnerScale", "NestX", "NestY", "Line", "Bubble", "Shape", "Layered", "Axes", "Interactive", "Padding", "Offset"];
223
224
  }
224
225
  }
225
226
 
226
227
  export function Shape_$reflection(gen0, gen1) {
227
- return union_type("Compost.Shape", [gen0, gen1], Shape, () => [[["Item1", lambda_type(Style_$reflection(), Style_$reflection())], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", VerticalAlign_$reflection()], ["Item4", HorizontalAlign_$reflection()], ["Item5", float64_type], ["Item6", string_type]], [["Item1", bool_type], ["Item2", bool_type], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", option_type(Scale_$reflection(gen0))], ["Item2", option_type(Scale_$reflection(gen1))], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen0)], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen1)], ["Item2", Value_$reflection(gen1)], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))])]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", float64_type], ["Item4", float64_type]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))])]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [Shape_$reflection(gen0, gen1)])]], [["Item1", bool_type], ["Item2", bool_type], ["Item3", bool_type], ["Item4", bool_type], ["Item5", Shape_$reflection(gen0, gen1)]], [["Item1", class_type("System.Collections.Generic.IEnumerable`1", [EventHandler_$reflection(gen0, gen1)])], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type, float64_type, float64_type)], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", Shape_$reflection(gen0, gen1)]]]);
228
+ return union_type("Compost.Shape", [gen0, gen1], Shape, () => [[["Item1", string_type], ["Item2", tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))], ["Item3", tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))]], [["Item1", lambda_type(Style_$reflection(), Style_$reflection())], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", VerticalAlign_$reflection()], ["Item4", HorizontalAlign_$reflection()], ["Item5", float64_type], ["Item6", string_type]], [["Item1", bool_type], ["Item2", bool_type], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", option_type(Scale_$reflection(gen0))], ["Item2", option_type(Scale_$reflection(gen1))], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen0)], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen1)], ["Item2", Value_$reflection(gen1)], ["Item3", Shape_$reflection(gen0, gen1)]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))])]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", float64_type], ["Item4", float64_type]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))])]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [Shape_$reflection(gen0, gen1)])]], [["Item1", bool_type], ["Item2", bool_type], ["Item3", bool_type], ["Item4", bool_type], ["Item5", Shape_$reflection(gen0, gen1)]], [["Item1", class_type("System.Collections.Generic.IEnumerable`1", [EventHandler_$reflection(gen0, gen1)])], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type, float64_type, float64_type)], ["Item2", Shape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", Shape_$reflection(gen0, gen1)]]]);
228
229
  }
229
230
 
230
231
  export class Svg_StringBuilder {
@@ -271,17 +272,17 @@ export class Svg_Svg extends Union {
271
272
  this.fields = fields;
272
273
  }
273
274
  cases() {
274
- return ["Path", "Ellipse", "Rect", "Text", "Combine", "Empty"];
275
+ return ["Image", "Path", "Ellipse", "Rect", "Text", "Combine", "Empty"];
275
276
  }
276
277
  }
277
278
 
278
279
  export function Svg_Svg_$reflection() {
279
- return union_type("Compost.Svg.Svg", [], Svg_Svg, () => [[["Item1", array_type(Svg_PathSegment_$reflection())], ["Item2", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", tuple_type(float64_type, float64_type)], ["Item3", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", tuple_type(float64_type, float64_type)], ["Item3", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", string_type], ["Item3", float64_type], ["Item4", string_type]], [["Item", array_type(Svg_Svg_$reflection())]], []]);
280
+ return union_type("Compost.Svg.Svg", [], Svg_Svg, () => [[["Item1", string_type], ["Item2", tuple_type(float64_type, float64_type)], ["Item3", tuple_type(float64_type, float64_type)], ["Item4", string_type]], [["Item1", array_type(Svg_PathSegment_$reflection())], ["Item2", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", tuple_type(float64_type, float64_type)], ["Item3", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", tuple_type(float64_type, float64_type)], ["Item3", string_type]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", string_type], ["Item3", float64_type], ["Item4", string_type]], [["Item", array_type(Svg_Svg_$reflection())]], []]);
280
281
  }
281
282
 
282
283
  export function Svg_mapSvg(f, _arg) {
283
- if (_arg.tag === 4) {
284
- return new Svg_Svg(4, [map((_arg_1) => Svg_mapSvg(f, _arg_1), _arg.fields[0])]);
284
+ if (_arg.tag === 5) {
285
+ return new Svg_Svg(5, [map((_arg_1) => Svg_mapSvg(f, _arg_1), _arg.fields[0])]);
285
286
  }
286
287
  else {
287
288
  return f(_arg);
@@ -322,17 +323,19 @@ export function Svg_RenderingContext_$reflection() {
322
323
  export function Svg_renderSvg(ctx, svg) {
323
324
  return delay(() => {
324
325
  switch (svg.tag) {
325
- case 3: {
326
+ case 4: {
326
327
  const y = svg.fields[0][1];
327
328
  const x = svg.fields[0][0];
328
329
  const rotation = svg.fields[2];
329
330
  return singleton(El_op_Dynamic_Z451691CD(s_6, "text")(toList(delay(() => append(singleton(op_EqualsGreater("style", svg.fields[3])), delay(() => ((rotation === 0) ? append(singleton(op_EqualsGreater("x", x.toString())), delay(() => singleton(op_EqualsGreater("y", y.toString())))) : append(singleton(op_EqualsGreater("x", "0")), delay(() => append(singleton(op_EqualsGreater("y", "0")), delay(() => singleton(op_EqualsGreater("transform", toText(printf("translate(%f,%f) rotate(%f)"))(x)(y)(rotation)))))))))))))(singleton_1(text(svg.fields[1]))));
330
331
  }
331
- case 4:
332
+ case 5:
332
333
  return collect((s) => Svg_renderSvg(ctx, s), svg.fields[0]);
333
- case 1:
334
+ case 2:
334
335
  return singleton(El_op_Dynamic_Z451691CD(s_6, "ellipse")(ofArray([op_EqualsGreater("cx", svg.fields[0][0].toString()), op_EqualsGreater("cy", svg.fields[0][1].toString()), op_EqualsGreater("rx", svg.fields[1][0].toString()), op_EqualsGreater("ry", svg.fields[1][1].toString()), op_EqualsGreater("style", svg.fields[2])]))(empty()));
335
- case 2: {
336
+ case 0:
337
+ return singleton(El_op_Dynamic_Z451691CD(s_6, "image")(ofArray([op_EqualsGreater("href", svg.fields[0]), op_EqualsGreater("preserveAspectRatio", svg.fields[3]), op_EqualsGreater("x", svg.fields[1][0].toString()), op_EqualsGreater("y", svg.fields[1][1].toString()), op_EqualsGreater("width", svg.fields[2][0].toString()), op_EqualsGreater("height", svg.fields[2][1].toString())]))(empty()));
338
+ case 3: {
336
339
  const y2 = svg.fields[1][1];
337
340
  const y1 = svg.fields[0][1];
338
341
  const x2 = svg.fields[1][0];
@@ -343,7 +346,7 @@ export function Svg_renderSvg(ctx, svg) {
343
346
  const matchValue_3 = Math.abs(y1 - y2);
344
347
  return singleton(El_op_Dynamic_Z451691CD(s_6, "rect")(ofArray([op_EqualsGreater("x", matchValue.toString()), op_EqualsGreater("y", matchValue_1.toString()), op_EqualsGreater("width", matchValue_2.toString()), op_EqualsGreater("height", matchValue_3.toString()), op_EqualsGreater("style", svg.fields[2])]))(empty()));
345
348
  }
346
- case 0:
349
+ case 1:
347
350
  return singleton(El_op_Dynamic_Z451691CD(s_6, "path")(ofArray([op_EqualsGreater("d", Svg_formatPath(svg.fields[0])), op_EqualsGreater("style", svg.fields[1])]))(empty()));
348
351
  default: {
349
352
  return empty_1();
@@ -382,8 +385,8 @@ export function Svg_formatStyle(defs, style) {
382
385
  const ease = matchValue[1];
383
386
  const anim = matchValue[2];
384
387
  const id = "anim_" + replace((copyOfStruct = newGuid(), copyOfStruct), "-", "");
385
- const fromstyle = Svg_formatStyle(defs, new Style(style.StrokeColor, style.StrokeWidth, style.StrokeDashArray, style.Fill, undefined, style.Font, style.Cursor, style.FormatAxisXLabel, style.FormatAxisYLabel));
386
- const tostyle = Svg_formatStyle(defs, (bind$0040 = anim(style), new Style(bind$0040.StrokeColor, bind$0040.StrokeWidth, bind$0040.StrokeDashArray, bind$0040.Fill, undefined, bind$0040.Font, bind$0040.Cursor, bind$0040.FormatAxisXLabel, bind$0040.FormatAxisYLabel)));
388
+ const fromstyle = Svg_formatStyle(defs, new Style(style.StrokeColor, style.StrokeWidth, style.StrokeDashArray, style.Fill, undefined, style.Font, style.Cursor, style.PreserveAspectRatio, style.FormatAxisXLabel, style.FormatAxisYLabel));
389
+ const tostyle = Svg_formatStyle(defs, (bind$0040 = anim(style), new Style(bind$0040.StrokeColor, bind$0040.StrokeWidth, bind$0040.StrokeDashArray, bind$0040.Fill, undefined, bind$0040.Font, bind$0040.Cursor, bind$0040.PreserveAspectRatio, bind$0040.FormatAxisXLabel, bind$0040.FormatAxisYLabel)));
387
390
  const item = El_op_Dynamic_Z451691CD(h_2, "style")(empty())(singleton_1(text(toText(printf("@keyframes %s { from { %s } to { %s } }"))(id)(fromstyle)(tostyle))));
388
391
  void (defs.push(item));
389
392
  patternInput = [anim(style), toText(printf("animation: %s %dms %s; "))(id)(ms)(ease)];
@@ -399,12 +402,12 @@ export class Scales_ScaledShape extends Union {
399
402
  this.fields = fields;
400
403
  }
401
404
  cases() {
402
- return ["ScaledStyle", "ScaledText", "ScaledLine", "ScaledBubble", "ScaledShape", "ScaledLayered", "ScaledInteractive", "ScaledPadding", "ScaledOffset", "ScaledNestX", "ScaledNestY"];
405
+ return ["ScaledStyle", "ScaledText", "ScaledLine", "ScaledBubble", "ScaledShape", "ScaledImage", "ScaledLayered", "ScaledInteractive", "ScaledPadding", "ScaledOffset", "ScaledNestX", "ScaledNestY"];
403
406
  }
404
407
  }
405
408
 
406
409
  export function Scales_ScaledShape_$reflection(gen0, gen1) {
407
- return union_type("Compost.Scales.ScaledShape", [gen0, gen1], Scales_ScaledShape, () => [[["Item1", lambda_type(Style_$reflection(), Style_$reflection())], ["Item2", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", VerticalAlign_$reflection()], ["Item4", HorizontalAlign_$reflection()], ["Item5", float64_type], ["Item6", string_type]], [["Item", array_type(tuple_type(Value_$reflection(gen0), Value_$reflection(gen1)))]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", float64_type], ["Item4", float64_type]], [["Item", array_type(tuple_type(Value_$reflection(gen0), Value_$reflection(gen1)))]], [["Item", array_type(Scales_ScaledShape_$reflection(gen0, gen1))]], [["Item1", class_type("System.Collections.Generic.IEnumerable`1", [EventHandler_$reflection(gen0, gen1)])], ["Item2", Scale_$reflection(gen0)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type, float64_type, float64_type)], ["Item2", Scale_$reflection(gen0)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen0)], ["Item3", Scale_$reflection(gen0)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen1)], ["Item2", Value_$reflection(gen1)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]]]);
410
+ return union_type("Compost.Scales.ScaledShape", [gen0, gen1], Scales_ScaledShape, () => [[["Item1", lambda_type(Style_$reflection(), Style_$reflection())], ["Item2", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", VerticalAlign_$reflection()], ["Item4", HorizontalAlign_$reflection()], ["Item5", float64_type], ["Item6", string_type]], [["Item", array_type(tuple_type(Value_$reflection(gen0), Value_$reflection(gen1)))]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen1)], ["Item3", float64_type], ["Item4", float64_type]], [["Item", array_type(tuple_type(Value_$reflection(gen0), Value_$reflection(gen1)))]], [["Item1", string_type], ["Item2", tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))], ["Item3", tuple_type(Value_$reflection(gen0), Value_$reflection(gen1))]], [["Item", array_type(Scales_ScaledShape_$reflection(gen0, gen1))]], [["Item1", class_type("System.Collections.Generic.IEnumerable`1", [EventHandler_$reflection(gen0, gen1)])], ["Item2", Scale_$reflection(gen0)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type, float64_type, float64_type)], ["Item2", Scale_$reflection(gen0)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", tuple_type(float64_type, float64_type)], ["Item2", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen0)], ["Item2", Value_$reflection(gen0)], ["Item3", Scale_$reflection(gen0)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]], [["Item1", Value_$reflection(gen1)], ["Item2", Value_$reflection(gen1)], ["Item3", Scale_$reflection(gen1)], ["Item4", Scales_ScaledShape_$reflection(gen0, gen1)]]]);
408
411
  }
409
412
 
410
413
  export function Scales_getExtremes(_arg) {
@@ -597,25 +600,25 @@ export function Scales_calculateShapeScales(points) {
597
600
  export function Scales_calculateScales(style, shape) {
598
601
  const calculateScales = (shape_2) => Scales_calculateScales(style, shape_2);
599
602
  switch (shape.tag) {
600
- case 4: {
603
+ case 5: {
601
604
  const nx2 = shape.fields[1];
602
605
  const nx1 = shape.fields[0];
603
606
  const patternInput_1 = calculateScales(shape.fields[2]);
604
- return [[Scales_calculateShapeScale([nx1, nx2]), patternInput_1[0][1]], new Scales_ScaledShape(9, [nx1, nx2, patternInput_1[0][0], patternInput_1[1]])];
607
+ return [[Scales_calculateShapeScale([nx1, nx2]), patternInput_1[0][1]], new Scales_ScaledShape(10, [nx1, nx2, patternInput_1[0][0], patternInput_1[1]])];
605
608
  }
606
- case 5: {
609
+ case 6: {
607
610
  const ny2 = shape.fields[1];
608
611
  const ny1 = shape.fields[0];
609
612
  const patternInput_2 = calculateScales(shape.fields[2]);
610
- return [[patternInput_2[0][0], Scales_calculateShapeScale([ny1, ny2])], new Scales_ScaledShape(10, [ny1, ny2, patternInput_2[0][1], patternInput_2[1]])];
613
+ return [[patternInput_2[0][0], Scales_calculateShapeScale([ny1, ny2])], new Scales_ScaledShape(11, [ny1, ny2, patternInput_2[0][1], patternInput_2[1]])];
611
614
  }
612
- case 3: {
615
+ case 4: {
613
616
  const sy = shape.fields[1];
614
617
  const sx = shape.fields[0];
615
618
  const patternInput_3 = calculateScales(shape.fields[2]);
616
619
  return [[(sx != null) ? sx : patternInput_3[0][0], (sy != null) ? sy : patternInput_3[0][1]], patternInput_3[1]];
617
620
  }
618
- case 2: {
621
+ case 3: {
619
622
  const patternInput_4 = calculateScales(shape.fields[2]);
620
623
  const isy_3 = patternInput_4[0][1];
621
624
  const isx_3 = patternInput_4[0][0];
@@ -630,17 +633,17 @@ export function Scales_calculateScales(style, shape) {
630
633
  };
631
634
  return [[shape.fields[0] ? autoScale(isx_3) : isx_3, shape.fields[1] ? autoScale(isy_3) : isy_3], patternInput_4[1]];
632
635
  }
633
- case 13: {
636
+ case 14: {
634
637
  const patternInput_6 = calculateScales(shape.fields[1]);
635
- return [patternInput_6[0], new Scales_ScaledShape(8, [shape.fields[0], patternInput_6[1]])];
638
+ return [patternInput_6[0], new Scales_ScaledShape(9, [shape.fields[0], patternInput_6[1]])];
636
639
  }
637
- case 12: {
640
+ case 13: {
638
641
  const patternInput_7 = calculateScales(shape.fields[1]);
639
642
  const sy_3 = patternInput_7[0][1];
640
643
  const sx_3 = patternInput_7[0][0];
641
- return [[sx_3, sy_3], new Scales_ScaledShape(7, [shape.fields[0], sx_3, sy_3, patternInput_7[1]])];
644
+ return [[sx_3, sy_3], new Scales_ScaledShape(8, [shape.fields[0], sx_3, sy_3, patternInput_7[1]])];
642
645
  }
643
- case 7: {
646
+ case 8: {
644
647
  const y = shape.fields[1];
645
648
  const x = shape.fields[0];
646
649
  const makeSingletonScale = (_arg_1) => {
@@ -654,7 +657,7 @@ export function Scales_calculateScales(style, shape) {
654
657
  };
655
658
  return [[makeSingletonScale(x), makeSingletonScale(y)], new Scales_ScaledShape(3, [x, y, shape.fields[2], shape.fields[3]])];
656
659
  }
657
- case 1: {
660
+ case 2: {
658
661
  const y_1 = shape.fields[1];
659
662
  const x_1 = shape.fields[0];
660
663
  const makeSingletonScale_1 = (_arg_2) => {
@@ -668,15 +671,20 @@ export function Scales_calculateScales(style, shape) {
668
671
  };
669
672
  return [[makeSingletonScale_1(x_1), makeSingletonScale_1(y_1)], new Scales_ScaledShape(1, [x_1, y_1, shape.fields[2], shape.fields[3], shape.fields[4], shape.fields[5]])];
670
673
  }
671
- case 6: {
674
+ case 7: {
672
675
  const line_1 = toArray(shape.fields[0]);
673
676
  return [Scales_calculateShapeScales(line_1), new Scales_ScaledShape(2, [line_1])];
674
677
  }
675
- case 8: {
678
+ case 0: {
679
+ const pt2 = shape.fields[2];
680
+ const pt1 = shape.fields[1];
681
+ return [Scales_calculateShapeScales([pt1, pt2]), new Scales_ScaledShape(5, [shape.fields[0], pt1, pt2])];
682
+ }
683
+ case 9: {
676
684
  const points_1 = toArray(shape.fields[0]);
677
685
  return [Scales_calculateShapeScales(points_1), new Scales_ScaledShape(4, [points_1])];
678
686
  }
679
- case 10: {
687
+ case 11: {
680
688
  const showTop = shape.fields[0];
681
689
  const showRight = shape.fields[1];
682
690
  const showLeft = shape.fields[3];
@@ -691,20 +699,20 @@ export function Scales_calculateScales(style, shape) {
691
699
  const lx = matchValue[0];
692
700
  const hy = matchValue_1[1];
693
701
  const hx = matchValue[1];
694
- const LineStyle = (clr, alpha, width, shape_18) => (new Shape(0, [(s) => (new Style([alpha, new Color(1, [clr])], new Width(width), s.StrokeDashArray, new FillStyle(0, [[1, new Color(1, ["transparent"])]]), s.Animation, s.Font, s.Cursor, s.FormatAxisXLabel, s.FormatAxisYLabel)), shape_18]));
695
- const FontStyle = (style_2, shape_19) => (new Shape(0, [(s_1) => (new Style([0, new Color(1, ["transparent"])], s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, ["black"])]]), s_1.Animation, style_2, s_1.Cursor, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), shape_19]));
696
- return calculateScales(new Shape(12, [[showTop ? 30 : 0, showRight ? 50 : 0, showBottom ? 30 : 0, showLeft ? 50 : 0], new Shape(9, [toList(delay(() => append(singleton(new Shape(3, [sx_4, sy_4, new Shape(9, [toList(delay(() => append(map_1((x_2) => LineStyle("#e4e4e4", 1, 1, new Shape(6, [[[x_2, ly], [x_2, hy]]])), Scales_generateAxisSteps(sx_4)), delay(() => map_1((y_2) => LineStyle("#e4e4e4", 1, 1, new Shape(6, [[[lx, y_2], [hx, y_2]]])), Scales_generateAxisSteps(sy_4))))))])])), delay(() => append(showTop ? append(singleton(LineStyle("black", 1, 2, new Shape(6, [[[lx, hy], [hx, hy]]]))), delay(() => collect((matchValue_2) => singleton(FontStyle("9pt sans-serif", new Shape(13, [[0, -10], new Shape(1, [matchValue_2[0], hy, new VerticalAlign(0, []), new HorizontalAlign(1, []), 0, matchValue_2[1]])]))), Scales_generateAxisLabels(style.FormatAxisXLabel, sx_4)))) : empty_1(), delay(() => append(showRight ? append(singleton(LineStyle("black", 1, 2, new Shape(6, [[[hx, hy], [hx, ly]]]))), delay(() => collect((matchValue_3) => singleton(FontStyle("9pt sans-serif", new Shape(13, [[10, 0], new Shape(1, [hx, matchValue_3[0], new VerticalAlign(1, []), new HorizontalAlign(0, []), 0, matchValue_3[1]])]))), Scales_generateAxisLabels(style.FormatAxisYLabel, sy_4)))) : empty_1(), delay(() => append(showBottom ? append(singleton(LineStyle("black", 1, 2, new Shape(6, [[[lx, ly], [hx, ly]]]))), delay(() => collect((matchValue_4) => singleton(FontStyle("9pt sans-serif", new Shape(13, [[0, 10], new Shape(1, [matchValue_4[0], ly, new VerticalAlign(2, []), new HorizontalAlign(1, []), 0, matchValue_4[1]])]))), Scales_generateAxisLabels(style.FormatAxisXLabel, sx_4)))) : empty_1(), delay(() => append(showLeft ? append(singleton(LineStyle("black", 1, 2, new Shape(6, [[[lx, hy], [lx, ly]]]))), delay(() => collect((matchValue_5) => singleton(FontStyle("9pt sans-serif", new Shape(13, [[-10, 0], new Shape(1, [lx, matchValue_5[0], new VerticalAlign(1, []), new HorizontalAlign(2, []), 0, matchValue_5[1]])]))), Scales_generateAxisLabels(style.FormatAxisYLabel, sy_4)))) : empty_1(), delay(() => singleton(shape_17)))))))))))))])]));
702
+ const LineStyle = (clr, alpha, width, shape_18) => (new Shape(1, [(s) => (new Style([alpha, new Color(1, [clr])], new Width(width), s.StrokeDashArray, new FillStyle(0, [[1, new Color(1, ["transparent"])]]), s.Animation, s.Font, s.Cursor, s.PreserveAspectRatio, s.FormatAxisXLabel, s.FormatAxisYLabel)), shape_18]));
703
+ const FontStyle = (style_2, shape_19) => (new Shape(1, [(s_1) => (new Style([0, new Color(1, ["transparent"])], s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, ["black"])]]), s_1.Animation, style_2, s_1.Cursor, s_1.PreserveAspectRatio, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), shape_19]));
704
+ return calculateScales(new Shape(13, [[showTop ? 30 : 0, showRight ? 50 : 0, showBottom ? 30 : 0, showLeft ? 50 : 0], new Shape(10, [toList(delay(() => append(singleton(new Shape(4, [sx_4, sy_4, new Shape(10, [toList(delay(() => append(map_1((x_2) => LineStyle("#e4e4e4", 1, 1, new Shape(7, [[[x_2, ly], [x_2, hy]]])), Scales_generateAxisSteps(sx_4)), delay(() => map_1((y_2) => LineStyle("#e4e4e4", 1, 1, new Shape(7, [[[lx, y_2], [hx, y_2]]])), Scales_generateAxisSteps(sy_4))))))])])), delay(() => append(showTop ? append(singleton(LineStyle("black", 1, 2, new Shape(7, [[[lx, hy], [hx, hy]]]))), delay(() => collect((matchValue_2) => singleton(FontStyle("9pt sans-serif", new Shape(14, [[0, -10], new Shape(2, [matchValue_2[0], hy, new VerticalAlign(0, []), new HorizontalAlign(1, []), 0, matchValue_2[1]])]))), Scales_generateAxisLabels(style.FormatAxisXLabel, sx_4)))) : empty_1(), delay(() => append(showRight ? append(singleton(LineStyle("black", 1, 2, new Shape(7, [[[hx, hy], [hx, ly]]]))), delay(() => collect((matchValue_3) => singleton(FontStyle("9pt sans-serif", new Shape(14, [[10, 0], new Shape(2, [hx, matchValue_3[0], new VerticalAlign(1, []), new HorizontalAlign(0, []), 0, matchValue_3[1]])]))), Scales_generateAxisLabels(style.FormatAxisYLabel, sy_4)))) : empty_1(), delay(() => append(showBottom ? append(singleton(LineStyle("black", 1, 2, new Shape(7, [[[lx, ly], [hx, ly]]]))), delay(() => collect((matchValue_4) => singleton(FontStyle("9pt sans-serif", new Shape(14, [[0, 10], new Shape(2, [matchValue_4[0], ly, new VerticalAlign(2, []), new HorizontalAlign(1, []), 0, matchValue_4[1]])]))), Scales_generateAxisLabels(style.FormatAxisXLabel, sx_4)))) : empty_1(), delay(() => append(showLeft ? append(singleton(LineStyle("black", 1, 2, new Shape(7, [[[lx, hy], [lx, ly]]]))), delay(() => collect((matchValue_5) => singleton(FontStyle("9pt sans-serif", new Shape(14, [[-10, 0], new Shape(2, [lx, matchValue_5[0], new VerticalAlign(1, []), new HorizontalAlign(2, []), 0, matchValue_5[1]])]))), Scales_generateAxisLabels(style.FormatAxisYLabel, sy_4)))) : empty_1(), delay(() => singleton(shape_17)))))))))))))])]));
697
705
  }
698
- case 9: {
706
+ case 10: {
699
707
  const scaled = map(calculateScales, Array.from(shape.fields[0]));
700
708
  const sxs = map((tupledArg) => tupledArg[0][0], scaled);
701
709
  const sys = map((tupledArg_1) => tupledArg_1[0][1], scaled);
702
- return [[sxs.reduce(Scales_unionScales), sys.reduce(Scales_unionScales)], new Scales_ScaledShape(5, [map((tuple) => tuple[1], scaled)])];
710
+ return [[sxs.reduce(Scales_unionScales), sys.reduce(Scales_unionScales)], new Scales_ScaledShape(6, [map((tuple) => tuple[1], scaled)])];
703
711
  }
704
- case 11: {
712
+ case 12: {
705
713
  const patternInput_10 = calculateScales(shape.fields[1]);
706
- const scales_8 = patternInput_10[0];
707
- return [scales_8, new Scales_ScaledShape(6, [shape.fields[0], scales_8[0], scales_8[1], patternInput_10[1]])];
714
+ const scales_9 = patternInput_10[0];
715
+ return [scales_9, new Scales_ScaledShape(7, [shape.fields[0], scales_9[0], scales_9[1], patternInput_10[1]])];
708
716
  }
709
717
  default: {
710
718
  const f = shape.fields[0];
@@ -795,12 +803,12 @@ export function Drawing_DrawingContext_$reflection() {
795
803
 
796
804
  export function Drawing_hideFill(style) {
797
805
  let matchValue, f;
798
- return new Style(style.StrokeColor, style.StrokeWidth, style.StrokeDashArray, new FillStyle(0, [[0, new Color(0, [0, 0, 0])]]), (matchValue = style.Animation, (matchValue != null) ? ((f = matchValue[2], [matchValue[0], matchValue[1], (arg) => Drawing_hideFill(f(arg))])) : undefined), style.Font, style.Cursor, style.FormatAxisXLabel, style.FormatAxisYLabel);
806
+ return new Style(style.StrokeColor, style.StrokeWidth, style.StrokeDashArray, new FillStyle(0, [[0, new Color(0, [0, 0, 0])]]), (matchValue = style.Animation, (matchValue != null) ? ((f = matchValue[2], [matchValue[0], matchValue[1], (arg) => Drawing_hideFill(f(arg))])) : undefined), style.Font, style.Cursor, style.PreserveAspectRatio, style.FormatAxisXLabel, style.FormatAxisYLabel);
799
807
  }
800
808
 
801
809
  export function Drawing_hideStroke(style) {
802
810
  let matchValue, f;
803
- return new Style([0, style.StrokeColor[1]], style.StrokeWidth, style.StrokeDashArray, style.Fill, (matchValue = style.Animation, (matchValue != null) ? ((f = matchValue[2], [matchValue[0], matchValue[1], (arg) => Drawing_hideStroke(f(arg))])) : undefined), style.Font, style.Cursor, style.FormatAxisXLabel, style.FormatAxisYLabel);
811
+ return new Style([0, style.StrokeColor[1]], style.StrokeWidth, style.StrokeDashArray, style.Fill, (matchValue = style.Animation, (matchValue != null) ? ((f = matchValue[2], [matchValue[0], matchValue[1], (arg) => Drawing_hideStroke(f(arg))])) : undefined), style.Font, style.Cursor, style.PreserveAspectRatio, style.FormatAxisXLabel, style.FormatAxisYLabel);
804
812
  }
805
813
 
806
814
  export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut, area__3_mut, scales__mut, scales__1_mut, shape_mut) {
@@ -817,7 +825,7 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
817
825
  const sx = scales_1[0];
818
826
  const project = (tupledArg) => [Projections_projectOneX(x1, x2)(sx)(tupledArg[0]), Projections_projectOneY(y1, y2)(sy)(tupledArg[1])];
819
827
  switch (shape.tag) {
820
- case 10: {
828
+ case 11: {
821
829
  ctx_mut = ctx;
822
830
  area__mut = x1;
823
831
  area__1_mut = Projections_projectOneY(y1, y2)(sy)(shape.fields[0]);
@@ -828,7 +836,7 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
828
836
  shape_mut = shape.fields[3];
829
837
  continue Drawing_drawShape;
830
838
  }
831
- case 8: {
839
+ case 9: {
832
840
  const dy = shape.fields[0][1];
833
841
  const dx = shape.fields[0][0];
834
842
  ctx_mut = ctx;
@@ -841,8 +849,8 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
841
849
  shape_mut = shape.fields[1];
842
850
  continue Drawing_drawShape;
843
851
  }
844
- case 5:
845
- return new Svg_Svg(4, [map((shape_4) => Drawing_drawShape(ctx, area_1[0], area_1[1], area_1[2], area_1[3], scales_1[0], scales_1[1], shape_4), shape.fields[0])]);
852
+ case 6:
853
+ return new Svg_Svg(5, [map((shape_4) => Drawing_drawShape(ctx, area_1[0], area_1[1], area_1[2], area_1[3], scales_1[0], scales_1[1], shape_4), shape.fields[0])]);
846
854
  case 0: {
847
855
  ctx_mut = (new Drawing_DrawingContext(shape.fields[0](ctx.Style), ctx.Definitions));
848
856
  area__mut = area_1[0];
@@ -856,9 +864,18 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
856
864
  }
857
865
  case 4: {
858
866
  const points = shape.fields[0];
859
- return new Svg_Svg(0, [toArray(delay(() => append(singleton(new Svg_PathSegment(0, [project(item_2(0, points))])), delay(() => append(map_1((pt) => (new Svg_PathSegment(1, [project(pt)])), skip(1, points)), delay(() => singleton(new Svg_PathSegment(1, [project(item_2(0, points))])))))))), Svg_formatStyle(ctx.Definitions, Drawing_hideStroke(ctx.Style))]);
867
+ return new Svg_Svg(1, [toArray(delay(() => append(singleton(new Svg_PathSegment(0, [project(item_2(0, points))])), delay(() => append(map_1((pt) => (new Svg_PathSegment(1, [project(pt)])), skip(1, points)), delay(() => singleton(new Svg_PathSegment(1, [project(item_2(0, points))])))))))), Svg_formatStyle(ctx.Definitions, Drawing_hideStroke(ctx.Style))]);
860
868
  }
861
- case 7: {
869
+ case 5: {
870
+ const patternInput = project(shape.fields[1]);
871
+ const y1_1 = patternInput[1];
872
+ const x1_1 = patternInput[0];
873
+ const patternInput_1 = project(shape.fields[2]);
874
+ const y2_1 = patternInput_1[1];
875
+ const x2_1 = patternInput_1[0];
876
+ return new Svg_Svg(0, [shape.fields[0], [min(x1_1, x2_1), min(y1_1, y2_1)], [Math.abs(x2_1 - x1_1), Math.abs(y2_1 - y1_1)], ctx.Style.PreserveAspectRatio]);
877
+ }
878
+ case 8: {
862
879
  const isy_1 = shape.fields[2];
863
880
  const isx_1 = shape.fields[1];
864
881
  const calculateNestedRange = (rev) => ((tupledArg_1) => ((ins) => {
@@ -883,13 +900,13 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
883
900
  }
884
901
  };
885
902
  }));
886
- const patternInput = calculateNestedRange(false)([x1, x2])(isx_1)(sx);
887
- const patternInput_1 = calculateNestedRange(true)([y1, y2])(isy_1)(sy);
903
+ const patternInput_2 = calculateNestedRange(false)([x1, x2])(isx_1)(sx);
904
+ const patternInput_3 = calculateNestedRange(true)([y1, y2])(isy_1)(sy);
888
905
  ctx_mut = ctx;
889
- area__mut = (patternInput[0] + shape.fields[0][3]);
890
- area__1_mut = (patternInput_1[0] + shape.fields[0][0]);
891
- area__2_mut = (patternInput[1] - shape.fields[0][1]);
892
- area__3_mut = (patternInput_1[1] - shape.fields[0][2]);
906
+ area__mut = (patternInput_2[0] + shape.fields[0][3]);
907
+ area__1_mut = (patternInput_3[0] + shape.fields[0][0]);
908
+ area__2_mut = (patternInput_2[1] - shape.fields[0][1]);
909
+ area__3_mut = (patternInput_3[1] - shape.fields[0][2]);
893
910
  scales__mut = isx_1;
894
911
  scales__1_mut = isy_1;
895
912
  shape_mut = shape.fields[3];
@@ -897,18 +914,18 @@ export function Drawing_drawShape(ctx_mut, area__mut, area__1_mut, area__2_mut,
897
914
  }
898
915
  case 2: {
899
916
  const line = shape.fields[0];
900
- return new Svg_Svg(0, [Array.from(delay(() => append(singleton(new Svg_PathSegment(0, [project(head(line))])), delay(() => map_1((pt_1) => (new Svg_PathSegment(1, [project(pt_1)])), skip(1, line)))))), Svg_formatStyle(ctx.Definitions, Drawing_hideFill(ctx.Style))]);
917
+ return new Svg_Svg(1, [Array.from(delay(() => append(singleton(new Svg_PathSegment(0, [project(head(line))])), delay(() => map_1((pt_1) => (new Svg_PathSegment(1, [project(pt_1)])), skip(1, line)))))), Svg_formatStyle(ctx.Definitions, Drawing_hideFill(ctx.Style))]);
901
918
  }
902
919
  case 1: {
903
920
  const va = shape.fields[2];
904
921
  const ha = shape.fields[3];
905
922
  const va_1 = (va.tag === 2) ? "hanging" : ((va.tag === 1) ? "middle" : "baseline");
906
923
  const ha_1 = (ha.tag === 1) ? "middle" : ((ha.tag === 2) ? "end" : "start");
907
- return new Svg_Svg(3, [project([shape.fields[0], shape.fields[1]]), shape.fields[5], shape.fields[4], toText(printf("alignment-baseline:%s; text-anchor:%s;"))(va_1)(ha_1) + Svg_formatStyle(ctx.Definitions, ctx.Style)]);
924
+ return new Svg_Svg(4, [project([shape.fields[0], shape.fields[1]]), shape.fields[5], shape.fields[4], toText(printf("alignment-baseline:%s; text-anchor:%s;"))(va_1)(ha_1) + Svg_formatStyle(ctx.Definitions, ctx.Style)]);
908
925
  }
909
926
  case 3:
910
- return new Svg_Svg(1, [project([shape.fields[0], shape.fields[1]]), [shape.fields[2], shape.fields[3]], Svg_formatStyle(ctx.Definitions, ctx.Style)]);
911
- case 6: {
927
+ return new Svg_Svg(2, [project([shape.fields[0], shape.fields[1]]), [shape.fields[2], shape.fields[3]], Svg_formatStyle(ctx.Definitions, ctx.Style)]);
928
+ case 7: {
912
929
  ctx_mut = ctx;
913
930
  area__mut = area_1[0];
914
931
  area__1_mut = area_1[1];
@@ -1123,7 +1140,7 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1123
1140
  continue Events_triggerEvent;
1124
1141
  break;
1125
1142
  }
1126
- case 8: {
1143
+ case 9: {
1127
1144
  const dy = shape.fields[0][1];
1128
1145
  const dx = shape.fields[0][0];
1129
1146
  area__mut = (x1 + dx);
@@ -1138,7 +1155,7 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1138
1155
  continue Events_triggerEvent;
1139
1156
  break;
1140
1157
  }
1141
- case 9: {
1158
+ case 10: {
1142
1159
  area__mut = Projections_projectOneX(x1, x2)(sx)(shape.fields[0]);
1143
1160
  area__1_mut = y1;
1144
1161
  area__2_mut = Projections_projectOneX(x1, x2)(sx)(shape.fields[1]);
@@ -1151,7 +1168,7 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1151
1168
  continue Events_triggerEvent;
1152
1169
  break;
1153
1170
  }
1154
- case 10: {
1171
+ case 11: {
1155
1172
  area__mut = x1;
1156
1173
  area__1_mut = Projections_projectOneY(y1, y2)(sy)(shape.fields[0]);
1157
1174
  area__2_mut = x2;
@@ -1164,7 +1181,7 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1164
1181
  continue Events_triggerEvent;
1165
1182
  break;
1166
1183
  }
1167
- case 7: {
1184
+ case 8: {
1168
1185
  const isy_1 = shape.fields[2];
1169
1186
  const isx_1 = shape.fields[1];
1170
1187
  const calculateNestedRange = (rev) => ((tupledArg) => ((ins) => {
@@ -1203,14 +1220,14 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1203
1220
  continue Events_triggerEvent;
1204
1221
  break;
1205
1222
  }
1206
- case 5: {
1223
+ case 6: {
1207
1224
  const shapes = shape.fields[0];
1208
1225
  for (let idx = 0; idx <= (shapes.length - 1); idx++) {
1209
1226
  Events_triggerEvent(area_1[0], area_1[1], area_1[2], area_1[3], scales_1[0], scales_1[1], item_2(idx, shapes), jse, event);
1210
1227
  }
1211
1228
  break;
1212
1229
  }
1213
- case 6: {
1230
+ case 7: {
1214
1231
  const localEvent = Events_projectEvent(area_1[0], area_1[1], area_1[2], area_1[3], scales_1[0], scales_1[1], event);
1215
1232
  if (Events_inScales(scales_1[0], scales_1[1], localEvent)) {
1216
1233
  const enumerator = getEnumerator(shape.fields[0]);
@@ -1355,20 +1372,24 @@ export function Events_triggerEvent(area__mut, area__1_mut, area__2_mut, area__3
1355
1372
  }
1356
1373
  }
1357
1374
 
1375
+ export function Derived_PreserveAspectRatio(pa, s) {
1376
+ return new Shape(1, [(s_1) => (new Style(s_1.StrokeColor, s_1.StrokeWidth, s_1.StrokeDashArray, s_1.Fill, s_1.Animation, s_1.Font, s_1.Cursor, pa, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1377
+ }
1378
+
1358
1379
  export function Derived_StrokeColor(clr, s) {
1359
- return new Shape(0, [(s_1) => (new Style([1, new Color(1, [clr])], s_1.StrokeWidth, s_1.StrokeDashArray, s_1.Fill, s_1.Animation, s_1.Font, s_1.Cursor, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1380
+ return new Shape(1, [(s_1) => (new Style([1, new Color(1, [clr])], s_1.StrokeWidth, s_1.StrokeDashArray, s_1.Fill, s_1.Animation, s_1.Font, s_1.Cursor, s_1.PreserveAspectRatio, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1360
1381
  }
1361
1382
 
1362
1383
  export function Derived_FillColor(clr, s) {
1363
- return new Shape(0, [(s_1) => (new Style(s_1.StrokeColor, s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, [clr])]]), s_1.Animation, s_1.Font, s_1.Cursor, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1384
+ return new Shape(1, [(s_1) => (new Style(s_1.StrokeColor, s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, [clr])]]), s_1.Animation, s_1.Font, s_1.Cursor, s_1.PreserveAspectRatio, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1364
1385
  }
1365
1386
 
1366
1387
  export function Derived_Font(font, clr, s) {
1367
- return new Shape(0, [(s_1) => (new Style([0, new Color(1, [clr])], s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, [clr])]]), s_1.Animation, font, s_1.Cursor, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1388
+ return new Shape(1, [(s_1) => (new Style([0, new Color(1, [clr])], s_1.StrokeWidth, s_1.StrokeDashArray, new FillStyle(0, [[1, new Color(1, [clr])]]), s_1.Animation, font, s_1.Cursor, s_1.PreserveAspectRatio, s_1.FormatAxisXLabel, s_1.FormatAxisYLabel)), s]);
1368
1389
  }
1369
1390
 
1370
1391
  export function Derived_Area(line) {
1371
- return new Shape(8, [delay(() => {
1392
+ return new Shape(9, [delay(() => {
1372
1393
  const line_1 = Array.from(line);
1373
1394
  const matchValue = item_2(0, line_1)[0];
1374
1395
  const matchValue_1 = item_2(line_1.length - 1, line_1)[0];
@@ -1378,7 +1399,7 @@ export function Derived_Area(line) {
1378
1399
  }
1379
1400
 
1380
1401
  export function Derived_VArea(line) {
1381
- return new Shape(8, [delay(() => {
1402
+ return new Shape(9, [delay(() => {
1382
1403
  const line_1 = Array.from(line);
1383
1404
  const matchValue = item_2(0, line_1)[1];
1384
1405
  const matchValue_1 = item_2(line_1.length - 1, line_1)[1];
@@ -1388,7 +1409,7 @@ export function Derived_VArea(line) {
1388
1409
  }
1389
1410
 
1390
1411
  export function Derived_VShiftedArea(offs, line) {
1391
- return new Shape(8, [delay(() => {
1412
+ return new Shape(9, [delay(() => {
1392
1413
  const line_1 = Array.from(line);
1393
1414
  const matchValue = item_2(0, line_1)[1];
1394
1415
  const matchValue_1 = item_2(line_1.length - 1, line_1)[1];
@@ -1398,11 +1419,11 @@ export function Derived_VShiftedArea(offs, line) {
1398
1419
  }
1399
1420
 
1400
1421
  export function Derived_Bar(x, y) {
1401
- return new Shape(8, [delay(() => append(singleton([new Value(1, [x]), new Value(0, [y, 0])]), delay(() => append(singleton([new Value(1, [x]), new Value(0, [y, 1])]), delay(() => append(singleton([new Value(1, [new continuous(0)]), new Value(0, [y, 1])]), delay(() => singleton([new Value(1, [new continuous(0)]), new Value(0, [y, 0])]))))))))]);
1422
+ return new Shape(9, [delay(() => append(singleton([new Value(1, [x]), new Value(0, [y, 0])]), delay(() => append(singleton([new Value(1, [x]), new Value(0, [y, 1])]), delay(() => append(singleton([new Value(1, [new continuous(0)]), new Value(0, [y, 1])]), delay(() => singleton([new Value(1, [new continuous(0)]), new Value(0, [y, 0])]))))))))]);
1402
1423
  }
1403
1424
 
1404
1425
  export function Derived_Column(x, y) {
1405
- return new Shape(8, [delay(() => append(singleton([new Value(0, [x, 0]), new Value(1, [y])]), delay(() => append(singleton([new Value(0, [x, 1]), new Value(1, [y])]), delay(() => append(singleton([new Value(0, [x, 1]), new Value(1, [new continuous(0)])]), delay(() => singleton([new Value(0, [x, 0]), new Value(1, [new continuous(0)])]))))))))]);
1426
+ return new Shape(9, [delay(() => append(singleton([new Value(0, [x, 0]), new Value(1, [y])]), delay(() => append(singleton([new Value(0, [x, 1]), new Value(1, [y])]), delay(() => append(singleton([new Value(0, [x, 1]), new Value(1, [new continuous(0)])]), delay(() => singleton([new Value(0, [x, 0]), new Value(1, [new continuous(0)])]))))))))]);
1406
1427
  }
1407
1428
 
1408
1429
  export function Compost_niceNumber(num, decs) {
@@ -1445,7 +1466,7 @@ export function Compost_defaultFormat(scale, value) {
1445
1466
  }
1446
1467
  }
1447
1468
 
1448
- export const Compost_defstyle = new Style([1, new Color(0, [256, 0, 0])], new Width(2), [], new FillStyle(0, [[1, new Color(0, [196, 196, 196])]]), undefined, "10pt sans-serif", "default", Compost_defaultFormat, Compost_defaultFormat);
1469
+ export const Compost_defstyle = new Style([1, new Color(0, [256, 0, 0])], new Width(2), [], new FillStyle(0, [[1, new Color(0, [196, 196, 196])]]), undefined, "10pt sans-serif", "default", "", Compost_defaultFormat, Compost_defaultFormat);
1449
1470
 
1450
1471
  export function Compost_getRelativeLocation(el, x, y) {
1451
1472
  const getOffset = (parent_mut, tupledArg_mut) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compostjs",
3
- "version": "0.0.12",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "Composable data visualization library for JavaScript",
6
6
  "author": "Tomas Petricek",
@@ -9,7 +9,7 @@
9
9
  "start": "dotnet fable watch src/compost/compost.fsproj --run npx vite",
10
10
  "build": "dotnet fable src/compost/compost.fsproj -o dist && rm dist/fable_modules/.gitignore",
11
11
  "rebuild": "rm -rf dist && npm run build",
12
- "standalone": "dotnet fable src/compost/compost.fsproj --run npx vite build && copy-latest.sh",
12
+ "standalone": "dotnet fable src/compost/compost.fsproj --run npx vite build && sh copy-latest.sh",
13
13
  "updatejs": "npm run standalone && git add . && git commit -m \"Update standalone release file in docs\"",
14
14
  "release": "np --yolo --no-release-draft --no-publish && npm run updatejs && npm run rebuild && npm publish"
15
15
  },