@bicharts/chart-host 0.5.56 → 0.5.58

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.
@@ -42,6 +42,8 @@ var COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT = 95;
42
42
  var COLOR_SCALE_SELF_CLAMP_PCT_MIN = 50;
43
43
  var COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
44
44
  var FLIP_MODE_DEFAULT = "both";
45
+ var APPROXIMATE_POSITIONS_DEFAULT = "mark";
46
+ var VALUE_AXIS_BASELINE_DEFAULT = "fit";
45
47
 
46
48
  // src/defaults.ts
47
49
  var clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
@@ -58,7 +60,24 @@ function resolveOptions(p2) {
58
60
  geoUnmatched: p2.geoUnmatched,
59
61
  geo: p2.geo,
60
62
  geoPoint: p2.geoPoint,
63
+ // THIRD AND FOURTH OCCURRENCES OF THE animLoopDelaySec OMISSION, found together by
64
+ // reading the contract against this list rather than by a bug report. geoPointDest is
65
+ // declared on RenderOptions, passed by the visual and read by the route archetypes, and
66
+ // was missing here - so a chart that claims "an arc is only as honest as its worse
67
+ // endpoint" never saw the destination end at all. The guard test at the bottom of
68
+ // tests/defaults.test.ts now compares the two lists, because four instances of one
69
+ // omission is a missing check, not four mistakes.
70
+ geoPointDest: p2.geoPointDest,
61
71
  maxMapPoints: p2.maxMapPoints,
72
+ // FIFTH AND SIXTH OCCURRENCES, and the two that argue hardest for the guard test: both
73
+ // were passed by the visual AND read by the charts, and neither was ever declared here or
74
+ // in the contract - so the contract-vs-whitelist check could not see them either. What
75
+ // found them was scanning the OTHER direction, from the caller and the charts inward.
76
+ // 0 is MEANINGFUL for both ("let the chart choose", "no paging"), so numberOr rather than
77
+ // `|| DEFAULT`, which would turn an explicit 0 into something else. Clamping stays
78
+ // chart-side for the same reason it does for flipIntervalMs.
79
+ geoPointRadiusPx: Math.max(0, numberOr(p2.geoPointRadiusPx, 0)),
80
+ pageSize: Math.max(0, numberOr(p2.pageSize, 0)),
62
81
  uiState: p2.uiState,
63
82
  setUiState: p2.setUiState,
64
83
  backgroundColor: p2.backgroundColor,
@@ -83,6 +102,17 @@ function resolveOptions(p2) {
83
102
  geoLandColor: p2.geoLandColor || void 0,
84
103
  geoNoDataColor: p2.geoNoDataColor || void 0,
85
104
  aggregation: (p2.aggregation == null ? "" : String(p2.aggregation)) || void 0,
105
+ // A recognised value wins, anything else falls to the default: an unknown string must
106
+ // never reach a chart as a live mode. Both of these are read on EVERY render, so a
107
+ // reader can change their mind about a cached chart without regenerating it.
108
+ approximatePositions: (() => {
109
+ const v3 = (p2.approximatePositions == null ? "" : String(p2.approximatePositions)).toLowerCase();
110
+ return v3 === "mark" || v3 === "aggregate" || v3 === "skip" ? v3 : APPROXIMATE_POSITIONS_DEFAULT;
111
+ })(),
112
+ valueAxisBaseline: (() => {
113
+ const v3 = (p2.valueAxisBaseline == null ? "" : String(p2.valueAxisBaseline)).toLowerCase();
114
+ return v3 === "zero" || v3 === "fit" || v3 === "auto" ? v3 : VALUE_AXIS_BASELINE_DEFAULT;
115
+ })(),
86
116
  // ---- animation: booleans, default+clamp numerics, "" default enum ----
87
117
  animAutoPlay: !!p2.animAutoPlay,
88
118
  // Math.max(250, Math.min(5000, Number(raw) || 1000))
@@ -1605,6 +1635,8 @@ export {
1605
1635
  COLOR_SCALE_SELF_CLAMP_PCT_MIN,
1606
1636
  COLOR_SCALE_SELF_CLAMP_PCT_MAX,
1607
1637
  FLIP_MODE_DEFAULT,
1638
+ APPROXIMATE_POSITIONS_DEFAULT,
1639
+ VALUE_AXIS_BASELINE_DEFAULT,
1608
1640
  resolveOptions,
1609
1641
  geoAssetFor,
1610
1642
  loadGeo,
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  ANIM_PLAY_SPEED_DEFAULT,
10
10
  ANIM_PLAY_SPEED_MAX,
11
11
  ANIM_PLAY_SPEED_MIN,
12
+ APPROXIMATE_POSITIONS_DEFAULT,
12
13
  AXIS_FILTER_CLASS,
13
14
  COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT,
14
15
  COLOR_SCALE_SELF_CLAMP_PCT_MAX,
@@ -32,6 +33,7 @@ import {
32
33
  MARK_SELECTED_CLASS,
33
34
  ROW_IDX_ATTR,
34
35
  SELECTION_ACTIVE_CLASS,
36
+ VALUE_AXIS_BASELINE_DEFAULT,
35
37
  XFILTER_REFRESH_EVENT,
36
38
  blankRenderFlag,
37
39
  buildRenderPayload,
@@ -57,7 +59,7 @@ import {
57
59
  sessionViewStateProvider,
58
60
  stripEsmExports,
59
61
  te
60
- } from "./chunk-COSG4M73.mjs";
62
+ } from "./chunk-UUH6S5Q5.mjs";
61
63
  import "./chunk-A2GMXZP7.mjs";
62
64
 
63
65
  // src/trivial.ts
@@ -875,6 +877,7 @@ export {
875
877
  ANIM_PLAY_SPEED_DEFAULT,
876
878
  ANIM_PLAY_SPEED_MAX,
877
879
  ANIM_PLAY_SPEED_MIN,
880
+ APPROXIMATE_POSITIONS_DEFAULT,
878
881
  AXIS_FILTER_CLASS,
879
882
  CHOOSER_MIN_HEIGHT_PX,
880
883
  CHOOSER_MIN_WIDTH_PX,
@@ -897,6 +900,7 @@ export {
897
900
  MARK_SELECTED_CLASS,
898
901
  ROW_IDX_ATTR,
899
902
  SELECTION_ACTIVE_CLASS,
903
+ VALUE_AXIS_BASELINE_DEFAULT,
900
904
  XFILTER_REFRESH_EVENT,
901
905
  actionFor,
902
906
  askApplyImprovements,
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createChartHost,
5
5
  geoFromCache,
6
6
  loadGeo
7
- } from "./chunk-COSG4M73.mjs";
7
+ } from "./chunk-UUH6S5Q5.mjs";
8
8
  import "./chunk-A2GMXZP7.mjs";
9
9
 
10
10
  // src/react.tsx
@@ -65,6 +65,10 @@ export declare const COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
65
65
  export type TimelineStyle = "" | "line" | "boxes";
66
66
  export type FlipMode = "" | "single" | "all" | "both";
67
67
  export declare const FLIP_MODE_DEFAULT: FlipMode;
68
+ export type ApproximatePositions = "mark" | "aggregate" | "skip";
69
+ export declare const APPROXIMATE_POSITIONS_DEFAULT: ApproximatePositions;
70
+ export type ValueAxisBaseline = "zero" | "fit" | "auto";
71
+ export declare const VALUE_AXIS_BASELINE_DEFAULT: ValueAxisBaseline;
68
72
  export type ColorScaleScope = "" | "frame" | "self";
69
73
  export interface RenderOptions {
70
74
  width: number;
@@ -96,6 +100,10 @@ export interface RenderOptions {
96
100
  rolesRefused?: string[];
97
101
  } | null;
98
102
  maxMapPoints?: number;
103
+ geoPointRadiusPx?: number;
104
+ pageSize?: number;
105
+ approximatePositions?: ApproximatePositions;
106
+ valueAxisBaseline?: ValueAxisBaseline;
99
107
  colorScaleLow?: string;
100
108
  colorScaleHigh?: string;
101
109
  colorScaleScope?: ColorScaleScope;
@@ -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, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, 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, COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX, FLIP_MODE_DEFAULT, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type ColorScaleScope, type RenderOptions, type ViewStateProvider, } from "./contract";
1
+ export { HOST_CONTRACT_VERSION, GEO_POINT_PRECISIONS, MARK_CLASS, LEGEND_MARK_CLASS, AXIS_FILTER_CLASS, ROW_IDX_ATTR, LIFT_SELECTED_CLASS, XFILTER_REFRESH_EVENT, CONTAINER_SLOT_ANIM_STOP, CONTAINER_SLOT_XF_CLEAR, CONTAINER_SLOT_INITIAL_XF_MARK, CONTAINER_SLOT_UI_STATE, 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, 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, type GeoPointPrecision, type GeoMapKind, type TimelineStyle, type FlipMode, type ApproximatePositions, type ValueAxisBaseline, type ColorScaleScope, type RenderOptions, type ViewStateProvider, } from "./contract";
2
2
  export { resolveOptions, type ResolveOptionsInput } from "./defaults";
3
3
  export { loadGeo, geoFromCache, registerGeo, registerGeoAsset, geoAssetFor, clearGeoCache, type GeoAssetName, } from "./geoLazy";
4
4
  /** REPLACE the bundled city gazetteer with another packed table. Rarely needed — see the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.56",
3
+ "version": "0.5.58",
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",