@bicharts/chart-host 0.6.99 → 0.6.102
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/card.mjs +2 -2
- package/dist/{chunk-RAKU2JBE.mjs → chunk-ALX4D2I2.mjs} +118 -12
- package/dist/{chunk-W5L6OH25.mjs → chunk-CNT3QA3R.mjs} +1 -1
- package/dist/{chunk-LDMLLLC6.mjs → chunk-D6A37G2G.mjs} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/react.mjs +2 -2
- package/dist/zoom-memory.mjs +1 -1
- package/package.json +1 -1
package/dist/card.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
2
|
import {
|
|
3
3
|
computeSelectionCard
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-D6A37G2G.mjs";
|
|
5
|
+
import "./chunk-CNT3QA3R.mjs";
|
|
6
6
|
import "./chunk-GHODWOAL.mjs";
|
|
7
7
|
|
|
8
8
|
// src/selectionCardChrome.ts
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
Yn,
|
|
41
41
|
ir,
|
|
42
42
|
tt
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-CNT3QA3R.mjs";
|
|
44
44
|
import {
|
|
45
45
|
NA_ISO3,
|
|
46
46
|
NA_LAT_MAX,
|
|
@@ -1767,6 +1767,67 @@ function shapeTest(mark) {
|
|
|
1767
1767
|
};
|
|
1768
1768
|
}
|
|
1769
1769
|
var parseIdxs = (s) => (s || "").split(",").map((x) => parseInt(x, 10)).filter((n) => Number.isFinite(n));
|
|
1770
|
+
var hits = (a, b) => a.l < b.r && b.l < a.r && a.t < b.b && b.t < a.b;
|
|
1771
|
+
var ROW_ASPECT = 3;
|
|
1772
|
+
var LABEL_JOIN = 0.75;
|
|
1773
|
+
var UNDRAWN = /* @__PURE__ */ new Set(["title", "desc", "style", "script", "noscript", "template", "metadata", "textarea", "option"]);
|
|
1774
|
+
function textBoxes(root, skip) {
|
|
1775
|
+
const doc = root.ownerDocument, out = [];
|
|
1776
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1777
|
+
const walker = doc.createTreeWalker(
|
|
1778
|
+
root,
|
|
1779
|
+
4
|
|
1780
|
+
/* NodeFilter.SHOW_TEXT */
|
|
1781
|
+
);
|
|
1782
|
+
let range = null;
|
|
1783
|
+
try {
|
|
1784
|
+
range = doc.createRange();
|
|
1785
|
+
} catch {
|
|
1786
|
+
range = null;
|
|
1787
|
+
}
|
|
1788
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) {
|
|
1789
|
+
if (!/\S/.test(n.nodeValue || "")) continue;
|
|
1790
|
+
const p = n.parentElement;
|
|
1791
|
+
if (!p || p.closest(skip)) continue;
|
|
1792
|
+
if (UNDRAWN.has(p.localName.toLowerCase()) || p.closest("defs, clipPath, mask, title, desc")) continue;
|
|
1793
|
+
let r = null;
|
|
1794
|
+
const svgText = p.closest("text");
|
|
1795
|
+
if (svgText) {
|
|
1796
|
+
if (seen.has(svgText)) continue;
|
|
1797
|
+
seen.add(svgText);
|
|
1798
|
+
r = svgText.getBoundingClientRect();
|
|
1799
|
+
} else {
|
|
1800
|
+
try {
|
|
1801
|
+
if (range && typeof range.getBoundingClientRect === "function") {
|
|
1802
|
+
range.selectNodeContents(n);
|
|
1803
|
+
const rr = range.getBoundingClientRect();
|
|
1804
|
+
if (rr && rr.width > 0 && rr.height > 0) r = rr;
|
|
1805
|
+
}
|
|
1806
|
+
} catch {
|
|
1807
|
+
r = null;
|
|
1808
|
+
}
|
|
1809
|
+
if (!r) r = p.getBoundingClientRect();
|
|
1810
|
+
}
|
|
1811
|
+
if (r && r.width > 0 && r.height > 0) out.push({ b: box(r), el: svgText ?? p, node: n });
|
|
1812
|
+
}
|
|
1813
|
+
return out;
|
|
1814
|
+
}
|
|
1815
|
+
function seenRight(el, right, stop) {
|
|
1816
|
+
const win = el.ownerDocument.defaultView;
|
|
1817
|
+
if (!win || el.closest("svg")) return right;
|
|
1818
|
+
for (let a = el; a && a !== stop.parentElement; a = a.parentElement) {
|
|
1819
|
+
try {
|
|
1820
|
+
const o = win.getComputedStyle(a);
|
|
1821
|
+
if (o && o.overflowX && o.overflowX !== "visible") {
|
|
1822
|
+
const r = a.getBoundingClientRect();
|
|
1823
|
+
if (r.width > 0) right = Math.min(right, r.right);
|
|
1824
|
+
}
|
|
1825
|
+
} catch {
|
|
1826
|
+
}
|
|
1827
|
+
if (a === stop) break;
|
|
1828
|
+
}
|
|
1829
|
+
return right;
|
|
1830
|
+
}
|
|
1770
1831
|
function createAnnotationLayer(container, onClick) {
|
|
1771
1832
|
let list = [];
|
|
1772
1833
|
let report = { shown: 0, notShown: 0 };
|
|
@@ -1842,28 +1903,73 @@ function createAnnotationLayer(container, onClick) {
|
|
|
1842
1903
|
return v;
|
|
1843
1904
|
};
|
|
1844
1905
|
const controls = Array.from(container.querySelectorAll(`.${CONTROL_CLASS}, .${ZOOM_PAD_CLASS}`)).map((c) => c.getBoundingClientRect()).filter((r) => r.width > 0 && r.height > 0).map(box);
|
|
1906
|
+
let texts = null;
|
|
1907
|
+
const textsNow = () => texts ??= textBoxes(container, `.${ANNOTATION_LAYER_CLASS}, .${CONTROL_CLASS}, .${ZOOM_PAD_CLASS}`);
|
|
1908
|
+
const placed = [];
|
|
1909
|
+
const clampX = (x, hw) => open.l === -Infinity ? x : Math.min(Math.max(x, open.l + hw), Math.max(open.l + hw, open.r - hw));
|
|
1910
|
+
const clampY = (y, hh) => open.t === -Infinity ? y : Math.min(Math.max(y, open.t + hh), Math.max(open.t + hh, open.b - hh));
|
|
1911
|
+
const rowLabel = (v, mark) => {
|
|
1912
|
+
const w = v.r - v.l, h = v.b - v.t;
|
|
1913
|
+
if (!(h > 0) || w < ROW_ASPECT * h) return null;
|
|
1914
|
+
const own = textsNow().filter((t) => {
|
|
1915
|
+
const x = (t.b.l + t.b.r) / 2, y = (t.b.t + t.b.b) / 2;
|
|
1916
|
+
return x > v.l && x < v.r && y > v.t && y < v.b && t.b.b - t.b.t <= h * 1.5;
|
|
1917
|
+
}).sort((p, q) => p.b.l - q.b.l || p.b.t - q.b.t);
|
|
1918
|
+
if (!own.length) return null;
|
|
1919
|
+
const first = own[0];
|
|
1920
|
+
let run = { ...first.b }, seen = mark ? seenRight(first.el, first.b.r, mark) : first.b.r;
|
|
1921
|
+
for (const t of own.slice(1)) {
|
|
1922
|
+
const lineH = run.b - run.t, midY = (t.b.t + t.b.b) / 2;
|
|
1923
|
+
if (midY < run.t || midY > run.b || t.b.l - run.r > LABEL_JOIN * lineH) continue;
|
|
1924
|
+
if (t.b.l < run.r - 1 && t.b.r <= run.r) continue;
|
|
1925
|
+
run = { l: run.l, t: Math.min(run.t, t.b.t), r: Math.max(run.r, t.b.r), b: Math.max(run.b, t.b.b) };
|
|
1926
|
+
seen = Math.max(seen, mark ? seenRight(t.el, t.b.r, mark) : t.b.r);
|
|
1927
|
+
}
|
|
1928
|
+
const after = own.filter((t) => t.b.l >= run.r && t.b.b > run.t && t.b.t < run.b).map((t) => t.b.l);
|
|
1929
|
+
return { r: Math.min(run.r, seen), y: (run.t + run.b) / 2, next: after.length ? Math.min(...after) : v.r };
|
|
1930
|
+
};
|
|
1845
1931
|
const clear = (v, len, mark) => {
|
|
1846
1932
|
const hw = Math.max(16, len * 6 + 8) / 2, hh = 8, g = 2;
|
|
1847
1933
|
const cx = (v.l + v.r) / 2, cy = (v.t + v.b) / 2;
|
|
1848
|
-
const
|
|
1849
|
-
const
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1934
|
+
const at = (x, y) => ({ l: x - hw, t: y - hh, r: x + hw, b: y + hh });
|
|
1935
|
+
const free = (x, y) => x >= v.l - hw && x <= v.r + hw && y >= v.t - hh && y <= v.b + hh && controls.every((c) => x + hw <= c.l || x - hw >= c.r || y + hh <= c.t || y - hh >= c.b);
|
|
1936
|
+
const noText = (x, y) => {
|
|
1937
|
+
const b = at(x, y);
|
|
1938
|
+
return textsNow().every((t) => !hits(b, t.b)) && placed.every((p) => !hits(b, p));
|
|
1939
|
+
};
|
|
1940
|
+
const shape = shapeTest(mark);
|
|
1941
|
+
const tries = [];
|
|
1942
|
+
const add = (x, y, px = x, py = y) => tries.push({ x: clampX(x, hw), y: clampY(y, hh), px, py });
|
|
1943
|
+
const label = rowLabel(v, mark);
|
|
1944
|
+
if (label) {
|
|
1945
|
+
const x = label.r + g + hw;
|
|
1946
|
+
if (x + hw <= label.next - g || label.next >= v.r) add(x, label.y, Math.min(x, v.r - 1), label.y);
|
|
1947
|
+
}
|
|
1948
|
+
const ix = Math.max(2, (v.r - v.l) * 0.175), iy = Math.max(2, (v.b - v.t) * 0.175);
|
|
1949
|
+
for (const [kx, ky, sx, sy] of [[v.r, v.t, 1, -1], [v.l, v.t, -1, -1], [v.r, v.b, 1, 1], [v.l, v.b, -1, 1]])
|
|
1950
|
+
for (const k of [0, 0.5, 1]) add(kx + sx * k * hw, ky + sy * k * hh, kx - sx * ix, ky - sy * iy);
|
|
1951
|
+
const grid = [];
|
|
1952
|
+
for (let i = 0; i <= 8; i++) for (let j = 0; j <= 6; j++) grid.push([v.l + (v.r - v.l) * i / 8, v.t + (v.b - v.t) * j / 6]);
|
|
1953
|
+
grid.sort((p, q) => Math.hypot(p[0] - v.r, p[1] - v.t) - Math.hypot(q[0] - v.r, q[1] - v.t));
|
|
1954
|
+
for (const [x, y] of grid) add(x, y);
|
|
1955
|
+
for (const c of controls) for (const [x, y] of [[cx, c.b + hh + g], [cx, c.t - hh - g], [c.l - hw - g, cy], [c.r + hw + g, cy]]) add(x, y);
|
|
1956
|
+
const on = (t) => shape(t.px, t.py);
|
|
1957
|
+
const pick = tries.find((t) => free(t.x, t.y) && noText(t.x, t.y) && on(t)) ?? tries.find((t) => free(t.x, t.y) && noText(t.x, t.y)) ?? tries.find((t) => free(t.x, t.y) && on(t)) ?? tries.find((t) => free(t.x, t.y));
|
|
1958
|
+
if (!pick) return null;
|
|
1959
|
+
placed.push(at(pick.x, pick.y));
|
|
1960
|
+
return [pick.x, pick.y];
|
|
1855
1961
|
};
|
|
1856
1962
|
let shown = 0;
|
|
1857
1963
|
for (const a of list) {
|
|
1858
1964
|
const pairs = (a.where ? Object.entries(a.where) : a.column != null ? [[a.column, a.value]] : []).map(([c, v]) => [names.indexOf(c), text(v)]);
|
|
1859
1965
|
const want = pairs.map((p) => p[1]).join(" / ");
|
|
1860
|
-
const
|
|
1966
|
+
const hits2 = /* @__PURE__ */ new Set();
|
|
1861
1967
|
if (pairs.length && pairs.every((p) => p[0] >= 0)) (data.rows || []).forEach((row, r) => {
|
|
1862
|
-
if (pairs.every(([ci, v]) => text(row?.[ci]) === v)) for (const m of marksByRow.get(r) ?? [])
|
|
1968
|
+
if (pairs.every(([ci, v]) => text(row?.[ci]) === v)) for (const m of marksByRow.get(r) ?? []) hits2.add(m);
|
|
1863
1969
|
});
|
|
1864
|
-
if (!
|
|
1970
|
+
if (!hits2.size) continue;
|
|
1865
1971
|
let best = null, bestMark = null, laidOut = false;
|
|
1866
|
-
for (const m of
|
|
1972
|
+
for (const m of hits2) {
|
|
1867
1973
|
const b = m.getBoundingClientRect();
|
|
1868
1974
|
if (!(b.width > 0 && b.height > 0)) continue;
|
|
1869
1975
|
laidOut = true;
|
|
@@ -1027,7 +1027,7 @@ function Fn(n, s2) {
|
|
|
1027
1027
|
return { iso: o2, unmatched: I2, matchedRows: N2, totalRows: n.length };
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
|
-
// ../shape-core/dist/chunk-
|
|
1030
|
+
// ../shape-core/dist/chunk-CQS6BGRJ.mjs
|
|
1031
1031
|
var import_papaparse = __toESM(require_papaparse_min(), 1);
|
|
1032
1032
|
/*! @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. */
|
|
1033
1033
|
var ft = { "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" };
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
formatSourceDateFor,
|
|
6
6
|
isExcelDateFormat,
|
|
7
7
|
normaliseAggregation
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-D6A37G2G.mjs";
|
|
9
9
|
import {
|
|
10
10
|
captureSvgSnapshot,
|
|
11
11
|
chartSvgOf,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
toRGBA,
|
|
98
98
|
toSourceRows,
|
|
99
99
|
valuePlacementFlag
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-ALX4D2I2.mjs";
|
|
101
101
|
import {
|
|
102
102
|
LASSO_AXES_SLOT,
|
|
103
103
|
LASSO_COUNT_CLASS,
|
|
@@ -189,7 +189,7 @@ import {
|
|
|
189
189
|
_3,
|
|
190
190
|
l,
|
|
191
191
|
o
|
|
192
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-CNT3QA3R.mjs";
|
|
193
193
|
import "./chunk-A2GMXZP7.mjs";
|
|
194
194
|
import {
|
|
195
195
|
ACTIVE_TICK_CLASS,
|
package/dist/react.mjs
CHANGED
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
loadGeo,
|
|
23
23
|
syncMemberSelection,
|
|
24
24
|
toSourceRows
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ALX4D2I2.mjs";
|
|
26
26
|
import "./chunk-B6BLSIID.mjs";
|
|
27
27
|
import "./chunk-ASLRGGLV.mjs";
|
|
28
28
|
import "./chunk-5OCL4EFM.mjs";
|
|
29
29
|
import "./chunk-3JBJ2SIF.mjs";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-CNT3QA3R.mjs";
|
|
31
31
|
import "./chunk-A2GMXZP7.mjs";
|
|
32
32
|
import "./chunk-M7MBTLDP.mjs";
|
|
33
33
|
import "./chunk-GHODWOAL.mjs";
|
package/dist/zoom-memory.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @bicharts/chart-host — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; Natural Earth and US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
2
2
|
import {
|
|
3
3
|
K
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CNT3QA3R.mjs";
|
|
5
5
|
import "./chunk-GHODWOAL.mjs";
|
|
6
6
|
|
|
7
7
|
// src/zoomMemory/zoomMemory.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.102",
|
|
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",
|