@bicharts/chart-host 0.6.95 → 0.6.96
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 -1
- package/dist/adapters.mjs +3 -3
- package/dist/{chunk-NNLBFIWU.mjs → chunk-3JBJ2SIF.mjs} +1 -1
- package/dist/{chunk-VEVBXK44.mjs → chunk-5OCL4EFM.mjs} +1 -1
- package/dist/{chunk-QHMLMF4L.mjs → chunk-6KACC7XH.mjs} +8 -2
- package/dist/{chunk-PDVEIW42.mjs → chunk-ASLRGGLV.mjs} +1 -1
- package/dist/{chunk-4ICQEVZX.mjs → chunk-JPJSWL2H.mjs} +36 -10
- package/dist/{chunk-CR7DSJVG.mjs → chunk-LFC5S4Z7.mjs} +1 -1
- package/dist/{chunk-45VILLJT.mjs → chunk-M7MBTLDP.mjs} +1 -1
- package/dist/{chunk-VC3Z5CH7.mjs → chunk-PMA56BKD.mjs} +1 -1
- package/dist/index.mjs +11 -7
- package/dist/legend-fit.mjs +3 -3
- package/dist/page.mjs +4 -4
- package/dist/react.mjs +15 -8
- package/dist/testing.mjs +1 -1
- package/dist/types/contract.d.ts +6 -1
- package/dist/types/host.d.ts +9 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lasso.d.ts +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# @bicharts/chart-host
|
|
2
2
|
|
|
3
|
-
> **Make Generative AI for Charts *Better*.**
|
|
3
|
+
> **Make Generative AI for Charts and Maps *Better*.**
|
|
4
|
+
|
|
5
|
+
**AI Data Components, running in your page:** a bivariate map with its two-way key, a what-if projection with its
|
|
6
|
+
controls inside the chart, a flow map, and about 90 everyday chart types, with selection, cross-filtering and the legend
|
|
7
|
+
already wired. This package is the open-source runtime that makes them behave the same way in Power BI, Excel, Fabric
|
|
8
|
+
Apps and any web page.
|
|
4
9
|
|
|
5
10
|
Describe the chart you want, or just hand over the data, and RegiaBI gives you back a working, interactive chart that fits your data on the first try — as source code you own. It goes into your repo and runs in the framework you already use: React, a plain web page, or whatever your coding agent is scaffolding. At run time there's no key, no call to us and nothing to pay per render: `@bicharts/chart-host`, the open-source runtime, makes the chart behave in your page — clicks, cross-filtering, selection — so that's code you don't have to write. You start from something that already works and spend your time on the last ten percent, in plain language or in the code itself; reading the code is an advantage, never the price of entry. And because the engine knows what each chart type can honestly say, it'll sometimes show you a view of your data you hadn't thought to ask for.
|
|
6
11
|
|
package/dist/adapters.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
censusHitBands,
|
|
4
4
|
ensureCrossfilterHitTargets,
|
|
5
5
|
hitBandFlag
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ASLRGGLV.mjs";
|
|
7
7
|
import {
|
|
8
8
|
clickWasDrag,
|
|
9
9
|
collectD3GlyphCenters,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
markKeyOf,
|
|
13
13
|
rowIdxsFromMark,
|
|
14
14
|
selectionRuleOf
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5OCL4EFM.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AXIS_FILTER_CLASS,
|
|
18
18
|
LEGEND_MARK_CLASS,
|
|
19
19
|
MARK_CLASS,
|
|
20
20
|
ROW_IDX_ATTR
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-M7MBTLDP.mjs";
|
|
22
22
|
import "./chunk-GHODWOAL.mjs";
|
|
23
23
|
|
|
24
24
|
// src/adapters/types.ts
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
gestureWasDrag,
|
|
5
5
|
isInsideControl,
|
|
6
6
|
rowIdxsFromMark
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5OCL4EFM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
AXIS_FILTER_CLASS,
|
|
10
10
|
CONTROL_CLASS,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
MARK_CLASS,
|
|
13
13
|
ROW_IDX_ATTR,
|
|
14
14
|
SNAPSHOT_SVG_ATTR
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-M7MBTLDP.mjs";
|
|
16
16
|
|
|
17
17
|
// src/lasso.ts
|
|
18
18
|
var LASSO_ROW_CAP = 5e3;
|
|
@@ -46,6 +46,10 @@ function lassoActions(setting) {
|
|
|
46
46
|
for (const n of a) if (typeof n === "string" && n.trim() && !out.includes(n.trim())) out.push(n.trim());
|
|
47
47
|
return out;
|
|
48
48
|
}
|
|
49
|
+
var LASSO_DEFAULT_EFFECT = "filter";
|
|
50
|
+
function lassoEffect(setting) {
|
|
51
|
+
return setting?.effect === "highlight" ? "highlight" : LASSO_DEFAULT_EFFECT;
|
|
52
|
+
}
|
|
49
53
|
function lassoVerdict(setting, rows) {
|
|
50
54
|
if (!setting || setting.capable !== true) return "not-capable";
|
|
51
55
|
if (setting.enabled === false) return "disabled";
|
|
@@ -657,6 +661,8 @@ export {
|
|
|
657
661
|
LASSO_DEFAULT_ACTIONS,
|
|
658
662
|
lassoRowCap,
|
|
659
663
|
lassoActions,
|
|
664
|
+
LASSO_DEFAULT_EFFECT,
|
|
665
|
+
lassoEffect,
|
|
660
666
|
lassoVerdict,
|
|
661
667
|
pointInShape,
|
|
662
668
|
registerLassoAction,
|
|
@@ -1,12 +1,13 @@
|
|
|
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
|
LASSO_OUTLINE_CLASS,
|
|
4
|
-
installLasso
|
|
5
|
-
|
|
4
|
+
installLasso,
|
|
5
|
+
lassoEffect
|
|
6
|
+
} from "./chunk-6KACC7XH.mjs";
|
|
6
7
|
import {
|
|
7
8
|
censusHitBands,
|
|
8
9
|
ensureCrossfilterHitTargets
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ASLRGGLV.mjs";
|
|
10
11
|
import {
|
|
11
12
|
clearPress,
|
|
12
13
|
clearSelectionGlyphs,
|
|
@@ -23,14 +24,14 @@ import {
|
|
|
23
24
|
selectionRuleOf,
|
|
24
25
|
trackPress,
|
|
25
26
|
validRowSet
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5OCL4EFM.mjs";
|
|
27
28
|
import {
|
|
28
29
|
clipWindowOf,
|
|
29
30
|
fitRenderedChart,
|
|
30
31
|
rememberScroll,
|
|
31
32
|
takeScroll,
|
|
32
33
|
unpinScrolledAxis
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3JBJ2SIF.mjs";
|
|
34
35
|
import {
|
|
35
36
|
Fn,
|
|
36
37
|
J3,
|
|
@@ -84,7 +85,7 @@ import {
|
|
|
84
85
|
XFILTER_REFRESH_EVENT,
|
|
85
86
|
chartOwnsTimeline,
|
|
86
87
|
periodTickSuppressesFeedback
|
|
87
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-M7MBTLDP.mjs";
|
|
88
89
|
|
|
89
90
|
// src/labelContrast.ts
|
|
90
91
|
function parseRGBA(c) {
|
|
@@ -2084,6 +2085,7 @@ function createChartHost(container, config) {
|
|
|
2084
2085
|
let warnedGeo = false;
|
|
2085
2086
|
let warnedBlank = false;
|
|
2086
2087
|
let warnedIds = false;
|
|
2088
|
+
let warnedLassoNoFilter = false;
|
|
2087
2089
|
const idScope = newIdScope();
|
|
2088
2090
|
let renderSeq = 0;
|
|
2089
2091
|
const annotationLayer = createAnnotationLayer(container, (a) => config.onAnnotationClick?.(a));
|
|
@@ -2120,6 +2122,7 @@ function createChartHost(container, config) {
|
|
|
2120
2122
|
let activeTickEl = null;
|
|
2121
2123
|
let selectionIsPeriod = false;
|
|
2122
2124
|
let selectionFromChart = false;
|
|
2125
|
+
let selectionPublished = true;
|
|
2123
2126
|
const clickedMarks = () => container[CONTAINER_SLOT_CLICKED_MARKS] ?? null;
|
|
2124
2127
|
const setClickedMarks = (c) => {
|
|
2125
2128
|
try {
|
|
@@ -2444,14 +2447,16 @@ function createChartHost(container, config) {
|
|
|
2444
2447
|
}
|
|
2445
2448
|
}
|
|
2446
2449
|
};
|
|
2447
|
-
const notify = (rowIdxs, source, tick, fromChart = false) => {
|
|
2450
|
+
const notify = (rowIdxs, source, tick, fromChart = false, publish = true) => {
|
|
2448
2451
|
if (destroyed) return;
|
|
2449
2452
|
current = rowIdxs;
|
|
2450
2453
|
selectionFromChart = rowIdxs.length > 0 && fromChart;
|
|
2454
|
+
selectionPublished = publish;
|
|
2451
2455
|
activeTickEl = rowIdxs.length ? tick ?? null : null;
|
|
2452
2456
|
selectionIsPeriod = rowIdxs.length > 0 && periodTickSuppressesFeedback(!!tick, chartOwnsTimeline(container));
|
|
2453
2457
|
paintSelection();
|
|
2454
2458
|
paintGlyphLayer();
|
|
2459
|
+
if (!publish) return;
|
|
2455
2460
|
for (const cb of subs) {
|
|
2456
2461
|
try {
|
|
2457
2462
|
cb(rowIdxs, source);
|
|
@@ -2459,12 +2464,33 @@ function createChartHost(container, config) {
|
|
|
2459
2464
|
}
|
|
2460
2465
|
}
|
|
2461
2466
|
};
|
|
2467
|
+
const selectFromLasso = (rows) => {
|
|
2468
|
+
if (lassoEffect(resolved.lasso) === "highlight") {
|
|
2469
|
+
notify(rows, "user", null, true, false);
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2472
|
+
notify(rows, "user", null, true);
|
|
2473
|
+
if (warnedLassoNoFilter || !rows.length) return;
|
|
2474
|
+
let reaches = true;
|
|
2475
|
+
try {
|
|
2476
|
+
reaches = config.selectionReachesPage ? config.selectionReachesPage() !== false : subs.size > 0;
|
|
2477
|
+
} catch {
|
|
2478
|
+
}
|
|
2479
|
+
if (reaches) return;
|
|
2480
|
+
warnedLassoNoFilter = true;
|
|
2481
|
+
try {
|
|
2482
|
+
(win?.console ?? console)?.warn(
|
|
2483
|
+
`[@bicharts/chart-host] a lasso circled ${rows.length} ${rows.length === 1 ? "row" : "rows"}, but the page gave this chart no filter to set (no \`selects\` or bindFilter, no chart group), so the lasso only highlights inside the chart and the rest of the page does not follow. To filter the page, pass selects={useBicFilter("<key column>")} to this chart and filter the other charts by that filter; for a highlight on purpose, set lasso.effect to "highlight".`
|
|
2484
|
+
);
|
|
2485
|
+
} catch {
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2462
2488
|
let xfAt = 0;
|
|
2463
2489
|
const XF_ECHO_MS = 150;
|
|
2464
2490
|
const onXf = (e) => {
|
|
2465
2491
|
const d = e?.detail || {};
|
|
2466
2492
|
xfAt = Date.now();
|
|
2467
|
-
if (d.clear) notify([], d.source || "chart");
|
|
2493
|
+
if (d.clear) notify([], d.source || "chart", void 0, false, selectionPublished || !(current && current.length));
|
|
2468
2494
|
else if (d.mark) notify(parseRowIdxs(d.mark.getAttribute?.(ROW_IDX_ATTR)), d.source || "chart", d.mark, true);
|
|
2469
2495
|
else if (Array.isArray(d.rows)) notify(validRowSet(d.rows), d.source || "chart", null, true);
|
|
2470
2496
|
};
|
|
@@ -2483,7 +2509,7 @@ function createChartHost(container, config) {
|
|
|
2483
2509
|
} catch {
|
|
2484
2510
|
}
|
|
2485
2511
|
}
|
|
2486
|
-
if (current && current.length) notify([], "user");
|
|
2512
|
+
if (current && current.length) notify([], "user", void 0, false, selectionPublished);
|
|
2487
2513
|
}
|
|
2488
2514
|
};
|
|
2489
2515
|
let lasso = null;
|
|
@@ -2679,7 +2705,7 @@ function createChartHost(container, config) {
|
|
|
2679
2705
|
container,
|
|
2680
2706
|
options: () => resolved,
|
|
2681
2707
|
rows: data.rows ? data.rows.length : 0,
|
|
2682
|
-
select:
|
|
2708
|
+
select: selectFromLasso,
|
|
2683
2709
|
clearSelection: clearFromGesture
|
|
2684
2710
|
});
|
|
2685
2711
|
} catch {
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
LASSO_KNOB_KEY
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6KACC7XH.mjs";
|
|
5
5
|
|
|
6
6
|
// src/filterScope.ts
|
|
7
7
|
function viewToken(view) {
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
|
3
3
|
// src/contract.ts
|
|
4
|
-
var HOST_CONTRACT_VERSION = "1.
|
|
4
|
+
var HOST_CONTRACT_VERSION = "1.17.0";
|
|
5
5
|
var GEO_POINT_PRECISIONS = ["latlon", "city", "zip3", "state", "country"];
|
|
6
6
|
var MARK_CLASS = "d3-mark";
|
|
7
7
|
var LEGEND_MARK_CLASS = "d3-legend-mark";
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
SNAPSHOT_SVG_ATTR
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-M7MBTLDP.mjs";
|
|
5
5
|
|
|
6
6
|
// src/snapshot.ts
|
|
7
7
|
var DEFAULT_TIMEOUT_MS = 2e3;
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
svgNaturalSize,
|
|
16
16
|
svgToDataUrl,
|
|
17
17
|
tableHostOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PMA56BKD.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ANNOTATION_CLASS,
|
|
21
21
|
ANNOTATION_LAYER_CLASS,
|
|
@@ -97,11 +97,12 @@ import {
|
|
|
97
97
|
toRGBA,
|
|
98
98
|
toSourceRows,
|
|
99
99
|
valuePlacementFlag
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-JPJSWL2H.mjs";
|
|
101
101
|
import {
|
|
102
102
|
LASSO_AXES_SLOT,
|
|
103
103
|
LASSO_COUNT_CLASS,
|
|
104
104
|
LASSO_DEFAULT_ACTIONS,
|
|
105
|
+
LASSO_DEFAULT_EFFECT,
|
|
105
106
|
LASSO_DRAG_PX,
|
|
106
107
|
LASSO_EVENT,
|
|
107
108
|
LASSO_KNOB_KEY,
|
|
@@ -118,17 +119,18 @@ import {
|
|
|
118
119
|
clearLasso,
|
|
119
120
|
installLasso,
|
|
120
121
|
lassoActions,
|
|
122
|
+
lassoEffect,
|
|
121
123
|
lassoRowCap,
|
|
122
124
|
lassoVerdict,
|
|
123
125
|
pointInShape,
|
|
124
126
|
registerLassoAction
|
|
125
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-6KACC7XH.mjs";
|
|
126
128
|
import {
|
|
127
129
|
MIN_HIT_BAND_PX,
|
|
128
130
|
censusHitBands,
|
|
129
131
|
ensureCrossfilterHitTargets,
|
|
130
132
|
hitBandFlag
|
|
131
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-ASLRGGLV.mjs";
|
|
132
134
|
import {
|
|
133
135
|
CONTAINER_SLOT_PRESS_AT,
|
|
134
136
|
DRAG_NOT_CLICK_PX,
|
|
@@ -153,7 +155,7 @@ import {
|
|
|
153
155
|
selectionRuleOf,
|
|
154
156
|
trackPress,
|
|
155
157
|
validRowSet
|
|
156
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-5OCL4EFM.mjs";
|
|
157
159
|
import {
|
|
158
160
|
AXIS_PIN_BAND_PAD_PX,
|
|
159
161
|
AXIS_PIN_MAX_BAND_FRACTION,
|
|
@@ -182,7 +184,7 @@ import {
|
|
|
182
184
|
svgInkReach,
|
|
183
185
|
takeScroll,
|
|
184
186
|
unpinScrolledAxis
|
|
185
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-3JBJ2SIF.mjs";
|
|
186
188
|
import {
|
|
187
189
|
_3,
|
|
188
190
|
l,
|
|
@@ -241,7 +243,7 @@ import {
|
|
|
241
243
|
chartOwnsTimeline,
|
|
242
244
|
periodTickSuppressesFeedback,
|
|
243
245
|
withoutViewOnlyKeys
|
|
244
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-M7MBTLDP.mjs";
|
|
245
247
|
import "./chunk-GHODWOAL.mjs";
|
|
246
248
|
|
|
247
249
|
// src/optionsVocabulary.ts
|
|
@@ -2195,6 +2197,7 @@ export {
|
|
|
2195
2197
|
LASSO_AXES_SLOT,
|
|
2196
2198
|
LASSO_COUNT_CLASS,
|
|
2197
2199
|
LASSO_DEFAULT_ACTIONS,
|
|
2200
|
+
LASSO_DEFAULT_EFFECT,
|
|
2198
2201
|
LASSO_DRAG_PX,
|
|
2199
2202
|
LASSO_EVENT,
|
|
2200
2203
|
LASSO_KNOB_KEY,
|
|
@@ -2360,6 +2363,7 @@ export {
|
|
|
2360
2363
|
isPillBackdropAlpha,
|
|
2361
2364
|
labelBand,
|
|
2362
2365
|
lassoActions,
|
|
2366
|
+
lassoEffect,
|
|
2363
2367
|
lassoRowCap,
|
|
2364
2368
|
lassoVerdict,
|
|
2365
2369
|
latePickupAction,
|
package/dist/legend-fit.mjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
chartSvgOf,
|
|
4
4
|
tableHostOf
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PMA56BKD.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FIT_CONTENT_SELECTOR,
|
|
8
8
|
ctmScaleOf,
|
|
9
9
|
isPhantomBox
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-3JBJ2SIF.mjs";
|
|
11
|
+
import "./chunk-M7MBTLDP.mjs";
|
|
12
12
|
import "./chunk-GHODWOAL.mjs";
|
|
13
13
|
|
|
14
14
|
// src/legendFit/legendReconcile.ts
|
package/dist/page.mjs
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
readControls,
|
|
15
15
|
viewFromToken,
|
|
16
16
|
viewToken
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-LFC5S4Z7.mjs";
|
|
18
|
+
import "./chunk-6KACC7XH.mjs";
|
|
19
|
+
import "./chunk-5OCL4EFM.mjs";
|
|
20
|
+
import "./chunk-M7MBTLDP.mjs";
|
|
21
21
|
import "./chunk-GHODWOAL.mjs";
|
|
22
22
|
export {
|
|
23
23
|
LINKED_HOVER_CLASS,
|
package/dist/react.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
payloadRowReader,
|
|
14
14
|
viewFromToken,
|
|
15
15
|
viewToken
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LFC5S4Z7.mjs";
|
|
17
17
|
import {
|
|
18
18
|
assembleD3,
|
|
19
19
|
createChartGroup,
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
loadGeo,
|
|
23
23
|
syncMemberSelection,
|
|
24
24
|
toSourceRows
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-JPJSWL2H.mjs";
|
|
26
|
+
import "./chunk-6KACC7XH.mjs";
|
|
27
|
+
import "./chunk-ASLRGGLV.mjs";
|
|
28
|
+
import "./chunk-5OCL4EFM.mjs";
|
|
29
|
+
import "./chunk-3JBJ2SIF.mjs";
|
|
30
30
|
import "./chunk-NQFJHNMC.mjs";
|
|
31
31
|
import "./chunk-A2GMXZP7.mjs";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-M7MBTLDP.mjs";
|
|
33
33
|
import "./chunk-GHODWOAL.mjs";
|
|
34
34
|
|
|
35
35
|
// src/react.tsx
|
|
@@ -119,6 +119,8 @@ function BicChart(props) {
|
|
|
119
119
|
zoomRef.current = zoomMemory ?? null;
|
|
120
120
|
});
|
|
121
121
|
const builtWithRef = useRef(null);
|
|
122
|
+
const reachRef = useRef({ selects, group, id });
|
|
123
|
+
reachRef.current = { selects, group, id };
|
|
122
124
|
const onSelectRef = useRef(onSelect);
|
|
123
125
|
onSelectRef.current = onSelect;
|
|
124
126
|
const onLabelContrastRef = useRef(onLabelContrast);
|
|
@@ -175,7 +177,12 @@ function BicChart(props) {
|
|
|
175
177
|
return onInvalidSentinelRef.current ? (info) => onInvalidSentinelRef.current?.(info) : void 0;
|
|
176
178
|
},
|
|
177
179
|
annotations: annotationsRef.current ?? [],
|
|
178
|
-
onAnnotationClick: (a) => onAnnotationClickRef.current?.(a)
|
|
180
|
+
onAnnotationClick: (a) => onAnnotationClickRef.current?.(a),
|
|
181
|
+
// What a filtering lasso reaches: the page filter (`selects`), or the
|
|
182
|
+
// siblings of a chart that has an id in a group. This binding always
|
|
183
|
+
// subscribes to the selection (for onSelect), so the host cannot count
|
|
184
|
+
// subscribers here; an onSelect callback alone is not the page's filter.
|
|
185
|
+
selectionReachesPage: () => !!reachRef.current.selects || !!(reachRef.current.group && reachRef.current.id)
|
|
179
186
|
});
|
|
180
187
|
hostRef.current = host;
|
|
181
188
|
builtAnnKeyRef.current = annKey;
|
package/dist/testing.mjs
CHANGED
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.17.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[];
|
|
@@ -214,12 +214,17 @@ export interface RenderOptions {
|
|
|
214
214
|
* so. Absent is LASSO_ROW_CAP.
|
|
215
215
|
* actions - what the host runs on release, in order, by name. Absent is ["select"]; a name the host does
|
|
216
216
|
* not know is skipped, so a list can be sent ahead of the build that understands it.
|
|
217
|
+
* effect - what circling a group does to the PAGE (1.17.0). "filter", the default (absent, or anything that
|
|
218
|
+
* is not exactly "highlight"): the marks inside are published as the selection a click makes, so a
|
|
219
|
+
* page filter bound to the chart sets every circled key and the other charts follow. "highlight":
|
|
220
|
+
* they light inside the chart only, and nothing is published. A host's choice, never the chart's.
|
|
217
221
|
*/
|
|
218
222
|
lasso?: {
|
|
219
223
|
enabled?: boolean;
|
|
220
224
|
rowCap?: number;
|
|
221
225
|
actions?: string[];
|
|
222
226
|
capable?: boolean;
|
|
227
|
+
effect?: "filter" | "highlight";
|
|
223
228
|
};
|
|
224
229
|
}
|
|
225
230
|
/** One reader gesture on a chart's own control. */
|
package/dist/types/host.d.ts
CHANGED
|
@@ -263,6 +263,15 @@ export interface ChartHostConfig {
|
|
|
263
263
|
annotations?: MarkAnnotation[];
|
|
264
264
|
/** A badge was clicked. The mark beneath is not selected. */
|
|
265
265
|
onAnnotationClick?: (annotation: MarkAnnotation) => void;
|
|
266
|
+
/**
|
|
267
|
+
* WHETHER THIS CHART'S SELECTION REACHES ANYTHING OUTSIDE IT - a page filter bound to it, a chart group that
|
|
268
|
+
* cross-filters. Read when a filtering lasso (RenderOptions.lasso.effect "filter", the default) circles a
|
|
269
|
+
* group: false makes the host say once, in the console, that the page gave the chart no filter to set, so the
|
|
270
|
+
* lasso only highlights. Absent: the selection reaches something when anything subscribes to it
|
|
271
|
+
* (selection.onChange, which bindFilter and a group's attach both use). The React binding answers it from
|
|
272
|
+
* `selects` and the group itself. Never throws through: an answer that throws counts as reached.
|
|
273
|
+
*/
|
|
274
|
+
selectionReachesPage?: () => boolean;
|
|
266
275
|
}
|
|
267
276
|
export interface ChartHost {
|
|
268
277
|
/** Replace the notes drawn on marks (see ChartHostConfig.annotations); redraws them at once. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type { Controls, ControlInfo, ControlsAttachment } from "./controls";
|
|
|
14
14
|
export { createChartGroup, toSourceRows, syncMemberSelection, type ChartGroup, type ChartGroupMember, type ChartGroupSelection, type ChartGroupChange, type ChartGroupMemberOptions, type ChartGroupSourceOptions, type ChartGroupPayload } from "./group";
|
|
15
15
|
export type { Filter, FilterScope, FilterOptions, FilterKey, FilterChangeReason, FilterBinding, BindFilterOptions, VegaInteractionEvent, PageView } from "./filterScope";
|
|
16
16
|
export { createMarkResolver, isInsideControl, rowIdxsFromMark, nextSelection, DRAG_NOT_CLICK_PX, gestureWasDrag, trackPress, pressOf, clearPress, clickWasDrag, CONTAINER_SLOT_PRESS_AT, type PressPoint, dispatchRowSet, validRowSet, ROW_SET_MAX, selectionRuleOf, markKeyOf, planSelectionPaint, nextClickedMarks, sameRowSet, type SelectionRule, type ClickedMarks, type SelectionPaintMark, type SelectionPaintMode, type SelectionPaintPlan, collectD3GlyphCenters, clearSelectionGlyphs, paintSelectionGlyphs, SELECTION_GLYPH_CLASS, type MarkResolver, type MarkResolverEnv, type GlyphCenter, type SelectionGlyphStyle, type SelectionModifiers, } from "./selection";
|
|
17
|
-
export { installLasso, clearLasso, lassoVerdict, lassoRowCap, lassoActions, registerLassoAction, pointInShape, LASSO_ROW_CAP, LASSO_DRAG_PX, LASSO_SAMPLE_PX, LASSO_MAX_VERTICES, LASSO_RESTORE_MAX_VERTICES, LASSO_RESTORE_MAX_SHAPES, LASSO_EVENT, LASSO_SURFACE_CLASS, LASSO_OUTLINE_CLASS, LASSO_COUNT_CLASS, LASSO_NOTE_CLASS, LASSO_PLOT_CLASS, LASSO_MODE_ATTR, LASSO_KNOB_KEY, LASSO_AXES_SLOT, LASSO_DEFAULT_ACTIONS, type LassoSetting, type LassoVerdict, type LassoMode, type LassoSpace, type LassoShape, type LassoStored, type LassoEventDetail, type LassoAxes, type LassoAction, type LassoActionContext, type LassoEnv, type LassoHandle, } from "./lasso";
|
|
17
|
+
export { installLasso, clearLasso, lassoVerdict, lassoRowCap, lassoActions, lassoEffect, registerLassoAction, pointInShape, LASSO_ROW_CAP, LASSO_DRAG_PX, LASSO_SAMPLE_PX, LASSO_MAX_VERTICES, LASSO_RESTORE_MAX_VERTICES, LASSO_RESTORE_MAX_SHAPES, LASSO_EVENT, LASSO_SURFACE_CLASS, LASSO_OUTLINE_CLASS, LASSO_COUNT_CLASS, LASSO_NOTE_CLASS, LASSO_PLOT_CLASS, LASSO_MODE_ATTR, LASSO_KNOB_KEY, LASSO_AXES_SLOT, LASSO_DEFAULT_ACTIONS, LASSO_DEFAULT_EFFECT, type LassoSetting, type LassoVerdict, type LassoEffect, type LassoMode, type LassoSpace, type LassoShape, type LassoStored, type LassoEventDetail, type LassoAxes, type LassoAction, type LassoActionContext, type LassoEnv, type LassoHandle, } from "./lasso";
|
|
18
18
|
export type { AdapterEvent, AdapterHit, AdapterId, AdapterScene, MarkHandle, MarkInfo, MarkRole, PaintRequest, RendererAdapter, RowTable, } from "./adapters/types";
|
|
19
19
|
export { planTrivialChart, compileTrivialSource, type TrivialPlan, type TrivialShapeKind } from "./trivial";
|
|
20
20
|
export { captureSvgSnapshot, svgToDataUrl, svgNaturalSize, rasterizeSvgToPngDataUrl, tableHostOf, chartSvgOf, htmlToSvgDataUrl, htmlNaturalSize, type SnapshotOptions } from "./snapshot";
|
package/dist/types/lasso.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export type LassoVerdict = "on" | "not-capable" | "disabled" | "over-cap";
|
|
|
49
49
|
export declare function lassoRowCap(setting: LassoSetting | null | undefined): number;
|
|
50
50
|
/** The action names to run on release, in order. Anything that is not a list of names is the default. */
|
|
51
51
|
export declare function lassoActions(setting: LassoSetting | null | undefined): string[];
|
|
52
|
+
/** What circling a group does to the page: "filter" publishes it as the selection, "highlight" only lights it. */
|
|
53
|
+
export type LassoEffect = "filter" | "highlight";
|
|
54
|
+
/** The effect when the setting names none. */
|
|
55
|
+
export declare const LASSO_DEFAULT_EFFECT: LassoEffect;
|
|
56
|
+
/** The effect in force: "highlight" only when the setting says exactly that, else LASSO_DEFAULT_EFFECT. */
|
|
57
|
+
export declare function lassoEffect(setting: LassoSetting | null | undefined): LassoEffect;
|
|
52
58
|
/** Whether a chart with `rows` rows in view gets a lasso under `setting`. */
|
|
53
59
|
export declare function lassoVerdict(setting: LassoSetting | null | undefined, rows: number): LassoVerdict;
|
|
54
60
|
type Pt = [number, number];
|
|
@@ -111,7 +117,8 @@ export interface LassoEnv {
|
|
|
111
117
|
options: () => RenderOptions;
|
|
112
118
|
/** How many rows the chart was handed: the number the cap is measured against. */
|
|
113
119
|
rows: number;
|
|
114
|
-
/**
|
|
120
|
+
/** Make this row set the selection (what the "select" action does). The host decides, from the setting's
|
|
121
|
+
* effect, whether it is published to the page or only lit inside the chart. */
|
|
115
122
|
select(rows: number[]): void;
|
|
116
123
|
/** Clear the host's selection the way an empty click does: the chart's own clear slot first when the
|
|
117
124
|
* chart owns the selection, then a published clear. A no-op when nothing is selected. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.96",
|
|
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",
|