@tidal-ts/chart 0.24.0 → 0.25.0

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.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  export { TimeSeriesChart, annotationInView, type ChartAnnotation, type ChartStats, type TimeSeriesChartProps, type TimeSeriesChartRow, } from './TimeSeriesChart.js';
15
15
  export type { ChartSeries } from './types.js';
16
16
  export { levelRole, levelRoles, rowLevelMarks, type ChartLevel, type ChartLevelLine, type ChartLevelRange, type ChartLevelStyle, type LevelLineMark, type LevelRoleStyle, type LevelWashMark, } from './levels.js';
17
- export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, type AxisRange, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, type ConfigOutput, type OutputLook, type OutputStyle, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, type PairJoinOp, type PairLensOp, type SeriesGroup, type PairPartView, type PairView, type SeriesBinding, type SeriesConfig, type CompareWith, type SeriesAxis, type SeriesStyle, type SeriesWindow, type CandleVariant, type ColorBy, readsFrom, sourcesOf, } from './series.js';
17
+ export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, type AxisRange, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, type ConfigOutput, type OutputLook, type OutputStyle, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, type PairJoinOp, type PairLensOp, type SeriesGroup, type PairPartView, type PairView, type SeriesBinding, type SeriesConfig, type CompareWith, compareWithInput, type SeriesAxis, type SeriesStyle, type SeriesWindow, type CandleVariant, type ColorBy, readsFrom, sourcesOf, } from './series.js';
18
18
  export { DEFAULT_CHART_SETTINGS, mergeChartSettings, type AnnotationOverride, type ChartSettings, type CategoryLineStyle, type SessionDividers, type SplitColorDefault, type LineDash, } from './chartSettings.js';
19
19
  export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
20
20
  export { assembleRows, carries, foldKey, foldSources, foldSourcesReport, type SourceFoldReport, prepareChart, sourceFacts, type ConfigRow, type PreparedRow, type SourceFacts, type SourceHold, type SourceInput, type SourceInputs, } from './prepare.js';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  export { TimeSeriesChart, annotationInView, } from './TimeSeriesChart.js';
15
15
  export { levelRole, levelRoles, rowLevelMarks, } from './levels.js';
16
- export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, readsFrom, sourcesOf, } from './series.js';
16
+ export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, compareWithInput, readsFrom, sourcesOf, } from './series.js';
17
17
  export { DEFAULT_CHART_SETTINGS, mergeChartSettings, } from './chartSettings.js';
18
18
  export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
19
19
  export { assembleRows, carries, foldKey, foldSources, foldSourcesReport, prepareChart, sourceFacts, } from './prepare.js';
package/dist/series.d.ts CHANGED
@@ -125,7 +125,7 @@ export declare function configColumns(c: {
125
125
  fan?: readonly string[];
126
126
  bandMiddle?: boolean;
127
127
  }): string[];
128
- import type { DeriveSpec, PairOp, SeriesWindow } from '@tidal-ts/core';
128
+ import type { DeriveInput, DeriveSpec, PairOp, SeriesWindow } from '@tidal-ts/core';
129
129
  export type { DeriveSpec, SeriesWindow };
130
130
  import type { CandleVariant, ColorBy } from '@pond-ts/charts';
131
131
  export type { CandleVariant, ColorBy };
@@ -327,8 +327,9 @@ export interface SeriesConfig {
327
327
  * function, it sleeps until there is a comparison again. The host does the
328
328
  * wiring at render time and treats an `id` that no longer exists as
329
329
  * automatic. The terminal machine drops a wiring as soon as the other side
330
- * is removed or stops being one line to read (joins a pair, draws several
331
- * columns, takes a fan).
330
+ * is removed or the line it reads stops being drawn: it joins a pair, or a
331
+ * wiring with no {@link CompareWith.output} finds it drawing several lines,
332
+ * or the named line is no longer one of its lines.
332
333
  *
333
334
  * The other side is read as its own PLAIN output, never its compare — so
334
335
  * two metrics wired to each other, or a metric wired to its own study, form
@@ -342,7 +343,27 @@ export interface CompareWith {
342
343
  id: string;
343
344
  /** Read on the primary symbol, or on the comparison. */
344
345
  side: 'primary' | 'comparison';
346
+ /**
347
+ * Which of its lines, when the other config draws several — a Bollinger's
348
+ * `Upper`, one column of a data node drawing open and close, one output of
349
+ * a fanned study — by the name {@link configOutputs} gives it. Absent for a
350
+ * config with one line.
351
+ */
352
+ output?: string;
345
353
  }
354
+ /**
355
+ * What a compare reads as its other side from `other` — the input a spec
356
+ * names it by ({@link CompareWith}): its spec or its raw column for one line;
357
+ * for one line of several, the column, the fanned spec or the PICKED output
358
+ * that is that line. Only a line the config DRAWS ({@link configColumns}):
359
+ * not a Bollinger's hidden middle, nor a third column of a two-line band.
360
+ *
361
+ * `null` when `output` names none of its drawn lines, or is missing for a
362
+ * config that draws several. A data node back to ONE column still answers to
363
+ * that column's name, so a wiring on `close` survives the node dropping
364
+ * `open`.
365
+ */
366
+ export declare function compareWithInput(other: Pick<SeriesConfig, 'column' | 'derive' | 'fan' | 'style' | 'bandMiddle'>, output?: string): DeriveInput | null;
346
367
  /** The textures in display order. */
347
368
  export declare const LINE_DASHES: readonly LineDash[];
348
369
  /** Ink for ONE output of a multi-output config — see
package/dist/series.js CHANGED
@@ -154,6 +154,32 @@ export function configColumns(c) {
154
154
  import { BAND_OUTPUTS, BAR_PRICE_COLUMNS, COMPARE_PREFIX, deriveId, hasPairOp, inputNames, isPairOp, isPickedInput, isStudyOp, opOutputs, opParams, outputMark, studyLevels, usesCompare, withFanOutput, } from '@tidal-ts/core';
155
155
  // The app-wide presentation defaults the category resolvers below read.
156
156
  import { DEFAULT_CHART_SETTINGS, } from './chartSettings.js';
157
+ /**
158
+ * What a compare reads as its other side from `other` — the input a spec
159
+ * names it by ({@link CompareWith}): its spec or its raw column for one line;
160
+ * for one line of several, the column, the fanned spec or the PICKED output
161
+ * that is that line. Only a line the config DRAWS ({@link configColumns}):
162
+ * not a Bollinger's hidden middle, nor a third column of a two-line band.
163
+ *
164
+ * `null` when `output` names none of its drawn lines, or is missing for a
165
+ * config that draws several. A data node back to ONE column still answers to
166
+ * that column's name, so a wiring on `close` survives the node dropping
167
+ * `open`.
168
+ */
169
+ export function compareWithInput(other, output) {
170
+ const drawn = new Set(configColumns(other));
171
+ const lines = configOutputs(other).filter((o) => drawn.has(o.column));
172
+ const several = lines.length > 1 || other.style === 'band' || other.style === 'lines';
173
+ if (output === undefined)
174
+ return several ? null : (other.derive ?? other.column);
175
+ if (!several)
176
+ return !other.derive && output === other.column ? other.column : null;
177
+ if (!lines.some((o) => o.name === output))
178
+ return null;
179
+ if (other.fan && other.fan.length > 0)
180
+ return other.derive ? withFanOutput(other.derive, output) : output;
181
+ return other.derive ? { from: other.derive, output } : null;
182
+ }
157
183
  /** The textures in display order. */
158
184
  export const LINE_DASHES = ['solid', 'dashed', 'dotted'];
159
185
  // --- Axis identity ------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-ts/chart",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "description": "TimeSeriesChart — a multi-row time-series chart on @pond-ts/charts, plus the series and settings vocabulary and the prepare step. Theme, colours and settings arrive as props.",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "react": "^18.2.0 || ^19.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@tidal-ts/core": "0.24.0"
41
+ "@tidal-ts/core": "0.25.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@pond-ts/charts": "^0.78.0",