@fasl-work/caos-app-shell 0.18.0 → 0.19.1

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/chart.d.ts CHANGED
@@ -1,10 +1,24 @@
1
1
  import * as react from 'react';
2
2
  import uPlot from 'uplot';
3
- import { F as FormatOptions, S as ShellColorToken } from './text-DyQ1A8oo.js';
4
- export { r as referenceLineName } from './text-DyQ1A8oo.js';
3
+ import { F as FormatOptions, S as ShellColorToken } from './tokens-BvU9bFPw.js';
4
+ export { r as referenceLineName, a as repeatedLabels } from './tokens-BvU9bFPw.js';
5
5
  import { B as BiText, L as Lang } from './text-BlY47nIt.js';
6
6
  import 'zustand';
7
7
 
8
+ /**
9
+ * The pure rules of the interactions every shell chart carries (Tier A of the interactive-visualization rubric, shell 0.19.0):
10
+ * zoom and pan of a range, the keys of the keyboard model, the window of categories a bar chart shows, the text a screen
11
+ * reader gets, and the thinning of a long table. Nothing here touches the DOM, so each rule is tested in node.
12
+ */
13
+
14
+ /** A placed mark label, in device pixels: the box its text occupies (`y1` is the baseline). */
15
+ interface LabelBox {
16
+ x0: number;
17
+ y0: number;
18
+ x1: number;
19
+ y1: number;
20
+ }
21
+
8
22
  interface ChartSeries {
9
23
  /** What identifies the series to the solo key (0.18.0): the solo follows the series with this id when the list of series
10
24
  * changes (one dropped, one added, a label changed), not its position. Without an id the English label is the key. Unique
@@ -116,6 +130,15 @@ interface UPlotChartProps {
116
130
  * other series (alpha 0.12, 1 px) and leaves the chosen one as drawn; pressing it again releases it, pressing another
117
131
  * moves the solo. The chart is redrawn, not rebuilt. A chart of one series shows the key too. Off by default. */
118
132
  solo?: boolean;
133
+ /** The chart's accessible name and the name of its data table (0.19.0); by default the y axis by the x axis. */
134
+ title?: BiText;
135
+ /** Zoom and pan the y axis too (0.19.0): the wheel, the pinch, the brush and the keys then work on both axes (a parity plot
136
+ * always does, its two axes share one range). Off by default: x zooms and y follows the visible data. */
137
+ zoomY?: boolean;
138
+ /** Turn zoom, pan and the brush off (0.19.0), with the reason, in both languages when the page is bilingual (a chart whose
139
+ * range is the finding). It names a reason of at least 12 characters, or the gate fails it; the gate lists every chart that
140
+ * sets it. The keyboard crosshair, the readout, the data table and the summary cannot be turned off. */
141
+ zoomOff?: BiText;
119
142
  }
120
143
  /** The alpha a series takes when another one is soloed (0.18.0; what CAOS_Fragmenta's key did). */
121
144
  declare const SOLO_DIM_ALPHA = 0.12;
@@ -206,14 +229,22 @@ declare function overlayExtent(series: readonly ChartSeries[], positiveX?: boole
206
229
  x: [number, number];
207
230
  y: [number, number];
208
231
  } | null;
209
- /** How many tick labels repeat the label before them (empty labels apart); the gate fails a chart with any (G6). */
210
- declare function repeatedLabels(labels: readonly (string | null | undefined)[]): number;
232
+ /** A placed mark label, in device pixels: its box (`y1` is the baseline), the kind of mark, the text drawn and the whole text it stands for. */
233
+ interface MarkBox extends LabelBox {
234
+ kind: 'x' | 'y';
235
+ text: string;
236
+ full: string;
237
+ }
211
238
  /**
212
239
  * The vertical marks of a chart and their labels. Every label is drawn with an explicit alignment (uPlot leaves the
213
240
  * context right-aligned after its last axis, so a label meant to start at its line ended there and ran off the plot
214
241
  * near the left edge, CAOS_Fragmenta 2026-10-06), on the side of its line where it fits inside the plot, on the next
215
- * row down when it would overlap the label before it, with a halo in the surface colour so a curve under it does not
242
+ * row down when it would overlap a label before it, with a halo in the surface colour so a curve under it does not
216
243
  * cross its letters. A mark outside the x range is not drawn.
244
+ *
245
+ * Since 0.19.0 the labels of x marks and of y marks share one set of boxes (`boxes`, to which `drawYMarks` adds its own first): no x
246
+ * label lies over a y label or another x label. A label for which no row inside the plot has room is cut with an ellipsis, and one
247
+ * that fits nowhere is not written; the whole texts of those are returned, and every label placed is added to `boxes`.
217
248
  */
218
249
  declare function drawMarks(u: uPlot, marks: {
219
250
  x: number;
@@ -222,11 +253,13 @@ declare function drawMarks(u: uPlot, marks: {
222
253
  color: string;
223
254
  halo: string;
224
255
  family: string;
225
- }): void;
256
+ }, boxes?: MarkBox[]): string[];
226
257
  /**
227
258
  * The horizontal reference lines of a chart and their labels: a dashed line across the plot, its label at the right
228
259
  * end above the line (below it when the line runs along the top), inside the plot, haloed; a label that would overlap
229
- * the one placed before it moves left of it. A line outside the y range is not drawn; a line without a label is drawn alone. A mark's `color` (the tone's) draws
260
+ * the one placed before it moves left of it, then to the other side of its line or a row further, and is cut with an ellipsis when no place
261
+ * clears (`placeYLabel`; `boxes`, when given, collects what is placed, for `drawMarks` to avoid). Returns the whole texts of the labels it cut
262
+ * or could not write. A line outside the y range is not drawn; a line without a label is drawn alone. A mark's `color` (the tone's) draws
230
263
  * its line and its label; without one `style.color` does.
231
264
  */
232
265
  declare function drawYMarks(u: uPlot, marks: {
@@ -237,7 +270,7 @@ declare function drawYMarks(u: uPlot, marks: {
237
270
  color: string;
238
271
  halo: string;
239
272
  family: string;
240
- }): void;
273
+ }, boxes?: MarkBox[]): string[];
241
274
  /**
242
275
  * The index of the point nearest (left, top) in the plane, over every series, or null when no point has a value.
243
276
  * `xs` and every column of `ys` are positions in the same pixels as (left, top); a null position is no point.
@@ -256,6 +289,6 @@ declare function nearestPoint(xs: readonly number[], ys: readonly (readonly (num
256
289
  * 0.18.0: named x ticks (`x.ticks`, declared in `data-x-tick-labels`), an x range (`x.range`), a key that solos a series
257
290
  * (`solo`, declared in `data-solo`), dots on a line (`ChartSeries.dots`) and reference lines without a label.
258
291
  */
259
- declare function UPlotChart({ x, y, series, marks, yMarks, onYMarkChange, height, onCursor, onPick, parity, readout, hint, solo }: UPlotChartProps): react.JSX.Element;
292
+ declare function UPlotChart({ x, y, series, marks, yMarks, onYMarkChange, height, onCursor, onPick, parity, readout, hint, solo, title, zoomY, zoomOff }: UPlotChartProps): react.JSX.Element;
260
293
 
261
- export { type ChartAxis, type ChartSeries, type ChartTick, LOG_TABLE_FLOOR, SOLO_DIM_ALPHA, UPlotChart, type UPlotChartProps, YMARK_TONE_TOKENS, type YMarkDrag, type YMarkTone, clampMark, decadeOnly, drawMarks, drawYMarks, logDecades, namedRepeats, nearestPoint, nudgeMark, overlayExtent, parityBox, parityRange, rangeWithLevels, repeatedLabels, seriesStyle, smallestPositive, soloKey, soloStyle, sortOrder, tickLabelAt, tickSplits, tickSteps, xScaleRange };
294
+ export { type ChartAxis, type ChartSeries, type ChartTick, LOG_TABLE_FLOOR, SOLO_DIM_ALPHA, UPlotChart, type UPlotChartProps, YMARK_TONE_TOKENS, type YMarkDrag, type YMarkTone, clampMark, decadeOnly, drawMarks, drawYMarks, logDecades, namedRepeats, nearestPoint, nudgeMark, overlayExtent, parityBox, parityRange, rangeWithLevels, seriesStyle, smallestPositive, soloKey, soloStyle, sortOrder, tickLabelAt, tickSplits, tickSteps, xScaleRange };