@bicharts/chart-host 0.5.81 → 0.5.83

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
@@ -611,14 +611,15 @@ function askApplyImprovements(container, reason, opts = {}) {
611
611
 
612
612
  // src/qualifyGroups.ts
613
613
  function newQualifyGroupState() {
614
- return { preview: false, previewClosed: false, projected: false, notRecommended: false };
614
+ return { preview: false, previewClosed: false, projected: false, notRecommended: false, rankedSeen: false };
615
615
  }
616
616
  function qualifyGroupHeadingFor(row, state) {
617
617
  const preview = row.isPreview === true;
618
- if (preview && !state.preview && !state.notRecommended) {
618
+ if (preview && !state.preview && !state.notRecommended && !state.rankedSeen) {
619
619
  state.preview = true;
620
620
  return "preview";
621
621
  }
622
+ if (!preview) state.rankedSeen = true;
622
623
  if (state.preview && !state.previewClosed && !preview) {
623
624
  state.previewClosed = true;
624
625
  return "main";
@@ -662,6 +663,11 @@ function qualifyRefusalHeadingFor(row, state) {
662
663
  function hasRefusalsToShow(rows) {
663
664
  return orderRefusalsForDisplay(rows).length > 0;
664
665
  }
666
+ var QUALIFY_REFUSAL_UNSPECIFIED = "refused for the fields as bound - no single requirement to name";
667
+ function qualifyRefusalReason(reason, fallback = QUALIFY_REFUSAL_UNSPECIFIED) {
668
+ const s = (reason ?? "").trim();
669
+ return s !== "" ? s : fallback;
670
+ }
665
671
 
666
672
  // src/qualifyLaunch.ts
667
673
  var qualifyPick = (chartType, projectionKey) => ({ kind: "pick", chartType, ...projectionKey ? { projectionKey } : {} });
@@ -1088,6 +1094,7 @@ export {
1088
1094
  PILL_MIN_ALPHA,
1089
1095
  PILL_MIN_COVERAGE,
1090
1096
  PILL_OPAQUE_ALPHA,
1097
+ QUALIFY_REFUSAL_UNSPECIFIED,
1091
1098
  ROW_IDX_ATTR,
1092
1099
  SCROLL_SLACK_PX,
1093
1100
  SEASONAL_MARKERS_DEFAULT,
@@ -1167,6 +1174,7 @@ export {
1167
1174
  qualifyGroupHeadingFor,
1168
1175
  qualifyPick,
1169
1176
  qualifyRefusalHeadingFor,
1177
+ qualifyRefusalReason,
1170
1178
  rasterizeSvgToPngDataUrl,
1171
1179
  readQualifyChartRow,
1172
1180
  readQualifyRefusalRow,
@@ -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, orderRefusalsForDisplay, refusalIsSelectable, hasRefusalsToShow, qualifyRefusalHeadingFor, newQualifyRefusalGroupState, type QualifyRefusalRow, type QualifyRefusalGroupState, type QualifyRefusalHeading, } from "./qualifyGroups";
14
+ export { qualifyGroupHeadingFor, newQualifyGroupState, type QualifyGroupRow, type QualifyGroupState, type QualifyGroupHeading, orderRefusalsForDisplay, refusalIsSelectable, hasRefusalsToShow, qualifyRefusalHeadingFor, newQualifyRefusalGroupState, qualifyRefusalReason, QUALIFY_REFUSAL_UNSPECIFIED, 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 { normalizeFilterTerm, filterQualifyRows, readQualifyChartRow, readQualifyRefusalRow, filterFitsChooser, listNeedsFilter, qualifyFilterGate, inlineFilterGate, FILTER_MIN_TERM_CHARS, FILTER_ROW_PX, FILTER_MIN_WIDTH_PX, FILTER_MIN_HEIGHT_PX, INLINE_FILTER_MIN_ROWS, computeQualifyFilterView, qualifyFilterCountText, type QualifyFilterTier, type QualifyFilterResult, type QualifyFilterRead, type QualifyFilterGateReason, type QualifyFilterGateInput, type QualifyFilterRow, type QualifyFilterGroup, type QualifyFilterView, type QualifyFilterNoteKind, } from "./qualifyFilter";
17
17
  export { computeSelectionCard, normaliseAggregation, type SelectionCardModel, type SelectionCardLine, type SelectionCardOptions, } from "./selectionCard";
@@ -15,6 +15,8 @@ export interface QualifyGroupState {
15
15
  previewClosed: boolean;
16
16
  projected: boolean;
17
17
  notRecommended: boolean;
18
+ /** A ranked (non-preview) row has been seen: from here on a badge is a badge, not a block. */
19
+ rankedSeen: boolean;
18
20
  }
19
21
  export declare function newQualifyGroupState(): QualifyGroupState;
20
22
  /**
@@ -24,7 +26,13 @@ export declare function newQualifyGroupState(): QualifyGroupState;
24
26
  *
25
27
  * ORDER OF THE CHECKS IS THE CONTRACT:
26
28
  * 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.
29
+ * preview type the ontology ruled out is NOT floated and belongs where it landed. AND NEVER
30
+ * ONCE A RANKED ROW HAS BEEN SEEN. The preview BLOCK is the set of rows the server floated
31
+ * to the top (preview TYPES, which cannot be scored); a preview LANE sits on a scorable type
32
+ * that ranks on its own merits and is deliberately left where it ranks, carrying only its
33
+ * badge. Before this clause, one badged lane mid-list opened "New - in preview" above row 13
34
+ * and closed it with "Best fit for your data" above row 14 - two headings claiming a
35
+ * grouping the list did not have.
28
36
  * 2. "main" closes it, at the first row that is not preview. Emitted only if a block opened.
29
37
  * 3. "projected" and 4. "notRecommended" are unchanged from the single-host original.
30
38
  */
@@ -80,3 +88,30 @@ export declare function qualifyRefusalHeadingFor(row: QualifyRefusalRow, state:
80
88
  * no checkbox: it reads as a broken control rather than an empty category.
81
89
  */
82
90
  export declare function hasRefusalsToShow(rows: readonly QualifyRefusalRow[] | null | undefined): boolean;
91
+ /**
92
+ * THE SENTENCE FOR A REFUSAL THAT NAMES NO REQUIREMENT.
93
+ *
94
+ * A null reason is a REAL answer, not a gap: the server walks a chart's DECLARED structural
95
+ * requirements and stays silent rather than fabricating a cause when the blocker rests on a
96
+ * runtime signal it cannot see - a viewport, a facet budget, a raw-observation floor. Both
97
+ * refusal builders say in so many words that the client renders that null as a fallback
98
+ * sentence. No host did. All three tested `if (reason)` and skipped the element, so the row
99
+ * came out as a bare chart name under a heading that claimed to know why it was refused.
100
+ *
101
+ * It lives here, beside `refusalIsSelectable`, for the same reason that predicate does: three
102
+ * hosts answering one question, and a fallback that only two of them remember to write is the
103
+ * drift this module exists to prevent. Call `qualifyRefusalReason` rather than reading `.reason`
104
+ * - a host cannot forget a fallback it never has to supply.
105
+ *
106
+ * IT DOES NOT GUESS. "We turned this down and cannot point at one requirement" is exactly what
107
+ * happened, and it is more useful than silence: the reader learns the row is an ANSWER rather
108
+ * than a rendering that failed to load.
109
+ */
110
+ export declare const QUALIFY_REFUSAL_UNSPECIFIED = "refused for the fields as bound - no single requirement to name";
111
+ /**
112
+ * The sentence to render beside a refused chart's name: the server's own words when it has them,
113
+ * and {@link QUALIFY_REFUSAL_UNSPECIFIED} when it does not. Never empty, which is the point.
114
+ *
115
+ * `fallback` lets a host localize without re-implementing the decision.
116
+ */
117
+ export declare function qualifyRefusalReason(reason: string | null | undefined, fallback?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.81",
3
+ "version": "0.5.83",
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",