@bicharts/chart-host 0.6.26 → 0.6.27
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 +27 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modelPicker.d.ts +16 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2433,6 +2433,28 @@ function shouldCaptureThumbnail(g2) {
|
|
|
2433
2433
|
return { capture, consent: g2.consented };
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
|
+
// src/modelPicker.ts
|
|
2437
|
+
var DEFAULT_MODEL_SUFFIX = " \u2014 default";
|
|
2438
|
+
function isPickableModelCode(code) {
|
|
2439
|
+
const c2 = String(code ?? "");
|
|
2440
|
+
return c2 !== "" && !c2.startsWith("BYO");
|
|
2441
|
+
}
|
|
2442
|
+
function markDefaultModel(label, code, defaultCode) {
|
|
2443
|
+
return defaultCode && code === defaultCode ? label + DEFAULT_MODEL_SUFFIX : label;
|
|
2444
|
+
}
|
|
2445
|
+
function defaultModelFirst(rows, defaultCode) {
|
|
2446
|
+
if (!defaultCode) return rows.slice();
|
|
2447
|
+
const first = rows.filter((r2) => r2.value === defaultCode);
|
|
2448
|
+
return first.concat(rows.filter((r2) => r2.value !== defaultCode));
|
|
2449
|
+
}
|
|
2450
|
+
function reconcileModelPick(saved, offered, fallback) {
|
|
2451
|
+
const s2 = String(saved ?? "");
|
|
2452
|
+
if (offered.includes(s2)) return s2;
|
|
2453
|
+
const f2 = String(fallback ?? "");
|
|
2454
|
+
if (offered.includes(f2)) return f2;
|
|
2455
|
+
return offered.length ? offered[0] : "";
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2436
2458
|
// src/clientIdentity.ts
|
|
2437
2459
|
function stableFingerprintOptions() {
|
|
2438
2460
|
return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
|
|
@@ -2498,6 +2520,7 @@ export {
|
|
|
2498
2520
|
CONTROL_CLASS,
|
|
2499
2521
|
D3_PLUGIN_PACKAGES,
|
|
2500
2522
|
DARK_TEXT,
|
|
2523
|
+
DEFAULT_MODEL_SUFFIX,
|
|
2501
2524
|
DIM_OPACITY_DEFAULT,
|
|
2502
2525
|
DIM_OPACITY_VAR,
|
|
2503
2526
|
DUPLICATE_GENERATE_WINDOW_MS,
|
|
@@ -2597,6 +2620,7 @@ export {
|
|
|
2597
2620
|
ctmScaleOf,
|
|
2598
2621
|
decideLabelColor,
|
|
2599
2622
|
decidePendingRecovery,
|
|
2623
|
+
defaultModelFirst,
|
|
2600
2624
|
deltaEHex,
|
|
2601
2625
|
encodePendingGenerate,
|
|
2602
2626
|
ensureCrossfilterHitTargets,
|
|
@@ -2626,6 +2650,7 @@ export {
|
|
|
2626
2650
|
isInvalidSentinelError,
|
|
2627
2651
|
isNarrowedByFilter,
|
|
2628
2652
|
isPhantomBox,
|
|
2653
|
+
isPickableModelCode,
|
|
2629
2654
|
isPillBackdropAlpha,
|
|
2630
2655
|
labelBand,
|
|
2631
2656
|
latePickupAction,
|
|
@@ -2634,6 +2659,7 @@ export {
|
|
|
2634
2659
|
launchGenerates,
|
|
2635
2660
|
listNeedsFilter,
|
|
2636
2661
|
loadGeo,
|
|
2662
|
+
markDefaultModel,
|
|
2637
2663
|
markerArmedBlind,
|
|
2638
2664
|
measureContainerBoxes,
|
|
2639
2665
|
mountProductFeedbackBox,
|
|
@@ -2671,6 +2697,7 @@ export {
|
|
|
2671
2697
|
readQualifyChartRow,
|
|
2672
2698
|
readQualifyRefusalRow,
|
|
2673
2699
|
reconcileChartPick,
|
|
2700
|
+
reconcileModelPick,
|
|
2674
2701
|
recoveryAnswerIsCancelled,
|
|
2675
2702
|
recoveryOwnsTheSentence,
|
|
2676
2703
|
recoveryPollRunning,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -42,5 +42,6 @@ export { isDuplicateGenerate, armGenerateGuard, DUPLICATE_GENERATE_WINDOW_MS, ty
|
|
|
42
42
|
export { canShowLastChart, shouldRestoreVersionAfterLicenseSave } from "./lastChart";
|
|
43
43
|
export { isNarrowedByFilter, isEmptiedByFilter, updateRowHighWater, type NarrowingState, } from "./filterNarrowing";
|
|
44
44
|
export { shouldCaptureThumbnail, type ThumbnailGate, type ThumbnailDecision } from "./thumbnailPolicy";
|
|
45
|
+
export { isPickableModelCode, markDefaultModel, defaultModelFirst, reconcileModelPick, DEFAULT_MODEL_SUFFIX, } from "./modelPicker";
|
|
45
46
|
export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
|
|
46
47
|
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,16 @@
|
|
|
1
|
+
/** The suffix that marks the default model's row, after its cost. */
|
|
2
|
+
export declare const DEFAULT_MODEL_SUFFIX = " \u2014 default";
|
|
3
|
+
/** Whether a catalogue code may appear in the open list: not empty, and not a bring-your-own-key code. */
|
|
4
|
+
export declare function isPickableModelCode(code: string | null | undefined): boolean;
|
|
5
|
+
/** The label with the default marker appended when `code` is the (non-empty) default. */
|
|
6
|
+
export declare function markDefaultModel(label: string, code: string, defaultCode: string | null | undefined): string;
|
|
7
|
+
/** A copy of `rows` with the default model's row first and every other row in its original order. */
|
|
8
|
+
export declare function defaultModelFirst<T extends {
|
|
9
|
+
value: string;
|
|
10
|
+
}>(rows: readonly T[], defaultCode: string | null | undefined): T[];
|
|
11
|
+
/**
|
|
12
|
+
* The pick to show: `saved` when the list still offers it; otherwise `fallback` (the host's default -
|
|
13
|
+
* the default model's code, or the host's own "service default" row) when the list offers that;
|
|
14
|
+
* otherwise the list's first row; "" only for an empty list.
|
|
15
|
+
*/
|
|
16
|
+
export declare function reconcileModelPick(saved: string | null | undefined, offered: readonly string[], fallback: string | null | undefined): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.27",
|
|
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",
|