@bicharts/chart-host 0.6.23 → 0.6.25
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/dist/index.mjs
CHANGED
|
@@ -2408,6 +2408,31 @@ function shouldRestoreVersionAfterLicenseSave(currentVersionValue, cachedVersion
|
|
|
2408
2408
|
return (currentVersionValue ?? 0) === 0 && canShowLastChart(cachedVersionPersisted, cachedCodePersisted);
|
|
2409
2409
|
}
|
|
2410
2410
|
|
|
2411
|
+
// src/filterNarrowing.ts
|
|
2412
|
+
function isNarrowedByFilter(s2) {
|
|
2413
|
+
if (s2.highWaterSchemaHash === null || s2.highWaterSchemaHash !== s2.currentSchemaHash) return false;
|
|
2414
|
+
if (!(s2.highWaterRows > 0)) return false;
|
|
2415
|
+
if (!(s2.currentRows > 0)) return false;
|
|
2416
|
+
return s2.currentRows < s2.highWaterRows;
|
|
2417
|
+
}
|
|
2418
|
+
function isEmptiedByFilter(s2) {
|
|
2419
|
+
if (s2.highWaterSchemaHash === null || s2.highWaterSchemaHash !== s2.currentSchemaHash) return false;
|
|
2420
|
+
if (!(s2.highWaterRows > 0)) return false;
|
|
2421
|
+
return s2.currentRows <= 0;
|
|
2422
|
+
}
|
|
2423
|
+
function updateRowHighWater(prevRows, prevSchemaHash, currentRows, currentSchemaHash) {
|
|
2424
|
+
if (prevSchemaHash !== currentSchemaHash) {
|
|
2425
|
+
return { rows: currentRows, schemaHash: currentSchemaHash };
|
|
2426
|
+
}
|
|
2427
|
+
return { rows: Math.max(prevRows, currentRows), schemaHash: currentSchemaHash };
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
// src/thumbnailPolicy.ts
|
|
2431
|
+
function shouldCaptureThumbnail(g2) {
|
|
2432
|
+
const capture = g2.forced || (g2.consented || g2.capturesByDefault) && g2.firstRenderAfterGenerate;
|
|
2433
|
+
return { capture, consent: g2.consented };
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2411
2436
|
// src/clientIdentity.ts
|
|
2412
2437
|
function stableFingerprintOptions() {
|
|
2413
2438
|
return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
|
|
@@ -2594,10 +2619,12 @@ export {
|
|
|
2594
2619
|
isBlankRender,
|
|
2595
2620
|
isBlindMarker,
|
|
2596
2621
|
isDuplicateGenerate,
|
|
2622
|
+
isEmptiedByFilter,
|
|
2597
2623
|
isExcelDateFormat,
|
|
2598
2624
|
isHorizontalLabelRow,
|
|
2599
2625
|
isInsideControl,
|
|
2600
2626
|
isInvalidSentinelError,
|
|
2627
|
+
isNarrowedByFilter,
|
|
2601
2628
|
isPhantomBox,
|
|
2602
2629
|
isPillBackdropAlpha,
|
|
2603
2630
|
labelBand,
|
|
@@ -2659,6 +2686,7 @@ export {
|
|
|
2659
2686
|
scrollFitFor,
|
|
2660
2687
|
servedCorrelationProves,
|
|
2661
2688
|
sessionViewStateProvider,
|
|
2689
|
+
shouldCaptureThumbnail,
|
|
2662
2690
|
shouldOpenChooserOnGenerate,
|
|
2663
2691
|
shouldOpenInlineChooserOnGenerate,
|
|
2664
2692
|
shouldRestoreVersionAfterLicenseSave,
|
|
@@ -2674,6 +2702,7 @@ export {
|
|
|
2674
2702
|
toSourceRows,
|
|
2675
2703
|
transportFailureShouldRecover,
|
|
2676
2704
|
unpinScrolledAxis,
|
|
2705
|
+
updateRowHighWater,
|
|
2677
2706
|
valuePlacementFlag,
|
|
2678
2707
|
vegaSpecReadsDatesInLocalTime,
|
|
2679
2708
|
withoutViewOnlyKeys
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface NarrowingState {
|
|
2
|
+
/** Row count of the dataset just delivered. */
|
|
3
|
+
currentRows: number;
|
|
4
|
+
/** Most rows ever seen for highWaterSchemaHash (0 = nothing recorded yet). */
|
|
5
|
+
highWaterRows: number;
|
|
6
|
+
/** Schema the high water was recorded against (null = nothing recorded yet). */
|
|
7
|
+
highWaterSchemaHash: number | null;
|
|
8
|
+
/** Schema of the dataset just delivered. */
|
|
9
|
+
currentSchemaHash: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* True when the current dataset is a strict, non-empty subset of the largest one this schema has
|
|
13
|
+
* produced - a slicer or cross-filter is narrowing the data right now, and the chart is drawable but
|
|
14
|
+
* thin. Zero rows is a different state with its own predicate, `isEmptiedByFilter`, so neither caller
|
|
15
|
+
* has to re-check a row count to learn which question it got an answer to.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isNarrowedByFilter(s: NarrowingState): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* True when the dataset has been filtered away to NOTHING - same schema, a positive high water, and
|
|
20
|
+
* zero rows now.
|
|
21
|
+
*
|
|
22
|
+
* Filtered-to-nothing is legitimately empty, but it is not indistinguishable from an empty dataset,
|
|
23
|
+
* and treating it as one cost a reader the connection between their own click and the chart that
|
|
24
|
+
* then read a flat "no data". The evidence needed is the SAME high-water signal: at zero rows, on an
|
|
25
|
+
* unchanged schema, a positive high water means this schema HAS delivered rows before and does not
|
|
26
|
+
* now. Only a filter does that. A changed schema resets the high water, so field drift reads a high
|
|
27
|
+
* water of 0 here and keeps the plain no-data wording.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isEmptiedByFilter(s: NarrowingState): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Roll the high-water mark forward for a completed load. Resets (rather than maxing) when the schema
|
|
32
|
+
* changes, so a field swap cannot leave a stale baseline from the previous schema making every later
|
|
33
|
+
* load look narrowed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateRowHighWater(prevRows: number, prevSchemaHash: number | null, currentRows: number, currentSchemaHash: number): {
|
|
36
|
+
rows: number;
|
|
37
|
+
schemaHash: number;
|
|
38
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -40,5 +40,7 @@ export { stripJsComments } from "./codeComments";
|
|
|
40
40
|
export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
|
|
41
41
|
export { isDuplicateGenerate, armGenerateGuard, DUPLICATE_GENERATE_WINDOW_MS, type GenerateGuardKey, type GenerateGuardState, } from "./duplicateGenerateGuard";
|
|
42
42
|
export { canShowLastChart, shouldRestoreVersionAfterLicenseSave } from "./lastChart";
|
|
43
|
+
export { isNarrowedByFilter, isEmptiedByFilter, updateRowHighWater, type NarrowingState, } from "./filterNarrowing";
|
|
44
|
+
export { shouldCaptureThumbnail, type ThumbnailGate, type ThumbnailDecision } from "./thumbnailPolicy";
|
|
43
45
|
export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
|
|
44
46
|
export type { HostServices, MarkerStore, PreferenceSource, HostTheme, ThemeSource, ThumbnailConsent, SnapshotTarget, WireSigner, WireTransport, WireResponse, CredentialTriple, CredentialSource, ViewportSource, Clock, DiagnosticEntry, DiagnosticsSink, RendererId, } from "./host/services";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ThumbnailGate {
|
|
2
|
+
/** The reader or their account opted in to saving thumbnails. The only input that is consent. */
|
|
3
|
+
consented: boolean;
|
|
4
|
+
/** The service asked for this account's renders to be captured for diagnosis. Not consent. */
|
|
5
|
+
forced: boolean;
|
|
6
|
+
/** The host's terms cover a capture without the setting (e.g. a free tier). Not consent. */
|
|
7
|
+
capturesByDefault: boolean;
|
|
8
|
+
/** This render is the first of a newly generated version - not a resize, reopen or filter. */
|
|
9
|
+
firstRenderAfterGenerate: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ThumbnailDecision {
|
|
12
|
+
/** Capture an image of this render. */
|
|
13
|
+
capture: boolean;
|
|
14
|
+
/** The consent flag to send beside it: `consented`, never raised by a forced or default capture. */
|
|
15
|
+
consent: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function shouldCaptureThumbnail(g: ThumbnailGate): ThumbnailDecision;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.25",
|
|
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",
|