@bicharts/chart-host 0.6.24 → 0.6.26
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.
|
@@ -1640,7 +1640,7 @@ function W2(e) {
|
|
|
1640
1640
|
function Z3(e, n) {
|
|
1641
1641
|
return y4(n, rt) ? true : $2(e).some((t) => /^\d{5}(-\d{4})?$/.test(t.replace(/\.0+$/, "")));
|
|
1642
1642
|
}
|
|
1643
|
-
function
|
|
1643
|
+
function tt2(e, n) {
|
|
1644
1644
|
let t = F3(e);
|
|
1645
1645
|
if (t.length === 0) return 0;
|
|
1646
1646
|
let o = 0;
|
|
@@ -1652,29 +1652,29 @@ function K3(e, n) {
|
|
|
1652
1652
|
for (let o of F3(e)) n(o) && t++;
|
|
1653
1653
|
return t;
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function rt3(e, n) {
|
|
1656
1656
|
let t = 0;
|
|
1657
1657
|
for (let o of $2(e)) n(o) && t++;
|
|
1658
1658
|
return t;
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1661
|
-
let a4 = [], s = [], i = {}, C2 = {},
|
|
1660
|
+
function ot(e, n, t, o, u2) {
|
|
1661
|
+
let a4 = [], s = [], i = {}, C2 = {}, P4 = new Set(e), m = (r) => n.map((l) => l[r]);
|
|
1662
1662
|
for (let r of ["city", "country"]) {
|
|
1663
1663
|
let l = t?.[r];
|
|
1664
|
-
l &&
|
|
1664
|
+
l && P4.has(l) && (i[r] = l);
|
|
1665
1665
|
}
|
|
1666
|
-
let
|
|
1666
|
+
let se = new Set(u2 ?? e);
|
|
1667
1667
|
for (let r of ["lat", "lon"]) {
|
|
1668
1668
|
let l = t?.[r];
|
|
1669
|
-
l &&
|
|
1669
|
+
l && se.has(l) && (i[r] = l);
|
|
1670
1670
|
}
|
|
1671
1671
|
let h3 = t?.zip;
|
|
1672
|
-
if (h3 &&
|
|
1672
|
+
if (h3 && P4.has(h3)) {
|
|
1673
1673
|
let r = m(h3), l = W2(r);
|
|
1674
1674
|
l < 95 ? s.push(`zip=${h3} (only ${l}% of values read as ZIPs)`) : Z3(r, h3) ? i.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
|
-
if (g3 &&
|
|
1677
|
+
if (g3 && P4.has(g3)) {
|
|
1678
1678
|
let r = m(g3), l = F3(r);
|
|
1679
1679
|
l.length > 0 && l.every((d2) => X3(d2, o)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : v3(r) ? (s.push(`state=${g3} (every value is a country, not a state)`), i.country || (i.country = g3)) : k3(r) < 95 ? s.push(`state=${g3} (only ${k3(r)}% of values are states/provinces)`) : i.state = g3;
|
|
1680
1680
|
}
|
|
@@ -1686,39 +1686,39 @@ function rt3(e, n, t, o, u2) {
|
|
|
1686
1686
|
if (v3(d2)) continue;
|
|
1687
1687
|
let p2 = k3(d2);
|
|
1688
1688
|
if (p2 < 95) continue;
|
|
1689
|
-
let _2 = K3(d2, (T3) => !!Y(T3)),
|
|
1690
|
-
_2 < V3 &&
|
|
1689
|
+
let _2 = K3(d2, (T3) => !!Y(T3)), le = K3(d2, (T3) => !!Y(T3) && !X3(T3, o));
|
|
1690
|
+
_2 < V3 && le < 1 || (!r || p2 > r.pct) && (r = { name: l, pct: p2 });
|
|
1691
1691
|
}
|
|
1692
1692
|
r && (i.state = r.name, b4.add(r.name), a4.push(`state=${r.name} (${r.pct}% states/provinces)`));
|
|
1693
1693
|
}
|
|
1694
1694
|
if (!i.zip) for (let r of w3) {
|
|
1695
1695
|
if (b4.has(r)) continue;
|
|
1696
1696
|
let l = m(r), d2 = W2(l);
|
|
1697
|
-
if (!(d2 < 95) && Z3(l, r) && !(
|
|
1697
|
+
if (!(d2 < 95) && Z3(l, r) && !(rt3(l, (p2) => Z(p2).length > 0) < V3)) {
|
|
1698
1698
|
i.zip = r, b4.add(r), a4.push(`zip=${r} (${d2}% ZIP codes)`);
|
|
1699
1699
|
break;
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
let
|
|
1703
|
-
if (!
|
|
1702
|
+
let R2 = i.country;
|
|
1703
|
+
if (!R2 || !v3(m(R2))) {
|
|
1704
1704
|
let r = null;
|
|
1705
1705
|
for (let l of w3) {
|
|
1706
1706
|
if (b4.has(l) || !v3(m(l))) continue;
|
|
1707
1707
|
let d2 = B3(m(l));
|
|
1708
1708
|
(!r || d2 > r.pct) && (r = { name: l, pct: d2 });
|
|
1709
1709
|
}
|
|
1710
|
-
r && (
|
|
1710
|
+
r && (R2 && (s.push(`country=${R2} (only ${B3(m(R2))}% of values are country identifiers; using ${r.name} instead)`), C2.country = R2), i.country = r.name, b4.add(r.name), a4.push(`country=${r.name}`));
|
|
1711
1711
|
}
|
|
1712
1712
|
if (!i.city) {
|
|
1713
1713
|
let r = null;
|
|
1714
1714
|
for (let l of w3) {
|
|
1715
1715
|
if (b4.has(l)) continue;
|
|
1716
|
-
let d2 = m(l), p2 =
|
|
1716
|
+
let d2 = m(l), p2 = tt2(d2, o);
|
|
1717
1717
|
p2 < m3 || K3(d2, (_2) => p3(_2, o)) < V3 || (!r || p2 > r.pct) && (r = { name: l, pct: p2 });
|
|
1718
1718
|
}
|
|
1719
1719
|
r && (i.city = r.name, a4.push(`city=${r.name} (${r.pct}% known cities)`));
|
|
1720
1720
|
}
|
|
1721
|
-
let H3 = i.country ? m(i.country) : [], E4 = !!i.country && v3(H3),
|
|
1721
|
+
let H3 = i.country ? m(i.country) : [], E4 = !!i.country && v3(H3), ae2 = E4 ? new Set(H3.map((r) => E(r == null ? null : String(r))).filter(Boolean)).size : 0, U3 = E4 && ae2 >= 2, O3 = !!(i.lat && i.lon) && n.some((r) => {
|
|
1722
1722
|
let l = +String(r[i.lat] ?? "").trim(), d2 = +String(r[i.lon] ?? "").trim();
|
|
1723
1723
|
return isFinite(l) && isFinite(d2) && l >= -90 && l <= 90 && d2 >= -180 && d2 <= 180 && String(r[i.lat] ?? "").trim() !== "" && String(r[i.lon] ?? "").trim() !== "";
|
|
1724
1724
|
});
|
|
@@ -1737,7 +1737,7 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1737
1737
|
let labelCol;
|
|
1738
1738
|
if (bind) {
|
|
1739
1739
|
const dims = cols.filter((c2) => !c2.isMeasure).map((c2) => c2.name);
|
|
1740
|
-
const res =
|
|
1740
|
+
const res = ot(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
|
|
1741
1741
|
bind = res.bind;
|
|
1742
1742
|
rolesBackfilled = res.backfilled;
|
|
1743
1743
|
rolesRefused = res.refused;
|
package/dist/index.mjs
CHANGED
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
unpinScrolledAxis,
|
|
141
141
|
valuePlacementFlag,
|
|
142
142
|
withoutViewOnlyKeys
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-QP5XGEPM.mjs";
|
|
144
144
|
import "./chunk-A2GMXZP7.mjs";
|
|
145
145
|
import "./chunk-GHODWOAL.mjs";
|
|
146
146
|
|
|
@@ -2427,6 +2427,12 @@ function updateRowHighWater(prevRows, prevSchemaHash, currentRows, currentSchema
|
|
|
2427
2427
|
return { rows: Math.max(prevRows, currentRows), schemaHash: currentSchemaHash };
|
|
2428
2428
|
}
|
|
2429
2429
|
|
|
2430
|
+
// src/thumbnailPolicy.ts
|
|
2431
|
+
function shouldCaptureThumbnail(g2) {
|
|
2432
|
+
const capture = g2.forced || (g2.consented || g2.capturesByDefault) && g2.firstRenderAfterGenerate;
|
|
2433
|
+
return { capture, consent: g2.consented };
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2430
2436
|
// src/clientIdentity.ts
|
|
2431
2437
|
function stableFingerprintOptions() {
|
|
2432
2438
|
return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
|
|
@@ -2680,6 +2686,7 @@ export {
|
|
|
2680
2686
|
scrollFitFor,
|
|
2681
2687
|
servedCorrelationProves,
|
|
2682
2688
|
sessionViewStateProvider,
|
|
2689
|
+
shouldCaptureThumbnail,
|
|
2683
2690
|
shouldOpenChooserOnGenerate,
|
|
2684
2691
|
shouldOpenInlineChooserOnGenerate,
|
|
2685
2692
|
shouldRestoreVersionAfterLicenseSave,
|
package/dist/react.mjs
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -41,5 +41,6 @@ export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
|
|
|
41
41
|
export { isDuplicateGenerate, armGenerateGuard, DUPLICATE_GENERATE_WINDOW_MS, type GenerateGuardKey, type GenerateGuardState, } from "./duplicateGenerateGuard";
|
|
42
42
|
export { canShowLastChart, shouldRestoreVersionAfterLicenseSave } from "./lastChart";
|
|
43
43
|
export { isNarrowedByFilter, isEmptiedByFilter, updateRowHighWater, type NarrowingState, } from "./filterNarrowing";
|
|
44
|
+
export { shouldCaptureThumbnail, type ThumbnailGate, type ThumbnailDecision } from "./thumbnailPolicy";
|
|
44
45
|
export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
|
|
45
46
|
export type { HostServices, MarkerStore, PreferenceSource, HostTheme, ThemeSource, ThumbnailConsent, SnapshotTarget, WireSigner, WireTransport, WireResponse, CredentialTriple, CredentialSource, ViewportSource, Clock, DiagnosticEntry, DiagnosticsSink, RendererId, } from "./host/services";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ThumbnailGate {
|
|
2
|
+
/** The reader or their account opted in to saving thumbnails. The only input that is consent. */
|
|
3
|
+
consented: boolean;
|
|
4
|
+
/** The service asked for this account's renders to be captured for diagnosis. Not consent. */
|
|
5
|
+
forced: boolean;
|
|
6
|
+
/** The host's terms cover a capture without the setting (e.g. a free tier). Not consent. */
|
|
7
|
+
capturesByDefault: boolean;
|
|
8
|
+
/** This render is the first of a newly generated version - not a resize, reopen or filter. */
|
|
9
|
+
firstRenderAfterGenerate: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ThumbnailDecision {
|
|
12
|
+
/** Capture an image of this render. */
|
|
13
|
+
capture: boolean;
|
|
14
|
+
/** The consent flag to send beside it: `consented`, never raised by a forced or default capture. */
|
|
15
|
+
consent: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function shouldCaptureThumbnail(g: ThumbnailGate): ThumbnailDecision;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.26",
|
|
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",
|