@bicharts/chart-host 0.5.29 → 0.5.31
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 +28 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/qualifyGroups.d.ts +31 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -543,6 +543,32 @@ function askApplyImprovements(container, reason, opts = {}) {
|
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
545
|
|
|
546
|
+
// src/qualifyGroups.ts
|
|
547
|
+
function newQualifyGroupState() {
|
|
548
|
+
return { preview: false, previewClosed: false, projected: false, notRecommended: false };
|
|
549
|
+
}
|
|
550
|
+
function qualifyGroupHeadingFor(row, state) {
|
|
551
|
+
const preview = row.isPreview === true;
|
|
552
|
+
if (preview && !state.preview && !state.notRecommended) {
|
|
553
|
+
state.preview = true;
|
|
554
|
+
return "preview";
|
|
555
|
+
}
|
|
556
|
+
if (state.preview && !state.previewClosed && !preview) {
|
|
557
|
+
state.previewClosed = true;
|
|
558
|
+
return "main";
|
|
559
|
+
}
|
|
560
|
+
const projected = typeof row.viaProjection === "string" && row.viaProjection !== "";
|
|
561
|
+
if (projected && !state.projected && !state.notRecommended) {
|
|
562
|
+
state.projected = true;
|
|
563
|
+
return "projected";
|
|
564
|
+
}
|
|
565
|
+
if (row.recommended === false && !state.notRecommended) {
|
|
566
|
+
state.notRecommended = true;
|
|
567
|
+
return "notRecommended";
|
|
568
|
+
}
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
|
|
546
572
|
// src/index.ts
|
|
547
573
|
function registerCityTable(packed) {
|
|
548
574
|
L3(packed);
|
|
@@ -590,7 +616,9 @@ export {
|
|
|
590
616
|
geoAssetFor,
|
|
591
617
|
geoFromCache,
|
|
592
618
|
loadGeo,
|
|
619
|
+
newQualifyGroupState,
|
|
593
620
|
planTrivialChart,
|
|
621
|
+
qualifyGroupHeadingFor,
|
|
594
622
|
rasterizeSvgToPngDataUrl,
|
|
595
623
|
registerCityTable,
|
|
596
624
|
registerGeo,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ 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";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** One row of a qualify result, in the only shape this logic cares about. */
|
|
2
|
+
export interface QualifyGroupRow {
|
|
3
|
+
/** Newer type, deliberately unscorable. Server-stamped from the chart catalogue. */
|
|
4
|
+
isPreview?: boolean | null;
|
|
5
|
+
/** false = the ontology says a required channel cannot be satisfied by these fields. */
|
|
6
|
+
recommended?: boolean | null;
|
|
7
|
+
/** Non-empty when the type qualifies only against an AGGREGATED projection of the shape. */
|
|
8
|
+
viaProjection?: string | null;
|
|
9
|
+
}
|
|
10
|
+
/** Which heading to write BEFORE a row, if any. */
|
|
11
|
+
export type QualifyGroupHeading = "preview" | "main" | "projected" | "notRecommended";
|
|
12
|
+
/** Carried across the loop. Create one per render with `newQualifyGroupState()`. */
|
|
13
|
+
export interface QualifyGroupState {
|
|
14
|
+
preview: boolean;
|
|
15
|
+
previewClosed: boolean;
|
|
16
|
+
projected: boolean;
|
|
17
|
+
notRecommended: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function newQualifyGroupState(): QualifyGroupState;
|
|
20
|
+
/**
|
|
21
|
+
* The heading (if any) that belongs immediately before `row`, MUTATING `state` so the caller's
|
|
22
|
+
* loop stays a plain for-of. At most one heading per row: the boundaries cannot coincide, since
|
|
23
|
+
* a row leaving the preview block is by definition not the row that opened it.
|
|
24
|
+
*
|
|
25
|
+
* ORDER OF THE CHECKS IS THE CONTRACT:
|
|
26
|
+
* 1. "preview" opens the block - but never once the not-recommended block has opened, because a
|
|
27
|
+
* preview type the ontology ruled out is NOT floated and belongs where it landed.
|
|
28
|
+
* 2. "main" closes it, at the first row that is not preview. Emitted only if a block opened.
|
|
29
|
+
* 3. "projected" and 4. "notRecommended" are unchanged from the single-host original.
|
|
30
|
+
*/
|
|
31
|
+
export declare function qualifyGroupHeadingFor(row: QualifyGroupRow, state: QualifyGroupState): QualifyGroupHeading | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
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",
|