@bicharts/chart-host 0.6.48 → 0.6.50

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.
@@ -493,6 +493,7 @@ var COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
493
493
  var FLIP_MODE_DEFAULT = "both";
494
494
  var FLIP_INTERVAL_MIN_MS = 500;
495
495
  var FLIP_INTERVAL_MAX_MS = 12e4;
496
+ var FLIP_DIRECTION_DEFAULT = "horizontal";
496
497
  var APPROXIMATE_POSITIONS_DEFAULT = "mark";
497
498
  var VALUE_AXIS_BASELINE_DEFAULT = "fit";
498
499
  var SEASONAL_MARKERS_DEFAULT = "auto";
@@ -938,6 +939,13 @@ function resolveOptions(p4) {
938
939
  if (p4.flipSync === true) return "all";
939
940
  return FLIP_MODE_DEFAULT;
940
941
  })(),
942
+ // WHICH WAY A FACE TURNS. Anything unrecognised - including absent, which is every host
943
+ // that predates the option - is the default, side to side, which is what every chart that
944
+ // turns did before it existed.
945
+ flipDirection: (() => {
946
+ const d2 = (p4.flipDirection == null ? "" : String(p4.flipDirection)).toLowerCase();
947
+ return d2 === "horizontal" || d2 === "vertical" ? d2 : FLIP_DIRECTION_DEFAULT;
948
+ })(),
941
949
  // 0 is MEANINGFUL here (manual only), so numberOr — not `|| DEFAULT` — for the same
942
950
  // reason animLoopDelaySec uses it. UNSET STAYS UNSET (undefined), because the default is
943
951
  // the CHART's, not this function's: the card deck reads `+(x || 0)` and is manual, a
@@ -4365,6 +4373,7 @@ function createChartGroup(columns, rows, opts = {}) {
4365
4373
  let table = rows;
4366
4374
  let geo = opts.geo ?? null;
4367
4375
  let point = opts.point ?? null;
4376
+ let destination = opts.destination ?? null;
4368
4377
  let selection = EMPTY6;
4369
4378
  const subs = /* @__PURE__ */ new Set();
4370
4379
  const members = /* @__PURE__ */ new Set();
@@ -4380,7 +4389,13 @@ function createChartGroup(columns, rows, opts = {}) {
4380
4389
  const payloadFor = (sourceRowIdxs) => {
4381
4390
  const idxs = sourceRowIdxs ? sourceRowIdxs.slice() : table.map((_4, i) => i);
4382
4391
  const subset = idxs.map((i) => table[i]);
4383
- const payload = buildRenderPayload(cols, subset, geo ?? void 0, point ?? void 0);
4392
+ const payload = buildRenderPayload(
4393
+ cols,
4394
+ subset,
4395
+ geo ?? void 0,
4396
+ point ?? void 0,
4397
+ destination ?? void 0
4398
+ );
4384
4399
  return { payload, rowMap: idxs };
4385
4400
  };
4386
4401
  const memberPayload = (id, o4 = {}) => payloadFor(o4.respondsWith === "highlight" ? null : incomingFor(id, o4.filteredBy));
@@ -4410,6 +4425,7 @@ function createChartGroup(columns, rows, opts = {}) {
4410
4425
  table = nextRows;
4411
4426
  geo = o4.geo ?? null;
4412
4427
  point = o4.point ?? null;
4428
+ destination = o4.destination ?? null;
4413
4429
  notify("source");
4414
4430
  },
4415
4431
  onChange(cb) {
@@ -4502,6 +4518,7 @@ export {
4502
4518
  FLIP_MODE_DEFAULT,
4503
4519
  FLIP_INTERVAL_MIN_MS,
4504
4520
  FLIP_INTERVAL_MAX_MS,
4521
+ FLIP_DIRECTION_DEFAULT,
4505
4522
  APPROXIMATE_POSITIONS_DEFAULT,
4506
4523
  VALUE_AXIS_BASELINE_DEFAULT,
4507
4524
  SEASONAL_MARKERS_DEFAULT,
package/dist/index.mjs CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  DIM_OPACITY_DEFAULT,
34
34
  DIM_OPACITY_VAR,
35
35
  FIT_CONTENT_SELECTOR,
36
+ FLIP_DIRECTION_DEFAULT,
36
37
  FLIP_INTERVAL_MAX_MS,
37
38
  FLIP_INTERVAL_MIN_MS,
38
39
  FLIP_MODE_DEFAULT,
@@ -162,7 +163,7 @@ import {
162
163
  unpinScrolledAxis,
163
164
  valuePlacementFlag,
164
165
  withoutViewOnlyKeys
165
- } from "./chunk-YD3QWCEP.mjs";
166
+ } from "./chunk-P4FOCNAX.mjs";
166
167
  import "./chunk-A2GMXZP7.mjs";
167
168
  import "./chunk-GHODWOAL.mjs";
168
169
 
@@ -203,6 +204,8 @@ var OPTIONS_VOCABULARY = Object.freeze({
203
204
  * clamped chart-side to FLIP_INTERVAL_MIN_MS..FLIP_INTERVAL_MAX_MS.
204
205
  */
205
206
  flipIntervalMs: entry({ timing: "live", default: "", min: 0, max: FLIP_INTERVAL_MAX_MS }),
207
+ /** Which way a face turns, for any chart that turns between faces: side to side, or top to bottom. */
208
+ flipDirection: entry({ timing: "live", default: FLIP_DIRECTION_DEFAULT, values: ["horizontal", "vertical"] }),
206
209
  // ---- the next generated chart ----
207
210
  levelOfDetail: entry({ timing: "next-generate", default: "", values: ["", "High", "Medium", "Low"], wire: "clientHints" }),
208
211
  favorLimitTo: entry({ timing: "next-generate", default: "", values: ["", "latest", "top / greatest", "bottom / smallest", "most common", "outliers"], wire: "clientHints" }),
@@ -2818,6 +2821,7 @@ export {
2818
2821
  FILTER_MIN_WIDTH_PX,
2819
2822
  FILTER_ROW_PX,
2820
2823
  FIT_CONTENT_SELECTOR,
2824
+ FLIP_DIRECTION_DEFAULT,
2821
2825
  FLIP_INTERVAL_MAX_MS,
2822
2826
  FLIP_INTERVAL_MIN_MS,
2823
2827
  FLIP_MODE_DEFAULT,
package/dist/react.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadGeo,
8
8
  syncMemberSelection,
9
9
  toSourceRows
10
- } from "./chunk-YD3QWCEP.mjs";
10
+ } from "./chunk-P4FOCNAX.mjs";
11
11
  import "./chunk-A2GMXZP7.mjs";
12
12
  import "./chunk-GHODWOAL.mjs";
13
13
 
@@ -23,15 +23,15 @@ function useBicSelection() {
23
23
  clear: () => g?.group.clear()
24
24
  };
25
25
  }
26
- function BicChartGroup({ rows, columns, geo, point, children }) {
26
+ function BicChartGroup({ rows, columns, geo, point, destination, children }) {
27
27
  const groupRef = useRef(null);
28
- if (!groupRef.current) groupRef.current = createChartGroup(columns, rows, { geo, point });
28
+ if (!groupRef.current) groupRef.current = createChartGroup(columns, rows, { geo, point, destination });
29
29
  const group = groupRef.current;
30
30
  const [sel, setSel] = useState(group.selection);
31
31
  const source = useMemo(() => {
32
- group.setSource(columns, rows, { geo, point });
32
+ group.setSource(columns, rows, { geo, point, destination });
33
33
  return {};
34
- }, [group, rows, columns, geo, point]);
34
+ }, [group, rows, columns, geo, point, destination]);
35
35
  useEffect(() => group.onChange((s, change) => {
36
36
  if (change !== "source") setSel(s);
37
37
  }), [group]);
@@ -75,6 +75,8 @@ export type FlipMode = "" | "single" | "all" | "both";
75
75
  export declare const FLIP_MODE_DEFAULT: FlipMode;
76
76
  export declare const FLIP_INTERVAL_MIN_MS = 500;
77
77
  export declare const FLIP_INTERVAL_MAX_MS = 120000;
78
+ export type FlipDirection = "horizontal" | "vertical";
79
+ export declare const FLIP_DIRECTION_DEFAULT: FlipDirection;
78
80
  export type ApproximatePositions = "mark" | "aggregate" | "skip";
79
81
  export declare const APPROXIMATE_POSITIONS_DEFAULT: ApproximatePositions;
80
82
  export type ValueAxisBaseline = "zero" | "fit" | "auto";
@@ -148,6 +150,7 @@ export interface RenderOptions {
148
150
  flipSync?: boolean;
149
151
  flipIntervalMs?: number;
150
152
  flipMode?: FlipMode;
153
+ flipDirection?: FlipDirection;
151
154
  cardBackgroundColor?: string;
152
155
  onSelect?: (rowIdxs: number[]) => void;
153
156
  /**
@@ -14,6 +14,12 @@ export interface ChartGroupSourceOptions {
14
14
  } | null;
15
15
  /** Point-map geocoding binding (city/state/zip/lat/lon column names). */
16
16
  point?: GeoPointBinding | null;
17
+ /**
18
+ * A route's far end (an origin-destination flow map): `point` is then the origin. The same
19
+ * binding buildRenderPayload takes, so the group builds the destination columns too instead of
20
+ * leaving a hosted flow map with one end.
21
+ */
22
+ destination?: GeoPointBinding | null;
17
23
  }
18
24
  /** How one member takes part in the group. */
19
25
  export interface ChartGroupMemberOptions {
@@ -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, SNAPSHOT_SVG_ATTR, 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, FLIP_INTERVAL_MIN_MS, FLIP_INTERVAL_MAX_MS, 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";
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, SNAPSHOT_SVG_ATTR, 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, 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, } from "./contract";
2
2
  export { resolveOptions, type ResolveOptionsInput } from "./defaults";
3
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";
4
4
  export { loadGeo, geoFromCache, registerGeo, registerGeoAsset, geoAssetFor, clearGeoCache, type GeoAssetName, } from "./geoLazy";
@@ -58,6 +58,8 @@ export declare const OPTIONS_VOCABULARY: Readonly<{
58
58
  * clamped chart-side to FLIP_INTERVAL_MIN_MS..FLIP_INTERVAL_MAX_MS.
59
59
  */
60
60
  flipIntervalMs: OptionVocabularyEntry;
61
+ /** Which way a face turns, for any chart that turns between faces: side to side, or top to bottom. */
62
+ flipDirection: OptionVocabularyEntry;
61
63
  levelOfDetail: OptionVocabularyEntry;
62
64
  favorLimitTo: OptionVocabularyEntry;
63
65
  /** 0 asks for no limit, and travels as absent (`wireLimitCount`): any value the server receives is a limit. */
@@ -81,6 +81,8 @@ export interface BicChartGroupProps {
81
81
  } | null;
82
82
  /** Point-map geocoding binding (city/state/zip/lat/lon column names). */
83
83
  point?: GeoPointBinding | null;
84
+ /** A route's far end (an origin-destination flow map); `point` is then the origin. */
85
+ destination?: GeoPointBinding | null;
84
86
  children: ReactNode;
85
87
  }
86
88
  /**
@@ -88,7 +90,7 @@ export interface BicChartGroupProps {
88
90
  * `filteredBy`; the group re-derives the filtered member's payload and translates row
89
91
  * indices in both directions, so a click in one chart filters another CORRECTLY.
90
92
  */
91
- export declare function BicChartGroup({ rows, columns, geo, point, children }: BicChartGroupProps): import("react").JSX.Element;
93
+ export declare function BicChartGroup({ rows, columns, geo, point, destination, children }: BicChartGroupProps): import("react").JSX.Element;
92
94
  export declare function BicChart(props: BicChartProps): import("react").JSX.Element;
93
95
  /**
94
96
  * THE SIZE A CHART SHOULD DRAW AT: the element's measured box, kept current as it resizes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.48",
3
+ "version": "0.6.50",
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",