@bicharts/chart-host 0.6.95 → 0.6.97

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,6 +1,11 @@
1
1
  # @bicharts/chart-host
2
2
 
3
- > **Make Generative AI for Charts *Better*.**
3
+ > **Make Generative AI for Charts and Maps *Better*.**
4
+
5
+ **AI Data Components, running in your page:** a bivariate map with its two-way key, a what-if projection with its
6
+ controls inside the chart, a flow map, and about 90 everyday chart types, with selection, cross-filtering and the legend
7
+ already wired. This package is the open-source runtime that makes them behave the same way in Power BI, Excel, Fabric
8
+ Apps and any web page.
4
9
 
5
10
  Describe the chart you want, or just hand over the data, and RegiaBI gives you back a working, interactive chart that fits your data on the first try — as source code you own. It goes into your repo and runs in the framework you already use: React, a plain web page, or whatever your coding agent is scaffolding. At run time there's no key, no call to us and nothing to pay per render: `@bicharts/chart-host`, the open-source runtime, makes the chart behave in your page — clicks, cross-filtering, selection — so that's code you don't have to write. You start from something that already works and spend your time on the last ten percent, in plain language or in the code itself; reading the code is an advantage, never the price of entry. And because the engine knows what each chart type can honestly say, it'll sometimes show you a view of your data you hadn't thought to ask for.
6
11
 
@@ -274,6 +279,9 @@ dim), never read as a percentage, and anything else is ignored. The host writes
274
279
  `--lch-dim-opacity` on its own container and, when the option goes away or the host is destroyed,
275
280
  puts back the value your page had set inline there, so with the option absent nothing is written
276
281
  and the CSS above decides: the stylesheet's `0.25`, or whatever your page sets on the variable.
282
+ A value your page sets inline while the host holds the variable is the one that comes back (or,
283
+ set since the host's last write, is left where it is); the same number with the same priority as
284
+ the host's own write cannot be told apart from it.
277
285
 
278
286
  ```js
279
287
  createChartHost(el, { code, data, options: { dimOpacity: 0.15 } });
package/dist/adapters.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  censusHitBands,
4
4
  ensureCrossfilterHitTargets,
5
5
  hitBandFlag
6
- } from "./chunk-PDVEIW42.mjs";
6
+ } from "./chunk-ASLRGGLV.mjs";
7
7
  import {
8
8
  clickWasDrag,
9
9
  collectD3GlyphCenters,
@@ -12,13 +12,13 @@ import {
12
12
  markKeyOf,
13
13
  rowIdxsFromMark,
14
14
  selectionRuleOf
15
- } from "./chunk-VEVBXK44.mjs";
15
+ } from "./chunk-5OCL4EFM.mjs";
16
16
  import {
17
17
  AXIS_FILTER_CLASS,
18
18
  LEGEND_MARK_CLASS,
19
19
  MARK_CLASS,
20
20
  ROW_IDX_ATTR
21
- } from "./chunk-45VILLJT.mjs";
21
+ } from "./chunk-M7MBTLDP.mjs";
22
22
  import "./chunk-GHODWOAL.mjs";
23
23
 
24
24
  // src/adapters/types.ts
package/dist/card.mjs CHANGED
@@ -1,8 +1,8 @@
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
3
  computeSelectionCard
4
- } from "./chunk-CJ4IG6G5.mjs";
5
- import "./chunk-NQFJHNMC.mjs";
4
+ } from "./chunk-P6VCB6SF.mjs";
5
+ import "./chunk-KFU44UEN.mjs";
6
6
  import "./chunk-GHODWOAL.mjs";
7
7
 
8
8
  // src/selectionCardChrome.ts
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONTAINER_SLOT_SCROLL,
4
4
  SNAPSHOT_SVG_ATTR
5
- } from "./chunk-45VILLJT.mjs";
5
+ } from "./chunk-M7MBTLDP.mjs";
6
6
 
7
7
  // src/fit.ts
8
8
  var SCROLL_SLACK_PX = 8;
@@ -8,7 +8,7 @@ import {
8
8
  SELECTION_RULE_ATTR,
9
9
  SELECTION_RULE_CLICKED_MARKS,
10
10
  XFILTER_REFRESH_EVENT
11
- } from "./chunk-45VILLJT.mjs";
11
+ } from "./chunk-M7MBTLDP.mjs";
12
12
 
13
13
  // src/selection.ts
14
14
  function rowIdxsFromMark(el) {
@@ -4,7 +4,7 @@ import {
4
4
  LEGEND_MARK_CLASS,
5
5
  MARK_CLASS,
6
6
  ROW_IDX_ATTR
7
- } from "./chunk-45VILLJT.mjs";
7
+ } from "./chunk-M7MBTLDP.mjs";
8
8
 
9
9
  // src/hitTargets.ts
10
10
  var SVG_NS = "http://www.w3.org/2000/svg";
@@ -4,7 +4,7 @@ import {
4
4
  gestureWasDrag,
5
5
  isInsideControl,
6
6
  rowIdxsFromMark
7
- } from "./chunk-VEVBXK44.mjs";
7
+ } from "./chunk-5OCL4EFM.mjs";
8
8
  import {
9
9
  AXIS_FILTER_CLASS,
10
10
  CONTROL_CLASS,
@@ -12,7 +12,7 @@ import {
12
12
  MARK_CLASS,
13
13
  ROW_IDX_ATTR,
14
14
  SNAPSHOT_SVG_ATTR
15
- } from "./chunk-45VILLJT.mjs";
15
+ } from "./chunk-M7MBTLDP.mjs";
16
16
 
17
17
  // src/lasso.ts
18
18
  var LASSO_ROW_CAP = 5e3;
@@ -46,6 +46,10 @@ function lassoActions(setting) {
46
46
  for (const n of a) if (typeof n === "string" && n.trim() && !out.includes(n.trim())) out.push(n.trim());
47
47
  return out;
48
48
  }
49
+ var LASSO_DEFAULT_EFFECT = "filter";
50
+ function lassoEffect(setting) {
51
+ return setting?.effect === "highlight" ? "highlight" : LASSO_DEFAULT_EFFECT;
52
+ }
49
53
  function lassoVerdict(setting, rows) {
50
54
  if (!setting || setting.capable !== true) return "not-capable";
51
55
  if (setting.enabled === false) return "disabled";
@@ -227,6 +231,31 @@ function readStored(options, container) {
227
231
  const bag = container.__lchKnobs;
228
232
  return isObject(bag) ? bag[LASSO_KNOB_KEY] : void 0;
229
233
  }
234
+ var LASSO_PARKED_FOR = "__lchLassoFor";
235
+ function claimParkedLasso(container, chartKey, sessionState) {
236
+ const holder = container;
237
+ if (!holder) return false;
238
+ let dropped = false;
239
+ try {
240
+ if (holder[LASSO_PARKED_FOR] !== chartKey) {
241
+ const bag = holder.__lchKnobs;
242
+ if (isObject(bag) && bag[LASSO_KNOB_KEY] !== void 0) {
243
+ delete bag[LASSO_KNOB_KEY];
244
+ dropped = true;
245
+ }
246
+ const knobs = isObject(sessionState) ? sessionState.knobs : void 0;
247
+ if (isObject(knobs) && knobs[LASSO_KNOB_KEY] !== void 0) {
248
+ const rest = { ...knobs };
249
+ delete rest[LASSO_KNOB_KEY];
250
+ sessionState.knobs = rest;
251
+ dropped = true;
252
+ }
253
+ }
254
+ holder[LASSO_PARKED_FOR] = chartKey;
255
+ } catch {
256
+ }
257
+ return dropped;
258
+ }
230
259
  function writeStored(container, options, value) {
231
260
  const holder = container;
232
261
  if (!isObject(holder.__lchKnobs)) holder.__lchKnobs = {};
@@ -657,9 +686,12 @@ export {
657
686
  LASSO_DEFAULT_ACTIONS,
658
687
  lassoRowCap,
659
688
  lassoActions,
689
+ LASSO_DEFAULT_EFFECT,
690
+ lassoEffect,
660
691
  lassoVerdict,
661
692
  pointInShape,
662
693
  registerLassoAction,
694
+ claimParkedLasso,
663
695
  installLasso,
664
696
  clearLasso
665
697
  };