@bicharts/chart-host 0.6.30 → 0.6.31
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/index.mjs +60 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/optionsVocabulary.d.ts +77 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -144,6 +144,60 @@ import {
|
|
|
144
144
|
import "./chunk-A2GMXZP7.mjs";
|
|
145
145
|
import "./chunk-GHODWOAL.mjs";
|
|
146
146
|
|
|
147
|
+
// src/optionsVocabulary.ts
|
|
148
|
+
var MAX_MAP_POINTS_MIN = 10;
|
|
149
|
+
var MAX_MAP_POINTS_MAX = 1e5;
|
|
150
|
+
var LIMIT_COUNT_MAX = 1e4;
|
|
151
|
+
var entry = (e2) => Object.freeze({ ...e2, ...e2.values ? { values: Object.freeze([...e2.values]) } : {} });
|
|
152
|
+
var OPTIONS_VOCABULARY = Object.freeze({
|
|
153
|
+
// ---- drawn from on every render, and stated on the request so the model reasons about them ----
|
|
154
|
+
aggregation: entry({ timing: "live-and-next-generate", default: "", values: ["", "sum", "average", "median", "min", "max", "count", "distinct"], wire: "request" }),
|
|
155
|
+
colorScaleLow: entry({ timing: "live-and-next-generate", default: "", wire: "request" }),
|
|
156
|
+
colorScaleHigh: entry({ timing: "live-and-next-generate", default: "", wire: "request" }),
|
|
157
|
+
/** Blank: the host's own colours when it offers them, else the engine's. */
|
|
158
|
+
palette: entry({ timing: "live-and-next-generate", default: "", wire: "request" }),
|
|
159
|
+
/** A HARD offer gate on the server as well as a live cap on what a point map plots. */
|
|
160
|
+
maxMapPoints: entry({ timing: "live-and-next-generate", default: MAX_MAP_POINTS_DEFAULT, min: MAX_MAP_POINTS_MIN, max: MAX_MAP_POINTS_MAX, wire: "clientHints" }),
|
|
161
|
+
// ---- live only ----
|
|
162
|
+
/** 0 means no paging. */
|
|
163
|
+
pageSize: entry({ timing: "live", default: 0, min: 0 }),
|
|
164
|
+
valueAxisBaseline: entry({ timing: "live", default: VALUE_AXIS_BASELINE_DEFAULT, values: ["fit", "zero", "auto"] }),
|
|
165
|
+
seasonalMarkers: entry({ timing: "live", default: SEASONAL_MARKERS_DEFAULT, values: ["auto", "always", "never"] }),
|
|
166
|
+
animAutoPlay: entry({ timing: "live", default: false }),
|
|
167
|
+
animPlaySpeedMs: entry({ timing: "live", default: ANIM_PLAY_SPEED_DEFAULT, min: ANIM_PLAY_SPEED_MIN, max: ANIM_PLAY_SPEED_MAX }),
|
|
168
|
+
/** 0 restarts at once; no upper bound, so a very large value plays once per viewing. */
|
|
169
|
+
animLoopDelaySec: entry({ timing: "live", default: ANIM_LOOP_DELAY_DEFAULT, min: ANIM_LOOP_DELAY_MIN }),
|
|
170
|
+
animStopAtEnd: entry({ timing: "live", default: false }),
|
|
171
|
+
animMaxIdealFrames: entry({ timing: "live", default: ANIM_MAX_IDEAL_FRAMES_DEFAULT, min: ANIM_MAX_IDEAL_FRAMES_MIN, max: ANIM_MAX_IDEAL_FRAMES_MAX }),
|
|
172
|
+
/** "" chooses by the number of periods. */
|
|
173
|
+
animTimelineStyle: entry({ timing: "live", default: "", values: ["", "line", "boxes"] }),
|
|
174
|
+
filtersDuringPlay: entry({ timing: "live", default: false }),
|
|
175
|
+
// ---- the next generated chart ----
|
|
176
|
+
levelOfDetail: entry({ timing: "next-generate", default: "", values: ["", "High", "Medium", "Low"], wire: "clientHints" }),
|
|
177
|
+
favorLimitTo: entry({ timing: "next-generate", default: "", values: ["", "latest", "top / greatest", "bottom / smallest", "most common", "outliers"], wire: "clientHints" }),
|
|
178
|
+
/** 0 asks for no limit, and travels as absent (`wireLimitCount`): any value the server receives is a limit. */
|
|
179
|
+
favorLimitCount: entry({ timing: "next-generate", default: 0, min: 0, max: LIMIT_COUNT_MAX, wire: "clientHints" }),
|
|
180
|
+
/** "1" asks for a title, "0" for none, "" leaves it to the engine. */
|
|
181
|
+
favorTitle: entry({ timing: "next-generate", default: "", values: ["", "1", "0"], wire: "clientHints" }),
|
|
182
|
+
/** Data labels on the marks: "1", "0", or "" for the engine's choice. */
|
|
183
|
+
favorDPValues: entry({ timing: "next-generate", default: "", values: ["", "1", "0"], wire: "clientHints" }),
|
|
184
|
+
legendPlacement: entry({ timing: "next-generate", default: "", values: ["", "outside", "inside", "none"], wire: "clientHints" }),
|
|
185
|
+
/** Free text: the industry the data belongs to. */
|
|
186
|
+
industryContext: entry({ timing: "next-generate", default: "", wire: "clientHints" }),
|
|
187
|
+
/** Free text: a font family for the chart's own text. */
|
|
188
|
+
suggestFontFamily: entry({ timing: "next-generate", default: "", wire: "clientHints" }),
|
|
189
|
+
// ---- after a chart is drawn ----
|
|
190
|
+
visionReview: entry({ timing: "after-render", default: false }),
|
|
191
|
+
saveThumbnails: entry({ timing: "after-render", default: false })
|
|
192
|
+
});
|
|
193
|
+
var LIVE_OPTION_KEYS = Object.freeze(
|
|
194
|
+
Object.keys(OPTIONS_VOCABULARY).filter((k2) => OPTIONS_VOCABULARY[k2].timing === "live" || OPTIONS_VOCABULARY[k2].timing === "live-and-next-generate")
|
|
195
|
+
);
|
|
196
|
+
function wireLimitCount(count) {
|
|
197
|
+
const n2 = typeof count === "number" ? count : count == null || count === "" ? NaN : Number(count);
|
|
198
|
+
return Number.isFinite(n2) && n2 > 0 ? n2 : null;
|
|
199
|
+
}
|
|
200
|
+
|
|
147
201
|
// src/dateCells.ts
|
|
148
202
|
var LOCAL_DATE_METHOD = /\.(?:getFullYear|getMonth|getDate|getDay|getHours|getMinutes|setFullYear|setMonth|setDate|setHours|setMinutes|setSeconds|setMilliseconds)\s*\(/;
|
|
149
203
|
var D3_LOCAL_TIME = /\bd3\s*\.\s*(?:scaleTime|time[A-Z]\w*)\b/;
|
|
@@ -2542,14 +2596,19 @@ export {
|
|
|
2542
2596
|
LEGIBLE_LIGHTNESS,
|
|
2543
2597
|
LIFT_SELECTED_CLASS,
|
|
2544
2598
|
LIGHT_TEXT,
|
|
2599
|
+
LIMIT_COUNT_MAX,
|
|
2600
|
+
LIVE_OPTION_KEYS,
|
|
2545
2601
|
MARK_CLASS,
|
|
2546
2602
|
MARK_SELECTED_CLASS,
|
|
2547
2603
|
MAX_FRAME_GROW_FACTOR,
|
|
2548
2604
|
MAX_MAP_POINTS_DEFAULT,
|
|
2605
|
+
MAX_MAP_POINTS_MAX,
|
|
2606
|
+
MAX_MAP_POINTS_MIN,
|
|
2549
2607
|
MIN_CONTRAST,
|
|
2550
2608
|
MIN_DELTA_E,
|
|
2551
2609
|
MIN_HIT_BAND_PX,
|
|
2552
2610
|
MIN_RAMP_FILLS,
|
|
2611
|
+
OPTIONS_VOCABULARY,
|
|
2553
2612
|
PAGE_MATCH_TOLERANCE,
|
|
2554
2613
|
PENDING_RECOVERY_FAST_PHASE_MS,
|
|
2555
2614
|
PENDING_RECOVERY_FIRST_POLL_MS,
|
|
@@ -2732,5 +2791,6 @@ export {
|
|
|
2732
2791
|
updateRowHighWater,
|
|
2733
2792
|
valuePlacementFlag,
|
|
2734
2793
|
vegaSpecReadsDatesInLocalTime,
|
|
2794
|
+
wireLimitCount,
|
|
2735
2795
|
withoutViewOnlyKeys
|
|
2736
2796
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { HOST_CONTRACT_VERSION, GEO_POINT_PRECISIONS, MARK_CLASS, LEGEND_MARK_CLASS, AXIS_FILTER_CLASS, ROW_IDX_ATTR, LIFT_SELECTED_CLASS, CONTROL_CLASS, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, VIEW_ONLY_UI_STATE_KEYS, withoutViewOnlyKeys, 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, ANIMATION_OPTION_KEYS, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, APPROXIMATE_POSITIONS_DEFAULT, VALUE_AXIS_BASELINE_DEFAULT, SEASONAL_MARKERS_DEFAULT, MAX_MAP_POINTS_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type ApproximatePositions, type ValueAxisBaseline, type SeasonalMarkers, type ColorScaleScope, type RenderOptions, type ViewStateProvider, type ChartControlChange, } from "./contract";
|
|
2
2
|
export { resolveOptions, type ResolveOptionsInput } from "./defaults";
|
|
3
|
+
export { OPTIONS_VOCABULARY, LIVE_OPTION_KEYS, MAX_MAP_POINTS_MIN, MAX_MAP_POINTS_MAX, LIMIT_COUNT_MAX, wireLimitCount, type OptionVocabularyEntry, type OptionTiming, type OptionWire, type OptionKey, } from "./optionsVocabulary";
|
|
3
4
|
export { loadGeo, geoFromCache, registerGeo, registerGeoAsset, geoAssetFor, clearGeoCache, type GeoAssetName, } from "./geoLazy";
|
|
4
5
|
/** REPLACE the bundled city gazetteer with another packed table. Rarely needed — see the
|
|
5
6
|
* note above registerCityTable in shape-core's geoPoint.ts before using it. */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a change to an option takes effect.
|
|
3
|
+
* - `live`: the chart on screen repaints with it; no request, no new chart.
|
|
4
|
+
* - `next-generate`: it steers what the engine makes, so it applies to the next generated chart.
|
|
5
|
+
* - `live-and-next-generate`: both - the chart on screen repaints, and the request carries it too.
|
|
6
|
+
* - `after-render`: it governs what happens after a chart is drawn (a review, a thumbnail).
|
|
7
|
+
*/
|
|
8
|
+
export type OptionTiming = "live" | "next-generate" | "live-and-next-generate" | "after-render";
|
|
9
|
+
/** Where an option travels on a generate request: the request itself, or its client hints. */
|
|
10
|
+
export type OptionWire = "request" | "clientHints";
|
|
11
|
+
/** The shared facts about one option. */
|
|
12
|
+
export interface OptionVocabularyEntry {
|
|
13
|
+
readonly timing: OptionTiming;
|
|
14
|
+
/** What "not set" means. A host that stores blank or 0 for "the default" resolves to this. */
|
|
15
|
+
readonly default: string | number | boolean;
|
|
16
|
+
/** The least value a reader may set, for a number. */
|
|
17
|
+
readonly min?: number;
|
|
18
|
+
/** The greatest value a reader may set, for a number. Absent: no upper bound. */
|
|
19
|
+
readonly max?: number;
|
|
20
|
+
/** The values a choice accepts, "" being "leave it to the engine" where offered. */
|
|
21
|
+
readonly values?: readonly string[];
|
|
22
|
+
/** Where it travels on a generate request; absent when it never travels. */
|
|
23
|
+
readonly wire?: OptionWire;
|
|
24
|
+
}
|
|
25
|
+
/** Max Map Points: the fewest and the most points a reader may allow a point map. */
|
|
26
|
+
export declare const MAX_MAP_POINTS_MIN = 10;
|
|
27
|
+
export declare const MAX_MAP_POINTS_MAX = 100000;
|
|
28
|
+
/** Favor Limit Count: the most groups a reader may ask a chart to keep. 0 asks for no limit. */
|
|
29
|
+
export declare const LIMIT_COUNT_MAX = 10000;
|
|
30
|
+
/** The options the hosts share, keyed by wire / render-option name. */
|
|
31
|
+
export declare const OPTIONS_VOCABULARY: Readonly<{
|
|
32
|
+
aggregation: OptionVocabularyEntry;
|
|
33
|
+
colorScaleLow: OptionVocabularyEntry;
|
|
34
|
+
colorScaleHigh: OptionVocabularyEntry;
|
|
35
|
+
/** Blank: the host's own colours when it offers them, else the engine's. */
|
|
36
|
+
palette: OptionVocabularyEntry;
|
|
37
|
+
/** A HARD offer gate on the server as well as a live cap on what a point map plots. */
|
|
38
|
+
maxMapPoints: OptionVocabularyEntry;
|
|
39
|
+
/** 0 means no paging. */
|
|
40
|
+
pageSize: OptionVocabularyEntry;
|
|
41
|
+
valueAxisBaseline: OptionVocabularyEntry;
|
|
42
|
+
seasonalMarkers: OptionVocabularyEntry;
|
|
43
|
+
animAutoPlay: OptionVocabularyEntry;
|
|
44
|
+
animPlaySpeedMs: OptionVocabularyEntry;
|
|
45
|
+
/** 0 restarts at once; no upper bound, so a very large value plays once per viewing. */
|
|
46
|
+
animLoopDelaySec: OptionVocabularyEntry;
|
|
47
|
+
animStopAtEnd: OptionVocabularyEntry;
|
|
48
|
+
animMaxIdealFrames: OptionVocabularyEntry;
|
|
49
|
+
/** "" chooses by the number of periods. */
|
|
50
|
+
animTimelineStyle: OptionVocabularyEntry;
|
|
51
|
+
filtersDuringPlay: OptionVocabularyEntry;
|
|
52
|
+
levelOfDetail: OptionVocabularyEntry;
|
|
53
|
+
favorLimitTo: OptionVocabularyEntry;
|
|
54
|
+
/** 0 asks for no limit, and travels as absent (`wireLimitCount`): any value the server receives is a limit. */
|
|
55
|
+
favorLimitCount: OptionVocabularyEntry;
|
|
56
|
+
/** "1" asks for a title, "0" for none, "" leaves it to the engine. */
|
|
57
|
+
favorTitle: OptionVocabularyEntry;
|
|
58
|
+
/** Data labels on the marks: "1", "0", or "" for the engine's choice. */
|
|
59
|
+
favorDPValues: OptionVocabularyEntry;
|
|
60
|
+
legendPlacement: OptionVocabularyEntry;
|
|
61
|
+
/** Free text: the industry the data belongs to. */
|
|
62
|
+
industryContext: OptionVocabularyEntry;
|
|
63
|
+
/** Free text: a font family for the chart's own text. */
|
|
64
|
+
suggestFontFamily: OptionVocabularyEntry;
|
|
65
|
+
visionReview: OptionVocabularyEntry;
|
|
66
|
+
saveThumbnails: OptionVocabularyEntry;
|
|
67
|
+
}>;
|
|
68
|
+
/** A shared option's key. */
|
|
69
|
+
export type OptionKey = keyof typeof OPTIONS_VOCABULARY;
|
|
70
|
+
/** The keys whose change repaints the chart on screen, in table order. */
|
|
71
|
+
export declare const LIVE_OPTION_KEYS: readonly OptionKey[];
|
|
72
|
+
/**
|
|
73
|
+
* THE LIMIT COUNT A REQUEST CARRIES: a positive count, or null - never 0. The server reads any value it
|
|
74
|
+
* receives as the reader's own limit (and 0 as a limit of zero), so "no limit" must arrive as no value.
|
|
75
|
+
* A host places null where it always has; one that omits blank fields maps it to absent.
|
|
76
|
+
*/
|
|
77
|
+
export declare function wireLimitCount(count: unknown): number | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.31",
|
|
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",
|