@bicharts/chart-host 0.5.18 → 0.5.20

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # @bicharts/chart-host
2
2
 
3
+ > **Make Generative AI for Charts *Better*.**
4
+
5
+ That is what **RegiaBI** is for; this package is the part that runs the result in your page,
6
+ so a generated chart behaves the same wherever it lands.
7
+
3
8
  Run a D3 chart generated by
4
9
  [Business Intelligence Champions](https://bizintelligencechampions.com) (BIC) in any web page.
5
10
 
@@ -24,6 +24,8 @@ var DIM_OPACITY_DEFAULT = 0.25;
24
24
  var ANIM_PLAY_SPEED_DEFAULT = 1e3;
25
25
  var ANIM_PLAY_SPEED_MIN = 250;
26
26
  var ANIM_PLAY_SPEED_MAX = 5e3;
27
+ var ANIM_LOOP_DELAY_DEFAULT = 3;
28
+ var ANIM_LOOP_DELAY_MIN = 0;
27
29
  var ANIM_MAX_IDEAL_FRAMES_DEFAULT = 60;
28
30
  var ANIM_MAX_IDEAL_FRAMES_MIN = 3;
29
31
  var ANIM_MAX_IDEAL_FRAMES_MAX = 500;
@@ -33,6 +35,10 @@ var COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
33
35
 
34
36
  // src/defaults.ts
35
37
  var clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
38
+ var numberOr = (raw, dflt) => {
39
+ const n = raw == null || raw === "" ? NaN : Number(raw);
40
+ return Number.isFinite(n) ? n : dflt;
41
+ };
36
42
  function resolveOptions(p2) {
37
43
  return {
38
44
  // ---- host fields: pass through exactly as supplied ----
@@ -71,11 +77,36 @@ function resolveOptions(p2) {
71
77
  animAutoPlay: !!p2.animAutoPlay,
72
78
  // Math.max(250, Math.min(5000, Number(raw) || 1000))
73
79
  animPlaySpeedMs: clamp(Number(p2.animPlaySpeedMs) || ANIM_PLAY_SPEED_DEFAULT, ANIM_PLAY_SPEED_MIN, ANIM_PLAY_SPEED_MAX),
80
+ // Loop-restart delay (seconds on the overview between auto-play passes).
81
+ // Floored at 0, deliberately NO upper clamp (huge = play once per viewing),
82
+ // and 0 must survive as 0 — hence numberOr, not `|| DEFAULT`. This field was
83
+ // MISSING from the resolve list when the assembly moved here, so callers
84
+ // that passed it saw it dropped: the scrubber read undefined -> 0 -> every
85
+ // pass restarted instantly and resumed-state auto-play lost its pacing.
86
+ animLoopDelaySec: Math.max(ANIM_LOOP_DELAY_MIN, numberOr(p2.animLoopDelaySec, ANIM_LOOP_DELAY_DEFAULT)),
74
87
  // Math.max(3, Math.min(500, Number(raw) || 60))
75
88
  animMaxIdealFrames: clamp(Number(p2.animMaxIdealFrames) || ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX),
76
89
  animStopAtEnd: !!p2.animStopAtEnd,
77
90
  filtersDuringPlay: !!p2.filtersDuringPlay,
78
- animTimelineStyle: (p2.animTimelineStyle || "").toString()
91
+ animTimelineStyle: (p2.animTimelineStyle || "").toString(),
92
+ // ---- card deck ----
93
+ // SECOND OCCURRENCE OF THE animLoopDelaySec BUG, six lines above (2026-08-13). The
94
+ // visual passed both of these, the generated code read both correctly, and this
95
+ // function — a whitelist that returns a NEW object — dropped them in between. Symptoms
96
+ // were exactly what the two defaults produce: flipSync undefined -> `!== false` -> true
97
+ // -> always synced, so "Flip Cards Together = Off" did nothing and the deck kept its
98
+ // shared strip; flipIntervalMs undefined -> `+(undefined || 0)` -> 0 -> the timer branch
99
+ // never ran, so a 1000 ms interval produced no flips. Two dead knobs, one omission.
100
+ //
101
+ // flipSync DEFAULTS TRUE, so it cannot use `!!p.flipSync` — that would read a missing
102
+ // value as "independent" and hand every deck twelve control strips. Absent means
103
+ // synced; only an explicit false switches it.
104
+ flipSync: p2.flipSync === void 0 || p2.flipSync === null ? true : !!p2.flipSync,
105
+ // 0 is MEANINGFUL here (manual only) and is the default, so numberOr — not
106
+ // `|| DEFAULT` — for the same reason animLoopDelaySec uses it. Clamping stays
107
+ // chart-side: the archetype already clamps 500..120000 and two clamps in two
108
+ // repositories is how they end up disagreeing.
109
+ flipIntervalMs: Math.max(0, numberOr(p2.flipIntervalMs, 0))
79
110
  };
80
111
  }
81
112
 
@@ -1209,6 +1240,8 @@ export {
1209
1240
  ANIM_PLAY_SPEED_DEFAULT,
1210
1241
  ANIM_PLAY_SPEED_MIN,
1211
1242
  ANIM_PLAY_SPEED_MAX,
1243
+ ANIM_LOOP_DELAY_DEFAULT,
1244
+ ANIM_LOOP_DELAY_MIN,
1212
1245
  ANIM_MAX_IDEAL_FRAMES_DEFAULT,
1213
1246
  ANIM_MAX_IDEAL_FRAMES_MIN,
1214
1247
  ANIM_MAX_IDEAL_FRAMES_MAX,
package/dist/index.mjs CHANGED
@@ -1,5 +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
+ ANIM_LOOP_DELAY_DEFAULT,
4
+ ANIM_LOOP_DELAY_MIN,
3
5
  ANIM_MAX_IDEAL_FRAMES_DEFAULT,
4
6
  ANIM_MAX_IDEAL_FRAMES_MAX,
5
7
  ANIM_MAX_IDEAL_FRAMES_MIN,
@@ -39,7 +41,7 @@ import {
39
41
  requiredD3Plugins,
40
42
  resolveOptions,
41
43
  stripEsmExports
42
- } from "./chunk-S4W2GTPM.mjs";
44
+ } from "./chunk-TBRWWGJW.mjs";
43
45
  import "./chunk-A2GMXZP7.mjs";
44
46
 
45
47
  // src/trivial.ts
@@ -319,6 +321,8 @@ function registerCityTable(packed) {
319
321
  L3(packed);
320
322
  }
321
323
  export {
324
+ ANIM_LOOP_DELAY_DEFAULT,
325
+ ANIM_LOOP_DELAY_MIN,
322
326
  ANIM_MAX_IDEAL_FRAMES_DEFAULT,
323
327
  ANIM_MAX_IDEAL_FRAMES_MAX,
324
328
  ANIM_MAX_IDEAL_FRAMES_MIN,
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createChartHost,
5
5
  geoFromCache,
6
6
  loadGeo
7
- } from "./chunk-S4W2GTPM.mjs";
7
+ } from "./chunk-TBRWWGJW.mjs";
8
8
  import "./chunk-A2GMXZP7.mjs";
9
9
 
10
10
  // src/react.tsx
@@ -23,6 +23,8 @@ export declare const DIM_OPACITY_DEFAULT = 0.25;
23
23
  export declare const ANIM_PLAY_SPEED_DEFAULT = 1000;
24
24
  export declare const ANIM_PLAY_SPEED_MIN = 250;
25
25
  export declare const ANIM_PLAY_SPEED_MAX = 5000;
26
+ export declare const ANIM_LOOP_DELAY_DEFAULT = 3;
27
+ export declare const ANIM_LOOP_DELAY_MIN = 0;
26
28
  export declare const ANIM_MAX_IDEAL_FRAMES_DEFAULT = 60;
27
29
  export declare const ANIM_MAX_IDEAL_FRAMES_MIN = 3;
28
30
  export declare const ANIM_MAX_IDEAL_FRAMES_MAX = 500;
@@ -70,9 +72,12 @@ export interface RenderOptions {
70
72
  noDataText?: string;
71
73
  animAutoPlay?: boolean;
72
74
  animPlaySpeedMs?: number;
75
+ animLoopDelaySec?: number;
73
76
  animMaxIdealFrames?: number;
74
77
  animStopAtEnd?: boolean;
75
78
  filtersDuringPlay?: boolean;
76
79
  animTimelineStyle?: TimelineStyle;
80
+ flipSync?: boolean;
81
+ flipIntervalMs?: number;
77
82
  onSelect?: (rowIdxs: number[]) => void;
78
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.18",
3
+ "version": "0.5.20",
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",