@bicharts/chart-host 0.5.50 → 0.5.52
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 +9 -0
- package/dist/{chunk-B4RZSFAC.mjs → chunk-ZU7QEK3A.mjs} +14 -1
- package/dist/index.mjs +3 -1
- package/dist/react.mjs +3 -2
- package/dist/types/contract.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/react.d.ts +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,8 +185,17 @@ visual — override them if you want a different look:
|
|
|
185
185
|
```css
|
|
186
186
|
.bic-chart-host { --lch-dim-opacity: 0.25; }
|
|
187
187
|
.bic-chart-host.lch-has-selection .d3-mark:not(.lch-mark-selected) { opacity: var(--lch-dim-opacity); }
|
|
188
|
+
.bic-chart-host.lch-has-selection .d3-lift-selected .d3-mark.lch-mark-selected { opacity: 1; stroke-opacity: 1; fill-opacity: 1; }
|
|
188
189
|
```
|
|
189
190
|
|
|
191
|
+
The second rule is opt-in. The affordance is dim-only — a selected mark is merely *exempt* from
|
|
192
|
+
the dim and keeps whatever paint the chart gave it — so a chart that rests its marks below full
|
|
193
|
+
opacity by design (a parallel-coordinates plot drawing every line at 0.38 so overplotting reads)
|
|
194
|
+
would show its selected lines at 38%, which the eye reads as dimmed. Such a chart stamps
|
|
195
|
+
`d3-lift-selected` on the group holding those marks, and inside that group a selected mark is
|
|
196
|
+
painted at full opacity. Undeclared charts are unchanged, so alpha used as an encoding (a depth
|
|
197
|
+
cue, a hierarchy level) is never flattened by a fix meant for another chart.
|
|
198
|
+
|
|
190
199
|
## Architecture — three layers, and why it matters if you contribute
|
|
191
200
|
|
|
192
201
|
Read this before adding code. The package has **three** concerns, and they are independent.
|
|
@@ -6,11 +6,12 @@ import {
|
|
|
6
6
|
} from "./chunk-A2GMXZP7.mjs";
|
|
7
7
|
|
|
8
8
|
// src/contract.ts
|
|
9
|
-
var HOST_CONTRACT_VERSION = "1.
|
|
9
|
+
var HOST_CONTRACT_VERSION = "1.7.0";
|
|
10
10
|
var GEO_POINT_PRECISIONS = ["latlon", "city", "zip3", "state", "country"];
|
|
11
11
|
var MARK_CLASS = "d3-mark";
|
|
12
12
|
var LEGEND_MARK_CLASS = "d3-legend-mark";
|
|
13
13
|
var AXIS_FILTER_CLASS = "d3-axis-filter";
|
|
14
|
+
var LIFT_SELECTED_CLASS = "d3-lift-selected";
|
|
14
15
|
var ROW_IDX_ATTR = "data-row-idx";
|
|
15
16
|
var XFILTER_REFRESH_EVENT = "llm-xfilter-refresh";
|
|
16
17
|
var CONTAINER_SLOT_ANIM_STOP = "__llmAnimStop";
|
|
@@ -1353,6 +1354,17 @@ function createChartHost(container, config) {
|
|
|
1353
1354
|
.${HOST_CONTAINER_CLASS}.${SELECTION_ACTIVE_CLASS} .${MARK_CLASS}:not(.${MARK_SELECTED_CLASS}):not([${ROW_IDX_ATTR}=""]) {
|
|
1354
1355
|
opacity: var(${DIM_OPACITY_VAR}, ${DIM_OPACITY_DEFAULT}) !important;
|
|
1355
1356
|
}
|
|
1357
|
+
/* THE LIFT, BY DECLARATION ONLY. Dimming the others is all the rule above does; a selected
|
|
1358
|
+
mark keeps whatever paint its chart gave it. A chart that draws every mark pale on purpose
|
|
1359
|
+
(a parallel-coordinates plot at 0.38 so overplotting reads) therefore shows its SELECTED
|
|
1360
|
+
lines at 38% - the same eye-reading as dimmed. Inside a group the chart stamps
|
|
1361
|
+
${LIFT_SELECTED_CLASS} on, a selected mark is painted at full opacity. Opacity only, never
|
|
1362
|
+
stroke geometry. Undeclared charts are byte-identical, which is what keeps an alpha
|
|
1363
|
+
ENCODING (a depth cue, a hierarchy level) from being flattened by a fix meant for one. */
|
|
1364
|
+
.${HOST_CONTAINER_CLASS}.${SELECTION_ACTIVE_CLASS} .${LIFT_SELECTED_CLASS} .${MARK_CLASS}.${MARK_SELECTED_CLASS},
|
|
1365
|
+
.${HOST_CONTAINER_CLASS}.${SELECTION_ACTIVE_CLASS} .${MARK_CLASS}.${LIFT_SELECTED_CLASS}.${MARK_SELECTED_CLASS} {
|
|
1366
|
+
opacity: 1 !important; stroke-opacity: 1 !important; fill-opacity: 1 !important;
|
|
1367
|
+
}
|
|
1356
1368
|
.${HOST_CONTAINER_CLASS} .${LEGEND_MARK_CLASS} { cursor: pointer; }
|
|
1357
1369
|
/* An axis/group header that filters when clicked LOOKS like inert text, and until it is
|
|
1358
1370
|
marked there is no way to tell a landed filter from a dead label \u2014 the report reads
|
|
@@ -1566,6 +1578,7 @@ export {
|
|
|
1566
1578
|
MARK_CLASS,
|
|
1567
1579
|
LEGEND_MARK_CLASS,
|
|
1568
1580
|
AXIS_FILTER_CLASS,
|
|
1581
|
+
LIFT_SELECTED_CLASS,
|
|
1569
1582
|
ROW_IDX_ATTR,
|
|
1570
1583
|
XFILTER_REFRESH_EVENT,
|
|
1571
1584
|
CONTAINER_SLOT_ANIM_STOP,
|
package/dist/index.mjs
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
HOST_CONTRACT_VERSION,
|
|
28
28
|
L3,
|
|
29
29
|
LEGEND_MARK_CLASS,
|
|
30
|
+
LIFT_SELECTED_CLASS,
|
|
30
31
|
MARK_CLASS,
|
|
31
32
|
MARK_SELECTED_CLASS,
|
|
32
33
|
Qt,
|
|
@@ -56,7 +57,7 @@ import {
|
|
|
56
57
|
resolveOptions,
|
|
57
58
|
sessionViewStateProvider,
|
|
58
59
|
stripEsmExports
|
|
59
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-ZU7QEK3A.mjs";
|
|
60
61
|
import "./chunk-A2GMXZP7.mjs";
|
|
61
62
|
|
|
62
63
|
// src/trivial.ts
|
|
@@ -891,6 +892,7 @@ export {
|
|
|
891
892
|
HOST_CONTAINER_CLASS,
|
|
892
893
|
HOST_CONTRACT_VERSION,
|
|
893
894
|
LEGEND_MARK_CLASS,
|
|
895
|
+
LIFT_SELECTED_CLASS,
|
|
894
896
|
MARK_CLASS,
|
|
895
897
|
MARK_SELECTED_CLASS,
|
|
896
898
|
ROW_IDX_ATTR,
|
package/dist/react.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createChartHost,
|
|
5
5
|
geoFromCache,
|
|
6
6
|
loadGeo
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZU7QEK3A.mjs";
|
|
8
8
|
import "./chunk-A2GMXZP7.mjs";
|
|
9
9
|
|
|
10
10
|
// src/react.tsx
|
|
@@ -49,6 +49,7 @@ function BicChart(props) {
|
|
|
49
49
|
options,
|
|
50
50
|
d3,
|
|
51
51
|
geoKind,
|
|
52
|
+
viewState,
|
|
52
53
|
id,
|
|
53
54
|
filteredBy,
|
|
54
55
|
respondsWith,
|
|
@@ -89,7 +90,7 @@ function BicChart(props) {
|
|
|
89
90
|
useLayoutEffect(() => {
|
|
90
91
|
const el = ref.current;
|
|
91
92
|
if (!el || !code && !renderFn || !data) return;
|
|
92
|
-
const host = createChartHost(el, { code, renderFn, data, options, d3, geoKind });
|
|
93
|
+
const host = createChartHost(el, { code, renderFn, data, options, d3, geoKind, viewState });
|
|
93
94
|
hostRef.current = host;
|
|
94
95
|
const off = host.selection.onChange((payloadIdxs, source) => {
|
|
95
96
|
if (source === "host") return;
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const HOST_CONTRACT_VERSION = "1.
|
|
1
|
+
export declare const HOST_CONTRACT_VERSION = "1.7.0";
|
|
2
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[];
|
|
@@ -10,6 +10,7 @@ export type GeoMapKind = "north-america" | "world";
|
|
|
10
10
|
export declare const MARK_CLASS = "d3-mark";
|
|
11
11
|
export declare const LEGEND_MARK_CLASS = "d3-legend-mark";
|
|
12
12
|
export declare const AXIS_FILTER_CLASS = "d3-axis-filter";
|
|
13
|
+
export declare const LIFT_SELECTED_CLASS = "d3-lift-selected";
|
|
13
14
|
export declare const ROW_IDX_ATTR = "data-row-idx";
|
|
14
15
|
export declare const XFILTER_REFRESH_EVENT = "llm-xfilter-refresh";
|
|
15
16
|
export declare const CONTAINER_SLOT_ANIM_STOP = "__llmAnimStop";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { HOST_CONTRACT_VERSION, GEO_POINT_PRECISIONS, MARK_CLASS, LEGEND_MARK_CLASS, AXIS_FILTER_CLASS, ROW_IDX_ATTR, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, HOST_CONTAINER_CLASS, SELECTION_ACTIVE_CLASS, MARK_SELECTED_CLASS, ACTIVE_TICK_CLASS, DIM_OPACITY_VAR, DIM_OPACITY_DEFAULT, chartOwnsTimeline, periodTickSuppressesFeedback, ANIM_PLAY_SPEED_DEFAULT, ANIM_PLAY_SPEED_MIN, ANIM_PLAY_SPEED_MAX, ANIM_LOOP_DELAY_DEFAULT, ANIM_LOOP_DELAY_MIN, ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type ColorScaleScope, type RenderOptions, type ViewStateProvider, } from "./contract";
|
|
1
|
+
export { HOST_CONTRACT_VERSION, GEO_POINT_PRECISIONS, MARK_CLASS, LEGEND_MARK_CLASS, AXIS_FILTER_CLASS, ROW_IDX_ATTR, LIFT_SELECTED_CLASS, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, HOST_CONTAINER_CLASS, SELECTION_ACTIVE_CLASS, MARK_SELECTED_CLASS, ACTIVE_TICK_CLASS, DIM_OPACITY_VAR, DIM_OPACITY_DEFAULT, chartOwnsTimeline, periodTickSuppressesFeedback, ANIM_PLAY_SPEED_DEFAULT, ANIM_PLAY_SPEED_MIN, ANIM_PLAY_SPEED_MAX, ANIM_LOOP_DELAY_DEFAULT, ANIM_LOOP_DELAY_MIN, ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type ColorScaleScope, type RenderOptions, type ViewStateProvider, } from "./contract";
|
|
2
2
|
export { resolveOptions, type ResolveOptionsInput } from "./defaults";
|
|
3
3
|
export { loadGeo, geoFromCache, registerGeo, registerGeoAsset, geoAssetFor, clearGeoCache, type GeoAssetName, } from "./geoLazy";
|
|
4
4
|
/** REPLACE the bundled city gazetteer with another packed table. Rarely needed — see the
|
package/dist/types/react.d.ts
CHANGED
|
@@ -15,6 +15,16 @@ export interface BicChartProps {
|
|
|
15
15
|
d3: any;
|
|
16
16
|
/** Attach the bundled geometry for this kind as options.geo (choropleth or basemap). */
|
|
17
17
|
geoKind?: string;
|
|
18
|
+
/**
|
|
19
|
+
* WHERE THIS APP KEEPS THE CHART'S RESTING VIEW-STATE - a sort, an expanded row, a 3D
|
|
20
|
+
* camera. Omit for the session store parked on the container element, which is the right
|
|
21
|
+
* answer for most pages: the chart remembers while it is mounted and forgets on reload.
|
|
22
|
+
*
|
|
23
|
+
* Supply one to outlive the page. A React app is the host that most often has somewhere
|
|
24
|
+
* better to put it - localStorage, a URL query, a user profile on the server - and no
|
|
25
|
+
* default could pick between them, which is why this is a prop rather than a flag.
|
|
26
|
+
*/
|
|
27
|
+
viewState?: ChartHostConfig["viewState"];
|
|
18
28
|
/** Identity within a <BicChartGroup> — the key other charts filter by. */
|
|
19
29
|
id?: string;
|
|
20
30
|
/** Take this group member's selection as a filter on THIS chart's rows. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.52",
|
|
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",
|