@bicharts/chart-host 0.6.113 → 0.6.115

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.
@@ -0,0 +1,92 @@
1
+ /** The reader's choice for every chart. */
2
+ export type SelectionMarkerChoice = "auto" | "none" | "dot" | "check" | "outline";
3
+ /** The reader's choice for region maps. */
4
+ export type MapSelectionMarkerChoice = "none" | "dot" | "check" | "outline";
5
+ /** What a chart is given, once the choice meets the chart. */
6
+ export type SelectionMarker = "none" | "dot" | "check" | "outline";
7
+ /** The default for every chart: an outline where the chart's ramp has a neutral centre, nothing elsewhere. */
8
+ export declare const SELECTION_MARKER_DEFAULT: SelectionMarkerChoice;
9
+ /** The default for region maps: an outline. */
10
+ export declare const MAP_SELECTION_MARKER_DEFAULT: MapSelectionMarkerChoice;
11
+ /** The choice for every chart from an untrusted value: one of the five words in any case, else the default. */
12
+ export declare function readSelectionMarker(raw: unknown): SelectionMarkerChoice;
13
+ /** The choice for region maps from an untrusted value: one of the four words in any case, else the default. */
14
+ export declare function readMapSelectionMarker(raw: unknown): MapSelectionMarkerChoice;
15
+ /** The column the host adds to a region map's rows: each row's region code, joined to the geometry. */
16
+ export declare const REGION_JOIN_COLUMN = "__geoIso__";
17
+ /** Whether the chart's data joins its rows to regions (a choropleth, a cartogram, a province map). */
18
+ export declare function isRegionMapData(data: {
19
+ columns?: readonly ({
20
+ name?: unknown;
21
+ } | null | undefined)[] | null;
22
+ } | null | undefined): boolean;
23
+ /** The legend the shared value ramp draws for a diverging scale: its centre colour is a neutral just off the canvas. */
24
+ export declare const NEUTRAL_CENTRE_RAMP_SELECTOR = ".llm-value-ramp[data-kind=\"diverging\"]";
25
+ /** Whether the drawn chart declares a colour ramp with a neutral centre. */
26
+ export declare function hasNeutralCentreRamp(container: Element | null | undefined): boolean;
27
+ /** What marks this chart's selection: the map choice on a region map, else the general choice with "auto" decided. */
28
+ export declare function selectionMarkerFor(facts: {
29
+ choice?: unknown;
30
+ mapChoice?: unknown;
31
+ regionMap: boolean;
32
+ neutralCentreRamp: boolean;
33
+ }): SelectionMarker;
34
+ /** The class on the host's outline layer (one svg in the overlay). */
35
+ export declare const SELECTION_OUTLINE_CLASS = "lch-sel-outline";
36
+ /** Whether `el` is an AREA mark: a path, rect or polygon whose interior is painted. A line (fill none), a point
37
+ * (a circle or an ellipse) and a group are not. Reads the computed fill where the platform resolves it, else the
38
+ * element's own attribute and inline style; an element with no fill at all is filled, as SVG paints it. */
39
+ export declare function isAreaMark(el: Element): boolean;
40
+ /** Which selected marks get an outline, for a host that draws its own layer: `shown` drops a mark the reader can't see. */
41
+ export interface OutlineMarkFilter {
42
+ shown?(mark: Element): boolean;
43
+ }
44
+ /**
45
+ * The selected area marks in `container`, in document order. A selected mark that is a group stands for the filled
46
+ * shapes inside it. A selected mark whose box strictly encloses another selected mark is a hierarchy's backdrop (a
47
+ * treemap's parent tile), whose children carry the outlines, and is left out - checked up to 300 marks, as the glyphs
48
+ * check it.
49
+ */
50
+ export declare function collectOutlineMarks(container: Element, filter?: OutlineMarkFilter): Element[];
51
+ type ClientWindow = {
52
+ left: number;
53
+ top: number;
54
+ right: number;
55
+ bottom: number;
56
+ };
57
+ /** The window a mark is seen through, in client coordinates: its outermost svg's box, narrowed by every clip-path on
58
+ * the way up to `stop`. Null when nothing measures (the outline then draws unclipped). */
59
+ export declare function outlineWindowOf(mark: Element, stop?: Element | null): ClientWindow | null;
60
+ export interface SelectionOutlineStyle {
61
+ /** The outline's colour: the chart's text colour. */
62
+ color: string;
63
+ /** The halo under it, in the canvas colour, so it reads on a dark and a light region alike. */
64
+ halo: string;
65
+ /** The outline's width in screen pixels. Default 2. */
66
+ width?: number;
67
+ /** At most this many are drawn. Default 600, which keeps the DOM light on a huge selection. */
68
+ max?: number;
69
+ /** The window each outline is clipped to, in client coordinates, or null for none. Default: outlineWindowOf. */
70
+ windowOf?(mark: Element): ClientWindow | null;
71
+ /** Boxes the outline never paints over, in client coordinates: the chart's own controls (controlBoxesIn). */
72
+ avoid?: readonly ClientWindow[];
73
+ }
74
+ /**
75
+ * Where a chart's OWN CONTROLS are, in client coordinates: every element it declares a control (CONTROL_CLASS - a map's
76
+ * zoom pad, a pager, a flip arrow), grown by `pad` px, and boxes within `join` px of each other merged, so a pad of
77
+ * buttons is one box and no sliver of an outline shows between its buttons. A selection outline is never painted over
78
+ * them: a mark on the reader's chart must not cover the button that moves it.
79
+ */
80
+ export declare function controlBoxesIn(root: Element | null | undefined, opts?: {
81
+ pad?: number;
82
+ join?: number;
83
+ }): ClientWindow[];
84
+ /**
85
+ * Draws an outline around each mark (up to `max`) into `overlay`: one svg layer positioned from the overlay's own
86
+ * top-left corner, never hit-tested and hidden from assistive technology. Each outline is the mark's own shape, placed
87
+ * through the mark's screen matrix, so it lands on the mark however the chart transformed it; its stroke keeps its
88
+ * width at any zoom. Returns how many it drew: a mark with no screen matrix or no geometry is skipped. It does not
89
+ * clear the overlay first: a host clears it (clearSelectionGlyphs) before deciding whether to paint at all.
90
+ */
91
+ export declare function paintSelectionOutlines(overlay: Element, marks: readonly Element[], style: SelectionOutlineStyle): number;
92
+ export {};
@@ -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
  K
4
- } from "./chunk-FIG5DIW7.mjs";
4
+ } from "./chunk-VPFP35XI.mjs";
5
5
  import "./chunk-GHODWOAL.mjs";
6
6
 
7
7
  // src/zoomMemory/zoomMemory.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.113",
3
+ "version": "0.6.115",
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",