@pipsend/charts 2.3.17 → 2.3.19

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v2.3.17-dev+202610130113
3
+ * Pipsend Charts v2.3.19-dev+202610211514
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -15924,6 +15924,127 @@
15924
15924
  return wrapper;
15925
15925
  }
15926
15926
 
15927
+ const timeLabelsOptionsDefaults = {
15928
+ position: 'bottom',
15929
+ offset: 4,
15930
+ fontSize: 11,
15931
+ fontFamily: '',
15932
+ color: '#787B86',
15933
+ };
15934
+
15935
+ class TimeLabelsRenderer {
15936
+ constructor(data) {
15937
+ this._private__data = data;
15938
+ }
15939
+ draw(target) {
15940
+ const { _internal_items: items, _internal_position: position, _internal_offset: offset } = this._private__data;
15941
+ if (items.length === 0) {
15942
+ return;
15943
+ }
15944
+ target.useMediaCoordinateSpace(({ context: ctx, mediaSize }) => {
15945
+ const y = position === 'top' ? offset : mediaSize.height - offset;
15946
+ ctx.save();
15947
+ ctx.textAlign = 'center';
15948
+ ctx.textBaseline = position === 'top' ? 'top' : 'bottom';
15949
+ for (const item of items) {
15950
+ if (item._internal_x < -100 /* Constants.OffscreenMargin */ || item._internal_x > mediaSize.width + 100 /* Constants.OffscreenMargin */) {
15951
+ continue;
15952
+ }
15953
+ ctx.font = item._internal_font;
15954
+ ctx.fillStyle = item._internal_color;
15955
+ ctx.fillText(item._internal_text, item._internal_x, y);
15956
+ }
15957
+ ctx.restore();
15958
+ });
15959
+ }
15960
+ }
15961
+ class TimeLabelsPaneView {
15962
+ constructor() {
15963
+ this._private__data = { _internal_items: [], _internal_position: 'bottom', _internal_offset: 0 };
15964
+ }
15965
+ _internal_update(data) {
15966
+ this._private__data = data;
15967
+ }
15968
+ zOrder() {
15969
+ return 'top';
15970
+ }
15971
+ renderer() {
15972
+ return new TimeLabelsRenderer(this._private__data);
15973
+ }
15974
+ }
15975
+ class TimeLabelsPrimitive {
15976
+ constructor(options) {
15977
+ this._private__chart = null;
15978
+ this._private__requestUpdate = null;
15979
+ this._private__labels = [];
15980
+ this._private__paneView = new TimeLabelsPaneView();
15981
+ this._private__options = { ...timeLabelsOptionsDefaults, ...options };
15982
+ }
15983
+ attached(param) {
15984
+ this._private__chart = param.chart;
15985
+ this._private__requestUpdate = param.requestUpdate;
15986
+ this._private__requestUpdate();
15987
+ }
15988
+ detached() {
15989
+ this._private__chart = null;
15990
+ this._private__requestUpdate = null;
15991
+ }
15992
+ _internal_setLabels(labels) {
15993
+ this._private__labels = labels.slice();
15994
+ this._private__requestUpdate?.();
15995
+ }
15996
+ _internal_labels() {
15997
+ return this._private__labels;
15998
+ }
15999
+ _internal_applyOptions(options) {
16000
+ this._private__options = { ...this._private__options, ...options };
16001
+ this._private__requestUpdate?.();
16002
+ }
16003
+ updateAllViews() {
16004
+ const chart = this._private__chart;
16005
+ const options = this._private__options;
16006
+ if (chart === null) {
16007
+ this._private__paneView._internal_update({ _internal_items: [], _internal_position: options.position, _internal_offset: options.offset });
16008
+ return;
16009
+ }
16010
+ const timeScale = chart.timeScale();
16011
+ const family = options.fontFamily || chart.options().layout.fontFamily;
16012
+ const items = [];
16013
+ for (const label of this._private__labels) {
16014
+ const x = timeScale.timeToCoordinate(label.time);
16015
+ if (x === null) {
16016
+ continue;
16017
+ }
16018
+ items.push({
16019
+ _internal_x: x,
16020
+ _internal_text: label.text,
16021
+ _internal_color: label.color ?? options.color,
16022
+ _internal_font: makeFont(label.size ?? options.fontSize, family),
16023
+ });
16024
+ }
16025
+ this._private__paneView._internal_update({ _internal_items: items, _internal_position: options.position, _internal_offset: options.offset });
16026
+ }
16027
+ paneViews() {
16028
+ return [this._private__paneView];
16029
+ }
16030
+ }
16031
+
16032
+ class TimeLabelsPrimitiveWrapper extends SeriesPrimitiveAdapter {
16033
+ setLabels(labels) {
16034
+ this._internal__primitive._internal_setLabels(labels);
16035
+ }
16036
+ labels() {
16037
+ return this._internal__primitive._internal_labels();
16038
+ }
16039
+ }
16040
+ function createTimeLabels(series, labels, options) {
16041
+ const wrapper = new TimeLabelsPrimitiveWrapper(series, new TimeLabelsPrimitive(options));
16042
+ if (labels) {
16043
+ wrapper.setLabels(labels);
16044
+ }
16045
+ return wrapper;
16046
+ }
16047
+
15927
16048
  class PositionMarkersManager {
15928
16049
  constructor(series, options) {
15929
16050
  this._private__markersPlugin = null;
@@ -27832,6 +27953,13 @@
27832
27953
  isDrawingModeActive() {
27833
27954
  return this._private__drawingModeActive;
27834
27955
  }
27956
+ /**
27957
+ * A brush armed for its next stroke is not a drawing yet: it stays out of the
27958
+ * undo history, where restoring it would re-arm a brush the app does not hold.
27959
+ */
27960
+ isComplete() {
27961
+ return (this._private__brushOptions.points ?? []).length > 0;
27962
+ }
27835
27963
  _private__onPointerDown(event) {
27836
27964
  // A press over an existing drawing belongs to that drawing: it is how the
27837
27965
  // user grabs or selects one without putting the brush away first.
@@ -30705,7 +30833,22 @@
30705
30833
  _private__applySnapshot(snapshot) {
30706
30834
  this._private__restoring = true;
30707
30835
  try {
30708
- this.restoreAll({ chart: this._private__chart, series: this._private__series }, snapshot, true);
30836
+ // The history only holds placed drawings, so a tool still being drawn
30837
+ // stays: undoing with the brush armed must leave it armed.
30838
+ this._private__applySelection(null);
30839
+ for (const [id, tool] of Array.from(this._private__tools)) {
30840
+ if (!tool.isComplete()) {
30841
+ continue;
30842
+ }
30843
+ tool.remove();
30844
+ this._private__tools.delete(id);
30845
+ this._private__pendingToolIds.delete(id);
30846
+ }
30847
+ // Annotated, or the build renames the keys the tools read
30848
+ const context = { chart: this._private__chart, series: this._private__series };
30849
+ for (const data of snapshot) {
30850
+ this.restoreTool(context, data);
30851
+ }
30709
30852
  this._private__committed = snapshot;
30710
30853
  }
30711
30854
  finally {
@@ -31313,6 +31456,8 @@
31313
31456
  event.preventDefault();
31314
31457
  }
31315
31458
  _private__handlePointerUp(event) {
31459
+ // A brush stroke ends here, and no click follows it to run the check
31460
+ this._private__scheduleCompletionCheck();
31316
31461
  if (!this._private__isDragging || this._private__draggedToolId === null) {
31317
31462
  return;
31318
31463
  }
@@ -31485,7 +31630,7 @@
31485
31630
  * Returns the current version as a string. For example `'1.0.0'`.
31486
31631
  */
31487
31632
  function version() {
31488
- return "2.3.17-dev+202610130113";
31633
+ return "2.3.19-dev+202610211514";
31489
31634
  }
31490
31635
 
31491
31636
  var PipsendChartsModule = /*#__PURE__*/Object.freeze({
@@ -31587,6 +31732,7 @@
31587
31732
  createSeriesMarkers: createSeriesMarkers,
31588
31733
  createTextTool: createTextTool,
31589
31734
  createTextWatermark: createTextWatermark,
31735
+ createTimeLabels: createTimeLabels,
31590
31736
  createTradingLine: createTradingLine,
31591
31737
  createTradingSessionsIndicator: createTradingSessionsIndicator,
31592
31738
  createTrendLineTool: createTrendLineTool,
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v2.3.17-dev+202610130113
3
+ * Pipsend Charts v2.3.19-dev+202610211514
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -15921,6 +15921,127 @@ function createUpDownMarkers(series, options = {}) {
15921
15921
  return wrapper;
15922
15922
  }
15923
15923
 
15924
+ const timeLabelsOptionsDefaults = {
15925
+ position: 'bottom',
15926
+ offset: 4,
15927
+ fontSize: 11,
15928
+ fontFamily: '',
15929
+ color: '#787B86',
15930
+ };
15931
+
15932
+ class TimeLabelsRenderer {
15933
+ constructor(data) {
15934
+ this._private__data = data;
15935
+ }
15936
+ draw(target) {
15937
+ const { _internal_items: items, _internal_position: position, _internal_offset: offset } = this._private__data;
15938
+ if (items.length === 0) {
15939
+ return;
15940
+ }
15941
+ target.useMediaCoordinateSpace(({ context: ctx, mediaSize }) => {
15942
+ const y = position === 'top' ? offset : mediaSize.height - offset;
15943
+ ctx.save();
15944
+ ctx.textAlign = 'center';
15945
+ ctx.textBaseline = position === 'top' ? 'top' : 'bottom';
15946
+ for (const item of items) {
15947
+ if (item._internal_x < -100 /* Constants.OffscreenMargin */ || item._internal_x > mediaSize.width + 100 /* Constants.OffscreenMargin */) {
15948
+ continue;
15949
+ }
15950
+ ctx.font = item._internal_font;
15951
+ ctx.fillStyle = item._internal_color;
15952
+ ctx.fillText(item._internal_text, item._internal_x, y);
15953
+ }
15954
+ ctx.restore();
15955
+ });
15956
+ }
15957
+ }
15958
+ class TimeLabelsPaneView {
15959
+ constructor() {
15960
+ this._private__data = { _internal_items: [], _internal_position: 'bottom', _internal_offset: 0 };
15961
+ }
15962
+ _internal_update(data) {
15963
+ this._private__data = data;
15964
+ }
15965
+ zOrder() {
15966
+ return 'top';
15967
+ }
15968
+ renderer() {
15969
+ return new TimeLabelsRenderer(this._private__data);
15970
+ }
15971
+ }
15972
+ class TimeLabelsPrimitive {
15973
+ constructor(options) {
15974
+ this._private__chart = null;
15975
+ this._private__requestUpdate = null;
15976
+ this._private__labels = [];
15977
+ this._private__paneView = new TimeLabelsPaneView();
15978
+ this._private__options = { ...timeLabelsOptionsDefaults, ...options };
15979
+ }
15980
+ attached(param) {
15981
+ this._private__chart = param.chart;
15982
+ this._private__requestUpdate = param.requestUpdate;
15983
+ this._private__requestUpdate();
15984
+ }
15985
+ detached() {
15986
+ this._private__chart = null;
15987
+ this._private__requestUpdate = null;
15988
+ }
15989
+ _internal_setLabels(labels) {
15990
+ this._private__labels = labels.slice();
15991
+ this._private__requestUpdate?.();
15992
+ }
15993
+ _internal_labels() {
15994
+ return this._private__labels;
15995
+ }
15996
+ _internal_applyOptions(options) {
15997
+ this._private__options = { ...this._private__options, ...options };
15998
+ this._private__requestUpdate?.();
15999
+ }
16000
+ updateAllViews() {
16001
+ const chart = this._private__chart;
16002
+ const options = this._private__options;
16003
+ if (chart === null) {
16004
+ this._private__paneView._internal_update({ _internal_items: [], _internal_position: options.position, _internal_offset: options.offset });
16005
+ return;
16006
+ }
16007
+ const timeScale = chart.timeScale();
16008
+ const family = options.fontFamily || chart.options().layout.fontFamily;
16009
+ const items = [];
16010
+ for (const label of this._private__labels) {
16011
+ const x = timeScale.timeToCoordinate(label.time);
16012
+ if (x === null) {
16013
+ continue;
16014
+ }
16015
+ items.push({
16016
+ _internal_x: x,
16017
+ _internal_text: label.text,
16018
+ _internal_color: label.color ?? options.color,
16019
+ _internal_font: makeFont(label.size ?? options.fontSize, family),
16020
+ });
16021
+ }
16022
+ this._private__paneView._internal_update({ _internal_items: items, _internal_position: options.position, _internal_offset: options.offset });
16023
+ }
16024
+ paneViews() {
16025
+ return [this._private__paneView];
16026
+ }
16027
+ }
16028
+
16029
+ class TimeLabelsPrimitiveWrapper extends SeriesPrimitiveAdapter {
16030
+ setLabels(labels) {
16031
+ this._internal__primitive._internal_setLabels(labels);
16032
+ }
16033
+ labels() {
16034
+ return this._internal__primitive._internal_labels();
16035
+ }
16036
+ }
16037
+ function createTimeLabels(series, labels, options) {
16038
+ const wrapper = new TimeLabelsPrimitiveWrapper(series, new TimeLabelsPrimitive(options));
16039
+ if (labels) {
16040
+ wrapper.setLabels(labels);
16041
+ }
16042
+ return wrapper;
16043
+ }
16044
+
15924
16045
  class PositionMarkersManager {
15925
16046
  constructor(series, options) {
15926
16047
  this._private__markersPlugin = null;
@@ -27829,6 +27950,13 @@ class BrushTool extends DrawingToolBase {
27829
27950
  isDrawingModeActive() {
27830
27951
  return this._private__drawingModeActive;
27831
27952
  }
27953
+ /**
27954
+ * A brush armed for its next stroke is not a drawing yet: it stays out of the
27955
+ * undo history, where restoring it would re-arm a brush the app does not hold.
27956
+ */
27957
+ isComplete() {
27958
+ return (this._private__brushOptions.points ?? []).length > 0;
27959
+ }
27832
27960
  _private__onPointerDown(event) {
27833
27961
  // A press over an existing drawing belongs to that drawing: it is how the
27834
27962
  // user grabs or selects one without putting the brush away first.
@@ -30702,7 +30830,22 @@ class DrawingToolsManager {
30702
30830
  _private__applySnapshot(snapshot) {
30703
30831
  this._private__restoring = true;
30704
30832
  try {
30705
- this.restoreAll({ chart: this._private__chart, series: this._private__series }, snapshot, true);
30833
+ // The history only holds placed drawings, so a tool still being drawn
30834
+ // stays: undoing with the brush armed must leave it armed.
30835
+ this._private__applySelection(null);
30836
+ for (const [id, tool] of Array.from(this._private__tools)) {
30837
+ if (!tool.isComplete()) {
30838
+ continue;
30839
+ }
30840
+ tool.remove();
30841
+ this._private__tools.delete(id);
30842
+ this._private__pendingToolIds.delete(id);
30843
+ }
30844
+ // Annotated, or the build renames the keys the tools read
30845
+ const context = { chart: this._private__chart, series: this._private__series };
30846
+ for (const data of snapshot) {
30847
+ this.restoreTool(context, data);
30848
+ }
30706
30849
  this._private__committed = snapshot;
30707
30850
  }
30708
30851
  finally {
@@ -31310,6 +31453,8 @@ class DrawingToolsManager {
31310
31453
  event.preventDefault();
31311
31454
  }
31312
31455
  _private__handlePointerUp(event) {
31456
+ // A brush stroke ends here, and no click follows it to run the check
31457
+ this._private__scheduleCompletionCheck();
31313
31458
  if (!this._private__isDragging || this._private__draggedToolId === null) {
31314
31459
  return;
31315
31460
  }
@@ -31482,7 +31627,7 @@ const customSeriesDefaultOptions = {
31482
31627
  * Returns the current version as a string. For example `'1.0.0'`.
31483
31628
  */
31484
31629
  function version() {
31485
- return "2.3.17-dev+202610130113";
31630
+ return "2.3.19-dev+202610211514";
31486
31631
  }
31487
31632
 
31488
- export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrossLineTool, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, ParallelChannelTool, PitchforkTool, PolygonTool, PositionCalculator, PositionLine, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyADX, applyATR, applyBollingerBands, applyCCI, applyDonchianChannels, applyEMA, applyHeikinAshi, applyIchimoku, applyKeltnerChannels, applyMACD, applyMFI, applyOBV, applyParabolicSAR, applyPivotPoints, applyRSI, applySMA, applyStochastic, applySuperTrend, applyVWAP, applyVolume, applyWMA, applyWilliamsR, calculateHeikinAshi, calculatePipConfig, coordinateFromTime, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createCrossLineTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createParallelChannelTool, createPitchforkTool, createPolygonTool, createPositionLine, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, hideSeriesPaint, isBusinessDay, isUTCTimestamp, setSeriesVolumes, setVolumeProfileData, timeFromCoordinate, version };
31633
+ export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrossLineTool, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, ParallelChannelTool, PitchforkTool, PolygonTool, PositionCalculator, PositionLine, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyADX, applyATR, applyBollingerBands, applyCCI, applyDonchianChannels, applyEMA, applyHeikinAshi, applyIchimoku, applyKeltnerChannels, applyMACD, applyMFI, applyOBV, applyParabolicSAR, applyPivotPoints, applyRSI, applySMA, applyStochastic, applySuperTrend, applyVWAP, applyVolume, applyWMA, applyWilliamsR, calculateHeikinAshi, calculatePipConfig, coordinateFromTime, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createCrossLineTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createParallelChannelTool, createPitchforkTool, createPolygonTool, createPositionLine, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTimeLabels, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, hideSeriesPaint, isBusinessDay, isUTCTimestamp, setSeriesVolumes, setVolumeProfileData, timeFromCoordinate, version };