@bicharts/chart-host 0.5.48 → 0.5.49
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 +33 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/qualifyGroups.d.ts +51 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -580,6 +580,34 @@ function qualifyGroupHeadingFor(row, state) {
|
|
|
580
580
|
}
|
|
581
581
|
return null;
|
|
582
582
|
}
|
|
583
|
+
function newQualifyRefusalGroupState() {
|
|
584
|
+
return { poorFit: false, cannotDraw: false };
|
|
585
|
+
}
|
|
586
|
+
function refusalIsSelectable(row) {
|
|
587
|
+
return !!row && row.isVeto !== true;
|
|
588
|
+
}
|
|
589
|
+
function orderRefusalsForDisplay(rows) {
|
|
590
|
+
if (!Array.isArray(rows)) return [];
|
|
591
|
+
const named = rows.filter((r) => !!r && typeof r.name === "string" && r.name.trim() !== "");
|
|
592
|
+
return [...named.filter(refusalIsSelectable), ...named.filter((r) => !refusalIsSelectable(r))];
|
|
593
|
+
}
|
|
594
|
+
function qualifyRefusalHeadingFor(row, state) {
|
|
595
|
+
if (refusalIsSelectable(row)) {
|
|
596
|
+
if (!state.poorFit) {
|
|
597
|
+
state.poorFit = true;
|
|
598
|
+
return "poorFit";
|
|
599
|
+
}
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
if (!state.cannotDraw) {
|
|
603
|
+
state.cannotDraw = true;
|
|
604
|
+
return "cannotDraw";
|
|
605
|
+
}
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
function hasRefusalsToShow(rows) {
|
|
609
|
+
return orderRefusalsForDisplay(rows).length > 0;
|
|
610
|
+
}
|
|
583
611
|
|
|
584
612
|
// src/qualifyLaunch.ts
|
|
585
613
|
var qualifyPick = (chartType) => ({ kind: "pick", chartType });
|
|
@@ -888,12 +916,15 @@ export {
|
|
|
888
916
|
explainRenderFailure,
|
|
889
917
|
geoAssetFor,
|
|
890
918
|
geoFromCache,
|
|
919
|
+
hasRefusalsToShow,
|
|
891
920
|
isBlankRender,
|
|
892
921
|
launchFavorStyle,
|
|
893
922
|
launchGenerates,
|
|
894
923
|
loadGeo,
|
|
895
924
|
newQualifyGroupState,
|
|
925
|
+
newQualifyRefusalGroupState,
|
|
896
926
|
normaliseAggregation,
|
|
927
|
+
orderRefusalsForDisplay,
|
|
897
928
|
periodTickSuppressesFeedback,
|
|
898
929
|
planTrivialChart,
|
|
899
930
|
qualifyAuto,
|
|
@@ -901,7 +932,9 @@ export {
|
|
|
901
932
|
qualifyFailureFallsOpen,
|
|
902
933
|
qualifyGroupHeadingFor,
|
|
903
934
|
qualifyPick,
|
|
935
|
+
qualifyRefusalHeadingFor,
|
|
904
936
|
rasterizeSvgToPngDataUrl,
|
|
937
|
+
refusalIsSelectable,
|
|
905
938
|
registerCityTable,
|
|
906
939
|
registerGeo,
|
|
907
940
|
registerGeoAsset,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { planTrivialChart, compileTrivialSource, type TrivialPlan, type TrivialS
|
|
|
11
11
|
export { captureSvgSnapshot, svgToDataUrl, svgNaturalSize, rasterizeSvgToPngDataUrl, type SnapshotOptions } from "./snapshot";
|
|
12
12
|
export { shouldReview, buildReviewWire, bareBase64, actionFor, type ReviewGate, type ReviewWire, type ReviewVerdict, type ReviewAction } from "./review";
|
|
13
13
|
export { askApplyImprovements, type ReviewDialogOptions, type ReviewDialogText } from "./reviewDialog";
|
|
14
|
-
export { qualifyGroupHeadingFor, newQualifyGroupState, type QualifyGroupRow, type QualifyGroupState, type QualifyGroupHeading, } from "./qualifyGroups";
|
|
14
|
+
export { qualifyGroupHeadingFor, newQualifyGroupState, type QualifyGroupRow, type QualifyGroupState, type QualifyGroupHeading, orderRefusalsForDisplay, refusalIsSelectable, hasRefusalsToShow, qualifyRefusalHeadingFor, newQualifyRefusalGroupState, type QualifyRefusalRow, type QualifyRefusalGroupState, type QualifyRefusalHeading, } from "./qualifyGroups";
|
|
15
15
|
export { qualifyPick, qualifyAuto, qualifyCancel, launchGenerates, launchFavorStyle, chooserFitsViewport, shouldOpenChooserOnGenerate, shouldOpenInlineChooserOnGenerate, canConfirmLaunch, confirmLaunch, qualifyFailureFallsOpen, CHOOSER_MIN_WIDTH_PX, CHOOSER_MIN_HEIGHT_PX, type QualifyLaunchOutcome, type ChooserGateInput, } from "./qualifyLaunch";
|
|
16
16
|
export { computeSelectionCard, normaliseAggregation, type SelectionCardModel, type SelectionCardLine, type SelectionCardOptions, } from "./selectionCard";
|
|
17
17
|
export { ensureCrossfilterHitTargets, type HitTargetReport } from "./hitTargets";
|
|
@@ -29,3 +29,54 @@ export declare function newQualifyGroupState(): QualifyGroupState;
|
|
|
29
29
|
* 3. "projected" and 4. "notRecommended" are unchanged from the single-host original.
|
|
30
30
|
*/
|
|
31
31
|
export declare function qualifyGroupHeadingFor(row: QualifyGroupRow, state: QualifyGroupState): QualifyGroupHeading | null;
|
|
32
|
+
/** One row of a qualify result's `refused` array, in the only shape this logic cares about. */
|
|
33
|
+
export interface QualifyRefusalRow {
|
|
34
|
+
name?: string | null;
|
|
35
|
+
/** The gate's sentence. Absent is a real answer — the blocker rested on a runtime signal. */
|
|
36
|
+
reason?: string | null;
|
|
37
|
+
/** True = a required channel is ABSENT. Absent/false = a threshold we are willing to waive. */
|
|
38
|
+
isVeto?: boolean | null;
|
|
39
|
+
}
|
|
40
|
+
/** Which heading to write BEFORE a refused row, if any. */
|
|
41
|
+
export type QualifyRefusalHeading = "poorFit" | "cannotDraw";
|
|
42
|
+
/** Carried across the refusal loop. One per render. */
|
|
43
|
+
export interface QualifyRefusalGroupState {
|
|
44
|
+
poorFit: boolean;
|
|
45
|
+
cannotDraw: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function newQualifyRefusalGroupState(): QualifyRefusalGroupState;
|
|
48
|
+
/**
|
|
49
|
+
* MAY THE READER PICK THIS ONE? The single place that answers it, in either host.
|
|
50
|
+
*
|
|
51
|
+
* DEFAULTS TO YES, and the asymmetry is deliberate. An older server sends no `isVeto` at all, so
|
|
52
|
+
* every row reads selectable and the reader is offered something that may be refused — one wasted
|
|
53
|
+
* click, and the refusal that follows names its own reason. The opposite default would hide charts
|
|
54
|
+
* from readers on exactly the servers that cannot tell us it is wrong to.
|
|
55
|
+
*/
|
|
56
|
+
export declare function refusalIsSelectable(row: QualifyRefusalRow | null | undefined): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The refused rows in RENDER ORDER: everything pickable first, then the vetoes.
|
|
59
|
+
*
|
|
60
|
+
* A STABLE PARTITION, not a sort — within each block the server's alphabetical order survives, so
|
|
61
|
+
* two answers over the same shape stay diffable. Rows without a name are dropped: a control
|
|
62
|
+
* labelled with nothing cannot be chosen and a reason with no subject cannot be read.
|
|
63
|
+
*
|
|
64
|
+
* The two blocks are ordered pickable-first because the reader opened this section to DO something.
|
|
65
|
+
* Putting the inert half above the actionable half makes them scroll past every chart they cannot
|
|
66
|
+
* have to reach the ones they can.
|
|
67
|
+
*/
|
|
68
|
+
export declare function orderRefusalsForDisplay<T extends QualifyRefusalRow>(rows: readonly T[] | null | undefined): T[];
|
|
69
|
+
/**
|
|
70
|
+
* The heading (if any) belonging immediately before `row`, MUTATING `state` — same shape as
|
|
71
|
+
* `qualifyGroupHeadingFor` so the two loops read alike.
|
|
72
|
+
*
|
|
73
|
+
* Assumes `rows` came through `orderRefusalsForDisplay`; fed an unpartitioned list it would write
|
|
74
|
+
* a heading at every alternation, which is why the ordering and the headings are one export pair
|
|
75
|
+
* rather than two independent helpers a host can half-adopt.
|
|
76
|
+
*/
|
|
77
|
+
export declare function qualifyRefusalHeadingFor(row: QualifyRefusalRow, state: QualifyRefusalGroupState): QualifyRefusalHeading | null;
|
|
78
|
+
/**
|
|
79
|
+
* Is there anything behind "Show all chart types"? A checkbox that reveals nothing is worse than
|
|
80
|
+
* no checkbox: it reads as a broken control rather than an empty category.
|
|
81
|
+
*/
|
|
82
|
+
export declare function hasRefusalsToShow(rows: readonly QualifyRefusalRow[] | null | undefined): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.49",
|
|
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",
|