@pipsend/charts 2.3.2 → 2.3.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v2.3.2
3
+ * Pipsend Charts v2.3.3
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -2485,6 +2485,22 @@
2485
2485
  // Used to avoid binary search if bars are already known
2486
2486
  return this._private__styleGetter(this._private__findBar, this._private__series._internal_options(), barIndex, precomputedBars);
2487
2487
  }
2488
+ /**
2489
+ * Like `barStyle`, but returns null instead of throwing when the bar is
2490
+ * gone.
2491
+ *
2492
+ * Recolouring walks items that were laid out against the data as it was. A
2493
+ * bar that has since disappeared is not an error there: the view is about
2494
+ * to be rebuilt from the new data anyway. Letting it throw took down
2495
+ * whatever asked for the repaint — including `setData`, which left the
2496
+ * series without its data and the pane empty until the page was reloaded.
2497
+ */
2498
+ _internal_barStyleOrNull(barIndex, precomputedBars) {
2499
+ if (precomputedBars === undefined && this._private__series._internal_bars()._internal_valueAt(barIndex) === null) {
2500
+ return null;
2501
+ }
2502
+ return this._internal_barStyle(barIndex, precomputedBars);
2503
+ }
2488
2504
  }
2489
2505
 
2490
2506
  /**
@@ -11428,10 +11444,14 @@
11428
11444
  return this._internal__itemsVisibleRange === null ? null : this._internal__renderer;
11429
11445
  }
11430
11446
  _internal__updateOptions() {
11431
- this._internal__items = this._internal__items.map((item) => ({
11432
- ...item,
11433
- ...this._internal__series._internal_barColorer()._internal_barStyle(item._internal_time),
11434
- }));
11447
+ const colorer = this._internal__series._internal_barColorer();
11448
+ this._internal__items = this._internal__items.map((item) => {
11449
+ // An item whose bar is gone keeps the colour it had. Throwing here
11450
+ // took down whatever asked for the repaint — `setData` among them,
11451
+ // which left the series without its data and the pane empty.
11452
+ const style = colorer._internal_barStyleOrNull(item._internal_time);
11453
+ return style === null ? item : { ...item, ...style };
11454
+ });
11435
11455
  }
11436
11456
  _internal__clearVisibleRange() {
11437
11457
  this._internal__itemsVisibleRange = null;
@@ -15860,9 +15880,6 @@
15860
15880
  return wrapper;
15861
15881
  }
15862
15882
 
15863
- /**
15864
- * Gestor de marcadores de posiciones de trading
15865
- */
15866
15883
  class PositionMarkersManager {
15867
15884
  constructor(series, options) {
15868
15885
  this._private__markersPlugin = null;
@@ -15882,30 +15899,20 @@
15882
15899
  };
15883
15900
  this._private__markersPlugin = createSeriesMarkers(series);
15884
15901
  }
15885
- /**
15886
- * Agrega una posición al gráfico
15887
- */
15888
15902
  addPosition(position) {
15889
15903
  this._private__positions.push(position);
15890
15904
  this._private__updateMarkers();
15891
15905
  }
15892
- /**
15893
- * Agrega múltiples posiciones al gráfico
15894
- */
15895
15906
  addPositions(positions) {
15896
15907
  this._private__positions.push(...positions);
15897
15908
  this._private__updateMarkers();
15898
15909
  }
15899
- /**
15900
- * Establece las posiciones (reemplaza las existentes)
15901
- */
15910
+ /** Replaces every position currently on the chart. */
15902
15911
  setPositions(positions) {
15903
15912
  this._private__positions = [...positions];
15904
15913
  this._private__updateMarkers();
15905
15914
  }
15906
- /**
15907
- * Cierra una posición abierta agregando el punto de salida
15908
- */
15915
+ /** Closes an open position by giving it an exit point. */
15909
15916
  closePosition(id, exit, exitText) {
15910
15917
  const position = this._private__positions.find(p => p.id === id);
15911
15918
  if (position) {
@@ -15919,29 +15926,17 @@
15919
15926
  this._private__updateMarkers();
15920
15927
  }
15921
15928
  }
15922
- /**
15923
- * Elimina una posición por ID
15924
- */
15925
15929
  removePosition(id) {
15926
15930
  this._private__positions = this._private__positions.filter(p => p.id !== id);
15927
15931
  this._private__updateMarkers();
15928
15932
  }
15929
- /**
15930
- * Limpia todas las posiciones
15931
- */
15932
15933
  clearPositions() {
15933
15934
  this._private__positions = [];
15934
15935
  this._private__updateMarkers();
15935
15936
  }
15936
- /**
15937
- * Obtiene todas las posiciones actuales
15938
- */
15939
15937
  getPositions() {
15940
15938
  return this._private__positions;
15941
15939
  }
15942
- /**
15943
- * Actualiza las opciones del gestor
15944
- */
15945
15940
  applyOptions(options) {
15946
15941
  if (options.longColors) {
15947
15942
  this._private__options.longColors = {
@@ -15966,9 +15961,6 @@
15966
15961
  }
15967
15962
  this._private__updateMarkers();
15968
15963
  }
15969
- /**
15970
- * Convierte las posiciones a marcadores de serie
15971
- */
15972
15964
  _private__positionsToMarkers() {
15973
15965
  const markers = [];
15974
15966
  for (const position of this._private__positions) {
@@ -16015,18 +16007,12 @@
16015
16007
  }
16016
16008
  return markers;
16017
16009
  }
16018
- /**
16019
- * Actualiza los marcadores en el gráfico
16020
- */
16021
16010
  _private__updateMarkers() {
16022
16011
  if (this._private__markersPlugin) {
16023
16012
  const markers = this._private__positionsToMarkers();
16024
16013
  this._private__markersPlugin.setMarkers(markers);
16025
16014
  }
16026
16015
  }
16027
- /**
16028
- * Desconecta el plugin y limpia recursos
16029
- */
16030
16016
  detach() {
16031
16017
  if (this._private__markersPlugin) {
16032
16018
  this._private__markersPlugin.detach();
@@ -16036,47 +16022,18 @@
16036
16022
  }
16037
16023
  }
16038
16024
  /**
16039
- * Crea un gestor de marcadores de posiciones de trading
16040
- *
16041
- * @param series - Serie a la que se adjuntarán los marcadores
16042
- * @param positions - Posiciones iniciales (opcional)
16043
- * @param options - Opciones de configuración (opcional)
16044
- * @returns Instancia del gestor de posiciones
16025
+ * Marks trades on a series with an arrow at the entry and, once closed, at the
16026
+ * exit.
16045
16027
  *
16046
16028
  * @example
16047
16029
  * ```typescript
16048
- * // Crear el gestor
16049
- * const positionMarkers = createPositionMarkers(candleSeries);
16050
- *
16051
- * // Agregar una posición long
16052
- * positionMarkers.addPosition({
16053
- * type: 'long',
16054
- * entry: { time: '2023-01-01', price: 100.50 },
16055
- * exit: { time: '2023-01-05', price: 105.20 },
16056
- * id: 'pos-1'
16057
- * });
16058
- *
16059
- * // Agregar una posición short
16060
- * positionMarkers.addPosition({
16061
- * type: 'short',
16062
- * entry: { time: '2023-01-10', price: 110.00 },
16063
- * exit: { time: '2023-01-15', price: 107.50 },
16064
- * id: 'pos-2'
16065
- * });
16066
- *
16067
- * // Agregar múltiples posiciones
16068
- * positionMarkers.setPositions([
16069
- * {
16030
+ * const markers = createPositionMarkers(candleSeries);
16031
+ * markers.addPosition({
16070
16032
  * type: 'long',
16071
- * entry: { time: '2023-02-01', price: 95.00 },
16072
- * exit: { time: '2023-02-10', price: 98.50 }
16073
- * },
16074
- * {
16075
- * type: 'short',
16076
- * entry: { time: '2023-02-15', price: 102.00 },
16077
- * exit: { time: '2023-02-20', price: 99.00 }
16078
- * }
16079
- * ]);
16033
+ * entry: { time: '2023-01-01', price: 100.50 },
16034
+ * exit: { time: '2023-01-05', price: 105.20 },
16035
+ * id: 'pos-1',
16036
+ * });
16080
16037
  * ```
16081
16038
  */
16082
16039
  function createPositionMarkers(series, positions, options) {
@@ -20327,9 +20284,6 @@
20327
20284
  return new DraggablePriceLine(chart, series, lineOptions);
20328
20285
  }
20329
20286
 
20330
- /**
20331
- * Interactive Line Manager - Permite crear líneas haciendo clic en el gráfico
20332
- */
20333
20287
  class InteractiveLineManager {
20334
20288
  constructor(chart, series) {
20335
20289
  this._private__container = null;
@@ -20358,10 +20312,9 @@
20358
20312
  return price === null ? 0 : price;
20359
20313
  }
20360
20314
  /**
20361
- * Activa el modo de creación de líneas por clic
20362
- * @param mode - Tipo de línea a crear
20363
- * @param customOptions - Opciones personalizadas para líneas custom
20364
- * @returns Promesa que se resuelve cuando el usuario hace clic
20315
+ * Arms the chart so the next click drops a line.
20316
+ *
20317
+ * @returns The line, once the user has clicked.
20365
20318
  */
20366
20319
  enableClickToCreate(mode, customOptions) {
20367
20320
  if (!this._private__container) {
@@ -20382,9 +20335,6 @@
20382
20335
  this._private__container.addEventListener('click', this._private__clickHandler);
20383
20336
  });
20384
20337
  }
20385
- /**
20386
- * Desactiva el modo de creación por clic
20387
- */
20388
20338
  disableClickToCreate() {
20389
20339
  if (this._private__container && this._private__clickHandler) {
20390
20340
  this._private__container.removeEventListener('click', this._private__clickHandler);
@@ -20474,31 +20424,21 @@
20474
20424
  }
20475
20425
  return new DraggablePriceLine(this._private__chart, this._private__series, options);
20476
20426
  }
20477
- /**
20478
- * Obtiene el modo actual de creación
20479
- */
20480
20427
  getCreationMode() {
20481
20428
  return this._private__creationMode;
20482
20429
  }
20483
- /**
20484
- * Verifica si está en modo de creación
20485
- */
20486
20430
  isCreating() {
20487
20431
  return this._private__creationMode !== null;
20488
20432
  }
20489
20433
  }
20490
20434
  /**
20491
- * Crea un manager interactivo para añadir líneas con clics
20492
- * @param chart - Chart instance
20493
- * @param series - Series instance
20494
- * @returns InteractiveLineManager
20435
+ * Lets the user place draggable lines by clicking the chart.
20436
+ *
20495
20437
  * @example
20496
20438
  * ```typescript
20497
20439
  * const manager = createInteractiveLineManager(chart, candleSeries);
20498
- *
20499
- * // Activar modo de creación
20500
20440
  * const line = await manager.enableClickToCreate('stop-loss', {
20501
- * onDragEnd: (price) => console.log('SL:', price)
20441
+ * onDragEnd: (price) => console.log('SL:', price),
20502
20442
  * });
20503
20443
  * ```
20504
20444
  */
@@ -24361,9 +24301,6 @@
24361
24301
  return new VerticalLineTool(context, options);
24362
24302
  }
24363
24303
 
24364
- /**
24365
- * Fibonacci Calculator - Cálculos de niveles de retroceso de Fibonacci
24366
- */
24367
24304
  /**
24368
24305
  * Standard Fibonacci retracement ratios
24369
24306
  */
@@ -24509,10 +24446,7 @@
24509
24446
  }
24510
24447
  }
24511
24448
 
24512
- /**
24513
- * Fibonacci Retracement Tool - Herramienta para dibujar niveles de Fibonacci
24514
- * Muestra niveles estándar: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
24515
- */
24449
+ /** Draws 0, 23.6, 38.2, 50, 61.8, 78.6 and 100% unless `levels` says otherwise. */
24516
24450
  /** A ratio and the label it is shown with, derived rather than stored. */
24517
24451
  function toRatio(ratio) {
24518
24452
  return { _internal_ratio: ratio, _internal_label: `${(ratio * 100).toFixed(1)}%` };
@@ -28343,9 +28277,6 @@
28343
28277
  return new TextTool(context, options);
28344
28278
  }
28345
28279
 
28346
- /**
28347
- * Position Calculator - Cálculos de P&L, pips, R:R para trading
28348
- */
28349
28280
  class PositionCalculator {
28350
28281
  constructor(pipConfig) {
28351
28282
  this._private__pipConfig = pipConfig;
@@ -28497,9 +28428,6 @@
28497
28428
  };
28498
28429
  }
28499
28430
 
28500
- /**
28501
- * Ruler Calculator - Cálculos de distancia, pips, tiempo para mediciones
28502
- */
28503
28431
  class RulerCalculator {
28504
28432
  constructor(pipConfig) {
28505
28433
  this._private__pipConfig = pipConfig;
@@ -28618,10 +28546,7 @@
28618
28546
  }
28619
28547
  }
28620
28548
 
28621
- /**
28622
- * Measurement Ruler Tool - Herramienta para medir distancia entre dos puntos
28623
- * Muestra pips, porcentaje, tiempo transcurrido y número de barras
28624
- */
28549
+ /** Measures two points: pips, percent, elapsed time and bar count. */
28625
28550
  class RulerTool extends DrawingToolBase {
28626
28551
  constructor(context, options) {
28627
28552
  super(context, 'ruler-tool', options);
@@ -29181,10 +29106,7 @@
29181
29106
  }
29182
29107
  }
29183
29108
 
29184
- /**
29185
- * Position Tool - Herramienta unificada para marcar posiciones long/short
29186
- * Muestra dos rectángulos ajustables (profit/loss) con línea vertical conectora
29187
- */
29109
+ /** Two adjustable boxes, profit and loss, joined by a vertical connector. */
29188
29110
  class PositionTool extends DrawingToolBase {
29189
29111
  constructor(context, options) {
29190
29112
  super(context, 'position-tool', options);
@@ -31079,7 +31001,7 @@
31079
31001
  * Returns the current version as a string. For example `'1.0.0'`.
31080
31002
  */
31081
31003
  function version() {
31082
- return "2.3.2";
31004
+ return "2.3.3";
31083
31005
  }
31084
31006
 
31085
31007
  var PipsendChartsModule = /*#__PURE__*/Object.freeze({