@bicharts/chart-host 0.5.82 → 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
@@ -663,6 +663,11 @@ function qualifyRefusalHeadingFor(row, state) {
663
663
  function hasRefusalsToShow(rows) {
664
664
  return orderRefusalsForDisplay(rows).length > 0;
665
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
+ }
666
671
 
667
672
  // src/qualifyLaunch.ts
668
673
  var qualifyPick = (chartType, projectionKey) => ({ kind: "pick", chartType, ...projectionKey ? { projectionKey } : {} });
@@ -1089,6 +1094,7 @@ export {
1089
1094
  PILL_MIN_ALPHA,
1090
1095
  PILL_MIN_COVERAGE,
1091
1096
  PILL_OPAQUE_ALPHA,
1097
+ QUALIFY_REFUSAL_UNSPECIFIED,
1092
1098
  ROW_IDX_ATTR,
1093
1099
  SCROLL_SLACK_PX,
1094
1100
  SEASONAL_MARKERS_DEFAULT,
@@ -1168,6 +1174,7 @@ export {
1168
1174
  qualifyGroupHeadingFor,
1169
1175
  qualifyPick,
1170
1176
  qualifyRefusalHeadingFor,
1177
+ qualifyRefusalReason,
1171
1178
  rasterizeSvgToPngDataUrl,
1172
1179
  readQualifyChartRow,
1173
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";
@@ -88,3 +88,30 @@ export declare function qualifyRefusalHeadingFor(row: QualifyRefusalRow, state:
88
88
  * no checkbox: it reads as a broken control rather than an empty category.
89
89
  */
90
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.82",
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",