@bicharts/chart-host 0.6.42 → 0.6.44
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/{chunk-Z6EA36OJ.mjs → chunk-YPXH42CQ.mjs} +309 -183
- package/dist/index.mjs +21 -9
- package/dist/react.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/selection.d.ts +61 -0
- package/package.json +1 -1
|
@@ -211,13 +211,13 @@ var require_papaparse_min = __commonJS({
|
|
|
211
211
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
212
212
|
}
|
|
213
213
|
function E4(C2) {
|
|
214
|
-
var S2 = (C2 = C2 || {}).delimiter, O3 = C2.newline, x3 = C2.comments,
|
|
215
|
-
if (void 0 !== C2.escapeChar && (
|
|
214
|
+
var S2 = (C2 = C2 || {}).delimiter, O3 = C2.newline, x3 = C2.comments, I4 = C2.step, A2 = C2.preview, T2 = C2.fastMode, D2 = null, L4 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j3 = F4;
|
|
215
|
+
if (void 0 !== C2.escapeChar && (j3 = C2.escapeChar), ("string" != typeof S2 || -1 < v2.BAD_DELIMITERS.indexOf(S2)) && (S2 = ","), x3 === S2) throw new Error("Comment character same as delimiter");
|
|
216
216
|
true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v2.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !== O3 && "\r" !== O3 && "\r\n" !== O3 && (O3 = "\n");
|
|
217
217
|
var z4 = 0, M2 = false;
|
|
218
218
|
this.parse = function(i2, t, r4) {
|
|
219
219
|
if ("string" != typeof i2) throw new Error("Input must be a string");
|
|
220
|
-
var n2 = i2.length, e = S2.length, s2 = O3.length, a4 = x3.length, o4 = q2(
|
|
220
|
+
var n2 = i2.length, e = S2.length, s2 = O3.length, a4 = x3.length, o4 = q2(I4), h4 = [], u4 = [], d3 = [], f5 = z4 = 0;
|
|
221
221
|
if (!i2) return w2();
|
|
222
222
|
if (T2 || false !== T2 && -1 === i2.indexOf(F4)) {
|
|
223
223
|
for (var l2 = i2.split(O3), c4 = 0; c4 < l2.length; c4++) {
|
|
@@ -232,11 +232,11 @@ var require_papaparse_min = __commonJS({
|
|
|
232
232
|
}
|
|
233
233
|
return w2();
|
|
234
234
|
}
|
|
235
|
-
for (var p4 = i2.indexOf(S2, z4), g4 = i2.indexOf(O3, z4), _4 = new RegExp(U2(
|
|
235
|
+
for (var p4 = i2.indexOf(S2, z4), g4 = i2.indexOf(O3, z4), _4 = new RegExp(U2(j3) + U2(F4), "g"), m4 = i2.indexOf(F4, z4); ; ) if (i2[z4] === F4) for (m4 = z4, z4++; ; ) {
|
|
236
236
|
if (-1 === (m4 = i2.indexOf(F4, m4 + 1))) return r4 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z4 }), E5();
|
|
237
237
|
if (m4 === n2 - 1) return E5(i2.substring(z4, m4).replace(_4, F4));
|
|
238
|
-
if (F4 ===
|
|
239
|
-
else if (F4 ===
|
|
238
|
+
if (F4 === j3 && i2[m4 + 1] === j3) m4++;
|
|
239
|
+
else if (F4 === j3 || 0 === m4 || i2[m4 - 1] !== j3) {
|
|
240
240
|
-1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S2, m4 + 1));
|
|
241
241
|
var y5 = v3(-1 === (g4 = -1 !== g4 && g4 < m4 + 1 ? i2.indexOf(O3, m4 + 1) : g4) ? p4 : Math.min(p4, g4));
|
|
242
242
|
if (i2.substr(m4 + 1 + y5, e) === S2) {
|
|
@@ -293,7 +293,7 @@ var require_papaparse_min = __commonJS({
|
|
|
293
293
|
return { data: h4, errors: u4, meta: { delimiter: S2, linebreak: O3, aborted: M2, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D2 } };
|
|
294
294
|
}
|
|
295
295
|
function R2() {
|
|
296
|
-
|
|
296
|
+
I4(w2()), h4 = [], u4 = [];
|
|
297
297
|
}
|
|
298
298
|
}, this.abort = function() {
|
|
299
299
|
M2 = true;
|
|
@@ -511,8 +511,8 @@ function rgbToLab(r2, g3, b4) {
|
|
|
511
511
|
const R2 = linearise(r2), G3 = linearise(g3), B3 = linearise(b4);
|
|
512
512
|
const X4 = 0.4124564 * R2 + 0.3575761 * G3 + 0.1804375 * B3;
|
|
513
513
|
const Y3 = 0.2126729 * R2 + 0.7151522 * G3 + 0.072175 * B3;
|
|
514
|
-
const
|
|
515
|
-
const fx = f(X4 / Xn), fy = f(Y3 / Yn), fz = f(
|
|
514
|
+
const Z5 = 0.0193339 * R2 + 0.119192 * G3 + 0.9503041 * B3;
|
|
515
|
+
const fx = f(X4 / Xn), fy = f(Y3 / Yn), fz = f(Z5 / Zn);
|
|
516
516
|
return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
|
|
517
517
|
}
|
|
518
518
|
function hexToLab(hex2) {
|
|
@@ -569,11 +569,11 @@ function labToHex(lab) {
|
|
|
569
569
|
const fy = (lab.L + 16) / 116, fx = fy + lab.a / 500, fz = fy - lab.b / 200;
|
|
570
570
|
const X4 = Xn * finv(fx);
|
|
571
571
|
const Y3 = Yn * (lab.L > KAPPA * EPS ? fy * fy * fy : lab.L / KAPPA);
|
|
572
|
-
const
|
|
572
|
+
const Z5 = Zn * finv(fz);
|
|
573
573
|
const lin = [
|
|
574
|
-
3.2404542 * X4 - 1.5371385 * Y3 - 0.4985314 *
|
|
575
|
-
-0.969266 * X4 + 1.8760108 * Y3 + 0.041556 *
|
|
576
|
-
0.0556434 * X4 - 0.2040259 * Y3 + 1.0572252 *
|
|
574
|
+
3.2404542 * X4 - 1.5371385 * Y3 - 0.4985314 * Z5,
|
|
575
|
+
-0.969266 * X4 + 1.8760108 * Y3 + 0.041556 * Z5,
|
|
576
|
+
0.0556434 * X4 - 0.2040259 * Y3 + 1.0572252 * Z5
|
|
577
577
|
];
|
|
578
578
|
return "#" + lin.map((v2) => {
|
|
579
579
|
const c2 = Math.max(0, Math.min(1, v2));
|
|
@@ -678,14 +678,14 @@ function censusColourSpread(container, doc) {
|
|
|
678
678
|
const d2 = cs.map(() => new Array(cs.length).fill(0));
|
|
679
679
|
let span = 0, lo = 0, hi = 1;
|
|
680
680
|
for (let i = 0; i < cs.length; i++) {
|
|
681
|
-
for (let
|
|
682
|
-
const v2 = deltaE2000(cs[i], cs[
|
|
683
|
-
d2[i][
|
|
684
|
-
d2[
|
|
681
|
+
for (let j3 = i + 1; j3 < cs.length; j3++) {
|
|
682
|
+
const v2 = deltaE2000(cs[i], cs[j3]);
|
|
683
|
+
d2[i][j3] = v2;
|
|
684
|
+
d2[j3][i] = v2;
|
|
685
685
|
if (v2 > span) {
|
|
686
686
|
span = v2;
|
|
687
687
|
lo = i;
|
|
688
|
-
hi =
|
|
688
|
+
hi = j3;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
}
|
|
@@ -700,8 +700,8 @@ function censusColourSpread(container, doc) {
|
|
|
700
700
|
let crowd = 0;
|
|
701
701
|
for (let i = 0; i < cs.length; i++) {
|
|
702
702
|
let n = 0;
|
|
703
|
-
for (let
|
|
704
|
-
if (i ===
|
|
703
|
+
for (let j3 = 0; j3 < cs.length; j3++) {
|
|
704
|
+
if (i === j3 || d2[i][j3] <= SAME_SHADE_DELTA_E) n += top[j3].n;
|
|
705
705
|
}
|
|
706
706
|
if (n > crowd) crowd = n;
|
|
707
707
|
}
|
|
@@ -1464,11 +1464,11 @@ function It(n, s) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
function Wt(n, s) {
|
|
1466
1466
|
let i = new Array(n.length), r2 = /* @__PURE__ */ new Set(), M2 = [], h3 = 0;
|
|
1467
|
-
for (let
|
|
1468
|
-
let
|
|
1469
|
-
if (i[
|
|
1467
|
+
for (let N3 = 0; N3 < n.length; ++N3) {
|
|
1468
|
+
let I4 = Mt(n[N3], s), O3 = I4 !== null && It(I4, s) ? I4 : null;
|
|
1469
|
+
if (i[N3] = O3, O3 !== null) h3++;
|
|
1470
1470
|
else {
|
|
1471
|
-
let d2 = n[
|
|
1471
|
+
let d2 = n[N3];
|
|
1472
1472
|
if (d2 != null) {
|
|
1473
1473
|
let p2 = String(d2).trim();
|
|
1474
1474
|
if (p2.length > 0) {
|
|
@@ -1481,88 +1481,88 @@ function Wt(n, s) {
|
|
|
1481
1481
|
return { iso: i, unmatched: M2, matchedRows: h3, totalRows: n.length };
|
|
1482
1482
|
}
|
|
1483
1483
|
|
|
1484
|
-
// ../shape-core/dist/chunk-
|
|
1484
|
+
// ../shape-core/dist/chunk-FUHYYIXD.mjs
|
|
1485
1485
|
var import_papaparse = __toESM(require_papaparse_min(), 1);
|
|
1486
1486
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
1487
|
-
var
|
|
1487
|
+
var ze = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
|
|
1488
1488
|
var J3 = (() => {
|
|
1489
1489
|
let t = /* @__PURE__ */ new Map();
|
|
1490
|
-
for (let e of Object.keys(
|
|
1490
|
+
for (let e of Object.keys(ze)) for (let n of ze[e].split(/\s+/)) n && t.set(n, e);
|
|
1491
1491
|
return t;
|
|
1492
1492
|
})();
|
|
1493
|
-
function
|
|
1493
|
+
function yt2(t) {
|
|
1494
1494
|
for (let [e, n] of t) {
|
|
1495
1495
|
let i = J3.get(e);
|
|
1496
1496
|
i && !J3.has(n) && J3.set(n, i);
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
|
-
|
|
1500
|
-
var
|
|
1501
|
-
var
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
1504
|
-
function
|
|
1499
|
+
yt2(N);
|
|
1500
|
+
var St2 = ["rate", "ratio", "pct", "percent", "percentage", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "utilisation", "z[_-]?score", "average", "avg", "mean", "median", "stddev", "variance", "gpa", "percentile", "quantile", "efficiency", "accuracy", "probability", "multiplier", "coefficient", "correlation", "occupancy", "age", "bmi", "temperature", "density", "pressure", "humidity", "ph", "velocity", "speed", "elevation", "altitude", "latency", "throughput", "bandwidth", "iops", "ppm", "ppb", "dpmo", "bps", "temperatuur", "temperatur", "temperatura", "teplota", "lampotila", "homerseklet", "sicaklik", "pression", "presion", "pressao", "pressione", "druck", "tryck", "tlak", "paine", "nyomas", "presiune", "humidite", "humedad", "umidade", "umidita", "feuchtigkeit", "vochtigheid", "kosteus", "vlhkost", "vitesse", "velocidad", "velocidade", "velocita", "geschwindigkeit", "snelheid", "hastighet", "hastighed", "rychlost", "nopeus", "sebesseg", "brzina", "predkosc", "densite", "densidad", "densidade", "densita", "dichte", "dichtheid", "hustota", "tiheys", "gustoca", "moyenne", "mediane", "promedio", "mediana", "gemiddelde", "durchschnitt", "mittelwert", "genomsnitt", "gennemsnit", "gjennomsnitt", "keskiarvo", "atlag", "ortalama", "prosjek", "srednia", "prumer", "priemer", "medie", "taux", "tasa", "taxa", "tasso", "verhaltnis", "verhouding", "aandeel", "anteil", "andel", "osuus", "podil", "udzial", "udio", "pourcentage", "porcentaje", "percentual", "prozent", "procent", "prosentti", "szazalek", "yuzde", "participacion", "participacao", "pondere", "omjer", "arany", "oran", "rata", "leeftijd", "edad", "idade", "wiek", "eletkor", "varsta", "puntuacion", "pontuacao", "punteggio", "betyg", "ocena", "indice", "indeks", "wskaznik", "puan"];
|
|
1501
|
+
var _t = ["pct", "percent", "percentage", "rate", "ratio", "rating", "share", "score", "index", "nps", "csat", "margin", "yield", "coverage", "utilization", "utilisation", "gpa", "percentile", "quantile", "bmi", "density", "pressure", "humidity", "velocity", "efficiency", "occupancy", "latency", "throughput", "bandwidth", "iops", "ppm", "ppb", "dpmo", "bps"];
|
|
1502
|
+
var At = ["latitude", "longitude"];
|
|
1503
|
+
var Ct = ["latitude", "longitude"];
|
|
1504
|
+
function Z3(t) {
|
|
1505
1505
|
return p(t);
|
|
1506
1506
|
}
|
|
1507
|
-
var
|
|
1508
|
-
function
|
|
1507
|
+
var be = ["somme de", "suma de", "soma de", "summe von", "som van", "somma di", "summa av", "sum av", "sum af", "soucet z", "suma z", "totaal van", "total de", "toplam", "osszeg", "nombre de", "recuento de", "contagem de", "anzahl von", "aantal van", "conteggio di", "antal av", "lukumaara", "pocet z"];
|
|
1508
|
+
function Mt2(t) {
|
|
1509
1509
|
return [...t].sort((e, n) => n.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|");
|
|
1510
1510
|
}
|
|
1511
|
-
var
|
|
1512
|
-
var
|
|
1513
|
-
var
|
|
1514
|
-
var
|
|
1515
|
-
function
|
|
1511
|
+
var $e = new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:" + Mt2(be) + ")\\s+)", "i");
|
|
1512
|
+
var xt = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
|
|
1513
|
+
var Rt = new RegExp("\\b(" + St2.join("|") + ")\\b|(" + _t.join("|") + ")$", "i");
|
|
1514
|
+
var Tt = new RegExp("\\b(" + At.join("|") + ")\\b|(" + Ct.join("|") + ")$", "i");
|
|
1515
|
+
function me(t) {
|
|
1516
1516
|
if (!t) return "";
|
|
1517
|
-
let e = String(t), n =
|
|
1517
|
+
let e = String(t), n = $e.exec(Z3(e));
|
|
1518
1518
|
return (n ? e.slice(n[0].length) : e).trim();
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return !!t &&
|
|
1520
|
+
function Nt(t) {
|
|
1521
|
+
return !!t && $e.test(Z3(String(t)));
|
|
1522
1522
|
}
|
|
1523
|
-
var
|
|
1524
|
-
var
|
|
1525
|
-
var
|
|
1526
|
-
var
|
|
1527
|
-
function
|
|
1528
|
-
let e =
|
|
1529
|
-
return e.length === 0 ? "" : e.replace(
|
|
1523
|
+
var Et = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
|
|
1524
|
+
var Ve = new RegExp("^\\s*(" + [...Et].sort((t, e) => e.length - t.length).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
|
|
1525
|
+
var He = { Sum: ["Sum of "], Avg: ["Average of "], Average: ["Average of "], Count: ["Count of "], CountNonNull: ["Count of "], Min: ["Min of ", "First ", "Earliest "], Max: ["Max of ", "Last ", "Latest "], Median: ["Median of "], StandardDeviation: ["Standard deviation of "], Variance: ["Variance of "] };
|
|
1526
|
+
var It2 = new RegExp("^(" + Object.keys(He).join("|") + ")\\((.+)\\)$");
|
|
1527
|
+
function vt(t) {
|
|
1528
|
+
let e = me(t);
|
|
1529
|
+
return e.length === 0 ? "" : e.replace(xt, " ");
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function je(t, e) {
|
|
1532
1532
|
if (!e) return false;
|
|
1533
|
-
let n =
|
|
1534
|
-
return t.test(
|
|
1533
|
+
let n = me(e);
|
|
1534
|
+
return t.test(Z3(vt(e))) || t.test(Z3(n)) || t.test(Z3(d(n).join(" ")));
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1537
|
-
return
|
|
1536
|
+
function Xe(t) {
|
|
1537
|
+
return je(Tt, t);
|
|
1538
1538
|
}
|
|
1539
|
-
function
|
|
1540
|
-
return
|
|
1539
|
+
function wt(t) {
|
|
1540
|
+
return je(Rt, t) || Xe(t);
|
|
1541
1541
|
}
|
|
1542
|
-
var
|
|
1543
|
-
function
|
|
1542
|
+
var Ze = /int|double|decimal|single|float|number|currency|money/i;
|
|
1543
|
+
function Lt(t) {
|
|
1544
1544
|
let e = String(t?.valueNature ?? "").trim().toLowerCase();
|
|
1545
|
-
return e === "categorical" ? "Categorical" : e === "ordinal" ? "Ordinal" : e === "continuous" || t?.isMeasure === true ||
|
|
1545
|
+
return e === "categorical" ? "Categorical" : e === "ordinal" ? "Ordinal" : e === "continuous" || t?.isMeasure === true || Ze.test(String(t?.dataType ?? "")) ? "Continuous" : "Categorical";
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1548
|
-
return t?.isMeasure === true ||
|
|
1547
|
+
function Dt(t) {
|
|
1548
|
+
return t?.isMeasure === true || Ze.test(String(t?.dataType ?? ""));
|
|
1549
1549
|
}
|
|
1550
|
-
function
|
|
1551
|
-
let e = t ?? {}, n =
|
|
1550
|
+
function qe(t) {
|
|
1551
|
+
let e = t ?? {}, n = Lt(e);
|
|
1552
1552
|
if (n !== "Continuous") return { nature: n, additivity: "unknown", basis: "role", suppressed: false };
|
|
1553
|
-
if (
|
|
1553
|
+
if (Xe(e.name)) return { nature: n, additivity: "positional", basis: "name", suppressed: true };
|
|
1554
1554
|
let i = String(e.additivity ?? "").trim().toLowerCase();
|
|
1555
|
-
if (!(i === "additive" &&
|
|
1555
|
+
if (!(i === "additive" && Nt(e.name))) {
|
|
1556
1556
|
if (i === "additive") return { nature: n, additivity: "additive", basis: "measured", suppressed: false };
|
|
1557
1557
|
if (i === "part_of_whole") return { nature: n, additivity: "part_of_whole", basis: "measured", suppressed: false };
|
|
1558
1558
|
if (i === "intensive_rate") return { nature: n, additivity: "intensive_rate", basis: "measured", suppressed: false };
|
|
1559
1559
|
}
|
|
1560
|
-
return e.discourageAggregationAcrossGroups === true ? { nature: n, additivity: "intensive_rate", basis: "host-flag", suppressed: false } :
|
|
1560
|
+
return e.discourageAggregationAcrossGroups === true ? { nature: n, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : wt(e.name) ? { nature: n, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: n, additivity: "additive", basis: "default", suppressed: false };
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1563
|
-
let e =
|
|
1562
|
+
function Qe(t) {
|
|
1563
|
+
let e = qe(t), n = t ?? {};
|
|
1564
1564
|
if (e.nature === "Categorical") return ["first", "distinctcount", "count"];
|
|
1565
|
-
if (e.nature === "Ordinal") return
|
|
1565
|
+
if (e.nature === "Ordinal") return Dt(n) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
|
|
1566
1566
|
switch (e.additivity) {
|
|
1567
1567
|
case "positional":
|
|
1568
1568
|
return ["min", "max", "count", "distinctcount", "first"];
|
|
@@ -1572,22 +1572,22 @@ function Xe(t) {
|
|
|
1572
1572
|
return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return
|
|
1575
|
+
function Zn2(t) {
|
|
1576
|
+
return Qe(t)[0];
|
|
1577
1577
|
}
|
|
1578
|
-
function
|
|
1578
|
+
function Qn(t, e) {
|
|
1579
1579
|
if (e !== "sum" && e !== "count") return false;
|
|
1580
1580
|
if (e === "count") return true;
|
|
1581
|
-
let n =
|
|
1581
|
+
let n = qe(t);
|
|
1582
1582
|
return n.additivity === "additive" || n.additivity === "part_of_whole" || n.additivity === "unknown";
|
|
1583
1583
|
}
|
|
1584
|
-
var
|
|
1584
|
+
var Yt = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, String.raw`\bcolumns\s*\[\s*-?\d`, String.raw`\.iloc\s*\[[^\]]*,`, String.raw`\.iat\s*\[`, String.raw`\bselect_dtypes\b`, String.raw`\b_get_numeric_data\b`, String.raw`\bis_numeric_dtype\b`, String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`, String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`, String.raw`\bdf\.dtypes\b`, String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`, String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));
|
|
1585
1585
|
|
|
1586
1586
|
// ../shape-core/dist/index.mjs
|
|
1587
1587
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
1588
1588
|
var X3 = 2;
|
|
1589
1589
|
var de = 400;
|
|
1590
|
-
function
|
|
1590
|
+
function Z4(t) {
|
|
1591
1591
|
return !!E(t);
|
|
1592
1592
|
}
|
|
1593
1593
|
function F3(t) {
|
|
@@ -1599,10 +1599,10 @@ function F3(t) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
return Array.from(e);
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function N2(t) {
|
|
1603
1603
|
let e = F3(t);
|
|
1604
1604
|
if (e.length === 0 || ee3(t) < 95) return false;
|
|
1605
|
-
let n = e.filter((u2) =>
|
|
1605
|
+
let n = e.filter((u2) => Z4(u2) && !Y(u2)).length, o2 = e.filter((u2) => !Z4(u2) && !!Y(u2)).length;
|
|
1606
1606
|
return n >= 1 && n >= o2;
|
|
1607
1607
|
}
|
|
1608
1608
|
function ue2(t, e) {
|
|
@@ -1614,7 +1614,7 @@ function ee3(t) {
|
|
|
1614
1614
|
let e = F3(t);
|
|
1615
1615
|
if (e.length === 0) return 0;
|
|
1616
1616
|
let n = 0;
|
|
1617
|
-
for (let o2 of e)
|
|
1617
|
+
for (let o2 of e) Z4(o2) && n++;
|
|
1618
1618
|
return Math.round(n / e.length * 1e3) / 10;
|
|
1619
1619
|
}
|
|
1620
1620
|
function z3(t) {
|
|
@@ -1640,10 +1640,10 @@ function te(t) {
|
|
|
1640
1640
|
for (let o2 of e) Z(o2).length > 0 && n++;
|
|
1641
1641
|
return Math.round(n / e.length * 1e3) / 10;
|
|
1642
1642
|
}
|
|
1643
|
-
function
|
|
1643
|
+
function ce3(t, e) {
|
|
1644
1644
|
return y2(e, rt) ? true : ne2(t).some((n) => /^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/, "")));
|
|
1645
1645
|
}
|
|
1646
|
-
function
|
|
1646
|
+
function Dn(t, e) {
|
|
1647
1647
|
let n = F3(t);
|
|
1648
1648
|
if (n.length === 0) return 0;
|
|
1649
1649
|
let o2 = 0;
|
|
@@ -1655,12 +1655,12 @@ function J4(t, e) {
|
|
|
1655
1655
|
for (let o2 of F3(t)) e(o2) && n++;
|
|
1656
1656
|
return n;
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function Vn2(t, e) {
|
|
1659
1659
|
let n = 0;
|
|
1660
1660
|
for (let o2 of ne2(t)) e(o2) && n++;
|
|
1661
1661
|
return n;
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function Un(t, e, n, o2, u2) {
|
|
1664
1664
|
let l = [], a2 = [], s = {}, b4 = {}, T2 = new Set(t), C2 = (i) => e.map((c2) => c2[i]);
|
|
1665
1665
|
for (let i of ["city", "country"]) {
|
|
1666
1666
|
let c2 = n?.[i];
|
|
@@ -1674,39 +1674,39 @@ function kn(t, e, n, o2, u2) {
|
|
|
1674
1674
|
let f4 = n?.zip;
|
|
1675
1675
|
if (f4 && T2.has(f4)) {
|
|
1676
1676
|
let i = C2(f4), c2 = te(i);
|
|
1677
|
-
c2 < 95 ? a2.push(`zip=${f4} (only ${c2}% of values read as ZIPs)`) :
|
|
1677
|
+
c2 < 95 ? a2.push(`zip=${f4} (only ${c2}% of values read as ZIPs)`) : ce3(i, f4) ? s.zip = f4 : a2.push(`zip=${f4} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1678
1678
|
}
|
|
1679
1679
|
let d2 = n?.state;
|
|
1680
1680
|
if (d2 && T2.has(d2)) {
|
|
1681
1681
|
let i = C2(d2), c2 = F3(i);
|
|
1682
|
-
c2.length > 0 && c2.every((S2) => ue2(S2, o2)) ? a2.push(`state=${d2} (every value is "CA", which is both Canada and California)`) :
|
|
1682
|
+
c2.length > 0 && c2.every((S2) => ue2(S2, o2)) ? a2.push(`state=${d2} (every value is "CA", which is both Canada and California)`) : N2(i) ? (a2.push(`state=${d2} (every value is a country, not a state)`), s.country || (s.country = d2)) : z3(i) < 95 ? a2.push(`state=${d2} (only ${z3(i)}% of values are states/provinces)`) : s.state = d2;
|
|
1683
1683
|
}
|
|
1684
1684
|
let p2 = new Set(Object.values(s).filter(Boolean)), g3 = t.filter((i) => !p2.has(i) && !i.startsWith("__"));
|
|
1685
1685
|
if (!s.state) {
|
|
1686
1686
|
let i = null;
|
|
1687
1687
|
for (let c2 of g3) {
|
|
1688
1688
|
let S2 = C2(c2);
|
|
1689
|
-
if (
|
|
1689
|
+
if (N2(S2)) continue;
|
|
1690
1690
|
let v2 = z3(S2);
|
|
1691
1691
|
if (v2 < 95) continue;
|
|
1692
|
-
let $3 = J4(S2, (D2) => !!Y(D2)),
|
|
1693
|
-
$3 < X3 &&
|
|
1692
|
+
let $3 = J4(S2, (D2) => !!Y(D2)), Le = J4(S2, (D2) => !!Y(D2) && !ue2(D2, o2));
|
|
1693
|
+
$3 < X3 && Le < 1 || (!i || v2 > i.pct) && (i = { name: c2, pct: v2 });
|
|
1694
1694
|
}
|
|
1695
1695
|
i && (s.state = i.name, p2.add(i.name), l.push(`state=${i.name} (${i.pct}% states/provinces)`));
|
|
1696
1696
|
}
|
|
1697
1697
|
if (!s.zip) for (let i of g3) {
|
|
1698
1698
|
if (p2.has(i)) continue;
|
|
1699
1699
|
let c2 = C2(i), S2 = te(c2);
|
|
1700
|
-
if (!(S2 < 95) &&
|
|
1700
|
+
if (!(S2 < 95) && ce3(c2, i) && !(Vn2(c2, (v2) => Z(v2).length > 0) < X3)) {
|
|
1701
1701
|
s.zip = i, p2.add(i), l.push(`zip=${i} (${S2}% ZIP codes)`);
|
|
1702
1702
|
break;
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
1705
|
let E4 = s.country;
|
|
1706
|
-
if (!E4 || !
|
|
1706
|
+
if (!E4 || !N2(C2(E4))) {
|
|
1707
1707
|
let i = null;
|
|
1708
1708
|
for (let c2 of g3) {
|
|
1709
|
-
if (p2.has(c2) || !
|
|
1709
|
+
if (p2.has(c2) || !N2(C2(c2))) continue;
|
|
1710
1710
|
let S2 = ee3(C2(c2));
|
|
1711
1711
|
(!i || S2 > i.pct) && (i = { name: c2, pct: S2 });
|
|
1712
1712
|
}
|
|
@@ -1716,12 +1716,12 @@ function kn(t, e, n, o2, u2) {
|
|
|
1716
1716
|
let i = null;
|
|
1717
1717
|
for (let c2 of g3) {
|
|
1718
1718
|
if (p2.has(c2)) continue;
|
|
1719
|
-
let S2 = C2(c2), v2 =
|
|
1719
|
+
let S2 = C2(c2), v2 = Dn(S2, o2);
|
|
1720
1720
|
v2 < m3 || J4(S2, ($3) => p3($3, o2)) < X3 || (!i || v2 > i.pct) && (i = { name: c2, pct: v2 });
|
|
1721
1721
|
}
|
|
1722
1722
|
i && (s.city = i.name, l.push(`city=${i.name} (${i.pct}% known cities)`));
|
|
1723
1723
|
}
|
|
1724
|
-
let
|
|
1724
|
+
let M2 = s.country ? C2(s.country) : [], R2 = !!s.country && N2(M2), _3 = R2 ? new Set(M2.map((i) => E(i == null ? null : String(i))).filter(Boolean)).size : 0, x3 = R2 && _3 >= 2, w2 = !!(s.lat && s.lon) && e.some((i) => {
|
|
1725
1725
|
let c2 = +String(i[s.lat] ?? "").trim(), S2 = +String(i[s.lon] ?? "").trim();
|
|
1726
1726
|
return isFinite(c2) && isFinite(S2) && c2 >= -90 && c2 <= 90 && S2 >= -180 && S2 <= 180 && String(i[s.lat] ?? "").trim() !== "" && String(i[s.lon] ?? "").trim() !== "";
|
|
1727
1727
|
});
|
|
@@ -1729,10 +1729,10 @@ function kn(t, e, n, o2, u2) {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
var r = (t, ...e) => ({ part: t, langs: Object.freeze(e) });
|
|
1731
1731
|
var re2 = Object.freeze({ jaar: r("year", "nl"), kwartaal: r("quarter", "nl"), maand: r("month", "nl"), dag: r("day", "nl", "sv", "da", "nb"), jahr: r("year", "de"), quartal: r("quarter", "de"), monat: r("month", "de"), tag: r("day", "de"), ann\u00E9e: r("year", "fr"), mois: r("month", "fr"), jour: r("day", "fr"), trimestre: r("quarter", "fr", "es", "pt", "it"), a\u00F1o: r("year", "es"), mes: r("month", "es"), d\u00EDa: r("day", "es"), ano: r("year", "pt"), m\u00EAs: r("month", "pt"), dia: r("day", "pt"), anno: r("year", "it"), mese: r("month", "it"), giorno: r("day", "it"), \u0433\u043E\u0434: r("year", "ru"), \u043C\u0435\u0441\u044F\u0446: r("month", "ru"), \u0440\u0456\u043A: r("year", "uk"), \u043C\u0456\u0441\u044F\u0446\u044C: r("month", "uk"), \u043A\u0432\u0430\u0440\u0442\u0430\u043B: r("quarter", "ru", "uk"), \u0434\u0435\u043D\u044C: r("day", "ru", "uk"), rok: r("year", "pl", "cs", "sk"), kwarta\u0142: r("quarter", "pl"), miesi\u0105c: r("month", "pl"), dzie\u0144: r("day", "pl"), \u010Dtvrtlet\u00ED: r("quarter", "cs"), m\u011Bs\u00EDc: r("month", "cs"), den: r("day", "cs"), \u0161tvr\u0165rok: r("quarter", "sk"), mesiac: r("month", "sk"), de\u0148: r("day", "sk"), \u00E5r: r("year", "sv", "da", "nb"), kvartal: r("quarter", "sv", "da", "nb"), m\u00E5nad: r("month", "sv"), m\u00E5ned: r("month", "da", "nb"), vuosi: r("year", "fi"), vuosinelj\u00E4nnes: r("quarter", "fi"), kuukausi: r("month", "fi"), p\u00E4iv\u00E4: r("day", "fi"), \u00E9v: r("year", "hu"), negyed\u00E9v: r("quarter", "hu"), h\u00F3nap: r("month", "hu"), nap: r("day", "hu"), y\u0131l: r("year", "tr"), \u00E7eyrek: r("quarter", "tr"), ay: r("month", "tr"), g\u00FCn: r("day", "tr"), \u03AD\u03C4\u03BF\u03C2: r("year", "el"), \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF: r("quarter", "el"), \u03BC\u03AE\u03BD\u03B1\u03C2: r("month", "el"), \u03B7\u03BC\u03AD\u03C1\u03B1: r("day", "el"), an: r("year", "ro"), trimestru: r("quarter", "ro"), lun\u0103: r("month", "ro"), zi: r("day", "ro"), godina: r("year", "hr"), tromjese\u010Dje: r("quarter", "hr"), mjesec: r("month", "hr"), dan: r("day", "hr"), \u5E74: r("year", "ja", "zh"), \u56DB\u534A\u671F: r("quarter", "ja"), \u5B63\u5EA6: r("quarter", "zh"), \u6708: r("month", "ja", "zh"), \u65E5: r("day", "ja", "zh"), \uC5F0\uB3C4: r("year", "ko"), \uBD84\uAE30: r("quarter", "ko"), \uC6D4: r("month", "ko"), \uC77C: r("day", "ko"), tahun: r("year", "id"), kuartal: r("quarter", "id"), triwulan: r("quarter", "id"), bulan: r("month", "id"), hari: r("day", "id"), n\u0103m: r("year", "vi"), qu\u00FD: r("quarter", "vi"), th\u00E1ng: r("month", "vi"), ng\u00E0y: r("day", "vi"), \u0E1B\u0E35: r("year", "th"), \u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A: r("quarter", "th"), \u0E40\u0E14\u0E37\u0E2D\u0E19: r("month", "th"), \u0E27\u0E31\u0E19: r("day", "th"), \u0627\u0644\u0633\u0646\u0629: r("year", "ar"), \u0633\u0646\u0629: r("year", "ar"), \u0627\u0644\u0639\u0627\u0645: r("year", "ar"), \u0639\u0627\u0645: r("year", "ar"), \u0627\u0644\u0631\u0628\u0639: r("quarter", "ar"), \u0631\u0628\u0639: r("quarter", "ar"), "\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629": r("quarter", "ar"), \u0627\u0644\u0634\u0647\u0631: r("month", "ar"), \u0634\u0647\u0631: r("month", "ar"), \u0627\u0644\u064A\u0648\u0645: r("day", "ar"), \u064A\u0648\u0645: r("day", "ar"), \u05E9\u05E0\u05D4: r("year", "he"), \u05E8\u05D1\u05E2\u05D5\u05DF: r("quarter", "he"), \u05D7\u05D5\u05D3\u05E9: r("month", "he"), \u05D9\u05D5\u05DD: r("day", "he"), \u0935\u0930\u094D\u0937: r("year", "hi"), \u0938\u093E\u0932: r("year", "hi"), \u0924\u093F\u092E\u093E\u0939\u0940: r("quarter", "hi"), \u092E\u0939\u0940\u0928\u093E: r("month", "hi"), \u092E\u093E\u0939: r("month", "hi"), \u0926\u093F\u0928: r("day", "hi"), \u0633\u0627\u0644: r("year", "fa"), \u0645\u0627\u0647: r("month", "fa"), \u0631\u0648\u0632: r("day", "fa") });
|
|
1732
|
-
var
|
|
1733
|
-
var
|
|
1734
|
-
var
|
|
1735
|
-
var
|
|
1732
|
+
var Wn = Object.freeze(Array.from(new Set(Object.values(re2).flatMap((t) => t.langs))));
|
|
1733
|
+
var me2 = Object.freeze(["fa", "ar", "he", "th"]);
|
|
1734
|
+
var cr = Object.freeze({ integer: "number", decimal: "number", double: "number", datetime: "date", date: "date", boolean: "boolean", string: "text" });
|
|
1735
|
+
var Cr = Object.freeze({ RENDER_START: "render-start", RENDER_OK: "render-ok", RENDER_ERROR: "render-error", VIEW: "view", VIEW_VERDICT: "view-verdict" });
|
|
1736
1736
|
var we = 2 ** 31 - 1;
|
|
1737
1737
|
|
|
1738
1738
|
// src/payload.ts
|
|
@@ -1748,7 +1748,7 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1748
1748
|
let labelCol;
|
|
1749
1749
|
if (bind) {
|
|
1750
1750
|
const dims = cols.filter((c2) => !c2.isMeasure).map((c2) => c2.name);
|
|
1751
|
-
const res =
|
|
1751
|
+
const res = Un(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
|
|
1752
1752
|
bind = res.bind;
|
|
1753
1753
|
rolesBackfilled = res.backfilled;
|
|
1754
1754
|
rolesRefused = res.refused;
|
|
@@ -1942,10 +1942,10 @@ function stripJsComments(code) {
|
|
|
1942
1942
|
continue;
|
|
1943
1943
|
}
|
|
1944
1944
|
if (ch === "/" && next === "/") {
|
|
1945
|
-
let
|
|
1946
|
-
while (
|
|
1945
|
+
let j3 = i + 2;
|
|
1946
|
+
while (j3 < n && src[j3] !== "\n" && src[j3] !== "\r") j3++;
|
|
1947
1947
|
out += " ";
|
|
1948
|
-
i =
|
|
1948
|
+
i = j3;
|
|
1949
1949
|
wordOpen = false;
|
|
1950
1950
|
continue;
|
|
1951
1951
|
}
|
|
@@ -1959,10 +1959,10 @@ function stripJsComments(code) {
|
|
|
1959
1959
|
continue;
|
|
1960
1960
|
}
|
|
1961
1961
|
if (ch === "'" || ch === '"') {
|
|
1962
|
-
let
|
|
1963
|
-
while (
|
|
1964
|
-
out += src.slice(i, Math.min(
|
|
1965
|
-
i =
|
|
1962
|
+
let j3 = i + 1;
|
|
1963
|
+
while (j3 < n && src[j3] !== ch && src[j3] !== "\n") j3 += src[j3] === "\\" ? 2 : 1;
|
|
1964
|
+
out += src.slice(i, Math.min(j3 + 1, n));
|
|
1965
|
+
i = j3 + 1;
|
|
1966
1966
|
prevSig = ch;
|
|
1967
1967
|
prevWord = "";
|
|
1968
1968
|
wordOpen = false;
|
|
@@ -1976,23 +1976,23 @@ function stripJsComments(code) {
|
|
|
1976
1976
|
continue;
|
|
1977
1977
|
}
|
|
1978
1978
|
if (ch === "/" && regexMayFollow()) {
|
|
1979
|
-
let
|
|
1980
|
-
while (
|
|
1981
|
-
const c2 = src[
|
|
1979
|
+
let j3 = i + 1, inClass = false;
|
|
1980
|
+
while (j3 < n && src[j3] !== "\n") {
|
|
1981
|
+
const c2 = src[j3];
|
|
1982
1982
|
if (c2 === "\\") {
|
|
1983
|
-
|
|
1983
|
+
j3 += 2;
|
|
1984
1984
|
continue;
|
|
1985
1985
|
}
|
|
1986
1986
|
if (c2 === "[") inClass = true;
|
|
1987
1987
|
else if (c2 === "]") inClass = false;
|
|
1988
1988
|
else if (c2 === "/" && !inClass) break;
|
|
1989
|
-
|
|
1989
|
+
j3++;
|
|
1990
1990
|
}
|
|
1991
|
-
if (
|
|
1992
|
-
|
|
1993
|
-
while (
|
|
1994
|
-
out += src.slice(i,
|
|
1995
|
-
i =
|
|
1991
|
+
if (j3 < n && src[j3] === "/") {
|
|
1992
|
+
j3++;
|
|
1993
|
+
while (j3 < n && /[A-Za-z]/.test(src[j3])) j3++;
|
|
1994
|
+
out += src.slice(i, j3);
|
|
1995
|
+
i = j3;
|
|
1996
1996
|
prevSig = "/";
|
|
1997
1997
|
prevWord = "";
|
|
1998
1998
|
wordOpen = false;
|
|
@@ -2030,6 +2030,30 @@ function stripJsComments(code) {
|
|
|
2030
2030
|
}
|
|
2031
2031
|
|
|
2032
2032
|
// src/selection.ts
|
|
2033
|
+
function rowIdxsFromMark(el) {
|
|
2034
|
+
if (!el) return [];
|
|
2035
|
+
const raw = el.getAttribute("data-row-idx");
|
|
2036
|
+
if (!raw) return [];
|
|
2037
|
+
const out = [];
|
|
2038
|
+
for (const tok of raw.split(",")) {
|
|
2039
|
+
const n = parseInt(tok.trim(), 10);
|
|
2040
|
+
if (!isNaN(n) && n >= 0) out.push(n);
|
|
2041
|
+
}
|
|
2042
|
+
return out;
|
|
2043
|
+
}
|
|
2044
|
+
function nextSelection(current, rowIdxs, mods = {}) {
|
|
2045
|
+
const cur = Array.from(current ?? []);
|
|
2046
|
+
if (mods.ctrl || mods.shift) {
|
|
2047
|
+
const next = new Set(cur);
|
|
2048
|
+
for (const r2 of rowIdxs) {
|
|
2049
|
+
if (next.has(r2)) next.delete(r2);
|
|
2050
|
+
else next.add(r2);
|
|
2051
|
+
}
|
|
2052
|
+
return Array.from(next);
|
|
2053
|
+
}
|
|
2054
|
+
const same = cur.length === rowIdxs.length && rowIdxs.every((r2) => cur.includes(r2));
|
|
2055
|
+
return same ? [] : rowIdxs.slice();
|
|
2056
|
+
}
|
|
2033
2057
|
function isInsideControl(target, container) {
|
|
2034
2058
|
let el = target;
|
|
2035
2059
|
if (el && el.nodeType !== 1) el = el.parentElement ?? el.parentNode ?? null;
|
|
@@ -2068,11 +2092,11 @@ function createMarkResolver(env) {
|
|
|
2068
2092
|
const m2 = el.getScreenCTM();
|
|
2069
2093
|
if (!m2) return Number.MAX_VALUE;
|
|
2070
2094
|
let best = Number.MAX_VALUE;
|
|
2071
|
-
const
|
|
2072
|
-
for (let i = 0; i <=
|
|
2073
|
-
const
|
|
2074
|
-
const dx = m2.a *
|
|
2075
|
-
const dy = m2.b *
|
|
2095
|
+
const N3 = 64;
|
|
2096
|
+
for (let i = 0; i <= N3; i++) {
|
|
2097
|
+
const pt2 = el.getPointAtLength(L4 * i / N3);
|
|
2098
|
+
const dx = m2.a * pt2.x + m2.c * pt2.y + m2.e - x3;
|
|
2099
|
+
const dy = m2.b * pt2.x + m2.d * pt2.y + m2.f - y4;
|
|
2076
2100
|
const d2 = dx * dx + dy * dy;
|
|
2077
2101
|
if (d2 < best) best = d2;
|
|
2078
2102
|
}
|
|
@@ -2121,17 +2145,6 @@ function createMarkResolver(env) {
|
|
|
2121
2145
|
if (m2 && ev) return refineHitCorridor(m2, ev.clientX, ev.clientY, sel);
|
|
2122
2146
|
return m2;
|
|
2123
2147
|
};
|
|
2124
|
-
const rowIdxsFromMark = (el) => {
|
|
2125
|
-
if (!el) return [];
|
|
2126
|
-
const raw = el.getAttribute("data-row-idx");
|
|
2127
|
-
if (!raw) return [];
|
|
2128
|
-
const out = [];
|
|
2129
|
-
for (const tok of raw.split(",")) {
|
|
2130
|
-
const n = parseInt(tok.trim(), 10);
|
|
2131
|
-
if (!isNaN(n) && n >= 0) out.push(n);
|
|
2132
|
-
}
|
|
2133
|
-
return out;
|
|
2134
|
-
};
|
|
2135
2148
|
const penetrateOverlayAt = (x3, y4, sel) => {
|
|
2136
2149
|
try {
|
|
2137
2150
|
const stack = doc.elementsFromPoint(x3, y4);
|
|
@@ -2169,8 +2182,8 @@ function createMarkResolver(env) {
|
|
|
2169
2182
|
for (const n of all) {
|
|
2170
2183
|
const tag = (n.tagName || "").toLowerCase();
|
|
2171
2184
|
if (!SHAPE.test(tag)) continue;
|
|
2172
|
-
const
|
|
2173
|
-
if (
|
|
2185
|
+
const pe = viewStyle(n);
|
|
2186
|
+
if (pe && pe !== "none") return true;
|
|
2174
2187
|
}
|
|
2175
2188
|
return false;
|
|
2176
2189
|
};
|
|
@@ -2186,6 +2199,120 @@ function createMarkResolver(env) {
|
|
|
2186
2199
|
};
|
|
2187
2200
|
return { isInvisibleStrokePath, distToPathCenterline, refineHitCorridor, findMark, rowIdxsFromMark, penetrateOverlayAt, resolveByGeometry };
|
|
2188
2201
|
}
|
|
2202
|
+
function collectD3GlyphCenters(container, baseRect, out) {
|
|
2203
|
+
const Point = container.ownerDocument?.defaultView?.DOMPoint ?? globalThis.DOMPoint;
|
|
2204
|
+
const marks = container.querySelectorAll(`.${MARK_CLASS}.${MARK_SELECTED_CLASS}`);
|
|
2205
|
+
const rects = [];
|
|
2206
|
+
for (let i = 0; i < marks.length; i++) {
|
|
2207
|
+
const r2 = marks[i].getBoundingClientRect();
|
|
2208
|
+
rects.push(r2);
|
|
2209
|
+
}
|
|
2210
|
+
const CONTAINMENT_CAP = 300;
|
|
2211
|
+
const EPS2 = 1;
|
|
2212
|
+
const filterContainers = marks.length <= CONTAINMENT_CAP;
|
|
2213
|
+
const enclosesAnother = (ci) => {
|
|
2214
|
+
const c2 = rects[ci];
|
|
2215
|
+
const cArea = c2.width * c2.height;
|
|
2216
|
+
if (cArea <= 0) return false;
|
|
2217
|
+
for (let mj = 0; mj < rects.length; mj++) {
|
|
2218
|
+
if (mj === ci) continue;
|
|
2219
|
+
const m2 = rects[mj];
|
|
2220
|
+
const mArea = m2.width * m2.height;
|
|
2221
|
+
if (mArea <= 0 || mArea >= cArea) continue;
|
|
2222
|
+
if (m2.left >= c2.left - EPS2 && m2.right <= c2.right + EPS2 && m2.top >= c2.top - EPS2 && m2.bottom <= c2.bottom + EPS2) return true;
|
|
2223
|
+
}
|
|
2224
|
+
return false;
|
|
2225
|
+
};
|
|
2226
|
+
for (let i = 0; i < marks.length; i++) {
|
|
2227
|
+
const el = marks[i];
|
|
2228
|
+
const r2 = rects[i];
|
|
2229
|
+
if (r2.width === 0 && r2.height === 0) continue;
|
|
2230
|
+
if (filterContainers && enclosesAnother(i)) continue;
|
|
2231
|
+
const tag = el.tagName.toLowerCase();
|
|
2232
|
+
let sx;
|
|
2233
|
+
let sy;
|
|
2234
|
+
const cxA = el.getAttribute("data-cx"), cyA = el.getAttribute("data-cy");
|
|
2235
|
+
if (cxA != null && cyA != null && typeof el.getScreenCTM === "function") {
|
|
2236
|
+
const ctm = el.getScreenCTM();
|
|
2237
|
+
const cxN = parseFloat(cxA), cyN = parseFloat(cyA);
|
|
2238
|
+
if (ctm && isFinite(cxN) && isFinite(cyN)) {
|
|
2239
|
+
const p2 = new Point(cxN, cyN).matrixTransform(ctm);
|
|
2240
|
+
sx = p2.x;
|
|
2241
|
+
sy = p2.y;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
if (sx === void 0 && tag === "path" && typeof el.getPointAtLength === "function") {
|
|
2245
|
+
try {
|
|
2246
|
+
const len = el.getTotalLength();
|
|
2247
|
+
const ctm = el.getScreenCTM();
|
|
2248
|
+
if (len > 0 && ctm) {
|
|
2249
|
+
const dAttr = el.getAttribute("d") || "";
|
|
2250
|
+
const isArcSector = /[Aa]/.test(dAttr) && !/[CcSsQqTt]/.test(dAttr);
|
|
2251
|
+
let local;
|
|
2252
|
+
if (isArcSector) {
|
|
2253
|
+
const N3 = 24;
|
|
2254
|
+
let ax = 0, ay = 0;
|
|
2255
|
+
for (let k3 = 0; k3 < N3; k3++) {
|
|
2256
|
+
const sp = el.getPointAtLength(len * k3 / N3);
|
|
2257
|
+
ax += sp.x;
|
|
2258
|
+
ay += sp.y;
|
|
2259
|
+
}
|
|
2260
|
+
const cand = new Point(ax / N3, ay / N3);
|
|
2261
|
+
let inside = true;
|
|
2262
|
+
try {
|
|
2263
|
+
if (typeof el.isPointInFill === "function") {
|
|
2264
|
+
inside = el.isPointInFill(cand);
|
|
2265
|
+
}
|
|
2266
|
+
} catch {
|
|
2267
|
+
inside = true;
|
|
2268
|
+
}
|
|
2269
|
+
if (inside) local = cand;
|
|
2270
|
+
}
|
|
2271
|
+
if (!local) local = el.getPointAtLength(len / 2);
|
|
2272
|
+
const p2 = local.matrixTransform(ctm);
|
|
2273
|
+
sx = p2.x;
|
|
2274
|
+
sy = p2.y;
|
|
2275
|
+
}
|
|
2276
|
+
} catch {
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
if (sx === void 0 || sy === void 0) {
|
|
2280
|
+
const isRect = tag === "rect";
|
|
2281
|
+
sx = isRect ? r2.left + r2.width * 0.8 : r2.left + r2.width / 2;
|
|
2282
|
+
sy = isRect ? r2.top + r2.height * 0.2 : r2.top + r2.height / 2;
|
|
2283
|
+
}
|
|
2284
|
+
out.push({ x: sx - baseRect.left, y: sy - baseRect.top });
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
var SELECTION_GLYPH_CLASS = "lch-sel-glyph";
|
|
2288
|
+
function clearSelectionGlyphs(overlay) {
|
|
2289
|
+
if (overlay) {
|
|
2290
|
+
while (overlay.firstChild) overlay.removeChild(overlay.firstChild);
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
function paintSelectionGlyphs(overlay, centers, style) {
|
|
2294
|
+
const doc = overlay.ownerDocument;
|
|
2295
|
+
const frag = doc.createDocumentFragment();
|
|
2296
|
+
const count = Math.min(centers.length, style.max ?? 600);
|
|
2297
|
+
for (let i = 0; i < count; i++) {
|
|
2298
|
+
const c2 = centers[i];
|
|
2299
|
+
const g3 = doc.createElement("span");
|
|
2300
|
+
g3.className = SELECTION_GLYPH_CLASS;
|
|
2301
|
+
g3.textContent = style.symbol;
|
|
2302
|
+
g3.style.position = "absolute";
|
|
2303
|
+
g3.style.left = c2.x + "px";
|
|
2304
|
+
g3.style.top = c2.y + "px";
|
|
2305
|
+
g3.style.transform = "translate(-50%, -50%)";
|
|
2306
|
+
g3.style.font = "700 11px/1 system-ui, -apple-system, Segoe UI, sans-serif";
|
|
2307
|
+
g3.style.color = style.color;
|
|
2308
|
+
const halo = style.halo;
|
|
2309
|
+
g3.style.textShadow = `-1px -1px 1px ${halo}, 1px -1px 1px ${halo}, -1px 1px 1px ${halo}, 1px 1px 1px ${halo}, 0 0 2px ${halo}`;
|
|
2310
|
+
g3.style.pointerEvents = "none";
|
|
2311
|
+
frag.appendChild(g3);
|
|
2312
|
+
}
|
|
2313
|
+
overlay.appendChild(frag);
|
|
2314
|
+
return count;
|
|
2315
|
+
}
|
|
2189
2316
|
|
|
2190
2317
|
// src/hitTargets.ts
|
|
2191
2318
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
@@ -2501,8 +2628,8 @@ function censusValuePlacement(container, data) {
|
|
|
2501
2628
|
const fit = 1 - ssRes / ssTot;
|
|
2502
2629
|
if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
|
|
2503
2630
|
const full = new Array(dots.length).fill(NaN);
|
|
2504
|
-
keep.forEach((k3,
|
|
2505
|
-
full[k3] = res[
|
|
2631
|
+
keep.forEach((k3, j3) => {
|
|
2632
|
+
full[k3] = res[j3];
|
|
2506
2633
|
});
|
|
2507
2634
|
best = { col: c2, axis, fit, res: full, log };
|
|
2508
2635
|
}
|
|
@@ -2732,14 +2859,14 @@ var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
|
2732
2859
|
var AXIS_PIN_MAX_CARRIED = 12;
|
|
2733
2860
|
function unpinScrolledAxis(container) {
|
|
2734
2861
|
if (!container) return;
|
|
2735
|
-
const
|
|
2736
|
-
if (!
|
|
2862
|
+
const st = container[CONTAINER_SLOT_AXIS_PIN];
|
|
2863
|
+
if (!st) return;
|
|
2737
2864
|
try {
|
|
2738
|
-
container.removeEventListener("scroll",
|
|
2865
|
+
container.removeEventListener("scroll", st.onScroll);
|
|
2739
2866
|
} catch {
|
|
2740
2867
|
}
|
|
2741
2868
|
try {
|
|
2742
|
-
if (
|
|
2869
|
+
if (st.overlay.parentNode) st.overlay.parentNode.removeChild(st.overlay);
|
|
2743
2870
|
} catch {
|
|
2744
2871
|
}
|
|
2745
2872
|
try {
|
|
@@ -2917,15 +3044,15 @@ function pinScrolledAxis(container, svg) {
|
|
|
2917
3044
|
const svgTop = svgBox.top - cRect.top - container.clientTop + container.scrollTop;
|
|
2918
3045
|
const contentBand = { top: svgTop + band.top, bottom: svgTop + band.bottom };
|
|
2919
3046
|
const place = () => {
|
|
2920
|
-
const
|
|
2921
|
-
const edge2 = axisPinPlacement(contentBand,
|
|
3047
|
+
const st = container.scrollTop, vh = container.clientHeight;
|
|
3048
|
+
const edge2 = axisPinPlacement(contentBand, st, vh);
|
|
2922
3049
|
if (!edge2) {
|
|
2923
3050
|
o2.display = "none";
|
|
2924
3051
|
return null;
|
|
2925
3052
|
}
|
|
2926
3053
|
o2.display = "block";
|
|
2927
3054
|
o2.left = `${svgLeft}px`;
|
|
2928
|
-
o2.top = `${edge2 === "top" ?
|
|
3055
|
+
o2.top = `${edge2 === "top" ? st : st + vh - bandPx}px`;
|
|
2929
3056
|
return edge2;
|
|
2930
3057
|
};
|
|
2931
3058
|
const onScroll = () => {
|
|
@@ -3141,10 +3268,10 @@ function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
|
|
|
3141
3268
|
if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
|
|
3142
3269
|
const k3 = Math.floor(n);
|
|
3143
3270
|
for (let i = 0; i < k3; i++) {
|
|
3144
|
-
for (let
|
|
3271
|
+
for (let j3 = 0; j3 < k3; j3++) {
|
|
3145
3272
|
out.push({
|
|
3146
3273
|
x: box.left + box.width * (i + 0.5) / k3,
|
|
3147
|
-
y: box.top + box.height * (
|
|
3274
|
+
y: box.top + box.height * (j3 + 0.5) / k3
|
|
3148
3275
|
});
|
|
3149
3276
|
}
|
|
3150
3277
|
}
|
|
@@ -3165,10 +3292,10 @@ var LABEL_CONTRAST_CAP = 2e3;
|
|
|
3165
3292
|
var EMPTY5 = { rects: 0, scanned: 0, fixed: 0, pillsBoosted: 0, offFill: 0, pageMajority: 0, paintedOver: 0 };
|
|
3166
3293
|
function backedSamples(el, pts) {
|
|
3167
3294
|
try {
|
|
3168
|
-
const
|
|
3169
|
-
if (typeof
|
|
3170
|
-
const m2 =
|
|
3171
|
-
const svg =
|
|
3295
|
+
const ge2 = el;
|
|
3296
|
+
if (typeof ge2.isPointInFill !== "function" || typeof ge2.getScreenCTM !== "function") return null;
|
|
3297
|
+
const m2 = ge2.getScreenCTM();
|
|
3298
|
+
const svg = ge2.ownerSVGElement;
|
|
3172
3299
|
if (!m2 || !svg || typeof svg.createSVGPoint !== "function") return null;
|
|
3173
3300
|
if (pts.length === 0) return null;
|
|
3174
3301
|
const inv = m2.inverse();
|
|
@@ -3177,7 +3304,7 @@ function backedSamples(el, pts) {
|
|
|
3177
3304
|
const p2 = svg.createSVGPoint();
|
|
3178
3305
|
p2.x = pts[i].x;
|
|
3179
3306
|
p2.y = pts[i].y;
|
|
3180
|
-
hit.push(
|
|
3307
|
+
hit.push(ge2.isPointInFill(p2.matrixTransform(inv)));
|
|
3181
3308
|
}
|
|
3182
3309
|
return hit;
|
|
3183
3310
|
} catch {
|
|
@@ -3311,10 +3438,10 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3311
3438
|
const cellRGBA = toRGBA(cell.fill);
|
|
3312
3439
|
let bgRGB = cellRGBA ? compositeOver([cellRGBA[0], cellRGBA[1], cellRGBA[2], cellRGBA[3] * cell.op], pageRGB) : pageRGB;
|
|
3313
3440
|
if (pill) {
|
|
3314
|
-
const
|
|
3315
|
-
if (
|
|
3316
|
-
bgRGB = compositeOver([
|
|
3317
|
-
pill.el.setAttribute("fill", `rgb(${
|
|
3441
|
+
const pr = toRGBA(pill.fill);
|
|
3442
|
+
if (pr) {
|
|
3443
|
+
bgRGB = compositeOver([pr[0], pr[1], pr[2], 0.9], bgRGB);
|
|
3444
|
+
pill.el.setAttribute("fill", `rgb(${pr[0]}, ${pr[1]}, ${pr[2]})`);
|
|
3318
3445
|
pill.el.setAttribute("fill-opacity", "0.9");
|
|
3319
3446
|
report.pillsBoosted++;
|
|
3320
3447
|
}
|
|
@@ -3457,9 +3584,9 @@ function compileRenderFn(code, win, doc, d3) {
|
|
|
3457
3584
|
"[@bicharts/chart-host] the generated code could not be COMPILED, so nothing was drawn. This path evaluates the chart as a code string, which cannot contain ES-module syntax" + (modular ? " \u2014 and this code still has `import`/`export` in it after the export clause was stripped. Either request the plain form from the generator, or `import` the module yourself and pass the render function directly." : ".") + " Original error: " + msg
|
|
3458
3585
|
);
|
|
3459
3586
|
}
|
|
3460
|
-
const
|
|
3461
|
-
if (typeof
|
|
3462
|
-
return
|
|
3587
|
+
const fn2 = factory.call(null, null, null, null, win, doc, writableD3(d3));
|
|
3588
|
+
if (typeof fn2 !== "function") throw new Error("generated code did not define render(container, data, options)");
|
|
3589
|
+
return fn2;
|
|
3463
3590
|
}
|
|
3464
3591
|
var ASYNC_RENDER_TIMEOUT_MS = 15e3;
|
|
3465
3592
|
var isThenable = (v2) => !!v2 && (typeof v2 === "object" || typeof v2 === "function") && typeof v2.then === "function";
|
|
@@ -3524,9 +3651,9 @@ function createChartHost(container, config) {
|
|
|
3524
3651
|
const ensureAffordanceStyles = () => {
|
|
3525
3652
|
try {
|
|
3526
3653
|
if (!doc || doc.getElementById("bic-chart-host-affordances")) return;
|
|
3527
|
-
const
|
|
3528
|
-
|
|
3529
|
-
|
|
3654
|
+
const st = doc.createElement("style");
|
|
3655
|
+
st.id = "bic-chart-host-affordances";
|
|
3656
|
+
st.textContent = `
|
|
3530
3657
|
/* TYPOGRAPHY FIREWALL. Generated charts set font-size but almost never line-height or
|
|
3531
3658
|
letter-spacing, so they INHERIT whatever the host page cascades in. A page with
|
|
3532
3659
|
\`:root { font: 18px/145% }\` (the stock Vite template does exactly this) hands every
|
|
@@ -3575,7 +3702,7 @@ function createChartHost(container, config) {
|
|
|
3575
3702
|
font-weight: 700 !important;
|
|
3576
3703
|
text-decoration: underline !important;
|
|
3577
3704
|
}`;
|
|
3578
|
-
(doc.head || doc.documentElement)?.appendChild(
|
|
3705
|
+
(doc.head || doc.documentElement)?.appendChild(st);
|
|
3579
3706
|
} catch {
|
|
3580
3707
|
}
|
|
3581
3708
|
};
|
|
@@ -3593,8 +3720,8 @@ function createChartHost(container, config) {
|
|
|
3593
3720
|
const marks = container.querySelectorAll(`.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}]`);
|
|
3594
3721
|
for (const m2 of Array.from(marks)) {
|
|
3595
3722
|
const rows = parseRowIdxs(m2.getAttribute(ROW_IDX_ATTR));
|
|
3596
|
-
const
|
|
3597
|
-
m2.classList?.[
|
|
3723
|
+
const on = active && rows.some((r2) => wanted.has(r2));
|
|
3724
|
+
m2.classList?.[on ? "add" : "remove"](MARK_SELECTED_CLASS);
|
|
3598
3725
|
}
|
|
3599
3726
|
} catch {
|
|
3600
3727
|
}
|
|
@@ -3649,17 +3776,10 @@ function createChartHost(container, config) {
|
|
|
3649
3776
|
const rows = parseRowIdxs(el.getAttribute(ROW_IDX_ATTR));
|
|
3650
3777
|
if (!rows.length) return;
|
|
3651
3778
|
const tick = el.classList?.contains?.(AXIS_FILTER_CLASS) ? el : null;
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
else next.add(r2);
|
|
3657
|
-
}
|
|
3658
|
-
notify(Array.from(next), "user", tick);
|
|
3659
|
-
return;
|
|
3660
|
-
}
|
|
3661
|
-
const same = !!current && current.length === rows.length && rows.every((r2) => current.includes(r2));
|
|
3662
|
-
notify(same ? [] : rows, "user", same ? null : tick);
|
|
3779
|
+
const multi = !!(e?.ctrlKey || e?.metaKey || e?.shiftKey);
|
|
3780
|
+
const next = nextSelection(current, rows, { ctrl: !!(e?.ctrlKey || e?.metaKey), shift: !!e?.shiftKey });
|
|
3781
|
+
const toggledOff = !multi && next.length === 0;
|
|
3782
|
+
notify(next, "user", toggledOff ? null : tick);
|
|
3663
3783
|
};
|
|
3664
3784
|
container.addEventListener(XFILTER_REFRESH_EVENT, onXf);
|
|
3665
3785
|
container.addEventListener("click", onClick);
|
|
@@ -3798,9 +3918,9 @@ function createChartHost(container, config) {
|
|
|
3798
3918
|
`[@bicharts/chart-host] the chart did not finish drawing within ${Math.round(ASYNC_RENDER_TIMEOUT_MS / 1e3)}s, so the host stopped waiting for it. Nothing past that point ran: no label-contrast pass, no hit-target heal, no census, no fit. A render() that returns a promise has to settle it.`
|
|
3799
3919
|
));
|
|
3800
3920
|
}, ASYNC_RENDER_TIMEOUT_MS);
|
|
3801
|
-
const done = (
|
|
3921
|
+
const done = (fn2) => {
|
|
3802
3922
|
clearTimeout(timer);
|
|
3803
|
-
|
|
3923
|
+
fn2();
|
|
3804
3924
|
};
|
|
3805
3925
|
Promise.resolve(outcome).then(
|
|
3806
3926
|
() => done(() => {
|
|
@@ -3887,11 +4007,11 @@ function toSourceRows(rowMap, payloadRowIdxs) {
|
|
|
3887
4007
|
return payloadRowIdxs.map((i) => rowMap[i]).filter((i) => i !== void 0);
|
|
3888
4008
|
}
|
|
3889
4009
|
function toPayloadRows(rowMap, sourceRowIdxs) {
|
|
3890
|
-
const
|
|
4010
|
+
const at2 = /* @__PURE__ */ new Map();
|
|
3891
4011
|
rowMap.forEach((src, k3) => {
|
|
3892
|
-
if (!
|
|
4012
|
+
if (!at2.has(src)) at2.set(src, k3);
|
|
3893
4013
|
});
|
|
3894
|
-
return sourceRowIdxs.map((s) =>
|
|
4014
|
+
return sourceRowIdxs.map((s) => at2.get(s)).filter((k3) => k3 !== void 0);
|
|
3895
4015
|
}
|
|
3896
4016
|
var sameRows = (a2, b4) => {
|
|
3897
4017
|
if (a2.length !== b4.length) return false;
|
|
@@ -4076,14 +4196,20 @@ export {
|
|
|
4076
4196
|
le,
|
|
4077
4197
|
L2 as L,
|
|
4078
4198
|
L3,
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4199
|
+
qe,
|
|
4200
|
+
Qe,
|
|
4201
|
+
Zn2 as Zn,
|
|
4202
|
+
Qn,
|
|
4083
4203
|
buildRenderPayload,
|
|
4084
4204
|
stripJsComments,
|
|
4205
|
+
rowIdxsFromMark,
|
|
4206
|
+
nextSelection,
|
|
4085
4207
|
isInsideControl,
|
|
4086
4208
|
createMarkResolver,
|
|
4209
|
+
collectD3GlyphCenters,
|
|
4210
|
+
SELECTION_GLYPH_CLASS,
|
|
4211
|
+
clearSelectionGlyphs,
|
|
4212
|
+
paintSelectionGlyphs,
|
|
4087
4213
|
ensureCrossfilterHitTargets,
|
|
4088
4214
|
censusMarks,
|
|
4089
4215
|
isBlankRender,
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
AXIS_PIN_MIN_LABELS,
|
|
21
21
|
AXIS_PIN_TRACK_REACH_PX,
|
|
22
22
|
BACKING_MAJORITY,
|
|
23
|
-
Bn,
|
|
24
23
|
COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT,
|
|
25
24
|
COLOR_SCALE_SELF_CLAMP_PCT_MAX,
|
|
26
25
|
COLOR_SCALE_SELF_CLAMP_PCT_MIN,
|
|
@@ -37,10 +36,8 @@ import {
|
|
|
37
36
|
FLIP_MODE_DEFAULT,
|
|
38
37
|
GEO_POINT_PRECISIONS,
|
|
39
38
|
GLYPH_SAMPLE_N,
|
|
40
|
-
Gn,
|
|
41
39
|
HOST_CONTAINER_CLASS,
|
|
42
40
|
HOST_CONTRACT_VERSION,
|
|
43
|
-
He,
|
|
44
41
|
L,
|
|
45
42
|
L3,
|
|
46
43
|
LABEL_CONTRAST_CAP,
|
|
@@ -60,17 +57,20 @@ import {
|
|
|
60
57
|
PILL_MIN_ALPHA,
|
|
61
58
|
PILL_MIN_COVERAGE,
|
|
62
59
|
PILL_OPAQUE_ALPHA,
|
|
60
|
+
Qe,
|
|
61
|
+
Qn,
|
|
63
62
|
ROW_IDX_ATTR,
|
|
64
63
|
SAME_SHADE_DELTA_E,
|
|
65
64
|
SCROLL_SLACK_PX,
|
|
66
65
|
SEASONAL_MARKERS_DEFAULT,
|
|
67
66
|
SELECTION_ACTIVE_CLASS,
|
|
67
|
+
SELECTION_GLYPH_CLASS,
|
|
68
68
|
VALUE_AXIS_BASELINE_DEFAULT,
|
|
69
69
|
VALUE_AXIS_MIN_FIT,
|
|
70
70
|
VIEW_ONLY_UI_STATE_KEYS,
|
|
71
71
|
WHITE_TEXT_BG_LUM,
|
|
72
72
|
XFILTER_REFRESH_EVENT,
|
|
73
|
-
|
|
73
|
+
Zn,
|
|
74
74
|
applyLabelContrast,
|
|
75
75
|
assembleD3,
|
|
76
76
|
autoRampCanvas,
|
|
@@ -86,6 +86,8 @@ import {
|
|
|
86
86
|
censusValuePlacement,
|
|
87
87
|
chartOwnsTimeline,
|
|
88
88
|
clearGeoCache,
|
|
89
|
+
clearSelectionGlyphs,
|
|
90
|
+
collectD3GlyphCenters,
|
|
89
91
|
colourSpreadFlag,
|
|
90
92
|
compileRenderFn,
|
|
91
93
|
compositeOver,
|
|
@@ -117,18 +119,22 @@ import {
|
|
|
117
119
|
loadGeo,
|
|
118
120
|
measureContainerBoxes,
|
|
119
121
|
needsScroll,
|
|
122
|
+
nextSelection,
|
|
120
123
|
noopViewStateProvider,
|
|
124
|
+
paintSelectionGlyphs,
|
|
121
125
|
periodTickSuppressesFeedback,
|
|
122
126
|
pillBacksGlyph,
|
|
123
127
|
pinScrolledAxis,
|
|
124
128
|
planAxisPin,
|
|
125
129
|
planFrameGrow,
|
|
130
|
+
qe,
|
|
126
131
|
registerGeo,
|
|
127
132
|
registerGeoAsset,
|
|
128
133
|
relativeLuminance,
|
|
129
134
|
requiredD3Plugins,
|
|
130
135
|
resolveAutoColorScale,
|
|
131
136
|
resolveOptions,
|
|
137
|
+
rowIdxsFromMark,
|
|
132
138
|
scrollFitFor,
|
|
133
139
|
sessionViewStateProvider,
|
|
134
140
|
stripEsmExports,
|
|
@@ -140,7 +146,7 @@ import {
|
|
|
140
146
|
unpinScrolledAxis,
|
|
141
147
|
valuePlacementFlag,
|
|
142
148
|
withoutViewOnlyKeys
|
|
143
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-YPXH42CQ.mjs";
|
|
144
150
|
import "./chunk-A2GMXZP7.mjs";
|
|
145
151
|
import "./chunk-GHODWOAL.mjs";
|
|
146
152
|
|
|
@@ -1487,15 +1493,15 @@ function displayText(col, raw, opts) {
|
|
|
1487
1493
|
return String(raw);
|
|
1488
1494
|
}
|
|
1489
1495
|
function isSuppressed(col) {
|
|
1490
|
-
return
|
|
1496
|
+
return qe(col).suppressed;
|
|
1491
1497
|
}
|
|
1492
1498
|
function resolveAgg(col, requested, auto) {
|
|
1493
1499
|
const fallback = () => {
|
|
1494
|
-
const d2 =
|
|
1500
|
+
const d2 = Zn(col);
|
|
1495
1501
|
return d2 === "first" ? "count" : d2;
|
|
1496
1502
|
};
|
|
1497
1503
|
if (auto) return fallback();
|
|
1498
|
-
return
|
|
1504
|
+
return Qe(col).indexOf(requested) >= 0 ? requested : fallback();
|
|
1499
1505
|
}
|
|
1500
1506
|
function toNumber(v2) {
|
|
1501
1507
|
if (v2 == null || v2 === "") return null;
|
|
@@ -1598,7 +1604,7 @@ function computeSelectionCard(payload, selectedRowIdxs, opts = {}) {
|
|
|
1598
1604
|
}
|
|
1599
1605
|
const value = reduce(selVals, colAgg, selRaw);
|
|
1600
1606
|
let sharePct = null;
|
|
1601
|
-
if (
|
|
1607
|
+
if (Qn(col, colAgg) && value != null) {
|
|
1602
1608
|
const allVals = [];
|
|
1603
1609
|
const allRaw = [];
|
|
1604
1610
|
for (let r2 = 0; r2 < rows.length; r2++) {
|
|
@@ -2629,6 +2635,7 @@ export {
|
|
|
2629
2635
|
SCROLL_SLACK_PX,
|
|
2630
2636
|
SEASONAL_MARKERS_DEFAULT,
|
|
2631
2637
|
SELECTION_ACTIVE_CLASS,
|
|
2638
|
+
SELECTION_GLYPH_CLASS,
|
|
2632
2639
|
TRANSPORT_LOST_CHECKING_MESSAGE,
|
|
2633
2640
|
VALUE_AXIS_BASELINE_DEFAULT,
|
|
2634
2641
|
VALUE_AXIS_MIN_FIT,
|
|
@@ -2662,7 +2669,9 @@ export {
|
|
|
2662
2669
|
chartOwnsTimeline,
|
|
2663
2670
|
chooserFitsViewport,
|
|
2664
2671
|
clearGeoCache,
|
|
2672
|
+
clearSelectionGlyphs,
|
|
2665
2673
|
codeReadsDatesInLocalTime,
|
|
2674
|
+
collectD3GlyphCenters,
|
|
2666
2675
|
colourSpreadFlag,
|
|
2667
2676
|
compileRenderFn,
|
|
2668
2677
|
compileTrivialSource,
|
|
@@ -2725,12 +2734,14 @@ export {
|
|
|
2725
2734
|
needsScroll,
|
|
2726
2735
|
newQualifyGroupState,
|
|
2727
2736
|
newQualifyRefusalGroupState,
|
|
2737
|
+
nextSelection,
|
|
2728
2738
|
noopViewStateProvider,
|
|
2729
2739
|
normaliseAggregation,
|
|
2730
2740
|
normaliseProductFeedbackText,
|
|
2731
2741
|
normalizeFilterTerm,
|
|
2732
2742
|
orderMostDistinct,
|
|
2733
2743
|
orderRefusalsForDisplay,
|
|
2744
|
+
paintSelectionGlyphs,
|
|
2734
2745
|
parsePendingGenerate,
|
|
2735
2746
|
pendingRecoveryNextDelayMs,
|
|
2736
2747
|
pendingRecoveryRemainingMs,
|
|
@@ -2768,6 +2779,7 @@ export {
|
|
|
2768
2779
|
requiredD3Plugins,
|
|
2769
2780
|
resolveAutoColorScale,
|
|
2770
2781
|
resolveOptions,
|
|
2782
|
+
rowIdxsFromMark,
|
|
2771
2783
|
sameMarker,
|
|
2772
2784
|
scrollFitFor,
|
|
2773
2785
|
servedCorrelationProves,
|
package/dist/react.mjs
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { buildRenderPayload, type RenderPayload, type GeoPointBinding } from "./
|
|
|
9
9
|
export { codeReadsDatesInLocalTime, vegaSpecReadsDatesInLocalTime } from "./dateCells";
|
|
10
10
|
export { createChartHost, compileRenderFn, stripEsmExports, requiredD3Plugins, explainRenderFailure, sessionViewStateProvider, noopViewStateProvider, assembleD3, D3_PLUGIN_PACKAGES, type ChartHost, type ChartHostConfig, type RenderFn } from "./host";
|
|
11
11
|
export { createChartGroup, toSourceRows, syncMemberSelection, type ChartGroup, type ChartGroupMember, type ChartGroupSelection, type ChartGroupChange, type ChartGroupMemberOptions, type ChartGroupSourceOptions, type ChartGroupPayload } from "./group";
|
|
12
|
-
export { createMarkResolver, isInsideControl, type MarkResolver, type MarkResolverEnv } from "./selection";
|
|
12
|
+
export { createMarkResolver, isInsideControl, rowIdxsFromMark, nextSelection, collectD3GlyphCenters, clearSelectionGlyphs, paintSelectionGlyphs, SELECTION_GLYPH_CLASS, type MarkResolver, type MarkResolverEnv, type GlyphCenter, type SelectionGlyphStyle, type SelectionModifiers, } from "./selection";
|
|
13
13
|
export { planTrivialChart, compileTrivialSource, type TrivialPlan, type TrivialShapeKind } from "./trivial";
|
|
14
14
|
export { captureSvgSnapshot, svgToDataUrl, svgNaturalSize, rasterizeSvgToPngDataUrl, type SnapshotOptions } from "./snapshot";
|
|
15
15
|
export { shouldReview, buildReviewWire, bareBase64, actionFor, type ReviewGate, type ReviewWire, type ReviewVerdict, type ReviewAction } from "./review";
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows a mark names: its data-row-idx read as a comma list of non-negative whole
|
|
3
|
+
* numbers. A token that is not one names no row and is skipped; no attribute, no rows.
|
|
4
|
+
*/
|
|
5
|
+
export declare function rowIdxsFromMark(el: Element | null): number[];
|
|
6
|
+
/** The keys held during a click. Cmd counts as Ctrl. */
|
|
7
|
+
export interface SelectionModifiers {
|
|
8
|
+
ctrl?: boolean;
|
|
9
|
+
shift?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* THE SELECTION A CLICK LEAVES - the one rule every host applies to a click on a mark that names
|
|
13
|
+
* `rowIdxs`, from the selection it holds (`current`).
|
|
14
|
+
*
|
|
15
|
+
* With Ctrl/Cmd or Shift the semantics are TOGGLE-PER-ROW, not union: each clicked row that is
|
|
16
|
+
* selected is removed and each that is not is added, so Ctrl-clicking a selected mark takes it
|
|
17
|
+
* off, and a mark spanning several rows (a legend swatch) toggles each of them - a naive union
|
|
18
|
+
* would leave a mark lit after the reader Ctrl-clicked it off. Toggling the last row off is a
|
|
19
|
+
* legitimate way to reach empty.
|
|
20
|
+
*
|
|
21
|
+
* Without a modifier a click REPLACES the selection, and a click on exactly the current selection
|
|
22
|
+
* - the same rows, compared with the selection the host holds now, never with a remembered click -
|
|
23
|
+
* clears it: the other half of the gesture. So a plain click that returns [] is a toggle-off.
|
|
24
|
+
* Comparing with a remembered click instead went stale whenever the selection changed under it (a
|
|
25
|
+
* clear from elsewhere, a re-derived selection), and the next click on the mark then did nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function nextSelection(current: Iterable<number> | null | undefined, rowIdxs: readonly number[], mods?: SelectionModifiers): number[];
|
|
1
28
|
/**
|
|
2
29
|
* True when a click's target sits inside a reader-operated control the chart drew (CONTROL_CLASS
|
|
3
30
|
* on the target or an ancestor), looking no further out than `container` - a page that wraps the
|
|
@@ -20,3 +47,37 @@ export interface MarkResolver {
|
|
|
20
47
|
resolveByGeometry(x: number, y: number, sel: string): HTMLElement | null;
|
|
21
48
|
}
|
|
22
49
|
export declare function createMarkResolver(env: MarkResolverEnv): MarkResolver;
|
|
50
|
+
/** A glyph's centre, in pixels from the overlay's own top-left corner. */
|
|
51
|
+
export interface GlyphCenter {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Where each SELECTED mark in `container` gets its glyph (every `.d3-mark` that also carries the
|
|
57
|
+
* selected class), pushed onto `out` in document order, relative to `baseRect` (the overlay's own
|
|
58
|
+
* client rect). Throws what the platform throws; a host that must not fail its paint catches it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function collectD3GlyphCenters(container: Element, baseRect: {
|
|
61
|
+
left: number;
|
|
62
|
+
top: number;
|
|
63
|
+
}, out: GlyphCenter[]): void;
|
|
64
|
+
/** The class every painted selection glyph carries. */
|
|
65
|
+
export declare const SELECTION_GLYPH_CLASS = "lch-sel-glyph";
|
|
66
|
+
/** Removes every glyph (every child) from the overlay. */
|
|
67
|
+
export declare function clearSelectionGlyphs(overlay: Element | null | undefined): void;
|
|
68
|
+
export interface SelectionGlyphStyle {
|
|
69
|
+
/** The character drawn at each centre. */
|
|
70
|
+
symbol: string;
|
|
71
|
+
/** The glyph's colour. */
|
|
72
|
+
color: string;
|
|
73
|
+
/** The halo drawn on every side of it, so it reads on a dark and a light mark alike. */
|
|
74
|
+
halo: string;
|
|
75
|
+
/** At most this many are drawn. Default 600, which keeps the DOM light on a huge selection. */
|
|
76
|
+
max?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Draws one glyph per centre (up to `max`) into `overlay`, positioned from the overlay's own
|
|
80
|
+
* top-left corner and never hit-tested. Returns how many it drew. It does not clear the overlay
|
|
81
|
+
* first: a host clears it (clearSelectionGlyphs) before deciding whether to paint at all.
|
|
82
|
+
*/
|
|
83
|
+
export declare function paintSelectionGlyphs(overlay: Element, centers: readonly GlyphCenter[], style: SelectionGlyphStyle): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.44",
|
|
4
4
|
"description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|