@bicharts/chart-host 0.6.25 → 0.6.27
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
|
|
|
@@ -2433,6 +2433,28 @@ function shouldCaptureThumbnail(g2) {
|
|
|
2433
2433
|
return { capture, consent: g2.consented };
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
|
+
// src/modelPicker.ts
|
|
2437
|
+
var DEFAULT_MODEL_SUFFIX = " \u2014 default";
|
|
2438
|
+
function isPickableModelCode(code) {
|
|
2439
|
+
const c2 = String(code ?? "");
|
|
2440
|
+
return c2 !== "" && !c2.startsWith("BYO");
|
|
2441
|
+
}
|
|
2442
|
+
function markDefaultModel(label, code, defaultCode) {
|
|
2443
|
+
return defaultCode && code === defaultCode ? label + DEFAULT_MODEL_SUFFIX : label;
|
|
2444
|
+
}
|
|
2445
|
+
function defaultModelFirst(rows, defaultCode) {
|
|
2446
|
+
if (!defaultCode) return rows.slice();
|
|
2447
|
+
const first = rows.filter((r2) => r2.value === defaultCode);
|
|
2448
|
+
return first.concat(rows.filter((r2) => r2.value !== defaultCode));
|
|
2449
|
+
}
|
|
2450
|
+
function reconcileModelPick(saved, offered, fallback) {
|
|
2451
|
+
const s2 = String(saved ?? "");
|
|
2452
|
+
if (offered.includes(s2)) return s2;
|
|
2453
|
+
const f2 = String(fallback ?? "");
|
|
2454
|
+
if (offered.includes(f2)) return f2;
|
|
2455
|
+
return offered.length ? offered[0] : "";
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2436
2458
|
// src/clientIdentity.ts
|
|
2437
2459
|
function stableFingerprintOptions() {
|
|
2438
2460
|
return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
|
|
@@ -2498,6 +2520,7 @@ export {
|
|
|
2498
2520
|
CONTROL_CLASS,
|
|
2499
2521
|
D3_PLUGIN_PACKAGES,
|
|
2500
2522
|
DARK_TEXT,
|
|
2523
|
+
DEFAULT_MODEL_SUFFIX,
|
|
2501
2524
|
DIM_OPACITY_DEFAULT,
|
|
2502
2525
|
DIM_OPACITY_VAR,
|
|
2503
2526
|
DUPLICATE_GENERATE_WINDOW_MS,
|
|
@@ -2597,6 +2620,7 @@ export {
|
|
|
2597
2620
|
ctmScaleOf,
|
|
2598
2621
|
decideLabelColor,
|
|
2599
2622
|
decidePendingRecovery,
|
|
2623
|
+
defaultModelFirst,
|
|
2600
2624
|
deltaEHex,
|
|
2601
2625
|
encodePendingGenerate,
|
|
2602
2626
|
ensureCrossfilterHitTargets,
|
|
@@ -2626,6 +2650,7 @@ export {
|
|
|
2626
2650
|
isInvalidSentinelError,
|
|
2627
2651
|
isNarrowedByFilter,
|
|
2628
2652
|
isPhantomBox,
|
|
2653
|
+
isPickableModelCode,
|
|
2629
2654
|
isPillBackdropAlpha,
|
|
2630
2655
|
labelBand,
|
|
2631
2656
|
latePickupAction,
|
|
@@ -2634,6 +2659,7 @@ export {
|
|
|
2634
2659
|
launchGenerates,
|
|
2635
2660
|
listNeedsFilter,
|
|
2636
2661
|
loadGeo,
|
|
2662
|
+
markDefaultModel,
|
|
2637
2663
|
markerArmedBlind,
|
|
2638
2664
|
measureContainerBoxes,
|
|
2639
2665
|
mountProductFeedbackBox,
|
|
@@ -2671,6 +2697,7 @@ export {
|
|
|
2671
2697
|
readQualifyChartRow,
|
|
2672
2698
|
readQualifyRefusalRow,
|
|
2673
2699
|
reconcileChartPick,
|
|
2700
|
+
reconcileModelPick,
|
|
2674
2701
|
recoveryAnswerIsCancelled,
|
|
2675
2702
|
recoveryOwnsTheSentence,
|
|
2676
2703
|
recoveryPollRunning,
|
package/dist/react.mjs
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -42,5 +42,6 @@ export { isDuplicateGenerate, armGenerateGuard, DUPLICATE_GENERATE_WINDOW_MS, ty
|
|
|
42
42
|
export { canShowLastChart, shouldRestoreVersionAfterLicenseSave } from "./lastChart";
|
|
43
43
|
export { isNarrowedByFilter, isEmptiedByFilter, updateRowHighWater, type NarrowingState, } from "./filterNarrowing";
|
|
44
44
|
export { shouldCaptureThumbnail, type ThumbnailGate, type ThumbnailDecision } from "./thumbnailPolicy";
|
|
45
|
+
export { isPickableModelCode, markDefaultModel, defaultModelFirst, reconcileModelPick, DEFAULT_MODEL_SUFFIX, } from "./modelPicker";
|
|
45
46
|
export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
|
|
46
47
|
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,16 @@
|
|
|
1
|
+
/** The suffix that marks the default model's row, after its cost. */
|
|
2
|
+
export declare const DEFAULT_MODEL_SUFFIX = " \u2014 default";
|
|
3
|
+
/** Whether a catalogue code may appear in the open list: not empty, and not a bring-your-own-key code. */
|
|
4
|
+
export declare function isPickableModelCode(code: string | null | undefined): boolean;
|
|
5
|
+
/** The label with the default marker appended when `code` is the (non-empty) default. */
|
|
6
|
+
export declare function markDefaultModel(label: string, code: string, defaultCode: string | null | undefined): string;
|
|
7
|
+
/** A copy of `rows` with the default model's row first and every other row in its original order. */
|
|
8
|
+
export declare function defaultModelFirst<T extends {
|
|
9
|
+
value: string;
|
|
10
|
+
}>(rows: readonly T[], defaultCode: string | null | undefined): T[];
|
|
11
|
+
/**
|
|
12
|
+
* The pick to show: `saved` when the list still offers it; otherwise `fallback` (the host's default -
|
|
13
|
+
* the default model's code, or the host's own "service default" row) when the list offers that;
|
|
14
|
+
* otherwise the list's first row; "" only for an empty list.
|
|
15
|
+
*/
|
|
16
|
+
export declare function reconcileModelPick(saved: string | null | undefined, offered: readonly string[], fallback: string | null | undefined): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.27",
|
|
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",
|