@bicharts/chart-host 0.6.77 → 0.6.78
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/dist/adapters.mjs +75 -0
- package/dist/card.mjs +2 -2
- package/dist/{chunk-IMNZYSIC.mjs → chunk-BFN4NY22.mjs} +28 -548
- package/dist/{chunk-H2P63UMG.mjs → chunk-L554L6HF.mjs} +2 -2
- package/dist/{chunk-QOKQUXVV.mjs → chunk-M7VM6F73.mjs} +1 -1
- package/dist/chunk-MGAO2DR7.mjs +543 -0
- package/dist/index.mjs +22 -20
- package/dist/react.mjs +3 -2
- package/dist/types/adapters/d3.d.ts +3 -0
- package/dist/types/adapters/index.d.ts +3 -0
- package/dist/types/adapters/types.d.ts +108 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
import {
|
|
3
|
+
censusHitBands,
|
|
4
|
+
collectD3GlyphCenters,
|
|
5
|
+
createMarkResolver,
|
|
6
|
+
ensureCrossfilterHitTargets,
|
|
7
|
+
hitBandFlag,
|
|
8
|
+
isInsideControl,
|
|
9
|
+
markKeyOf,
|
|
10
|
+
rowIdxsFromMark,
|
|
11
|
+
selectionRuleOf
|
|
12
|
+
} from "./chunk-MGAO2DR7.mjs";
|
|
13
|
+
import {
|
|
14
|
+
AXIS_FILTER_CLASS,
|
|
15
|
+
LEGEND_MARK_CLASS,
|
|
16
|
+
MARK_CLASS,
|
|
17
|
+
ROW_IDX_ATTR
|
|
18
|
+
} from "./chunk-7JWL6LYE.mjs";
|
|
19
|
+
import "./chunk-GHODWOAL.mjs";
|
|
20
|
+
|
|
21
|
+
// src/adapters/types.ts
|
|
22
|
+
var NULL_ADAPTER = { id: "NONE", input: "none" };
|
|
23
|
+
|
|
24
|
+
// src/adapters/d3.ts
|
|
25
|
+
var CLICK_SELECTOR = `.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}], .${AXIS_FILTER_CLASS}[${ROW_IDX_ATTR}]`;
|
|
26
|
+
function roleOf(el) {
|
|
27
|
+
const cl = el.classList;
|
|
28
|
+
if (cl?.contains(AXIS_FILTER_CLASS)) return "axis";
|
|
29
|
+
if (cl?.contains(LEGEND_MARK_CLASS)) return "legend";
|
|
30
|
+
return "mark";
|
|
31
|
+
}
|
|
32
|
+
function markInfo(el) {
|
|
33
|
+
return { handle: el, role: roleOf(el), rows: rowIdxsFromMark(el), key: markKeyOf(el) };
|
|
34
|
+
}
|
|
35
|
+
function createD3Adapter() {
|
|
36
|
+
return {
|
|
37
|
+
id: "D3",
|
|
38
|
+
input: "container-click",
|
|
39
|
+
hit(event, scene) {
|
|
40
|
+
const e = event.native;
|
|
41
|
+
if (isInsideControl(e?.target, scene.container)) return { kind: "control" };
|
|
42
|
+
const x = event.clientX ?? e?.clientX;
|
|
43
|
+
const y = event.clientY ?? e?.clientY;
|
|
44
|
+
const resolver = createMarkResolver({
|
|
45
|
+
root: scene.container,
|
|
46
|
+
doc: scene.doc,
|
|
47
|
+
log: (tag, data) => scene.log(tag, data)
|
|
48
|
+
});
|
|
49
|
+
let el = resolver.findMark(e?.target, CLICK_SELECTOR, e);
|
|
50
|
+
if (!el) el = resolver.penetrateOverlayAt(x, y, CLICK_SELECTOR);
|
|
51
|
+
if (!el) el = resolver.resolveByGeometry(x, y, CLICK_SELECTOR);
|
|
52
|
+
if (!el) return { kind: "empty" };
|
|
53
|
+
const info = markInfo(el);
|
|
54
|
+
if (!info.rows.length) return { kind: "ignored", reason: "mark names no rows" };
|
|
55
|
+
return { kind: "mark", mark: info };
|
|
56
|
+
},
|
|
57
|
+
rowsOf: (handle) => rowIdxsFromMark(handle),
|
|
58
|
+
declaredRule: (scene) => selectionRuleOf(scene.container),
|
|
59
|
+
glyphAnchors(base, scene) {
|
|
60
|
+
const out = [];
|
|
61
|
+
collectD3GlyphCenters(scene.container, base, out);
|
|
62
|
+
return out;
|
|
63
|
+
},
|
|
64
|
+
prepare: (scene) => ensureCrossfilterHitTargets(scene.container, scene.doc),
|
|
65
|
+
census(scene) {
|
|
66
|
+
const detail = censusHitBands(scene.container, scene.doc);
|
|
67
|
+
const flag = hitBandFlag(detail);
|
|
68
|
+
return flag ? { flag, detail } : null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
NULL_ADAPTER,
|
|
74
|
+
createD3Adapter
|
|
75
|
+
};
|
package/dist/card.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
computeSelectionCard
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-M7VM6F73.mjs";
|
|
5
|
+
import "./chunk-L554L6HF.mjs";
|
|
6
6
|
import "./chunk-GHODWOAL.mjs";
|
|
7
7
|
|
|
8
8
|
// src/selectionCardChrome.ts
|