timescope 0.0.0-alpha.5 → 0.0.0-alpha.6

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/index.d.ts CHANGED
@@ -105,7 +105,7 @@ declare namespace Decimal {
105
105
  type NumberLike = string | bigint | number | DecimalInstance;
106
106
  //#endregion
107
107
  //#region src/core/range.d.ts
108
- type Range<T> = [T, T];
108
+ type TimescopeRange<T> = [T, T];
109
109
  //#endregion
110
110
  //#region src/core/chunk.d.ts
111
111
  /**
@@ -119,7 +119,7 @@ type TimescopeDataChunkDesc = {
119
119
  /** Expiration timestamp (ms). */
120
120
  expires?: number;
121
121
  /** Time range covered by this chunk. */
122
- range: Range<Decimal | undefined>;
122
+ range: TimescopeRange<Decimal | undefined>;
123
123
  /** Resolution in milliseconds per sample. */
124
124
  resolution: Decimal;
125
125
  /** Zoom level. */
@@ -198,9 +198,9 @@ type ZoomLike = NumberLike;
198
198
  //#region src/core/TimescopeState.d.ts
199
199
  interface TimescopeStateOptions {
200
200
  time?: TimeLike;
201
- timeRange?: Range<TimeLike | null | undefined>;
201
+ timeRange?: TimescopeRange<TimeLike | null | undefined>;
202
202
  zoom?: ZoomLike;
203
- zoomRange?: Range<ZoomLike | undefined>;
203
+ zoomRange?: TimescopeRange<ZoomLike | undefined>;
204
204
  }
205
205
  //#endregion
206
206
  //#region src/core/types.d.ts
@@ -314,10 +314,10 @@ type TimescopeSeriesInput<Source extends Record<string, TimescopeSourceInput>, S
314
314
  digits?: number;
315
315
  color?: string;
316
316
  scale?: 'linear' | 'log';
317
- range?: NumberLike | Range<NumberLike | undefined> | {
317
+ range?: NumberLike | TimescopeRange<NumberLike | undefined> | {
318
318
  expand?: boolean;
319
319
  shrink?: boolean;
320
- default?: NumberLike | Range<NumberLike | undefined>;
320
+ default?: NumberLike | TimescopeRange<NumberLike | undefined>;
321
321
  };
322
322
  instantaneous?: {
323
323
  using?: Using1<[InferTimeKey<TimeDef>, InferValueKey<ValueDef>]>;
@@ -396,7 +396,7 @@ type TimescopeOptionsSelection = boolean | {
396
396
  resizable?: boolean;
397
397
  color?: string;
398
398
  invert?: boolean;
399
- range?: Range<Decimal | undefined> | null;
399
+ range?: TimescopeRange<Decimal | undefined> | null;
400
400
  };
401
401
  type TimescopeOptions<Source extends Record<string, TimescopeSourceInput> = Record<string, TimescopeSourceInput>, SourceName extends Record<string, keyof Source> = Record<string, keyof Source>, TimeDef extends Record<string, FieldDefLike<TimeLike<never>>> = Record<string, FieldDefLike<TimeLike<never>>>, ValueDef extends Record<string, FieldDefLike<NumberLike | null>> = Record<string, FieldDefLike<NumberLike | null>>, Track extends string = string> = {
402
402
  style?: TimescopeStyle;
@@ -423,6 +423,16 @@ declare const defineTimescopeTracks: <Track extends string>(opts: TimescopeOptio
423
423
  declare const defineTimescopeSeries: <Source extends Record<string, TimescopeSourceInput>, SourceName extends Record<string, keyof Source>, TimeDef extends Record<string, FieldDefLike<TimeLike<never>>>, ValueDef extends Record<string, FieldDefLike<NumberLike | null>>, Track extends string = "default">(opts: TimescopeOptionsSeries<Source, SourceName, TimeDef, ValueDef, Track>, sources?: TimescopeOptionsSources<Source>, tracks?: TimescopeOptionsTracks<Track>) => typeof opts;
424
424
  //#endregion
425
425
  //#region src/main/Timescope.d.ts
426
+ type TimescopeSize = {
427
+ /** Canvas x position in the viewport. */
428
+ x: number;
429
+ /** Canvas y position in the viewport. */
430
+ y: number;
431
+ /** Canvas width in CSS pixels. */
432
+ width: number;
433
+ /** Canvas height in CSS pixels. */
434
+ height: number;
435
+ };
426
436
  type TimescopeUpdateOptions<Source extends Record<string, TimescopeSourceInput>, SourceName extends Record<string, keyof Source>, TimeDef extends Record<string, FieldDefLike<TimeLike<never>>>, ValueDef extends Record<string, FieldDefLike<NumberLike | null>>, Track extends string> = Omit<TimescopeOptions<Source, SourceName, TimeDef, ValueDef, Track>, 'series'> & {
427
437
  series?: { [K in keyof SourceName & keyof TimeDef & keyof ValueDef]: Omit<TimescopeSeriesInput<Source, SourceName[K] & string, TimeDef[K], ValueDef[K], Track>, 'data'> & {
428
438
  data: Omit<TimescopeSeriesInput<Source, SourceName[K] & string, TimeDef[K], ValueDef[K], Track>['data'], 'source'> & {
@@ -434,24 +444,24 @@ type TimescopeFitOptions = {
434
444
  animation?: boolean;
435
445
  padding?: number | [l: number, r: number];
436
446
  };
437
- declare class Timescope<Source extends Record<string, TimescopeSourceInput> = Record<string, TimescopeSourceInput>, SourceName extends Record<string, keyof Source> = Record<string, keyof Source>, TimeDef extends Record<string, FieldDefLike<TimeLike<never>>> = Record<string, FieldDefLike<TimeLike<never>>>, ValueDef extends Record<string, FieldDefLike<NumberLike | null>> = Record<string, FieldDefLike<NumberLike | null>>, Track extends string = string> extends TimescopeObservable<TimescopeEvent<'timechanging', Decimal | null> | TimescopeEvent<'timechanged', Decimal | null> | TimescopeEvent<'timeanimating', Decimal | null> | TimescopeEvent<'zoomchanging', number> | TimescopeEvent<'zoomchanged', number> | TimescopeEvent<'zoomanimating', number> | TimescopeEvent<'rangechanging', Range<Decimal>> | TimescopeEvent<'rangechanged', Range<Decimal> | null>> {
447
+ declare class Timescope<Source extends Record<string, TimescopeSourceInput> = Record<string, TimescopeSourceInput>, SourceName extends Record<string, keyof Source> = Record<string, keyof Source>, TimeDef extends Record<string, FieldDefLike<TimeLike<never>>> = Record<string, FieldDefLike<TimeLike<never>>>, ValueDef extends Record<string, FieldDefLike<NumberLike | null>> = Record<string, FieldDefLike<NumberLike | null>>, Track extends string = string> extends TimescopeObservable<TimescopeEvent<'timechanging', Decimal | null> | TimescopeEvent<'timechanged', Decimal | null> | TimescopeEvent<'timeanimating', Decimal | null> | TimescopeEvent<'zoomchanging', number> | TimescopeEvent<'zoomchanged', number> | TimescopeEvent<'zoomanimating', number> | TimescopeEvent<'rangechanging', TimescopeRange<Decimal>> | TimescopeEvent<'rangechanged', TimescopeRange<Decimal> | null>> {
438
448
  #private;
439
449
  get time(): Decimal | null;
440
450
  set time(v: TimeLike | null);
441
- setTime(v: TimeLike | null, animation?: TimescopeAnimationInput): void;
451
+ setTime(v: TimeLike | null, animation?: TimescopeAnimationInput): boolean;
442
452
  get timeChanging(): Decimal | null;
443
453
  get timeAnimating(): Decimal | null;
444
- get timeRange(): Range<Decimal | null | undefined>;
445
- setTimeRange(domain?: Range<TimeLike | null | undefined>): void;
454
+ get timeRange(): TimescopeRange<Decimal | null | undefined>;
455
+ setTimeRange(domain?: TimescopeRange<TimeLike | null | undefined>): void;
446
456
  get zoom(): number;
447
457
  set zoom(v: ZoomLike);
448
458
  setZoom(v: ZoomLike, animation?: TimescopeAnimationInput): boolean;
449
459
  get zoomChanging(): number;
450
460
  get zoomAnimating(): number;
451
- fitTo(range: Range<TimeLike<never>>, opts?: TimescopeFitOptions): false | undefined;
452
- get zoomRange(): Range<number | undefined>;
453
- setZoomRange(domain?: Range<ZoomLike | undefined>): void;
454
- setSelection(domain: Range<TimeLike<undefined>> | null): void;
461
+ fitTo(range: TimescopeRange<TimeLike<never>>, opts?: TimescopeFitOptions): boolean;
462
+ get zoomRange(): TimescopeRange<number | undefined>;
463
+ setZoomRange(domain?: TimescopeRange<ZoomLike | undefined>): void;
464
+ setSelection(domain: TimescopeRange<TimeLike<undefined>> | null): void;
455
465
  clearSelection(): void;
456
466
  get animating(): boolean;
457
467
  get editing(): boolean;
@@ -469,9 +479,10 @@ declare class Timescope<Source extends Record<string, TimescopeSourceInput> = Re
469
479
  updateOptions(opts: TimescopeUpdateOptions<Source, SourceName, TimeDef, ValueDef, Track>): void;
470
480
  constructor(opts?: TimescopeOptionsInitial<Source, SourceName, TimeDef, ValueDef, Track>);
471
481
  reload(sources?: (keyof SourceName & string)[]): void;
482
+ redraw(): void;
472
483
  mount(target: HTMLElement | string): this;
473
484
  unmount(): void;
474
485
  dispose(): void;
475
486
  }
476
487
  //#endregion
477
- export { AngleStyle, BoxStyle, CalendarLevel, Decimal, type DecimalLike, FieldDefLike, FillStyle, IconStyle, OffsetStyle, PathStyle, SizeStyle, StrokeStyle, TextStyle, TimeFormatFunc, TimeFormatFuncOptions, TimeFormatLabeler, TimeFormatLabelerOptions, Timescope, TimescopeChartLink, TimescopeChartMark, TimescopeChartStyleEntry, TimescopeChartType, type NumberLike as TimescopeNumberLike, type TimescopeOptions, type TimescopeOptionsInitial, TimescopeOptionsSelection, TimescopeOptionsSeries, TimescopeOptionsSources, TimescopeOptionsTracks, TimescopeSeriesInput, TimescopeSourceCommonOptions, TimescopeSourceInput, TimescopeSourceOptions, TimescopeTimeAxisOptions, type TimeLike as TimescopeTimeLike, Using, Using1, Using2, createDefineTimescopeOptions, createDefineTimescopeSeries, createDefineTimescopeSources, createDefineTimescopeTracks, defineTimescopeOptions, defineTimescopeSeries, defineTimescopeSources, defineTimescopeTracks };
488
+ export { AngleStyle, BoxStyle, CalendarLevel, Decimal, type DecimalLike, FieldDefLike, FillStyle, IconStyle, OffsetStyle, PathStyle, SizeStyle, StrokeStyle, TextStyle, TimeFormatFunc, TimeFormatFuncOptions, TimeFormatLabeler, TimeFormatLabelerOptions, Timescope, type TimescopeAnimationInput, TimescopeChartLink, TimescopeChartMark, TimescopeChartStyleEntry, TimescopeChartType, TimescopeFitOptions, type NumberLike as TimescopeNumberLike, type TimescopeOptions, type TimescopeOptionsInitial, TimescopeOptionsSelection, TimescopeOptionsSeries, TimescopeOptionsSources, TimescopeOptionsTracks, type TimescopeRange, TimescopeSeriesInput, TimescopeSize, TimescopeSourceCommonOptions, TimescopeSourceInput, TimescopeSourceOptions, TimescopeTimeAxisOptions, type TimeLike as TimescopeTimeLike, Using, Using1, Using2, createDefineTimescopeOptions, createDefineTimescopeSeries, createDefineTimescopeSources, createDefineTimescopeTracks, defineTimescopeOptions, defineTimescopeSeries, defineTimescopeSources, defineTimescopeTracks };