@bicharts/chart-host 0.5.19 → 0.5.21
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 +5 -0
- package/dist/{chunk-P2NWAYI7.mjs → chunk-QIF3TAVP.mjs} +44 -1
- package/dist/index.mjs +3 -1
- package/dist/react.mjs +1 -1
- package/dist/types/contract.d.ts +6 -0
- package/package.json +1 -1
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
|
|
|
@@ -32,6 +32,7 @@ var ANIM_MAX_IDEAL_FRAMES_MAX = 500;
|
|
|
32
32
|
var COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT = 95;
|
|
33
33
|
var COLOR_SCALE_SELF_CLAMP_PCT_MIN = 50;
|
|
34
34
|
var COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
|
|
35
|
+
var FLIP_MODE_DEFAULT = "both";
|
|
35
36
|
|
|
36
37
|
// src/defaults.ts
|
|
37
38
|
var clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
@@ -88,7 +89,48 @@ function resolveOptions(p2) {
|
|
|
88
89
|
animMaxIdealFrames: clamp(Number(p2.animMaxIdealFrames) || ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX),
|
|
89
90
|
animStopAtEnd: !!p2.animStopAtEnd,
|
|
90
91
|
filtersDuringPlay: !!p2.filtersDuringPlay,
|
|
91
|
-
animTimelineStyle: (p2.animTimelineStyle || "").toString()
|
|
92
|
+
animTimelineStyle: (p2.animTimelineStyle || "").toString(),
|
|
93
|
+
// ---- card deck ----
|
|
94
|
+
// SECOND OCCURRENCE OF THE animLoopDelaySec BUG, six lines above (2026-08-13). The
|
|
95
|
+
// visual passed both of these, the generated code read both correctly, and this
|
|
96
|
+
// function — a whitelist that returns a NEW object — dropped them in between. Symptoms
|
|
97
|
+
// were exactly what the two defaults produce: flipSync undefined -> `!== false` -> true
|
|
98
|
+
// -> always synced, so "Flip Cards Together = Off" did nothing and the deck kept its
|
|
99
|
+
// shared strip; flipIntervalMs undefined -> `+(undefined || 0)` -> 0 -> the timer branch
|
|
100
|
+
// never ran, so a 1000 ms interval produced no flips. Two dead knobs, one omission.
|
|
101
|
+
//
|
|
102
|
+
// flipSync DEFAULTS TRUE, so it cannot use `!!p.flipSync` — that would read a missing
|
|
103
|
+
// value as "independent" and hand every deck twelve control strips. Absent means
|
|
104
|
+
// synced; only an explicit false switches it.
|
|
105
|
+
flipSync: p2.flipSync === void 0 || p2.flipSync === null ? true : !!p2.flipSync,
|
|
106
|
+
// WHERE the controls live, which is a different question from whether the cards move
|
|
107
|
+
// together (Joel 2026-08-13: "the ability to flip individual cards shouldn't necessarily
|
|
108
|
+
// stop being able to flip all together too"). Resolution order matters and is the whole
|
|
109
|
+
// back-compat story:
|
|
110
|
+
// 1. an explicit, recognised flipMode wins;
|
|
111
|
+
// 2. otherwise DERIVE from flipSync, so a chart generated before this option existed
|
|
112
|
+
// behaves exactly as it did - true -> "all", false -> "single";
|
|
113
|
+
// 3. and a caller that sends neither gets the default.
|
|
114
|
+
// Deriving rather than defaulting is the point: a cached chart must not change behaviour
|
|
115
|
+
// because a newer client shipped, and "both" would have done exactly that to every deck
|
|
116
|
+
// already in a report.
|
|
117
|
+
flipMode: (() => {
|
|
118
|
+
const m2 = (p2.flipMode == null ? "" : String(p2.flipMode)).toLowerCase();
|
|
119
|
+
if (m2 === "single" || m2 === "all" || m2 === "both") return m2;
|
|
120
|
+
if (p2.flipSync === false) return "single";
|
|
121
|
+
if (p2.flipSync === true) return "all";
|
|
122
|
+
return FLIP_MODE_DEFAULT;
|
|
123
|
+
})(),
|
|
124
|
+
// 0 is MEANINGFUL here (manual only) and is the default, so numberOr — not
|
|
125
|
+
// `|| DEFAULT` — for the same reason animLoopDelaySec uses it. Clamping stays
|
|
126
|
+
// chart-side: the archetype already clamps 500..120000 and two clamps in two
|
|
127
|
+
// repositories is how they end up disagreeing.
|
|
128
|
+
flipIntervalMs: Math.max(0, numberOr(p2.flipIntervalMs, 0)),
|
|
129
|
+
// `raw || undefined`, the same idiom as the colour-scale endpoints and the map fills:
|
|
130
|
+
// blank must arrive as ABSENT, not as an empty string, because the chart's fallback is
|
|
131
|
+
// `options.cardBackgroundColor || <its own choice>` and "" would satisfy a truthiness
|
|
132
|
+
// test in some hands while painting nothing in others.
|
|
133
|
+
cardBackgroundColor: p2.cardBackgroundColor || void 0
|
|
92
134
|
};
|
|
93
135
|
}
|
|
94
136
|
|
|
@@ -1230,6 +1272,7 @@ export {
|
|
|
1230
1272
|
COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT,
|
|
1231
1273
|
COLOR_SCALE_SELF_CLAMP_PCT_MIN,
|
|
1232
1274
|
COLOR_SCALE_SELF_CLAMP_PCT_MAX,
|
|
1275
|
+
FLIP_MODE_DEFAULT,
|
|
1233
1276
|
resolveOptions,
|
|
1234
1277
|
geoAssetFor,
|
|
1235
1278
|
loadGeo,
|
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
CONTAINER_SLOT_XF_CLEAR,
|
|
18
18
|
DIM_OPACITY_DEFAULT,
|
|
19
19
|
DIM_OPACITY_VAR,
|
|
20
|
+
FLIP_MODE_DEFAULT,
|
|
20
21
|
GEO_POINT_PRECISIONS,
|
|
21
22
|
HOST_CONTAINER_CLASS,
|
|
22
23
|
HOST_CONTRACT_VERSION,
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
requiredD3Plugins,
|
|
42
43
|
resolveOptions,
|
|
43
44
|
stripEsmExports
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-QIF3TAVP.mjs";
|
|
45
46
|
import "./chunk-A2GMXZP7.mjs";
|
|
46
47
|
|
|
47
48
|
// src/trivial.ts
|
|
@@ -338,6 +339,7 @@ export {
|
|
|
338
339
|
CONTAINER_SLOT_XF_CLEAR,
|
|
339
340
|
DIM_OPACITY_DEFAULT,
|
|
340
341
|
DIM_OPACITY_VAR,
|
|
342
|
+
FLIP_MODE_DEFAULT,
|
|
341
343
|
GEO_POINT_PRECISIONS,
|
|
342
344
|
HOST_CONTAINER_CLASS,
|
|
343
345
|
HOST_CONTRACT_VERSION,
|
package/dist/react.mjs
CHANGED
package/dist/types/contract.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare const COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT = 95;
|
|
|
32
32
|
export declare const COLOR_SCALE_SELF_CLAMP_PCT_MIN = 50;
|
|
33
33
|
export declare const COLOR_SCALE_SELF_CLAMP_PCT_MAX = 100;
|
|
34
34
|
export type TimelineStyle = "" | "line" | "boxes";
|
|
35
|
+
export type FlipMode = "" | "single" | "all" | "both";
|
|
36
|
+
export declare const FLIP_MODE_DEFAULT: FlipMode;
|
|
35
37
|
export type ColorScaleScope = "" | "frame" | "self";
|
|
36
38
|
export interface RenderOptions {
|
|
37
39
|
width: number;
|
|
@@ -77,5 +79,9 @@ export interface RenderOptions {
|
|
|
77
79
|
animStopAtEnd?: boolean;
|
|
78
80
|
filtersDuringPlay?: boolean;
|
|
79
81
|
animTimelineStyle?: TimelineStyle;
|
|
82
|
+
flipSync?: boolean;
|
|
83
|
+
flipIntervalMs?: number;
|
|
84
|
+
flipMode?: FlipMode;
|
|
85
|
+
cardBackgroundColor?: string;
|
|
80
86
|
onSelect?: (rowIdxs: number[]) => void;
|
|
81
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
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",
|