Skip to content

Commit

Permalink
deploy: 92e68f5
Browse files Browse the repository at this point in the history
  • Loading branch information
rolyp committed Nov 13, 2023
1 parent 6356b15 commit 6e838c2
Showing 1 changed file with 45 additions and 110 deletions.
155 changes: 45 additions & 110 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16898,9 +16898,6 @@
// node_modules/d3-scale-chromatic/src/categorical/Pastel1.js
var Pastel1_default = colors_default("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");

// node_modules/d3-scale-chromatic/src/categorical/Set1.js
var Set1_default = colors_default("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");

// node_modules/d3-shape/src/constant.js
function constant_default4(x2) {
return function constant() {
Expand Down Expand Up @@ -18195,7 +18192,7 @@
}, listener) {
return () => {
const childId = id3 + "-" + childIndex;
const margin = { top: 15, right: 0, bottom: 40, left: 30 }, width = 350 - margin.left - margin.right, height = 185 - margin.top - margin.bottom;
const margin = { top: 15, right: 0, bottom: 40, left: 30 }, width = 200 - margin.left - margin.right, height = 185 - margin.top - margin.bottom;
const div = select_default2("#" + id3);
div.selectAll("#" + childId).remove();
const svg = div.append("svg").attr("width", width + margin.left + margin.right).attr("height", height + margin.top + margin.bottom).attr("id", childId).append("g").attr("transform", `translate(${margin.left}, ${margin.top})`);
Expand All @@ -18205,11 +18202,11 @@
svg.append("g").attr("transform", "translate(0," + height + ")").call(axisBottom(x2)).selectAll("text").style("text-anchor", "middle");
const nearest = 100, y_max = Math.ceil(Math.max(...data.map((d) => d.y._1)) / nearest) * nearest;
const y2 = linear2().domain([0, y_max]).range([height, 0]);
const tickEvery = 100, ticks = Array.from(Array(Math.ceil(y_max / tickEvery + 1)).keys()).map((n) => n * tickEvery);
const tickEvery = nearest / 2, ticks = Array.from(Array(y_max / tickEvery + 1).keys()).map((n) => n * tickEvery);
const yAxis = axisLeft(y2).tickValues(ticks);
svg.append("g").call(yAxis);
const barFill = "#dcdcdc";
svg.selectAll("rect").data([...data.entries()]).enter().append("rect").attr("x", ([, d]) => x2(d.x._1)).attr("y", ([, d]) => y2(d.y._1)).attr("width", x2.bandwidth()).attr("height", ([, d]) => height - y2(d.y._1)).attr("fill", ([, d]) => d.y._2 ? colorShade(barFill, -40) : barFill).attr("class", ([, d]) => d.y._2 ? "bar-selected" : "bar-unselected").on("mousedown", (e, d) => {
svg.selectAll("rect").data([...data.entries()]).enter().append("rect").attr("x", ([, d]) => x2(d.x._1)).attr("y", ([, d]) => y2(d.y._1 + 1)).attr("width", x2.bandwidth()).attr("height", ([, d]) => height - y2(d.y._1)).attr("fill", ([, d]) => d.y._2 ? colorShade(barFill, -40) : barFill).attr("class", ([, d]) => d.y._2 ? "bar-selected" : "bar-unselected").on("mousedown", (e, d) => {
console.log(`mousedown ${d[0]}`);
listener(e);
});
Expand Down Expand Up @@ -18249,88 +18246,6 @@
Just
)).__data__)(0)))(functorVal.map(boolNot))));

// output-es/App.BubbleChart/foreign.js
function curry42(f) {
return (x1) => (x2) => (x3) => (x4) => f(x1, x2, x3, x4);
}
function colorShade2(col, amt) {
col = col.replace(/^#/, "");
if (col.length === 3)
col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
let [r, g, b] = col.match(/.{2}/g);
[r, g, b] = [parseInt(r, 16) + amt, parseInt(g, 16) + amt, parseInt(b, 16) + amt];
r = Math.max(Math.min(255, r), 0).toString(16);
g = Math.max(Math.min(255, g), 0).toString(16);
b = Math.max(Math.min(255, b), 0).toString(16);
const rr = (r.length < 2 ? "0" : "") + r;
const gg = (g.length < 2 ? "0" : "") + g;
const bb = (b.length < 2 ? "0" : "") + b;
return `#${rr}${gg}${bb}`;
}
function drawBubbleChart_(id3, childIndex, {
caption,
data
}, listener) {
return () => {
const childId = id3 + "-" + childIndex;
const margin = { top: 15, right: 0, bottom: 40, left: 40 }, width = 350 - margin.left - margin.right, height = 185 - margin.top - margin.bottom;
const div = select_default2("#" + id3);
div.selectAll("#" + childId).remove();
const svg = div.append("svg").attr("width", width + margin.left + margin.right).attr("height", height + margin.top + margin.bottom).attr("id", childId).append("g").attr("transform", `translate(${margin.left}, ${margin.top})`);
const tip = d3_tip_default().attr("class", "d3-tip").offset([0, 0]).html((_, d) => d.y_1);
svg.call(tip);
const x_max = Math.ceil(Math.max(...data.map((d) => d.x._1 + d.z._1)));
const y_max = Math.ceil(Math.max(...data.map((d) => d.y._1 + d.z._1)));
const z_max = Math.ceil(Math.max(...data.map((d) => d.z._1)));
const x2 = linear2().domain([0, x_max]).range([0, width]);
svg.append("g").attr("transform", "translate(0," + height + ")").call(axisBottom(x2)).selectAll("text").style("text-anchor", "middle");
const y2 = linear2().domain([0, y_max]).range([height, 0]);
svg.append("g").call(axisLeft(y2));
const z = linear2().domain([1, z_max]).range([1, 30]);
const c = ordinal().domain([...new Set(...data.map((d) => d.c._1))]).range(Set1_default);
const dotFill = "#dcdcdc";
svg.append("g").selectAll("dot").data([...data.entries()]).enter().append("circle").attr("cx", ([, d]) => x2(d.x._1)).attr("cy", ([, d]) => y2(d.y._1)).attr("r", ([, d]) => z(d.z._1)).attr("stroke", "black").style("fill", ([, d]) => d.y._2 ? colorShade2(c(d.c._1), -40) : c(d.c._1)).style("class", ([, d]) => d.y._2 ? "dot-selected" : "dot-unselected").on("mousedown", (e, d) => {
console.log(`mousedown ${d[0]}`);
listener(e);
});
svg.append("text").text(caption._1).attr("x", width / 2).attr("y", height + 35).attr("class", "title-text").attr("dominant-baseline", "bottom").attr("text-anchor", "middle");
};
}
var drawBubbleChart = curry42(drawBubbleChart_);

// output-es/App.BubbleChart/index.js
var reflectDictVal\u{1D539}BubbleChar = {
from: () => (r) => ({
x: get_intOrNumber("x")(r),
y: get_intOrNumber("y")(r),
z: get_intOrNumber("z")(r),
c: (() => {
const $2 = $$get("c")(r);
if ($2.tag === "Str") {
return $Tuple($2._2, $2._1);
}
return typeError($2)("Str");
})()
})
};
var reflectDictVal\u{1D539}BubbleChar1 = {
from: () => (r) => ({
caption: (() => {
const $2 = $$get("caption")(r);
if ($2.tag === "Str") {
return $Tuple($2._2, $2._1);
}
return typeError($2)("Str");
})(),
data: arrayMap(record2(reflectDictVal\u{1D539}BubbleChar.from()))(reflectValBooleanArrayVal.from()($$get("data")(r)))
})
};
var bubbleChartHandler = (ev) => constrArg("BubbleChart")(0)(field("data")(listElement(definitely("index within bounds")(index2(definitely("absurd")(nullable(
_target(ev),
Nothing,
Just
)).__data__)(0)))(functorVal.map(boolNot))));

// node_modules/@codemirror/state/dist/index.js
var Text = class {
constructor() {
Expand Down Expand Up @@ -30811,10 +30726,10 @@
var update2 = curry2(update_);

// output-es/App.LineChart/foreign.js
function curry43(f) {
function curry42(f) {
return (x1) => (x2) => (x3) => (x4) => f(x1, x2, x3, x4);
}
function colorShade3(col, amt) {
function colorShade2(col, amt) {
col = col.replace(/^#/, "");
if (col.length === 3)
col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
Expand Down Expand Up @@ -30854,7 +30769,7 @@
const smallRadius = 2;
for (const n_plot of plots.entries()) {
const [i, plot] = n_plot, col = color2(names.indexOf(plot.name._1));
svg.selectAll("markers").data([...plot.data.entries()].map(([j, ns]) => [[i, j], ns])).enter().append("g").append("circle").attr("r", ([, d]) => d.y._2 ? smallRadius * 2 : smallRadius).attr("cx", ([, d]) => x2(d.x._1)).attr("cy", ([, d]) => y2(d.y._1)).attr("fill", col).attr("stroke", ([, d]) => d.y._2 ? colorShade3(col, -30) : col).on("mousedown", (e, d) => {
svg.selectAll("markers").data([...plot.data.entries()].map(([j, ns]) => [[i, j], ns])).enter().append("g").append("circle").attr("r", ([, d]) => d.y._2 ? smallRadius * 2 : smallRadius).attr("cx", ([, d]) => x2(d.x._1)).attr("cy", ([, d]) => y2(d.y._1)).attr("fill", col).attr("stroke", ([, d]) => d.y._2 ? colorShade2(col, -30) : col).on("mousedown", (e, d) => {
console.log(`mousedown ${d[0]}`);
listener(e);
});
Expand All @@ -30872,7 +30787,7 @@
svg.append("text").text(caption._1).attr("x", width / 2).attr("y", height + 35).attr("class", "title-text").attr("dominant-baseline", "bottom").attr("text-anchor", "middle");
};
}
var drawLineChart = curry43(drawLineChart_);
var drawLineChart = curry42(drawLineChart_);

// output-es/App.LineChart/index.js
var reflectDictValBooleanPoin = { from: () => (r) => ({ x: get_intOrNumber("x")(r), y: get_intOrNumber("y")(r) }) };
Expand Down Expand Up @@ -30927,7 +30842,7 @@
};

// output-es/App.MatrixView/foreign.js
function curry44(f) {
function curry43(f) {
return (x1) => (x2) => (x3) => (x4) => f(x1, x2, x3, x4);
}
function drawMatrix_(id3, childIndex, {
Expand Down Expand Up @@ -30958,7 +30873,7 @@
});
};
}
var drawMatrix = curry44(drawMatrix_);
var drawMatrix = curry43(drawMatrix_);

// output-es/App.MatrixView/index.js
var matrixViewHandler = (ev) => {
Expand All @@ -30972,10 +30887,10 @@
var matrixRep2 = (v) => $Tuple(arrayMap((v1) => arrayMap($$int.unpack)(v1))(v._1), $Tuple(v._2._1._1, v._2._2._1));

// output-es/App.TableView/foreign.js
function curry45(f) {
function curry44(f) {
return (x1) => (x2) => (x3) => (x4) => f(x1, x2, x3, x4);
}
function colorShade4(col, amt) {
function colorShade3(col, amt) {
col = col.replace(/^#/, "");
if (col.length === 3)
col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
Expand All @@ -30990,7 +30905,7 @@
return `#${rr}${gg}${bb}`;
}
function isUsed(r) {
return Object.keys(r).some((k) => r[k]._1);
return Object.keys(r).some((k) => r[k]._2);
}
function drawTable_(id3, childIndex, {
title: title2,
Expand All @@ -31009,14 +30924,40 @@
const rows = HTMLtable.append("tbody").selectAll("tr").data(table).enter().append("tr");
rows.selectAll("td").data((d) => colNames.map((k) => {
return { "value": d[k], "name": k };
})).enter().append("td").attr("data-th", (d) => d.name).attr("class", (d) => d.value._1 ? "cell-selected" : null).attr("bgcolor", (d) => d.value._1 ? colorShade4(cellFill, -40) : cellFill).text((d) => d.value._2).on(
})).enter().append("td").attr("data-th", (d) => d.name).attr("class", (d) => d.value._2 ? "cell-selected" : null).attr("bgcolor", (d) => d.value._2 ? colorShade3(cellFill, -40) : cellFill).text((d) => d.value._1).on(
"mouseover",
(e, d) => listener(e)
);
}
};
}
var drawTable = curry45(drawTable_);
var drawTable = curry44(drawTable_);

// output-es/App.TableView/index.js
var energyRecord = (r) => ({
year: (() => {
const $1 = $$get("year")(r);
if ($1.tag === "Int") {
return $Tuple($1._2, $1._1);
}
return typeError($1)("Int");
})(),
country: (() => {
const $1 = $$get("country")(r);
if ($1.tag === "Str") {
return $Tuple($1._2, $1._1);
}
return typeError($1)("Str");
})(),
energyType: (() => {
const $1 = $$get("energyType")(r);
if ($1.tag === "Str") {
return $Tuple($1._2, $1._1);
}
return typeError($1)("Str");
})(),
output: get_intOrNumber("output")(r)
});

// output-es/Control.Monad.Error.Class/index.js
var monadThrowEffect = { throwError: throwException, Monad0: () => monadEffect };
Expand Down Expand Up @@ -37547,14 +37488,14 @@

// output-es/App.Fig/index.js
var $View = (tag, _1) => ({ tag, _1 });
var identity24 = (x2) => x2;
var matrixRep3 = /* @__PURE__ */ matrixRep(annBoolean);
var botOf = /* @__PURE__ */ (() => functorVal.map((v) => false))();
var boundedLattice3 = { BoundedJoinSemilattice0: () => boundedJoinSemilatticeBoo, BoundedMeetSemilattice1: () => boundedMeetSemilatticeBoo };
var evalBwd2 = /* @__PURE__ */ evalBwd(annBoolean);
var erase2 = /* @__PURE__ */ (() => functorVal.map((v) => unit))();
var sequence_ = /* @__PURE__ */ traverse_(applicativeEffect)(foldableArray)(identity2);
var length4 = /* @__PURE__ */ foldlArray((c) => (v) => 1 + c | 0)(0);
var identity24 = (x2) => x2;
var sequence1 = /* @__PURE__ */ (() => traversableArray.traverse(applicativeAff)(identity7))();
var loadFile2 = /* @__PURE__ */ loadFile(monadAffAff)(monadErrorAff);
var view = (v) => (v1) => {
Expand All @@ -37567,21 +37508,18 @@
if (v1._2 === "LineChart") {
return $View("LineChartFig", reflectDictValBooleanLine1.from()(record1.unpack(v1._3._1)._1));
}
if (v1._2 === "BubbleChart") {
return $View("BubbleChartFig", reflectDictVal\u{1D539}BubbleChar1.from()(record1.unpack(v1._3._1)._1));
}
if (v1._2 === "Nil" || v1._2 === ":") {
return $View("TableView", { title: v, table: arrayMap(record2(identity24))(reflectValBooleanArrayVal.from()(v1)) });
return $View("EnergyTableView", { title: v, table: arrayMap(record2(energyRecord))(reflectValBooleanArrayVal.from()(v1)) });
}
return unsafePerformEffect(throwException(error("absurd")));
}
if (v1._2 === "Nil" || v1._2 === ":") {
return $View("TableView", { title: v, table: arrayMap(record2(identity24))(reflectValBooleanArrayVal.from()(v1)) });
return $View("EnergyTableView", { title: v, table: arrayMap(record2(energyRecord))(reflectValBooleanArrayVal.from()(v1)) });
}
return unsafePerformEffect(throwException(error("absurd")));
}
if (v1._2 === "Nil" || v1._2 === ":") {
return $View("TableView", { title: v, table: arrayMap(record2(identity24))(reflectValBooleanArrayVal.from()(v1)) });
return $View("EnergyTableView", { title: v, table: arrayMap(record2(energyRecord))(reflectValBooleanArrayVal.from()(v1)) });
}
return unsafePerformEffect(throwException(error("absurd")));
}
Expand Down Expand Up @@ -37725,7 +37663,7 @@
if (v3.tag === "MatrixFig") {
return bindE(eventListener((x2) => v1(matrixViewHandler(x2))))(drawMatrix(v)(v2)(v3._1));
}
if (v3.tag === "TableView") {
if (v3.tag === "EnergyTableView") {
return bindE(eventListener((x2) => v1((x$1) => x$1)))(drawTable(v)(v2)(v3._1));
}
if (v3.tag === "LineChartFig") {
Expand All @@ -37734,9 +37672,6 @@
if (v3.tag === "BarChartFig") {
return bindE(eventListener((x2) => v1(barChartHandler(x2))))(drawBarChart(v)(v2)(v3._1));
}
if (v3.tag === "BubbleChartFig") {
return bindE(eventListener((x2) => v1(bubbleChartHandler(x2))))(drawBubbleChart(v)(v2)(v3._1));
}
fail();
};
var drawCode = (ed) => (s) => bindE(update2(ed.state)([{ changes: { from: 0, to: getContentsLength(ed), insert: s } }]))(dispatch2(ed));
Expand Down

0 comments on commit 6e838c2

Please # to comment.