@bicharts/chart-host 0.6.13 → 0.6.15

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.
@@ -1584,10 +1584,10 @@ var wt = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, String
1584
1584
  /*! @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. */
1585
1585
  var z3 = 2;
1586
1586
  var Y3 = 400;
1587
- function K3(n) {
1587
+ function B3(n) {
1588
1588
  return !!E(n);
1589
1589
  }
1590
- function M(n) {
1590
+ function T3(n) {
1591
1591
  let e = /* @__PURE__ */ new Set();
1592
1592
  for (let t of n) {
1593
1593
  if (t == null) continue;
@@ -1596,10 +1596,10 @@ function M(n) {
1596
1596
  }
1597
1597
  return Array.from(e);
1598
1598
  }
1599
- function T3(n) {
1600
- let e = M(n);
1599
+ function M(n) {
1600
+ let e = T3(n);
1601
1601
  if (e.length === 0 || W2(n) < 95) return false;
1602
- let t = e.filter((c2) => K3(c2) && !Y(c2)).length, i = e.filter((c2) => !K3(c2) && !!Y(c2)).length;
1602
+ let t = e.filter((c2) => B3(c2) && !Y(c2)).length, i = e.filter((c2) => !B3(c2) && !!Y(c2)).length;
1603
1603
  return t >= 1 && t >= i;
1604
1604
  }
1605
1605
  function X3(n, e) {
@@ -1608,20 +1608,20 @@ function X3(n, e) {
1608
1608
  return t ? e === "world" ? true : s3.has(t) : false;
1609
1609
  }
1610
1610
  function W2(n) {
1611
- let e = M(n);
1611
+ let e = T3(n);
1612
1612
  if (e.length === 0) return 0;
1613
1613
  let t = 0;
1614
- for (let i of e) K3(i) && t++;
1614
+ for (let i of e) B3(i) && t++;
1615
1615
  return Math.round(t / e.length * 1e3) / 10;
1616
1616
  }
1617
1617
  function E4(n) {
1618
- let e = M(n);
1618
+ let e = T3(n);
1619
1619
  if (e.length === 0) return 0;
1620
1620
  let t = 0;
1621
1621
  for (let i of e) Y(i) && t++;
1622
1622
  return Math.round(t / e.length * 1e3) / 10;
1623
1623
  }
1624
- function V3(n) {
1624
+ function $2(n) {
1625
1625
  let e = /* @__PURE__ */ new Set();
1626
1626
  for (let t of n) {
1627
1627
  if (t == null) continue;
@@ -1630,99 +1630,99 @@ function V3(n) {
1630
1630
  }
1631
1631
  return Array.from(e);
1632
1632
  }
1633
- function $2(n) {
1634
- let e = V3(n);
1633
+ function K3(n) {
1634
+ let e = $2(n);
1635
1635
  if (e.length === 0) return 0;
1636
1636
  let t = 0;
1637
1637
  for (let i of e) Z(i).length > 0 && t++;
1638
1638
  return Math.round(t / e.length * 1e3) / 10;
1639
1639
  }
1640
1640
  function Z3(n, e) {
1641
- return y4(e, rt) ? true : V3(n).some((t) => /^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/, "")));
1641
+ return y4(e, rt) ? true : $2(n).some((t) => /^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/, "")));
1642
1642
  }
1643
1643
  function et2(n, e) {
1644
- let t = M(n);
1644
+ let t = T3(n);
1645
1645
  if (t.length === 0) return 0;
1646
1646
  let i = 0;
1647
1647
  for (let c2 of t) p3(c2, e) && i++;
1648
1648
  return Math.round(i / t.length * 1e3) / 10;
1649
1649
  }
1650
- function B3(n, e) {
1650
+ function V3(n, e) {
1651
1651
  let t = 0;
1652
- for (let i of M(n)) e(i) && t++;
1652
+ for (let i of T3(n)) e(i) && t++;
1653
1653
  return t;
1654
1654
  }
1655
1655
  function nt2(n, e) {
1656
1656
  let t = 0;
1657
- for (let i of V3(n)) e(i) && t++;
1657
+ for (let i of $2(n)) e(i) && t++;
1658
1658
  return t;
1659
1659
  }
1660
1660
  function tt2(n, e, t, i, c2) {
1661
- let a4 = [], s = [], r = {}, C2 = {}, x2 = new Set(n), d2 = (o) => e.map((u2) => u2[o]);
1662
- for (let o of ["city", "country"]) {
1663
- let u2 = t?.[o];
1664
- u2 && x2.has(u2) && (r[o] = u2);
1661
+ let a4 = [], s = [], o = {}, C2 = {}, x2 = new Set(n), d2 = (r) => e.map((u2) => u2[r]);
1662
+ for (let r of ["city", "country"]) {
1663
+ let u2 = t?.[r];
1664
+ u2 && x2.has(u2) && (o[r] = u2);
1665
1665
  }
1666
- let re = new Set(c2 ?? n);
1667
- for (let o of ["lat", "lon"]) {
1668
- let u2 = t?.[o];
1669
- u2 && re.has(u2) && (r[o] = u2);
1666
+ let oe = new Set(c2 ?? n);
1667
+ for (let r of ["lat", "lon"]) {
1668
+ let u2 = t?.[r];
1669
+ u2 && oe.has(u2) && (o[r] = u2);
1670
1670
  }
1671
- let P4 = t?.zip;
1672
- if (P4 && x2.has(P4)) {
1673
- let o = d2(P4), u2 = $2(o);
1674
- u2 < 95 ? s.push(`zip=${P4} (only ${u2}% of values read as ZIPs)`) : Z3(o, P4) ? r.zip = P4 : s.push(`zip=${P4} (all values are 3-4 digits with nothing to say they are postal)`);
1671
+ let h3 = t?.zip;
1672
+ if (h3 && x2.has(h3)) {
1673
+ let r = d2(h3), u2 = K3(r);
1674
+ u2 < 95 ? s.push(`zip=${h3} (only ${u2}% of values read as ZIPs)`) : Z3(r, h3) ? o.zip = h3 : s.push(`zip=${h3} (all values are 3-4 digits with nothing to say they are postal)`);
1675
1675
  }
1676
1676
  let g3 = t?.state;
1677
1677
  if (g3 && x2.has(g3)) {
1678
- let o = d2(g3), u2 = M(o);
1679
- u2.length > 0 && u2.every((m) => X3(m, i)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : T3(o) ? (s.push(`state=${g3} (every value is a country, not a state)`), r.country || (r.country = g3)) : E4(o) < 95 ? s.push(`state=${g3} (only ${E4(o)}% of values are states/provinces)`) : r.state = g3;
1678
+ let r = d2(g3), u2 = T3(r);
1679
+ u2.length > 0 && u2.every((m) => X3(m, i)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : M(r) ? (s.push(`state=${g3} (every value is a country, not a state)`), o.country || (o.country = g3)) : E4(r) < 95 ? s.push(`state=${g3} (only ${E4(r)}% of values are states/provinces)`) : o.state = g3;
1680
1680
  }
1681
- let S = new Set(Object.values(r).filter(Boolean)), A2 = n.filter((o) => !S.has(o) && !o.startsWith("__"));
1682
- if (!r.state) {
1683
- let o = null;
1684
- for (let u2 of A2) {
1681
+ let S = new Set(Object.values(o).filter(Boolean)), w3 = n.filter((r) => !S.has(r) && !r.startsWith("__"));
1682
+ if (!o.state) {
1683
+ let r = null;
1684
+ for (let u2 of w3) {
1685
1685
  let m = d2(u2);
1686
- if (T3(m)) continue;
1686
+ if (M(m)) continue;
1687
1687
  let p2 = E4(m);
1688
1688
  if (p2 < 95) continue;
1689
- let O3 = B3(m, (N3) => !!Y(N3)), se = B3(m, (N3) => !!Y(N3) && !X3(N3, i));
1690
- O3 < z3 && se < 1 || (!o || p2 > o.pct) && (o = { name: u2, pct: p2 });
1689
+ let D3 = V3(m, (N3) => !!Y(N3)), se = V3(m, (N3) => !!Y(N3) && !X3(N3, i));
1690
+ D3 < z3 && se < 1 || (!r || p2 > r.pct) && (r = { name: u2, pct: p2 });
1691
1691
  }
1692
- o && (r.state = o.name, S.add(o.name), a4.push(`state=${o.name} (${o.pct}% states/provinces)`));
1692
+ r && (o.state = r.name, S.add(r.name), a4.push(`state=${r.name} (${r.pct}% states/provinces)`));
1693
1693
  }
1694
- if (!r.zip) for (let o of A2) {
1695
- if (S.has(o)) continue;
1696
- let u2 = d2(o), m = $2(u2);
1697
- if (!(m < 95) && Z3(u2, o) && !(nt2(u2, (p2) => Z(p2).length > 0) < z3)) {
1698
- r.zip = o, S.add(o), a4.push(`zip=${o} (${m}% ZIP codes)`);
1694
+ if (!o.zip) for (let r of w3) {
1695
+ if (S.has(r)) continue;
1696
+ let u2 = d2(r), m = K3(u2);
1697
+ if (!(m < 95) && Z3(u2, r) && !(nt2(u2, (p2) => Z(p2).length > 0) < z3)) {
1698
+ o.zip = r, S.add(r), a4.push(`zip=${r} (${m}% ZIP codes)`);
1699
1699
  break;
1700
1700
  }
1701
1701
  }
1702
- let b4 = r.country;
1703
- if (!b4 || !T3(d2(b4))) {
1704
- let o = null;
1705
- for (let u2 of A2) {
1706
- if (S.has(u2) || !T3(d2(u2))) continue;
1702
+ let b4 = o.country;
1703
+ if (!b4 || !M(d2(b4))) {
1704
+ let r = null;
1705
+ for (let u2 of w3) {
1706
+ if (S.has(u2) || !M(d2(u2))) continue;
1707
1707
  let m = W2(d2(u2));
1708
- (!o || m > o.pct) && (o = { name: u2, pct: m });
1708
+ (!r || m > r.pct) && (r = { name: u2, pct: m });
1709
1709
  }
1710
- o && (b4 && (s.push(`country=${b4} (only ${W2(d2(b4))}% of values are country identifiers; using ${o.name} instead)`), C2.country = b4), r.country = o.name, S.add(o.name), a4.push(`country=${o.name}`));
1710
+ r && (b4 && (s.push(`country=${b4} (only ${W2(d2(b4))}% of values are country identifiers; using ${r.name} instead)`), C2.country = b4), o.country = r.name, S.add(r.name), a4.push(`country=${r.name}`));
1711
1711
  }
1712
- if (!r.city) {
1713
- let o = null;
1714
- for (let u2 of A2) {
1712
+ if (!o.city) {
1713
+ let r = null;
1714
+ for (let u2 of w3) {
1715
1715
  if (S.has(u2)) continue;
1716
1716
  let m = d2(u2), p2 = et2(m, i);
1717
- p2 < m3 || B3(m, (O3) => p3(O3, i)) < z3 || (!o || p2 > o.pct) && (o = { name: u2, pct: p2 });
1717
+ p2 < m3 || V3(m, (D3) => p3(D3, i)) < z3 || (!r || p2 > r.pct) && (r = { name: u2, pct: p2 });
1718
1718
  }
1719
- o && (r.city = o.name, a4.push(`city=${o.name} (${o.pct}% known cities)`));
1719
+ r && (o.city = r.name, a4.push(`city=${r.name} (${r.pct}% known cities)`));
1720
1720
  }
1721
- let U3 = r.country ? d2(r.country) : [], _2 = !!r.country && T3(U3), ie = _2 ? new Set(U3.map((o) => E(o == null ? null : String(o))).filter(Boolean)).size : 0, H3 = _2 && ie >= 2, D3 = !!(r.lat && r.lon) && e.some((o) => {
1722
- let u2 = +String(o[r.lat] ?? "").trim(), m = +String(o[r.lon] ?? "").trim();
1723
- return isFinite(u2) && isFinite(m) && u2 >= -90 && u2 <= 90 && m >= -180 && m <= 180 && String(o[r.lat] ?? "").trim() !== "" && String(o[r.lon] ?? "").trim() !== "";
1721
+ let U3 = o.country ? d2(o.country) : [], _2 = !!o.country && M(U3), ie = _2 ? new Set(U3.map((r) => E(r == null ? null : String(r))).filter(Boolean)).size : 0, H3 = _2 && ie >= 2, F3 = !!(o.lat && o.lon) && e.some((r) => {
1722
+ let u2 = +String(r[o.lat] ?? "").trim(), m = +String(r[o.lon] ?? "").trim();
1723
+ return isFinite(u2) && isFinite(m) && u2 >= -90 && u2 <= 90 && m >= -180 && m <= 180 && String(r[o.lat] ?? "").trim() !== "" && String(r[o.lon] ?? "").trim() !== "";
1724
1724
  });
1725
- return r.lat && r.lon && !D3 && s.push(`lat/lon=${r.lat}/${r.lon} (no row holds a usable coordinate pair)`), r.country && !H3 && !(r.city || r.state || r.zip || D3) && s.push(_2 ? `country=${r.country} (every row resolves to the same country - nothing to place apart)` : `country=${r.country} (values are not country identifiers)`), { bind: !!(r.city || r.state || r.zip || H3 || D3) ? r : null, backfilled: a4, refused: s, ...Object.keys(C2).length ? { labelFallback: C2 } : {} };
1725
+ return o.lat && o.lon && !F3 && s.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !H3 && !(o.city || o.state || o.zip || F3) && s.push(_2 ? `country=${o.country} (every row resolves to the same country - nothing to place apart)` : `country=${o.country} (values are not country identifiers)`), { bind: !!(o.city || o.state || o.zip || H3 || F3) ? o : null, backfilled: a4, refused: s, ...Object.keys(C2).length ? { labelFallback: C2 } : {} };
1726
1726
  }
1727
1727
 
1728
1728
  // src/payload.ts
package/dist/index.mjs CHANGED
@@ -140,7 +140,7 @@ import {
140
140
  unpinScrolledAxis,
141
141
  valuePlacementFlag,
142
142
  withoutViewOnlyKeys
143
- } from "./chunk-Z5LQVIBL.mjs";
143
+ } from "./chunk-HLNXKVQP.mjs";
144
144
  import "./chunk-A2GMXZP7.mjs";
145
145
  import "./chunk-GHODWOAL.mjs";
146
146
 
package/dist/react.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadGeo,
8
8
  syncMemberSelection,
9
9
  toSourceRows
10
- } from "./chunk-Z5LQVIBL.mjs";
10
+ } from "./chunk-HLNXKVQP.mjs";
11
11
  import "./chunk-A2GMXZP7.mjs";
12
12
  import "./chunk-GHODWOAL.mjs";
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.13",
3
+ "version": "0.6.15",
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",