@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)
@@ -15528,6 +15528,127 @@ function createUpDownMarkers(series, options = {}) {
15528
15528
  return wrapper;
15529
15529
  }
15530
15530
 
15531
+ const timeLabelsOptionsDefaults = {
15532
+ position: 'bottom',
15533
+ offset: 4,
15534
+ fontSize: 11,
15535
+ fontFamily: '',
15536
+ color: '#787B86',
15537
+ };
15538
+
15539
+ class TimeLabelsRenderer {
15540
+ constructor(data) {
15541
+ this._private__data = data;
15542
+ }
15543
+ draw(target) {
15544
+ const { _internal_items: items, _internal_position: position, _internal_offset: offset } = this._private__data;
15545
+ if (items.length === 0) {
15546
+ return;
15547
+ }
15548
+ target.useMediaCoordinateSpace(({ context: ctx, mediaSize }) => {
15549
+ const y = position === 'top' ? offset : mediaSize.height - offset;
15550
+ ctx.save();
15551
+ ctx.textAlign = 'center';
15552
+ ctx.textBaseline = position === 'top' ? 'top' : 'bottom';
15553
+ for (const item of items) {
15554
+ if (item._internal_x < -100 /* Constants.OffscreenMargin */ || item._internal_x > mediaSize.width + 100 /* Constants.OffscreenMargin */) {
15555
+ continue;
15556
+ }
15557
+ ctx.font = item._internal_font;
15558
+ ctx.fillStyle = item._internal_color;
15559
+ ctx.fillText(item._internal_text, item._internal_x, y);
15560
+ }
15561
+ ctx.restore();
15562
+ });
15563
+ }
15564
+ }
15565
+ class TimeLabelsPaneView {
15566
+ constructor() {
15567
+ this._private__data = { _internal_items: [], _internal_position: 'bottom', _internal_offset: 0 };
15568
+ }
15569
+ _internal_update(data) {
15570
+ this._private__data = data;
15571
+ }
15572
+ zOrder() {
15573
+ return 'top';
15574
+ }
15575
+ renderer() {
15576
+ return new TimeLabelsRenderer(this._private__data);
15577
+ }
15578
+ }
15579
+ class TimeLabelsPrimitive {
15580
+ constructor(options) {
15581
+ this._private__chart = null;
15582
+ this._private__requestUpdate = null;
15583
+ this._private__labels = [];
15584
+ this._private__paneView = new TimeLabelsPaneView();
15585
+ this._private__options = { ...timeLabelsOptionsDefaults, ...options };
15586
+ }
15587
+ attached(param) {
15588
+ this._private__chart = param.chart;
15589
+ this._private__requestUpdate = param.requestUpdate;
15590
+ this._private__requestUpdate();
15591
+ }
15592
+ detached() {
15593
+ this._private__chart = null;
15594
+ this._private__requestUpdate = null;
15595
+ }
15596
+ _internal_setLabels(labels) {
15597
+ this._private__labels = labels.slice();
15598
+ this._private__requestUpdate?.();
15599
+ }
15600
+ _internal_labels() {
15601
+ return this._private__labels;
15602
+ }
15603
+ _internal_applyOptions(options) {
15604
+ this._private__options = { ...this._private__options, ...options };
15605
+ this._private__requestUpdate?.();
15606
+ }
15607
+ updateAllViews() {
15608
+ const chart = this._private__chart;
15609
+ const options = this._private__options;
15610
+ if (chart === null) {
15611
+ this._private__paneView._internal_update({ _internal_items: [], _internal_position: options.position, _internal_offset: options.offset });
15612
+ return;
15613
+ }
15614
+ const timeScale = chart.timeScale();
15615
+ const family = options.fontFamily || chart.options().layout.fontFamily;
15616
+ const items = [];
15617
+ for (const label of this._private__labels) {
15618
+ const x = timeScale.timeToCoordinate(label.time);
15619
+ if (x === null) {
15620
+ continue;
15621
+ }
15622
+ items.push({
15623
+ _internal_x: x,
15624
+ _internal_text: label.text,
15625
+ _internal_color: label.color ?? options.color,
15626
+ _internal_font: makeFont(label.size ?? options.fontSize, family),
15627
+ });
15628
+ }
15629
+ this._private__paneView._internal_update({ _internal_items: items, _internal_position: options.position, _internal_offset: options.offset });
15630
+ }
15631
+ paneViews() {
15632
+ return [this._private__paneView];
15633
+ }
15634
+ }
15635
+
15636
+ class TimeLabelsPrimitiveWrapper extends SeriesPrimitiveAdapter {
15637
+ setLabels(labels) {
15638
+ this._internal__primitive._internal_setLabels(labels);
15639
+ }
15640
+ labels() {
15641
+ return this._internal__primitive._internal_labels();
15642
+ }
15643
+ }
15644
+ function createTimeLabels(series, labels, options) {
15645
+ const wrapper = new TimeLabelsPrimitiveWrapper(series, new TimeLabelsPrimitive(options));
15646
+ if (labels) {
15647
+ wrapper.setLabels(labels);
15648
+ }
15649
+ return wrapper;
15650
+ }
15651
+
15531
15652
  class PositionMarkersManager {
15532
15653
  constructor(series, options) {
15533
15654
  this._private__markersPlugin = null;
@@ -27436,6 +27557,13 @@ class BrushTool extends DrawingToolBase {
27436
27557
  isDrawingModeActive() {
27437
27558
  return this._private__drawingModeActive;
27438
27559
  }
27560
+ /**
27561
+ * A brush armed for its next stroke is not a drawing yet: it stays out of the
27562
+ * undo history, where restoring it would re-arm a brush the app does not hold.
27563
+ */
27564
+ isComplete() {
27565
+ return (this._private__brushOptions.points ?? []).length > 0;
27566
+ }
27439
27567
  _private__onPointerDown(event) {
27440
27568
  // A press over an existing drawing belongs to that drawing: it is how the
27441
27569
  // user grabs or selects one without putting the brush away first.
@@ -30309,7 +30437,22 @@ class DrawingToolsManager {
30309
30437
  _private__applySnapshot(snapshot) {
30310
30438
  this._private__restoring = true;
30311
30439
  try {
30312
- this.restoreAll({ chart: this._private__chart, series: this._private__series }, snapshot, true);
30440
+ // The history only holds placed drawings, so a tool still being drawn
30441
+ // stays: undoing with the brush armed must leave it armed.
30442
+ this._private__applySelection(null);
30443
+ for (const [id, tool] of Array.from(this._private__tools)) {
30444
+ if (!tool.isComplete()) {
30445
+ continue;
30446
+ }
30447
+ tool.remove();
30448
+ this._private__tools.delete(id);
30449
+ this._private__pendingToolIds.delete(id);
30450
+ }
30451
+ // Annotated, or the build renames the keys the tools read
30452
+ const context = { chart: this._private__chart, series: this._private__series };
30453
+ for (const data of snapshot) {
30454
+ this.restoreTool(context, data);
30455
+ }
30313
30456
  this._private__committed = snapshot;
30314
30457
  }
30315
30458
  finally {
@@ -30917,6 +31060,8 @@ class DrawingToolsManager {
30917
31060
  event.preventDefault();
30918
31061
  }
30919
31062
  _private__handlePointerUp(event) {
31063
+ // A brush stroke ends here, and no click follows it to run the check
31064
+ this._private__scheduleCompletionCheck();
30920
31065
  if (!this._private__isDragging || this._private__draggedToolId === null) {
30921
31066
  return;
30922
31067
  }
@@ -31089,7 +31234,7 @@ const customSeriesDefaultOptions = {
31089
31234
  * Returns the current version as a string. For example `'1.0.0'`.
31090
31235
  */
31091
31236
  function version() {
31092
- return "2.3.17-dev+202610130113";
31237
+ return "2.3.19-dev+202610211514";
31093
31238
  }
31094
31239
 
31095
- 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 };
31240
+ 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 };