@tradecanvas/chart 2.0.0-beta.1 → 2.0.0-beta.3

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, a as l, b as u, c as ee, d, f as te, g as ne, h as f, i as re, j as ie, k as ae, l as p, m as oe, n as se, p as ce, r as le, s as m, t as ue, w as de, x as fe, y as pe } from "./LayoutSession-D1AIWXuH.js";
1
+ import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, a as l, b as u, c as ee, d, f as te, g as ne, h as f, i as re, j as ie, k as ae, l as p, m as oe, n as se, p as ce, r as le, s as m, t as ue, w as de, x as fe, y as pe } from "./LayoutSession-CV28T-KY.js";
2
2
  import { CHART_SPACING as me, CHART_STYLE_KEYS as he, DARK_PRICE_LIMITS as ge, DARK_TERMINAL as _e, DARK_THEME as ve, DARK_THEME as ye, DEFAULT_DRAWING_STYLE as be, DEFAULT_FONT_FAMILY as xe, DEFAULT_RECONNECT as Se, DEFAULT_SIGNAL_STYLE as Ce, DEFAULT_STREAM_CONFIG as we, DEFAULT_TIMEFRAME_FAVORITES as Te, DEFAULT_TRADE_ZONE_STYLE as Ee, DEFAULT_TRADING_CONFIG as De, HNX_SESSIONS as Oe, HOSE_SESSIONS as ke, KRX_SESSIONS as Ae, KR_COLORS as je, LIGHT_PRICE_LIMITS as Me, LIGHT_THEME as Ne, LIGHT_THEME as Pe, MARKET_CRYPTO as Fe, MARKET_HNX as Ie, MARKET_HOSE as Le, MARKET_HOSE_ETF as h, MARKET_KRX as g, MARKET_NXT as Re, MARKET_NYSE as ze, MARKET_UPBIT_KRW as Be, MARKET_UPCOM as Ve, MARKET_VN30F as He, MS_TIME_THRESHOLD as Ue, NXT_SESSIONS as We, PRICE_SOURCES as Ge, SANS_FONT_FAMILY as Ke, TC_PALETTE as qe, TC_SERIES_COLORS as Je, TIMEFRAMES_CRYPTO as Ye, TIMEFRAMES_FOREX as Xe, TIMEFRAMES_STOCK as Ze, UPCOM_SESSIONS as Qe, VN30F_SESSIONS as $e, VN_COLORS as et, VOLUME_ALPHA as tt, barTimeUnit as nt, barsAreDaily as rt, computePriceLimits as it, contrastRatio as at, createMarketTheme as ot, createVNTheme as st, formatFraction as ct, formatNumber as lt, formatVND as ut, formatVolumeLoc as dt, fractionTick as ft, getCurrentSession as pt, getLocale as mt, indicatorSource as ht, inkOn as gt, isPriceSource as _t, isTimeFrame as vt, isValidTimeZone as yt, marketStatus as bt, normalizeBar as xt, normalizeBarTime as St, offsetAt as Ct, parseIndicatorSource as wt, parseTimeframe as Tt, pickBaseTimeframe as Et, priceFormatterFor as Dt, priceStepAt as Ot, rankSymbols as kt, readNews as At, readQuote as jt, readableOn as Mt, registerLocale as Nt, resampleBars as Pt, roundToPriceStep as Ft, scaleMarketPrices as It, setLocale as Lt, sourcePrice as Rt, stepDecimals as zt, symbolTimeZone as Bt, t as Vt, tickBarCount as Ht, tickerOf as Ut, timeframeBucketStart as Wt, timeframeBucketStart as Gt, timeframeToMs as Kt, usesKoreanUnits as qt, vn30fContracts as Jt, vn30fLastTradingDay as Yt, volumeColor as Xt, wallToUtc as Zt, zoneOffsetMinutes as Qt } from "@tradecanvas/commons";
3
3
  import { AlertManager as $t, Animator as en, BarCountdown as tn, BaseFinanceChart as _, BinanceAdapter as nn, BybitAdapter as rn, CANDLE_PATTERNS as an, ChartLegend as on, ChartStateManager as sn, CoinbaseAdapter as cn, CompareRenderer as ln, CrosshairTooltip as un, CurrentPriceLine as dn, DEFAULT_LEGEND_CONFIG as fn, DEFAULT_MAX_WEBGL_CHARTS as pn, DEFAULT_SESSION_HOURS as mn, DataExporter as hn, DrawingBase as gn, Easing as _n, FinanceCrosshair as v, GROUP_HEADER as vn, INDICATOR_CATEGORIES as yn, IndicatorBase as bn, IndicatorValueMap as xn, KEPT_BUCKETS as Sn, KeyboardHandler as Cn, KrakenAdapter as wn, MAX_ALERT_BARS as Tn, MIN_ALERT_BARS as En, ManualFeed as Dn, MockAdapter as On, PaperExecutionAdapter as kn, PollingAdapter as An, RANGE_PRESETS as jn, ReconnectManager as Mn, ReplayController as Nn, ReplayManager as Pn, ResamplingAdapter as Fn, ReshapeMemo as In, Screenshot as Ln, SessionBreaks as Rn, SessionShading as zn, SignalMarkerManager as Bn, StreamManager as Vn, TickAggregator as Hn, TickBarAdapter as Un, TickBarBuilder as Wn, TradeZoneManager as Gn, UndoRedoManager as y, UpbitAdapter as Kn, VolumeRenderer as qn, Watermark as Jn, WebSocketAdapter as Yn, adapterFromFeed as Xn, axisTimes as Zn, barIndexToTime as Qn, barIndexToX as $n, barIndexToX as b, canvasMeasure as er, computeBarLayout as tr, computeCalendarLayout as nr, computeCounterClockLayout as rr, computeDonutLayout as ir, computeHistogramLayout as ar, computeMatrixLayout as or, computeScatterLayout as sr, correlationMatrix as cr, counterClockPhase as lr, counterClockPhase as ur, counterClockPoints as dr, counterClockPoints as fr, describeInputs as pr, detectCandlePatterns as mr, feedFromAdapter as hr, formatTooltipTime as gr, histogramBins as _r, hitBar as x, hitDay as S, hitMatrixCell as C, hitSlice as w, indicatorCategory as vr, isDataFeed as yr, isDataFeed as br, isPriceLevelAlert as xr, layoutGroupedTreemap as Sr, layoutSquarifiedTreemap as Cr, layoutUniformGrid as wr, lttbDownsample as Tr, lttbVisibleIndices as Er, nearestCounterClockPoint as T, nearestPoint as E, niceScale as Dr, priceToY as Or, priceToYMapper as kr, priceToYMapper as Ar, rangePresetStart as jr, renderBarChart as Mr, renderCalendar as Nr, renderCounterClock as Pr, renderDepthChart as Fr, renderDonut as Ir, renderEquityCurve as Lr, renderGauge as Rr, renderHeatmap as zr, renderHistogram as Br, renderMatrix as Vr, renderScatter as Hr, renderSparkline as Ur, renderWaterfall as Wr, servesTimeframe as Gr, setMaxWebGLCharts as Kr, shownCount as qr, timeToX as Jr, timestampToBarIndex as Yr, timestampToBarIndex as Xr, toHeikinAshi as Zr, toKagi as Qr, toLineBreak as $r, toPointAndFigure as ei, toRangeBars as ti, toRenko as ni, withResampling as ri, withTickBars as ii, xToBarIndex as ai, xToBarIndex as D, xToTime as oi, yToPrice as si, yToPrice as ci } from "@tradecanvas/core";
4
4
  //#region src/frameworks/syncIndicators.ts
@@ -275,7 +275,7 @@ var ki = class {
275
275
  }, Ai = class extends _ {
276
276
  options;
277
277
  constructor(e, t) {
278
- super(e, t.theme), this.options = t, this.requestRender();
278
+ super(e, t.theme), this.options = t, this.applyBaseOptions({ ariaLabel: t.ariaLabel }), this.requestRender();
279
279
  }
280
280
  renderChart(e, t, n, r) {
281
281
  Ur(e, t, n, this.options, r);
@@ -290,16 +290,18 @@ var ki = class {
290
290
  this.options = {
291
291
  ...this.options,
292
292
  ...e
293
- }, this.requestRender();
293
+ }, this.applyBaseOptions(e), this.requestRender();
294
294
  }
295
295
  }, ji = class extends _ {
296
296
  options;
297
- crosshair = null;
297
+ crosshair;
298
298
  constructor(e, t) {
299
- super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new v(this.canvas, () => this.requestRender())), this.requestRender();
299
+ super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
300
+ this.options.crosshair !== !1 && this.requestRender();
301
+ }), this.applyBaseOptions({ ariaLabel: t.ariaLabel }), this.requestRender();
300
302
  }
301
303
  renderChart(e, t, n, r) {
302
- let i = this.crosshair?.getPosition() ?? null;
304
+ let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
303
305
  Fr(e, t, n, this.options, r, i);
304
306
  }
305
307
  update(e) {
@@ -312,19 +314,21 @@ var ki = class {
312
314
  this.options = {
313
315
  ...this.options,
314
316
  ...e
315
- }, this.requestRender();
317
+ }, this.applyBaseOptions(e), this.requestRender();
316
318
  }
317
319
  destroy() {
318
- this.crosshair?.destroy(), super.destroy();
320
+ this.crosshair.destroy(), super.destroy();
319
321
  }
320
322
  }, H = class extends _ {
321
323
  options;
322
- crosshair = null;
324
+ crosshair;
323
325
  constructor(e, t) {
324
- super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new v(this.canvas, () => this.requestRender())), this.requestRender();
326
+ super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
327
+ this.options.crosshair !== !1 && this.requestRender();
328
+ }), this.applyBaseOptions({ ariaLabel: t.ariaLabel }), this.requestRender();
325
329
  }
326
330
  renderChart(e, t, n, r) {
327
- let i = this.crosshair?.getPosition() ?? null;
331
+ let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
328
332
  Lr(e, t, n, this.options, r, i);
329
333
  }
330
334
  update(e, t) {
@@ -340,25 +344,27 @@ var ki = class {
340
344
  this.options = {
341
345
  ...this.options,
342
346
  ...e
343
- }, this.requestRender();
347
+ }, this.applyBaseOptions(e), this.requestRender();
344
348
  }
345
349
  destroy() {
346
- this.crosshair?.destroy(), super.destroy();
350
+ this.crosshair.destroy(), super.destroy();
347
351
  }
348
352
  }, U = class extends _ {
349
353
  options;
350
- crosshair = null;
354
+ crosshair;
351
355
  cachedRects = [];
352
356
  cachedGroups = [];
353
357
  currentData = [];
354
358
  lastLayoutWidth = 0;
355
359
  lastLayoutHeight = 0;
356
- handleClick = null;
360
+ handleClick = (e) => {
361
+ let t = this.canvas.getBoundingClientRect();
362
+ this.onCanvasClick(e.clientX - t.left, e.clientY - t.top);
363
+ };
357
364
  constructor(e, t) {
358
- super(e, t.theme), this.options = t, this.currentData = t.data ?? [], t.crosshair !== !1 && (this.crosshair = new v(this.canvas, () => this.requestRender())), t.onCellClick && (this.handleClick = (e) => {
359
- let t = this.canvas.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
360
- this.onCanvasClick(n, r);
361
- }, this.canvas.addEventListener("click", this.handleClick)), this.applyLabel(), this.recomputeLayout(), this.requestRender();
365
+ super(e, t.theme), this.options = t, this.currentData = t.data ?? [], this.crosshair = new v(this.canvas, () => {
366
+ this.options.crosshair !== !1 && this.requestRender();
367
+ }), this.canvas.addEventListener("click", this.handleClick), this.applyLabel(), this.recomputeLayout(), this.requestRender();
362
368
  }
363
369
  applyLabel() {
364
370
  let e = new Set(this.currentData.map((e) => e.group).filter(Boolean)).size, t = this.options.grouped && e > 0 ? `Market map of ${this.currentData.length} cells in ${e} groups` : `Heatmap of ${this.currentData.length} cells`;
@@ -399,7 +405,7 @@ var ki = class {
399
405
  }
400
406
  renderChart(e, t, n, r) {
401
407
  (t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
402
- let i = this.crosshair?.getPosition() ?? null;
408
+ let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
403
409
  zr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
404
410
  }
405
411
  update(e) {
@@ -412,19 +418,21 @@ var ki = class {
412
418
  this.options = {
413
419
  ...this.options,
414
420
  ...e
415
- }, e.data && (this.currentData = e.data), this.applyLabel(), this.recomputeLayout(), this.requestRender();
421
+ }, "theme" in e && this.applyBaseOptions({ theme: e.theme }), e.data && (this.currentData = e.data), this.applyLabel(), this.recomputeLayout(), this.requestRender();
416
422
  }
417
423
  destroy() {
418
- this.crosshair?.destroy(), this.handleClick && this.canvas.removeEventListener("click", this.handleClick), super.destroy();
424
+ this.crosshair.destroy(), this.canvas.removeEventListener("click", this.handleClick), super.destroy();
419
425
  }
420
426
  }, Mi = class extends _ {
421
427
  options;
422
- crosshair = null;
428
+ crosshair;
423
429
  constructor(e, t) {
424
- super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new v(this.canvas, () => this.requestRender())), this.requestRender();
430
+ super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
431
+ this.options.crosshair !== !1 && this.requestRender();
432
+ }), this.applyBaseOptions({ ariaLabel: t.ariaLabel }), this.requestRender();
425
433
  }
426
434
  renderChart(e, t, n, r) {
427
- let i = this.crosshair?.getPosition() ?? null;
435
+ let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
428
436
  Wr(e, t, n, this.options, r, i);
429
437
  }
430
438
  update(e) {
@@ -437,10 +445,10 @@ var ki = class {
437
445
  this.options = {
438
446
  ...this.options,
439
447
  ...e
440
- }, this.requestRender();
448
+ }, this.applyBaseOptions(e), this.requestRender();
441
449
  }
442
450
  destroy() {
443
- this.crosshair?.destroy(), super.destroy();
451
+ this.crosshair.destroy(), super.destroy();
444
452
  }
445
453
  }, Ni = 500;
446
454
  function Pi(e) {
@@ -455,7 +463,7 @@ var Fi = class extends _ {
455
463
  animationFrom = 0;
456
464
  animationFrameId = null;
457
465
  constructor(e, t) {
458
- super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.requestRender();
466
+ super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.applyBaseOptions({ ariaLabel: t.ariaLabel }), this.requestRender();
459
467
  }
460
468
  renderChart(e, t, n, r) {
461
469
  Rr(e, t, n, this.options, r, this.currentValue);
@@ -478,7 +486,7 @@ var Fi = class extends _ {
478
486
  ...this.options,
479
487
  ...e
480
488
  };
481
- if (e.value !== void 0 && e.value !== this.targetValue) {
489
+ if (this.applyBaseOptions(e), e.value !== void 0 && e.value !== this.targetValue) {
482
490
  this.options = t, this.setValue(e.value);
483
491
  return;
484
492
  }