@bicharts/chart-host 0.6.113 → 0.6.116
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 +94 -5
- package/dist/adapters.mjs +3 -3
- package/dist/card.mjs +2 -2
- package/dist/category-colours.mjs +275 -0
- package/dist/{chunk-7XT5OJ6M.mjs → chunk-63IUMWY2.mjs} +40 -3
- package/dist/{chunk-AEO5SFEQ.mjs → chunk-EFKGSDFF.mjs} +1 -1
- package/dist/{chunk-TE54AFRN.mjs → chunk-GZSYTDFN.mjs} +531 -393
- package/dist/{chunk-PELRAFYZ.mjs → chunk-IW6BKFF5.mjs} +1 -1
- package/dist/{chunk-OLCUKXKL.mjs → chunk-JMLSNV5Q.mjs} +1 -1
- package/dist/chunk-JTZTTJJK.mjs +244 -0
- package/dist/{chunk-FIG5DIW7.mjs → chunk-K2TH7D5V.mjs} +335 -335
- package/dist/{chunk-KY4FI2HA.mjs → chunk-QG5TENI3.mjs} +5 -1
- package/dist/{chunk-KGVNZR23.mjs → chunk-RLOIA7QK.mjs} +1 -1
- package/dist/{chunk-IL5M7K6Z.mjs → chunk-TUZCM7SX.mjs} +2 -2
- package/dist/{chunk-GTJG3SMD.mjs → chunk-VGJH63LZ.mjs} +1 -1
- package/dist/{chunk-2KLFIGTQ.mjs → chunk-ZZBX5ZJ6.mjs} +145 -18
- package/dist/dax.mjs +23 -1
- package/dist/index.mjs +97 -16
- package/dist/legend-fit.mjs +3 -3
- package/dist/page.mjs +7 -5
- package/dist/provinces.mjs +4 -4
- package/dist/react.mjs +18 -14
- package/dist/testing.mjs +1 -1
- package/dist/types/categoryColours.d.ts +71 -0
- package/dist/types/contract.d.ts +16 -3
- package/dist/types/dax.d.ts +26 -0
- package/dist/types/filterScope.d.ts +52 -4
- package/dist/types/fit.d.ts +6 -1
- package/dist/types/fitDom.d.ts +13 -0
- package/dist/types/host.d.ts +19 -5
- package/dist/types/index.d.ts +7 -4
- package/dist/types/keyboardMarks.d.ts +1 -1
- package/dist/types/markFollower.d.ts +21 -0
- package/dist/types/page.d.ts +1 -1
- package/dist/types/qualifyTable.d.ts +52 -0
- package/dist/types/react.d.ts +11 -3
- package/dist/types/selectionMarker.d.ts +92 -0
- package/dist/zoom-memory.mjs +1 -1
- package/package.json +6 -1
- /package/dist/{chunk-5YSZABCS.mjs → chunk-LXTW6YII.mjs} +0 -0
package/dist/types/dax.d.ts
CHANGED
|
@@ -20,3 +20,29 @@ export declare function calculateTable(table: string, ...filters: Array<string |
|
|
|
20
20
|
* filterQuery(FORECAST_DAX, treatAs(region, "Geography[RegionCode]"))
|
|
21
21
|
*/
|
|
22
22
|
export declare function filterQuery(query: string, ...filters: Array<string | null | undefined | false>): string;
|
|
23
|
+
/** A DAX query's result as the semantic-model query hooks return it: headers, then rows of values in header order. */
|
|
24
|
+
export interface QueryTable {
|
|
25
|
+
columns: readonly {
|
|
26
|
+
name: string;
|
|
27
|
+
}[];
|
|
28
|
+
rows: readonly (readonly unknown[])[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A result header's bare name: "Accounts[Account Number]" and "'Sales Owners'[Owner]" give the column's name,
|
|
32
|
+
* "[Total Revenue]" the measure's; a header that isn't a reference comes back as it is.
|
|
33
|
+
*/
|
|
34
|
+
export declare function columnName(header: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* A QUERY'S ROWS BY COLUMN NAME, for a query that feeds no chart: a form's choice list, a lookup, a count beside a
|
|
37
|
+
* chart. A DAX result names its columns "Table[Column]" and its measures "[Measure]"; each row comes back as an object
|
|
38
|
+
* keyed by the bare name, so `row["Account Number"]` reads Accounts[Account Number]. Two headers with one bare name
|
|
39
|
+
* (Accounts[Name] beside Owners[Name]) keep their whole headers, so neither hides the other. Takes the table or the
|
|
40
|
+
* query hook's `data` (a failed or pending result gives no rows):
|
|
41
|
+
*
|
|
42
|
+
* const owners = queryRows(useSemanticModelQuery({ connection, query: OWNERS_DAX }).data);
|
|
43
|
+
* owners.map(r => r["Sales owner"])
|
|
44
|
+
*/
|
|
45
|
+
export declare function queryRows(result: QueryTable | {
|
|
46
|
+
status?: string;
|
|
47
|
+
table?: QueryTable;
|
|
48
|
+
} | null | undefined): Record<string, unknown>[];
|
|
@@ -16,13 +16,26 @@ export interface FilterOptions {
|
|
|
16
16
|
display?: string | readonly string[];
|
|
17
17
|
/** A stable id for this filter within its scope. Generated when absent. */
|
|
18
18
|
id?: string;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Its name in a saved view (scope.save / a link). Defaults to the key columns joined with "+". Two filters in one
|
|
21
|
+
* scope never share a name there: the second with one name is saved as "<name>-2", the third "<name>-3", in the order
|
|
22
|
+
* they joined the scope, so each puts back its own pick (FilterScope.keyOf says which name a filter has).
|
|
23
|
+
*/
|
|
20
24
|
key?: string;
|
|
21
25
|
/**
|
|
22
26
|
* LINKED HOVER: hovering a mark on a chart bound to this filter lights the marks with the same key on every other
|
|
23
27
|
* chart bound to it (a glow, never a filter). Off by default.
|
|
24
28
|
*/
|
|
25
29
|
hover?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* ONE PICK ACROSS SEVERAL PANELS. Filters with the same group name in one scope (one page) are one pick: a map, a
|
|
32
|
+
* table and a scatter that each pick a country, each with its own filter so each panel's query can leave its own pick
|
|
33
|
+
* out. A pick in one member clears the others, so the most recent pick is the page's one pick, and only the member
|
|
34
|
+
* holding it is active: one chip, one scope line, and a side list over the members' keys names that pick alone.
|
|
35
|
+
* Every member's chart shows the pick, so clicking the picked mark again in whichever panel shows it clears it.
|
|
36
|
+
* The members share their key columns; a filter keyed differently stays out of the group (said once in the console).
|
|
37
|
+
*/
|
|
38
|
+
group?: string;
|
|
26
39
|
}
|
|
27
40
|
export interface Filter {
|
|
28
41
|
readonly id: string;
|
|
@@ -56,9 +69,11 @@ export interface Filter {
|
|
|
56
69
|
/**
|
|
57
70
|
* The display text for ANY key - a badge's, a key set by value - read from `rows` (a table carrying the display
|
|
58
71
|
* columns, e.g. the chart's own rows) or else from the rows this filter has seen; the key's values when neither
|
|
59
|
-
* has it.
|
|
72
|
+
* has it. `parts` names the key columns to say (a query that maps only some of them, see ScopedFilter): a display
|
|
73
|
+
* column speaks for the key column it is, or for the key column in its place when there is one display column per
|
|
74
|
+
* key column; a wildcard part says nothing. Absent, or naming every key column: the whole key.
|
|
60
75
|
*/
|
|
61
|
-
textOf(key: FilterKey | unknown, rows?: readonly Record<string, unknown>[]): string;
|
|
76
|
+
textOf(key: FilterKey | unknown, rows?: readonly Record<string, unknown>[], parts?: readonly string[]): string;
|
|
62
77
|
/** Why the last change happened (null before any). */
|
|
63
78
|
readonly reason: FilterChangeReason | null;
|
|
64
79
|
/** Bumped on every change: a cheap identity for memoising on the filter's state. */
|
|
@@ -82,6 +97,15 @@ export interface Filter {
|
|
|
82
97
|
keep<T extends Record<string, unknown>>(rows: readonly T[], columns?: readonly string[]): T[];
|
|
83
98
|
/** Subscribe to changes. Returns the unsubscribe. */
|
|
84
99
|
onChange(cb: (filter: Filter, reason: FilterChangeReason) => void): () => void;
|
|
100
|
+
/** Its group's name (FilterOptions.group), or null. */
|
|
101
|
+
readonly group?: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* The filter holding the pick this one shows: the group member a reader last picked in, or this filter itself when it
|
|
104
|
+
* has no group; null while nothing is picked. A chart bound to a member paints this filter's keys.
|
|
105
|
+
*/
|
|
106
|
+
readonly pick?: Filter | null;
|
|
107
|
+
/** Subscribe to the pick changing: this filter's, or any member's of its group. Returns the unsubscribe. */
|
|
108
|
+
onPick?(cb: () => void): () => void;
|
|
85
109
|
}
|
|
86
110
|
/** A page's filters: what a chip bar lists and what clear-all clears. */
|
|
87
111
|
export interface FilterScope {
|
|
@@ -104,6 +128,11 @@ export interface FilterScope {
|
|
|
104
128
|
save(): PageView;
|
|
105
129
|
/** Put a saved view back: each filter set (or cleared when the view doesn't name it), each controls set. */
|
|
106
130
|
restore(view: PageView | null | undefined): void;
|
|
131
|
+
/**
|
|
132
|
+
* A filter's name in this scope's saved views: its key, or "<key>-2", "<key>-3"... for the second and later filters
|
|
133
|
+
* with one key, in the order they joined the scope. Null for a filter not in the scope.
|
|
134
|
+
*/
|
|
135
|
+
keyOf?(filter: Filter): string | null;
|
|
107
136
|
}
|
|
108
137
|
/** A saved page view: what save() returns and restore() takes. */
|
|
109
138
|
export interface PageView {
|
|
@@ -130,13 +159,32 @@ export declare function isAnyValue(v: unknown): boolean;
|
|
|
130
159
|
export declare function createFilter(columns: string | readonly string[], opts?: FilterOptions): Filter;
|
|
131
160
|
/** Make a page's filter scope. */
|
|
132
161
|
export declare function createFilterScope(): FilterScope;
|
|
162
|
+
/**
|
|
163
|
+
* A FILTER AS ONE PANEL'S QUERY TAKES IT, for filterScopeOf and BicChart's scopedBy. A query that maps only some of a
|
|
164
|
+
* compound key's columns (treatAs(cell, "Accounts[Region]") on a Region x Stage pick) is narrowed by those parts alone,
|
|
165
|
+
* so its scope line names only them: `{ filter: cell, takes: ["Region"] }` says "Europe", never "Europe → 3-Propose".
|
|
166
|
+
*/
|
|
167
|
+
export interface ScopedFilter {
|
|
168
|
+
filter: Filter;
|
|
169
|
+
/** The filter's key columns this panel's query maps (by name, as the filter is keyed). Absent: the whole key. */
|
|
170
|
+
takes?: readonly string[];
|
|
171
|
+
/** What the scope line calls it. Default: the filter's label, or the taken columns while the filter has no label of its own. */
|
|
172
|
+
label?: string;
|
|
173
|
+
}
|
|
174
|
+
/** What filterScopeOf and scopedBy take: a filter whose whole key the query maps, or a ScopedFilter. */
|
|
175
|
+
export type ScopeSource = Filter | ScopedFilter;
|
|
176
|
+
/** The filter behind a scope source, or null. */
|
|
177
|
+
export declare function scopeFilterOf(src: ScopeSource | null | undefined): Filter | null;
|
|
133
178
|
/**
|
|
134
179
|
* THE PAGE FILTERS THAT NARROWED A CHART'S ROWS, as the fact the chart is told (RenderOptions.filterScope, contract
|
|
135
180
|
* 1.23.0). For filters applied to the chart's QUERY, so its rows arrive already narrowed and it can't see the filter.
|
|
136
181
|
* Only the active ones count. The field is each one's label (its key columns when it has none), joined ", "; the values
|
|
137
182
|
* are what its chip shows for each key, in order, each once. Nothing active, nothing to say: undefined.
|
|
183
|
+
*
|
|
184
|
+
* A ScopedFilter whose `takes` leaves key columns out says only the taken parts, as treatAs maps them: a pick whose
|
|
185
|
+
* taken parts are all wildcards keeps every row of that query, so while one is held the filter narrows nothing there.
|
|
138
186
|
*/
|
|
139
|
-
export declare function filterScopeOf(filters:
|
|
187
|
+
export declare function filterScopeOf(filters: ScopeSource | readonly ScopeSource[] | null | undefined): FilterScopeFact | undefined;
|
|
140
188
|
export interface FilterBinding {
|
|
141
189
|
/**
|
|
142
190
|
* Call after the chart is handed new data. The selection is repainted where its keys are drawn now, and a key the new
|
package/dist/types/fit.d.ts
CHANGED
|
@@ -90,11 +90,16 @@ export type AxisPinEdge = "top" | "bottom";
|
|
|
90
90
|
* one drawn over it.
|
|
91
91
|
*/
|
|
92
92
|
export declare function axisPinPlacement(band: AxisBand, scrollTop: number, viewportH: number): AxisPinEdge | null;
|
|
93
|
-
/** A reader's scroll offsets and the identity of the chart they were made on.
|
|
93
|
+
/** A reader's scroll offsets and the identity of the chart they were made on. `inner` holds the offsets of the chart's own
|
|
94
|
+
* scrollers (TABLE_SCROLLER_CLASS), in document order, when any of them was scrolled; absent otherwise. */
|
|
94
95
|
export interface ScrollMemory {
|
|
95
96
|
key: unknown;
|
|
96
97
|
x: number;
|
|
97
98
|
y: number;
|
|
99
|
+
inner?: ReadonlyArray<{
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
}>;
|
|
98
103
|
}
|
|
99
104
|
/** What the container reports once the overflow is decided. */
|
|
100
105
|
export interface ScrollMetrics {
|
package/dist/types/fitDom.d.ts
CHANGED
|
@@ -113,8 +113,21 @@ export declare function unpinScrolledAxis(container: HTMLElement | null | undefi
|
|
|
113
113
|
* Remember where the container is scrolled, BEFORE the container is cleared. A memory already waiting is kept: a second render that
|
|
114
114
|
* starts before the first one restored sees an emptied (unscrolled) container, and must not overwrite what the reader really did.
|
|
115
115
|
* A diagram that scrolls inside itself remembers its own position, so it is left alone.
|
|
116
|
+
* A table scrolls its rows inside its own frame (TABLE_SCROLLER_CLASS) while the container stays at the top, so those offsets
|
|
117
|
+
* are kept too, in document order, whenever one of them is scrolled; restoreInnerScroll puts them back.
|
|
116
118
|
*/
|
|
117
119
|
export declare function rememberScroll(container: HTMLElement | null | undefined, key: unknown): void;
|
|
120
|
+
/**
|
|
121
|
+
* Put a table's own scroll back after the SAME chart has drawn again: each element carrying TABLE_SCROLLER_CLASS gets the
|
|
122
|
+
* offsets its counterpart (by document order) had in `memory`. Nothing happens for a different chart (another key), a memory
|
|
123
|
+
* with no inner offsets, or a chart with no such element, so a new chart opens at the top. The browser clamps an offset the new
|
|
124
|
+
* layout cannot reach. Call it once the chart has drawn, with the memory takeScroll returned. Returns the offsets the scrollers
|
|
125
|
+
* report afterwards, or null when nothing was restored. Never throws.
|
|
126
|
+
*/
|
|
127
|
+
export declare function restoreInnerScroll(container: HTMLElement | null | undefined, memory: ScrollMemory | null | undefined, key: unknown): Array<{
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
}> | null;
|
|
118
131
|
/** The waiting memory, removed. The one place it is consumed, so a stale memory can never outlive a render. */
|
|
119
132
|
export declare function takeScroll(container: HTMLElement | null | undefined): ScrollMemory | null;
|
|
120
133
|
export declare function pinScrolledAxis(container: HTMLElement | null | undefined, svg: SVGSVGElement | null | undefined): AxisPinReport;
|
package/dist/types/host.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface SelectionChangeMeta {
|
|
|
9
9
|
/** The pick was a category label (an axis label carrying its category's rows), not a mark: a page filter selects on
|
|
10
10
|
* the label's own field (bindFilter), leaving the key columns the label doesn't name free. */
|
|
11
11
|
fromLabel?: boolean;
|
|
12
|
+
/** The pick was ONE mark clicked on its own (no Ctrl/Shift, not a lasso): a page filter selects the key columns that
|
|
13
|
+
* mark's rows share, leaving the ones they differ on free (bindFilter), so a region row over its stages picks the region. */
|
|
14
|
+
fromMark?: boolean;
|
|
12
15
|
}
|
|
13
16
|
export interface SelectionPaintReport {
|
|
14
17
|
rule: SelectionRule;
|
|
@@ -20,6 +23,7 @@ export interface SelectionPaintReport {
|
|
|
20
23
|
import { type MarkCensus } from "./blankRender";
|
|
21
24
|
import { type HitBandCensus } from "./hitBands";
|
|
22
25
|
import { type ColourSpreadCensus } from "./colourSpread";
|
|
26
|
+
import type { CategoryColourCensus } from "./categoryColours";
|
|
23
27
|
import { type ClippedTextCensus } from "./clippedText";
|
|
24
28
|
import { type ValuePlacementCensus } from "./valuePlacement";
|
|
25
29
|
import { type FitRenderedChartOptions, type FitRenderedChartResult } from "./fitDom";
|
|
@@ -147,6 +151,15 @@ export interface ChartHostConfig {
|
|
|
147
151
|
* own skew is measured on the raw column while the ramp encodes an aggregate.
|
|
148
152
|
*/
|
|
149
153
|
onColourSpreadCensus?: (census: ColourSpreadCensus) => void;
|
|
154
|
+
/**
|
|
155
|
+
* HOW CLOSE ARE THE TWO CLOSEST CATEGORY COLOURS, AS PAINTED? Runs after every render, counts only, never repaints;
|
|
156
|
+
* the census loads on first use, so the report arrives a tick after the render rather than inside it.
|
|
157
|
+
* One colour per category (the legend's swatches, else the marks' distinct colours), the closest pair by CIEDE2000
|
|
158
|
+
* at full strength, over the page at each element's own opacity, and at the dim level a selection applies. Generated
|
|
159
|
+
* code can build its own scale or draw at partial opacity, so the palette that was checked is not always what a
|
|
160
|
+
* reader compares. Declines on a sequential ramp or a continuous colour channel.
|
|
161
|
+
*/
|
|
162
|
+
onCategoryColourCensus?: (census: CategoryColourCensus) => void;
|
|
150
163
|
/**
|
|
151
164
|
* IS ANY TEXT CUT OFF BY THE FRAME? Runs after every render, counts only, and never moves anything: a title
|
|
152
165
|
* drawn above its own origin is clipped without anything throwing, so only a measurement against the SVG box
|
|
@@ -224,13 +237,14 @@ export interface ChartHostConfig {
|
|
|
224
237
|
/** What the label-contrast pass did after each render - counts, so a host can log them. */
|
|
225
238
|
onLabelContrast?: (report: LabelContrastReport) => void;
|
|
226
239
|
/**
|
|
227
|
-
* What the selection-
|
|
228
|
-
* Called only when
|
|
229
|
-
*
|
|
230
|
-
*
|
|
240
|
+
* What the selection-marker pass did after each paint of an active selection - counts, so a host can log them.
|
|
241
|
+
* Called only when the chart's marker is "dot", "check" or "outline" (options.selectionGlyph, or on a region map
|
|
242
|
+
* options.mapSelectionGlyph; "auto" decided); `suppressed` is true when the chart's family never takes a marker
|
|
243
|
+
* (options.suppressSelectionGlyph, or the same fact in data.meta). For an outline, `total` counts the selected
|
|
244
|
+
* area marks. A repaint that only follows marks moving without a render (a pan, a transition) is not reported again.
|
|
231
245
|
*/
|
|
232
246
|
onSelectionGlyphs?: (report: {
|
|
233
|
-
mode: "dot" | "check";
|
|
247
|
+
mode: "dot" | "check" | "outline";
|
|
234
248
|
drawn: number;
|
|
235
249
|
total: number;
|
|
236
250
|
suppressed: boolean;
|
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, LIFT_SELECTED_CLASS, CONTROL_CLASS, NO_ROW_MARKS_ATTR, NOTE_STYLE_ATTR, SELECTION_RULE_ATTR, SELECTION_RULE_CLICKED_MARKS, MARK_KEY_ATTR, CONTAINER_SLOT_CLICKED_MARKS, SNAPSHOT_SVG_ATTR, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, CONTAINER_SLOT_SCROLL, CONTAINER_SLOT_HOST_SELECTION, VIEW_ONLY_UI_STATE_KEYS, withoutViewOnlyKeys, HOST_CONTAINER_CLASS, SELECTION_ACTIVE_CLASS, MARK_SELECTED_CLASS, MARKS_INERT_CLASS, ACTIVE_TICK_CLASS, DIM_OPACITY_VAR, DIM_OPACITY_DEFAULT, DIM_OPACITY_MIN, 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, ANIMATION_OPTION_KEYS, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, FLIP_INTERVAL_MIN_MS, FLIP_INTERVAL_MAX_MS, FLIP_DIRECTION_DEFAULT, APPROXIMATE_POSITIONS_DEFAULT, VALUE_AXIS_BASELINE_DEFAULT, SEASONAL_MARKERS_DEFAULT, MAX_MAP_POINTS_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type FlipDirection, type ApproximatePositions, type ValueAxisBaseline, type SeasonalMarkers, type ColorScaleScope, type RenderOptions, type ViewStateProvider, type ChartControlChange, type XfilterRefreshDetail, type HostSelectionFact, type FilterScopeFact, } from "./contract";
|
|
1
|
+
export { HOST_CONTRACT_VERSION, GEO_POINT_PRECISIONS, MARK_CLASS, LEGEND_MARK_CLASS, AXIS_FILTER_CLASS, ROW_IDX_ATTR, LIFT_SELECTED_CLASS, CONTROL_CLASS, NO_ROW_MARKS_ATTR, NOTE_STYLE_ATTR, SELECTION_RULE_ATTR, SELECTION_RULE_CLICKED_MARKS, MARK_KEY_ATTR, CONTAINER_SLOT_CLICKED_MARKS, SNAPSHOT_SVG_ATTR, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, CONTAINER_SLOT_SCROLL, TABLE_SCROLLER_CLASS, CONTAINER_SLOT_HOST_SELECTION, VIEW_ONLY_UI_STATE_KEYS, withoutViewOnlyKeys, HOST_CONTAINER_CLASS, SELECTION_ACTIVE_CLASS, MARK_SELECTED_CLASS, MARKS_INERT_CLASS, ACTIVE_TICK_CLASS, DIM_OPACITY_VAR, DIM_OPACITY_DEFAULT, DIM_OPACITY_MIN, CATEGORY_DELTA_E_FLOOR, 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, ANIMATION_OPTION_KEYS, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, FLIP_INTERVAL_MIN_MS, FLIP_INTERVAL_MAX_MS, FLIP_DIRECTION_DEFAULT, APPROXIMATE_POSITIONS_DEFAULT, VALUE_AXIS_BASELINE_DEFAULT, SEASONAL_MARKERS_DEFAULT, MAX_MAP_POINTS_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type FlipDirection, type ApproximatePositions, type ValueAxisBaseline, type SeasonalMarkers, type ColorScaleScope, type RenderOptions, type ViewStateProvider, type ChartControlChange, type XfilterRefreshDetail, type HostSelectionFact, type FilterScopeFact, } from "./contract";
|
|
2
2
|
export { resolveOptions, cleanHostSelection, cleanFilterScope, type ResolveOptionsInput } from "./defaults";
|
|
3
3
|
export { hostLinkServices, type HostLinkServices, type ClipboardLike } from "./hostLinks";
|
|
4
4
|
export { tableToCsv, tableToXlsx, buildExportFile, exportFileName, sheetName as exportSheetName, excelNumberFormat, excelSerial, bytesToBase64, exportFormatsFor, exportTableService, browserSaveFile, EXPORT_FORMATS, XLSX_MIME, CSV_MIME, type ExportTable, type ExportColumn, type ExportColumnType, type ExportCell, type ExportFormat, type ExportFile, type SaveFileService, type ExportTableService, } from "./exportTable";
|
|
@@ -16,8 +16,10 @@ export { rememberFocus, restoreFocus, trackFocus, type FocusMemory, type FocusTr
|
|
|
16
16
|
export type { MarkNoteLike, NoteBadgeOptions } from "./markNotes";
|
|
17
17
|
export type { Controls, ControlInfo, ControlsAttachment } from "./controls";
|
|
18
18
|
export { createChartGroup, toSourceRows, syncMemberSelection, type ChartGroup, type ChartGroupMember, type ChartGroupSelection, type ChartGroupChange, type ChartGroupMemberOptions, type ChartGroupSourceOptions, type ChartGroupPayload } from "./group";
|
|
19
|
-
export type { Filter, FilterScope, FilterOptions, FilterKey, FilterChangeReason, FilterBinding, BindFilterOptions, VegaInteractionEvent, PageView } from "./filterScope";
|
|
19
|
+
export type { Filter, FilterScope, FilterOptions, FilterKey, FilterChangeReason, FilterBinding, BindFilterOptions, VegaInteractionEvent, PageView, ScopedFilter, ScopeSource } from "./filterScope";
|
|
20
20
|
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";
|
|
21
|
+
export { readSelectionMarker, readMapSelectionMarker, selectionMarkerFor, SELECTION_MARKER_DEFAULT, MAP_SELECTION_MARKER_DEFAULT, REGION_JOIN_COLUMN, isRegionMapData, NEUTRAL_CENTRE_RAMP_SELECTOR, hasNeutralCentreRamp, isAreaMark, collectOutlineMarks, outlineWindowOf, controlBoxesIn, paintSelectionOutlines, SELECTION_OUTLINE_CLASS, type SelectionMarkerChoice, type MapSelectionMarkerChoice, type SelectionMarker, type SelectionOutlineStyle, type OutlineMarkFilter, } from "./selectionMarker";
|
|
22
|
+
export { followMarks, MARK_MOVE_ATTRIBUTES, type MarkFollower, type MarkFollowerOptions } from "./markFollower";
|
|
21
23
|
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";
|
|
22
24
|
export type { AdapterEvent, AdapterHit, AdapterId, AdapterScene, MarkHandle, MarkInfo, MarkRole, PaintRequest, RendererAdapter, RowTable, } from "./adapters/types";
|
|
23
25
|
export { planTrivialChart, compileTrivialSource, type TrivialPlan, type TrivialShapeKind } from "./trivial";
|
|
@@ -29,7 +31,7 @@ export { mountShareRateLine, shareRateLineModel, type ShareRateLine, type ShareR
|
|
|
29
31
|
export { qualifyGroupHeadingFor, newQualifyGroupState, type QualifyGroupRow, type QualifyGroupState, type QualifyGroupHeading, orderRefusalsForDisplay, refusalIsSelectable, hasRefusalsToShow, qualifyRefusalHeadingFor, newQualifyRefusalGroupState, qualifyRefusalReason, QUALIFY_REFUSAL_UNSPECIFIED, refusalIsTileBound, QUALIFY_TILE_REFUSAL_CODES, QUALIFY_TOO_SMALL_HEADING, type QualifyRefusalRow, type QualifyRefusalGroupState, type QualifyRefusalHeading, } from "./qualifyGroups";
|
|
30
32
|
export { qualifyPick, qualifyAuto, qualifyCancel, launchGenerates, launchFavorStyle, chooserFitsViewport, shouldOpenChooserOnGenerate, shouldOpenInlineChooserOnGenerate, canConfirmLaunch, confirmLaunch, qualifyFailureFallsOpen, CHOOSER_MIN_WIDTH_PX, CHOOSER_MIN_HEIGHT_PX, type QualifyLaunchOutcome, type ChooserGateInput, } from "./qualifyLaunch";
|
|
31
33
|
export { normalizeFilterTerm, filterQualifyRows, readQualifyChartRow, readQualifyRefusalRow, DEFAULT_FILTER_MATCH_STYLE, filterMatchStyleOf, type FilterMatchStyle, filterFitsChooser, listNeedsFilter, qualifyFilterGate, inlineFilterGate, FILTER_MIN_TERM_CHARS, FILTER_ROW_PX, FILTER_MIN_WIDTH_PX, FILTER_MIN_HEIGHT_PX, INLINE_FILTER_MIN_ROWS, computeQualifyFilterView, qualifyFilterCountText, type QualifyFilterTier, type QualifyFilterResult, type QualifyFilterRead, type QualifyFilterGateReason, type QualifyFilterGateInput, type QualifyFilterRow, type QualifyFilterGroup, type QualifyFilterView, type QualifyFilterNoteKind, } from "./qualifyFilter";
|
|
32
|
-
export { qualifyTableRows, type QualifyTableRow, type QualifyTableSource } from "./qualifyTable";
|
|
34
|
+
export { qualifyTableRows, type QualifyTableRow, type QualifyTableSource, QUALIFY_KIND_BADGES, qualifyKindBadgeStyle, type QualifyKind, type QualifyKindBadge, type QualifyKindBadgeColours, type QualifyKindPane, type QualifyKindBadgeStyle, } from "./qualifyTable";
|
|
33
35
|
export { computeSelectionCard, normaliseAggregation, type SelectionCardModel, type SelectionCardLine, type SelectionCardOptions, } from "./selectionCard";
|
|
34
36
|
export { formatSourceDate, formatSourceDateFor, isExcelDateFormat, type SourceFormats, type SourceFormatDialect, type SourceDateOptions, } from "./sourceDateFormat";
|
|
35
37
|
export { composeSummaryText } from "./summaryText";
|
|
@@ -43,13 +45,14 @@ export { rowGrowthNotice, ROW_GROWTH_MIN_RATIO, ROW_GROWTH_MIN_EXTRA, type RowGr
|
|
|
43
45
|
export { censusHitBands, hitBandFlag, MIN_HIT_BAND_PX, type HitBandCensus } from "./hitBands";
|
|
44
46
|
export { censusClippedText, clippedTextFlag, CLIP_TOLERANCE_PX, type ClippedTextCensus, type ClippedText } from "./clippedText";
|
|
45
47
|
export { censusColourSpread, colourSpreadFlag, SAME_SHADE_DELTA_E, MIN_RAMP_FILLS, type ColourSpreadCensus } from "./colourSpread";
|
|
48
|
+
export type { CategoryColourCensus, CategoryColourCensusOptions } from "./categoryColours";
|
|
46
49
|
export { censusValuePlacement, valuePlacementFlag, VALUE_AXIS_MIN_FIT, type ValuePlacementCensus } from "./valuePlacement";
|
|
47
50
|
export { SCROLL_SLACK_PX, MAX_FRAME_GROW_FACTOR, PHANTOM_FRACTION, FIT_CONTENT_SELECTOR, needsScroll, contentExtentOf, scrollFitFor, planFrameGrow, isPhantomBox, type MeasuredBox, type ContentExtent, type ScrollFit, type FrameGrowPlan, } from "./fit";
|
|
48
51
|
export { fitRenderedChart, fitReadingFor, measureContainerBoxes, svgInkReach, ctmScaleOf, type FitReading, type InkReach, type FitRenderedChartOptions, type FitRenderedChartResult, } from "./fitDom";
|
|
49
52
|
export { AXIS_PIN_MIN_LABELS, AXIS_PIN_BAND_PAD_PX, AXIS_PIN_MAX_BAND_FRACTION, AXIS_PIN_TRACK_REACH_PX, isHorizontalLabelRow, labelBand, planAxisPin, axisPinPlacement, type LabelRowBox, type AxisBand, type AxisPinCandidate, type AxisPinPlan, type AxisPinEdge, } from "./fit";
|
|
50
53
|
export { pinScrolledAxis, unpinScrolledAxis, type AxisPinReport } from "./fitDom";
|
|
51
54
|
export { planScrollRestore, type ScrollMemory, type ScrollMetrics } from "./fit";
|
|
52
|
-
export { rememberScroll, takeScroll } from "./fitDom";
|
|
55
|
+
export { rememberScroll, takeScroll, restoreInnerScroll } from "./fitDom";
|
|
53
56
|
export { MIN_DELTA_E, pickDistinctColorFromSeed, buildPalette, buildPaletteFromSeed, orderMostDistinct, LEGIBLE_LIGHTNESS, type PaletteResult, type SeedForSlot, type PaletteOptions, } from "./palette";
|
|
54
57
|
export { deltaEHex } from "./deltaE";
|
|
55
58
|
export { resolveAutoColorScale, autoRampMinStep, autoRampCanvas, AUTO_RAMP_CLASSES, AUTO_RAMP_DRAWN_OPACITY, AUTO_RAMP_MIN_STEP_DELTA_E, type AutoColorScale, type AutoColorScaleInput } from "./autoRamp";
|
|
@@ -13,7 +13,7 @@ export interface KeyboardEnv {
|
|
|
13
13
|
pressSelector: string;
|
|
14
14
|
/** Elements never to treat as marks (the host's own layers). */
|
|
15
15
|
skipSelector: string;
|
|
16
|
-
/** True while a click on a mark selects nothing (the marks are then
|
|
16
|
+
/** True while a click on a mark selects nothing (the marks are then read as images, with no pressed state). */
|
|
17
17
|
inert(): boolean;
|
|
18
18
|
/** Select a mark as a click on it would. */
|
|
19
19
|
select(mark: Element, mods: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MarkFollowerOptions {
|
|
2
|
+
/** Elements whose own writes never count (the host's layers), as a selector. */
|
|
3
|
+
blind?: string;
|
|
4
|
+
/** The window whose observers and frames to use. Default: the container's own. */
|
|
5
|
+
win?: any;
|
|
6
|
+
/** Called on the next frame after the marks moved; `resized` is true when the container's size changed. */
|
|
7
|
+
repaint(resized: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
export interface MarkFollower {
|
|
10
|
+
/** Start (true) or stop (false) following. Connecting twice is harmless. */
|
|
11
|
+
follow(on: boolean): void;
|
|
12
|
+
/** Note the container's size now, as painted at: a later size equal to it repaints nothing. Call at each paint. */
|
|
13
|
+
painted(): void;
|
|
14
|
+
/** Drop the writes already recorded: call after a paint, whose own writes (the selection's classes) are in it. */
|
|
15
|
+
takeRecords(): void;
|
|
16
|
+
/** Whether it is following now. */
|
|
17
|
+
readonly following: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** The attributes whose writes can move or hide a mark. */
|
|
20
|
+
export declare const MARK_MOVE_ATTRIBUTES: readonly string[];
|
|
21
|
+
export declare function followMarks(container: HTMLElement, opts: MarkFollowerOptions): MarkFollower;
|
package/dist/types/page.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { viewToken, viewFromToken, LINKED_HOVER_CLASS, type PageView } from "./filterScope";
|
|
2
|
-
export { createFilter, createFilterScope, bindFilter, payloadRowReader, fromVegaInteraction, filterScopeOf, ANY_VALUE, isAnyValue, type Filter, type FilterScope, type FilterOptions, type FilterKey, type FilterChangeReason, type FilterBinding, type BindFilterOptions, type VegaInteractionEvent } from "./filterScope";
|
|
2
|
+
export { createFilter, createFilterScope, bindFilter, payloadRowReader, fromVegaInteraction, filterScopeOf, scopeFilterOf, ANY_VALUE, isAnyValue, type Filter, type FilterScope, type FilterOptions, type FilterKey, type FilterChangeReason, type FilterBinding, type BindFilterOptions, type VegaInteractionEvent, type ScopedFilter, type ScopeSource } from "./filterScope";
|
|
3
3
|
export { createControls, attachControls, readControls, type Controls, type ControlInfo, type ControlsAttachment } from "./controls";
|
|
4
4
|
export { noteBadges, badgeKey, notesFor, type MarkNoteLike, type NoteBadgeOptions } from "./markNotes";
|
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What kind of thing a chart type is, beyond a plain chart, in the chart gallery's own families: an app (a type with
|
|
3
|
+
* its own controls or logic), a table, a map or a KPI card. A plain chart has no kind and no badge. The same four
|
|
4
|
+
* strings shape-core's qualify parse accepts (a test pins the two lists equal).
|
|
5
|
+
*/
|
|
6
|
+
export type QualifyKind = "app" | "table" | "map" | "kpi";
|
|
7
|
+
/** A colour pair for one badge: the chip's fill and its text. */
|
|
8
|
+
export interface QualifyKindBadgeColours {
|
|
9
|
+
background: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
/** How one kind is badged: its word, and its colours on a light pane and on a dark pane. */
|
|
13
|
+
export interface QualifyKindBadge {
|
|
14
|
+
/** The word on the badge. The word is the signal; colour only repeats it. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** On a light pane: the gallery family's own light tint, with the family's colour darkened to 75% as the text. */
|
|
17
|
+
light: QualifyKindBadgeColours;
|
|
18
|
+
/** On a dark pane: the family's colour at 50% as the fill, with the gallery's light tint as the text. */
|
|
19
|
+
dark: QualifyKindBadgeColours;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The four badges, in the gallery's family order (apps, tables, maps, KPIs). Each host draws them in its own widget,
|
|
23
|
+
* after the name and before a Preview badge, and a badge never reorders, hides or gates a row.
|
|
24
|
+
*
|
|
25
|
+
* The light fills are the chart gallery's family tints exactly. The gallery's own family text colour does not reach
|
|
26
|
+
* 4.5:1 on three of its tints (about 3.6 to 4.5), so the text is that colour darkened to 75%, which keeps the hue and
|
|
27
|
+
* clears 5.7:1 on every fill. The dark fills are the family colour at 50%, with the tint as text (above 9:1). Light
|
|
28
|
+
* tints sit close to each other by nature (the nearest pair is about 8.5 apart by CIEDE2000), so the claim is that
|
|
29
|
+
* the badges are distinct with the word on them, not that colour alone tells them apart.
|
|
30
|
+
*/
|
|
31
|
+
export declare const QUALIFY_KIND_BADGES: Readonly<Record<QualifyKind, QualifyKindBadge>>;
|
|
32
|
+
/** The pane a badge is drawn on. In high contrast the host's own foreground colour is the only colour used. */
|
|
33
|
+
export type QualifyKindPane = "light" | "dark" | {
|
|
34
|
+
highContrastForeground: string;
|
|
35
|
+
};
|
|
36
|
+
/** What a host sets on a badge element: its word, fill, text colour and border, as CSS values. */
|
|
37
|
+
export interface QualifyKindBadgeStyle {
|
|
38
|
+
label: string;
|
|
39
|
+
background: string;
|
|
40
|
+
color: string;
|
|
41
|
+
border: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The style for one kind's badge on one pane, or null for no kind (a plain chart, or a kind this version does not
|
|
45
|
+
* know). In high contrast the badge has no fill: the text and a 1px border take the host's foreground colour, so the
|
|
46
|
+
* system's colours decide and the word stays the signal.
|
|
47
|
+
*/
|
|
48
|
+
export declare function qualifyKindBadgeStyle(kind: string | null | undefined, pane: QualifyKindPane): QualifyKindBadgeStyle | null;
|
|
1
49
|
/** What a what-fits row must carry to become a table row (the shape-core parse result satisfies it). */
|
|
2
50
|
export interface QualifyTableSource {
|
|
3
51
|
name: string;
|
|
@@ -8,6 +56,8 @@ export interface QualifyTableSource {
|
|
|
8
56
|
recommended?: boolean | null;
|
|
9
57
|
isPreview?: boolean | null;
|
|
10
58
|
alsoWorthALook?: boolean | null;
|
|
59
|
+
/** The server's kind for the type ("app", "table", "map", "kpi"); absent or anything else is a plain chart. */
|
|
60
|
+
kind?: string | null;
|
|
11
61
|
}
|
|
12
62
|
export interface QualifyTableRow {
|
|
13
63
|
/** The position in the order asked for, or null for a row the server did not rank. */
|
|
@@ -22,6 +72,8 @@ export interface QualifyTableRow {
|
|
|
22
72
|
renderer: string | null;
|
|
23
73
|
/** One of the "something different" picks drawn from below the top fits. */
|
|
24
74
|
alsoWorthALook: boolean;
|
|
75
|
+
/** The type's kind, for its badge (QUALIFY_KIND_BADGES); null for a plain chart. qualifyTableRows always sets it. */
|
|
76
|
+
kind?: QualifyKind | null;
|
|
25
77
|
}
|
|
26
78
|
/** The rows as table rows, in the order given (the server's order IS the ranking). */
|
|
27
79
|
export declare function qualifyTableRows(rows: readonly QualifyTableSource[]): QualifyTableRow[];
|
package/dist/types/react.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { ReactNode, RefObject } from "react";
|
|
|
2
2
|
import { type ChartHostConfig } from "./host";
|
|
3
3
|
import type { ResolveOptionsInput } from "./defaults";
|
|
4
4
|
import type { GeoPointBinding } from "./payload";
|
|
5
|
-
import { type PageView, type Filter, type FilterOptions } from "./filterScope";
|
|
5
|
+
import { type PageView, type Filter, type FilterOptions, type ScopeSource } from "./filterScope";
|
|
6
6
|
export { assembleD3 } from "./host";
|
|
7
7
|
import { type Controls } from "./controls";
|
|
8
8
|
export { createControls, type Controls, type ControlInfo } from "./controls";
|
|
9
9
|
export { noteBadges, badgeKey, notesFor, type MarkNoteLike, type NoteBadgeOptions } from "./markNotes";
|
|
10
10
|
export { viewToken, viewFromToken, LINKED_HOVER_CLASS, type PageView } from "./filterScope";
|
|
11
|
-
export { createFilter, createFilterScope, fromVegaInteraction, filterScopeOf, ANY_VALUE, isAnyValue, type Filter, type FilterOptions, type FilterScope, type FilterChangeReason } from "./filterScope";
|
|
11
|
+
export { createFilter, createFilterScope, fromVegaInteraction, filterScopeOf, ANY_VALUE, isAnyValue, type Filter, type FilterOptions, type FilterScope, type FilterChangeReason, type ScopedFilter, type ScopeSource } from "./filterScope";
|
|
12
12
|
export interface BicChartProps {
|
|
13
13
|
/** Generated render() source (an ES module's `code` export, or the raw string). */
|
|
14
14
|
code?: string;
|
|
@@ -111,8 +111,11 @@ export interface BicChartProps {
|
|
|
111
111
|
* chip shows), and its titles and comparisons say so ("North America · United States only", "rank 2 of 3 (United
|
|
112
112
|
* States only)"). Cleared again when the filters clear. Not for the filter this chart `selects` unless its own rows
|
|
113
113
|
* are narrowed by it too. Absent: the page's own options.filterScope, if any, goes through untouched.
|
|
114
|
+
* A query that maps only some of a compound key's columns names them, `{ filter, takes }`: with
|
|
115
|
+
* `treatAs(cell, "Accounts[Region]")` on a Region x Stage pick, `scopedBy={{ filter: cell, takes: ["Region"] }}` says
|
|
116
|
+
* the region alone, and a stage-label pick (any region) says nothing, since that query keeps every row.
|
|
114
117
|
*/
|
|
115
|
-
scopedBy?:
|
|
118
|
+
scopedBy?: ScopeSource | readonly ScopeSource[];
|
|
116
119
|
/**
|
|
117
120
|
* THE CHART'S OWN CONTROLS AS PAGE STATE - from useBicControls(). For a chart that draws
|
|
118
121
|
* sliders (the What-if projection's rate and horizon): `controls.values` holds every
|
|
@@ -183,6 +186,11 @@ export declare function BicPage({ children }: {
|
|
|
183
186
|
* ["OriginCode", "DestinationCode"]). Pass it to a chart's `selects` and read
|
|
184
187
|
* `value` / `values` / `row` / `active` for the rest of the page; `clear()` clears it and the
|
|
185
188
|
* chart's marks. Re-renders the component on every change. The key columns are read once.
|
|
189
|
+
*
|
|
190
|
+
* SEVERAL PANELS PICKING ONE KEY ARE ONE PICK: give their filters one `group` ("country") and the most recent pick is
|
|
191
|
+
* the page's one pick - a pick in one clears the others, the picked mark shows in every member's chart and a click on it
|
|
192
|
+
* in any of them clears it, and only the member holding it is active (one chip, one scope line). Each panel's query
|
|
193
|
+
* still takes every member but its own, so the panel a reader picked in keeps all its marks.
|
|
186
194
|
*/
|
|
187
195
|
export declare function useBicFilter(columns: string | readonly string[], opts?: FilterOptions): Filter;
|
|
188
196
|
/**
|
|
@@ -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 {};
|
package/dist/zoom-memory.mjs
CHANGED
|
@@ -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-
|
|
4
|
+
} from "./chunk-K2TH7D5V.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.
|
|
3
|
+
"version": "0.6.116",
|
|
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",
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
"import": "./dist/zoom-memory.mjs",
|
|
75
75
|
"default": "./dist/zoom-memory.mjs"
|
|
76
76
|
},
|
|
77
|
+
"./category-colours": {
|
|
78
|
+
"types": "./dist/types/categoryColours.d.ts",
|
|
79
|
+
"import": "./dist/category-colours.mjs",
|
|
80
|
+
"default": "./dist/category-colours.mjs"
|
|
81
|
+
},
|
|
77
82
|
"./dax": {
|
|
78
83
|
"types": "./dist/types/dax.d.ts",
|
|
79
84
|
"import": "./dist/dax.mjs",
|
|
File without changes
|