@bicharts/chart-host 0.4.0 → 0.4.2
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/README.md +6 -2
- package/dist/{chunk-CVJFLLAD.mjs → chunk-3TQHUKTM.mjs} +279 -239
- package/dist/geo.mjs +11 -0
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +18 -2
- package/dist/types/contract.d.ts +2 -2
- package/package.json +3 -1
package/dist/geo.mjs
CHANGED
|
@@ -22,8 +22,19 @@ function geoForKind(geoKind) {
|
|
|
22
22
|
if (k === "us-state-code" || k === "us-state-name") return US_STATES;
|
|
23
23
|
if (k === "us-zip5") return US_ZIP3;
|
|
24
24
|
if (k === "north-america") return northAmerica();
|
|
25
|
+
if (k === "world") return worldBasemap();
|
|
25
26
|
return void 0;
|
|
26
27
|
}
|
|
28
|
+
var _worldBase;
|
|
29
|
+
function worldBasemap() {
|
|
30
|
+
if (!_worldBase) {
|
|
31
|
+
_worldBase = {
|
|
32
|
+
type: "FeatureCollection",
|
|
33
|
+
features: WORLD_110M.features.filter((f) => f?.geometry && f.geometry.type !== "Point")
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return _worldBase;
|
|
37
|
+
}
|
|
27
38
|
var _na;
|
|
28
39
|
function northAmerica() {
|
|
29
40
|
if (!_na) {
|
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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
|
buildRenderPayload,
|
|
4
|
-
createChartHost
|
|
5
|
-
|
|
4
|
+
createChartHost,
|
|
5
|
+
geoFromCache,
|
|
6
|
+
loadGeo
|
|
7
|
+
} from "./chunk-3TQHUKTM.mjs";
|
|
6
8
|
import "./chunk-A2GMXZP7.mjs";
|
|
7
9
|
|
|
8
10
|
// src/react.tsx
|
|
@@ -70,6 +72,20 @@ function BicChart(props) {
|
|
|
70
72
|
rowMapRef.current = built ? built.rowMap : null;
|
|
71
73
|
const onSelectRef = useRef(onSelect);
|
|
72
74
|
onSelectRef.current = onSelect;
|
|
75
|
+
const [geoTick, setGeoTick] = useState(0);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!geoKind || geoFromCache(geoKind)) return;
|
|
78
|
+
let alive = true;
|
|
79
|
+
loadGeo(geoKind).then((g) => {
|
|
80
|
+
if (alive && g) setGeoTick((t) => t + 1);
|
|
81
|
+
});
|
|
82
|
+
return () => {
|
|
83
|
+
alive = false;
|
|
84
|
+
};
|
|
85
|
+
}, [geoKind]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (geoTick) hostRef.current?.render();
|
|
88
|
+
}, [geoTick]);
|
|
73
89
|
useLayoutEffect(() => {
|
|
74
90
|
const el = ref.current;
|
|
75
91
|
if (!el || !code && !renderFn || !data) return;
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const HOST_CONTRACT_VERSION = "1.
|
|
2
|
-
export type GeoPointPrecision = "latlon" | "city" | "zip3" | "state";
|
|
1
|
+
export declare const HOST_CONTRACT_VERSION = "1.1.0";
|
|
2
|
+
export type GeoPointPrecision = "latlon" | "city" | "zip3" | "state" | "country";
|
|
3
3
|
/** Every valid tier, ordered most precise → coarsest. Runtime form of GeoPointPrecision. */
|
|
4
4
|
export declare const GEO_POINT_PRECISIONS: readonly GeoPointPrecision[];
|
|
5
5
|
export declare const MARK_CLASS = "d3-mark";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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",
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/react": "^19.2.17",
|
|
71
71
|
"esbuild": "^0.28.1",
|
|
72
|
+
"react": "^19.2.8",
|
|
73
|
+
"react-dom": "^19.2.8",
|
|
72
74
|
"typescript": "^5.9.3"
|
|
73
75
|
},
|
|
74
76
|
"publishConfig": {
|