@bicharts/chart-host 0.5.120 → 0.5.122

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.
@@ -847,7 +847,7 @@ function resolveOptions(p2) {
847
847
  allowTooltips: p2.allowTooltips,
848
848
  noDataText: p2.noDataText,
849
849
  onSelect: p2.onSelect,
850
- // Item 639. Passed straight through like onSelect: the host owns what a gesture MEANS,
850
+ // Control gestures (1.10.0). Passed straight through like onSelect: the host owns what a gesture MEANS,
851
851
  // and a host that supplies nothing leaves every control behaving exactly as before.
852
852
  onControlChange: p2.onControlChange,
853
853
  // ---- live-restyle knobs: `raw || undefined` / `.toString() || undefined` ----
@@ -1451,7 +1451,7 @@ function Wt(n, s) {
1451
1451
  return { iso: i, unmatched: M2, matchedRows: h3, totalRows: n.length };
1452
1452
  }
1453
1453
 
1454
- // ../shape-core/dist/chunk-NY26PXWD.mjs
1454
+ // ../shape-core/dist/chunk-TDTXRIHS.mjs
1455
1455
  var import_papaparse = __toESM(require_papaparse_min(), 1);
1456
1456
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
1457
1457
  var Se = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
@@ -1545,10 +1545,10 @@ function Le(n) {
1545
1545
  return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
1546
1546
  }
1547
1547
  }
1548
- function Xt(n) {
1548
+ function Qt(n) {
1549
1549
  return Le(n)[0];
1550
1550
  }
1551
- function qt(n, e) {
1551
+ function Jt(n, e) {
1552
1552
  if (e !== "sum" && e !== "count") return false;
1553
1553
  if (e === "count") return true;
1554
1554
  let t = Oe(n);
@@ -3868,8 +3868,8 @@ export {
3868
3868
  a2 as a,
3869
3869
  Oe,
3870
3870
  Le,
3871
- Xt,
3872
- qt,
3871
+ Qt,
3872
+ Jt,
3873
3873
  buildRenderPayload,
3874
3874
  stripJsComments,
3875
3875
  createMarkResolver,
package/dist/index.mjs CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  GLYPH_SAMPLE_N,
37
37
  HOST_CONTAINER_CLASS,
38
38
  HOST_CONTRACT_VERSION,
39
+ Jt,
39
40
  L3,
40
41
  LABEL_CONTRAST_CAP,
41
42
  LABEL_CONTRAST_DONE_ATTR,
@@ -57,6 +58,7 @@ import {
57
58
  PILL_MIN_ALPHA,
58
59
  PILL_MIN_COVERAGE,
59
60
  PILL_OPAQUE_ALPHA,
61
+ Qt,
60
62
  ROW_IDX_ATTR,
61
63
  SAME_SHADE_DELTA_E,
62
64
  SCROLL_SLACK_PX,
@@ -67,7 +69,6 @@ import {
67
69
  VIEW_ONLY_UI_STATE_KEYS,
68
70
  WHITE_TEXT_BG_LUM,
69
71
  XFILTER_REFRESH_EVENT,
70
- Xt,
71
72
  a,
72
73
  applyLabelContrast,
73
74
  autoRampCanvas,
@@ -117,7 +118,6 @@ import {
117
118
  pinScrolledAxis,
118
119
  planAxisPin,
119
120
  planFrameGrow,
120
- qt,
121
121
  registerGeo,
122
122
  registerGeoAsset,
123
123
  relativeLuminance,
@@ -133,7 +133,7 @@ import {
133
133
  unpinScrolledAxis,
134
134
  valuePlacementFlag,
135
135
  withoutViewOnlyKeys
136
- } from "./chunk-CNFVXCOY.mjs";
136
+ } from "./chunk-7RLI3VOM.mjs";
137
137
  import "./chunk-A2GMXZP7.mjs";
138
138
  import "./chunk-GHODWOAL.mjs";
139
139
 
@@ -1430,7 +1430,7 @@ function isSuppressed(col) {
1430
1430
  }
1431
1431
  function resolveAgg(col, requested, auto) {
1432
1432
  const fallback = () => {
1433
- const d2 = Xt(col);
1433
+ const d2 = Qt(col);
1434
1434
  return d2 === "first" ? "count" : d2;
1435
1435
  };
1436
1436
  if (auto) return fallback();
@@ -1537,7 +1537,7 @@ function computeSelectionCard(payload, selectedRowIdxs, opts = {}) {
1537
1537
  }
1538
1538
  const value = reduce(selVals, colAgg, selRaw);
1539
1539
  let sharePct = null;
1540
- if (qt(col, colAgg) && value != null) {
1540
+ if (Jt(col, colAgg) && value != null) {
1541
1541
  const allVals = [];
1542
1542
  const allRaw = [];
1543
1543
  for (let r2 = 0; r2 < rows.length; r2++) {
@@ -2376,6 +2376,34 @@ function reconcileChartPick(pick, offered, autoLabel) {
2376
2376
  };
2377
2377
  }
2378
2378
 
2379
+ // src/clientIdentity.ts
2380
+ function stableFingerprintOptions() {
2381
+ return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
2382
+ }
2383
+ function fnv1a(text) {
2384
+ let h2 = 2166136261;
2385
+ for (let i2 = 0; i2 < text.length; i2++) {
2386
+ h2 ^= text.charCodeAt(i2);
2387
+ h2 = Math.imul(h2, 16777619) >>> 0;
2388
+ }
2389
+ return h2 >>> 0;
2390
+ }
2391
+ function fingerprintComponentDigest(components) {
2392
+ if (!components || typeof components !== "object") return "";
2393
+ const parts = [];
2394
+ for (const [name2, value] of Object.entries(components)) {
2395
+ const timedOut = !!value && typeof value === "object" && value.timeout === "true";
2396
+ let text;
2397
+ try {
2398
+ text = JSON.stringify(value) ?? "undefined";
2399
+ } catch {
2400
+ text = String(value);
2401
+ }
2402
+ parts.push(`${name2}:${timedOut ? "timeout" : (fnv1a(text) >>> 16).toString(16).padStart(4, "0")}`);
2403
+ }
2404
+ return parts.join(",");
2405
+ }
2406
+
2379
2407
  // src/index.ts
2380
2408
  function registerCityTable(packed) {
2381
2409
  L3(packed);
@@ -2511,6 +2539,7 @@ export {
2511
2539
  explainRenderFailure,
2512
2540
  filterFitsChooser,
2513
2541
  filterQualifyRows,
2542
+ fingerprintComponentDigest,
2514
2543
  fitReadingFor,
2515
2544
  fitRenderedChart,
2516
2545
  formatSourceDate,
@@ -2592,6 +2621,7 @@ export {
2592
2621
  shouldOpenChooserOnGenerate,
2593
2622
  shouldOpenInlineChooserOnGenerate,
2594
2623
  shouldReview,
2624
+ stableFingerprintOptions,
2595
2625
  stripEsmExports,
2596
2626
  stripJsComments,
2597
2627
  svgInkReach,
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createChartHost,
5
5
  geoFromCache,
6
6
  loadGeo
7
- } from "./chunk-CNFVXCOY.mjs";
7
+ } from "./chunk-7RLI3VOM.mjs";
8
8
  import "./chunk-A2GMXZP7.mjs";
9
9
  import "./chunk-GHODWOAL.mjs";
10
10
 
@@ -0,0 +1,16 @@
1
+ /** Where a host's client id came from, reported on every request so identity durability is measured, not guessed.
2
+ * `persisted`: a minted id the host keeps; `fingerprint`: derived from the browser; `session`: neither was available,
3
+ * so the id lives for this session only. */
4
+ export type ClientIdSource = "persisted" | "fingerprint" | "session";
5
+ /** ThumbmarkJS options shared by every browser host. A fresh object each call, so no host can mutate another's. */
6
+ export declare function stableFingerprintOptions(): {
7
+ exclude: string[];
8
+ logging: boolean;
9
+ };
10
+ /**
11
+ * A short digest of each fingerprint component - `name:xxxx` joined by commas, in the library's own order - so a log
12
+ * line can say WHICH input moved when a host's fingerprint changes (the id alone cannot). A component the library gave
13
+ * up on (it times out after a few seconds and reports `{timeout: "true"}`) reads `name:timeout`, because a timed-out
14
+ * component alone changes the fingerprint. Opaque to every source value: 16 bits of a hash per component.
15
+ */
16
+ export declare function fingerprintComponentDigest(components: Record<string, unknown> | null | undefined): string;
@@ -37,3 +37,4 @@ export { resolveAutoColorScale, autoRampMinStep, autoRampCanvas, AUTO_RAMP_CLASS
37
37
  export { PENDING_RECOVERY_WINDOW_MS, PENDING_RECOVERY_POLL_MS, PENDING_RECOVERY_FIRST_POLL_MS, PENDING_RECOVERY_FAST_PHASE_MS, PENDING_RECOVERY_MID_POLL_MS, PENDING_RECOVERY_SLOW_PHASE_MS, PENDING_RECOVERY_SLOW_POLL_MS, pendingRecoveryNextDelayMs, encodePendingGenerate, parsePendingGenerate, markerArmedBlind, isBlindMarker, servedCorrelationProves, sameMarker, decidePendingRecovery, recoveryPollRunning, recoveryOwnsTheSentence, latePickupAction, latePickupKeepsMarker, pollGiveUpKeepsMarker, pendingRecoveryRemainingMs, transportFailureShouldRecover, TRANSPORT_LOST_CHECKING_MESSAGE, GENERATION_CANCELLED_MESSAGE, recoveryAnswerIsCancelled, generationCancelledMessage, type PendingGenerateMarker, type PendingRecoveryDecision, type LatePickupAction, } from "./pendingGenerate";
38
38
  export { stripJsComments } from "./codeComments";
39
39
  export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
40
+ export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.120",
3
+ "version": "0.5.122",
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",