lightweight-charts-indicators 0.20.0 → 0.20.2
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.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/render/renderer.d.ts +14 -0
- package/dist/render/renderer.d.ts.map +1 -1
- package/dist/render.mjs +100 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -462546,4 +462546,4 @@ var registryPart12 = [
|
|
|
462546
462546
|
}
|
|
462547
462547
|
];
|
|
462548
462548
|
var indicatorRegistry = [...registryPart1, ...registryPart11, ...registryPart2, ...registryPart3, ...registryPart4, ...registryPart5, ...registryPart6, ...registryPart7, ...registryPart8, ...registryPart9, ...registryPart10, ...registryPart12].map(withReferenceNames).map(withValueFormat).map(withStyleOutputs).map(withAlertConditions);
|
|
462549
|
-
var version = "0.20.
|
|
462549
|
+
var version = "0.20.2";
|
package/dist/index.d.ts
CHANGED
|
@@ -3724,5 +3724,5 @@ export type { ChartContext, VisibleRange, SymbolRequest, SymbolInfo } from './ch
|
|
|
3724
3724
|
export { MissingSymbolDataError, symbolBarsOf } from './chart-context';
|
|
3725
3725
|
export { mintickOf, timezoneOf, tickeridOf, tickerOf, symbolTypeOf, currencyOf, basecurrencyOf, rootOf, foregroundColorOf, backgroundColorOf, lastBarConfirmedOf, nowOf, visibleRangeOf, } from './chart-context';
|
|
3726
3726
|
export { securityOther, securityOtherValues, securityLowerTf, otherSymbolChart, spreadSymbols, spreadBars, spreadOptions, type OtherSymbolOptions, type OtherSymbolChart, type SymbolCalendar, } from './other-symbol';
|
|
3727
|
-
export declare const version = "0.20.
|
|
3727
|
+
export declare const version = "0.20.2";
|
|
3728
3728
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.mjs
CHANGED
|
@@ -462760,7 +462760,7 @@ var registryPart12 = [
|
|
|
462760
462760
|
}
|
|
462761
462761
|
];
|
|
462762
462762
|
var indicatorRegistry = [...registryPart1, ...registryPart11, ...registryPart2, ...registryPart3, ...registryPart4, ...registryPart5, ...registryPart6, ...registryPart7, ...registryPart8, ...registryPart9, ...registryPart10, ...registryPart12].map(withReferenceNames).map(withValueFormat).map(withStyleOutputs).map(withAlertConditions);
|
|
462763
|
-
var version = "0.20.
|
|
462763
|
+
var version = "0.20.2";
|
|
462764
462764
|
export {
|
|
462765
462765
|
ADR,
|
|
462766
462766
|
ADX,
|
|
@@ -81,9 +81,17 @@ export declare class IndicatorRenderer {
|
|
|
81
81
|
/** The previous render's attached slots a reuseSeries render can take again (by attach order); null = taken */
|
|
82
82
|
private slotPool;
|
|
83
83
|
private markerPlugins;
|
|
84
|
+
/** The previous render's markers plugins a reuseSeries render can take again (by order); null = taken */
|
|
85
|
+
private markerPool;
|
|
84
86
|
private tables;
|
|
87
|
+
/** The previous render's tables a reuseSeries render can take again (by order); null = taken */
|
|
88
|
+
private tablePool;
|
|
85
89
|
private tableObserver;
|
|
86
90
|
private tableFrame;
|
|
91
|
+
/** A drawing asked for an update during the render: one light update when it ends */
|
|
92
|
+
private rendering;
|
|
93
|
+
private lightPending;
|
|
94
|
+
private readonly lightUpdate;
|
|
87
95
|
private renderOpts;
|
|
88
96
|
/** Series of this render in creation order, with their type (series definition or custom pane view class) */
|
|
89
97
|
private created;
|
|
@@ -187,6 +195,11 @@ export declare class IndicatorRenderer {
|
|
|
187
195
|
* transparent shape colour, labels, multi-line text, top / bottom, and every marker without a main series).
|
|
188
196
|
*/
|
|
189
197
|
private drawMarkers;
|
|
198
|
+
/**
|
|
199
|
+
* Native markers on `series`. A reuseSeries render takes the previous render's plugin of the same series again (by
|
|
200
|
+
* order) and sets its markers only when they changed: creating, detaching or setting a plugin is a full update.
|
|
201
|
+
*/
|
|
202
|
+
private nativeMarkers;
|
|
190
203
|
/** plotarrow arrows, one group per plotarrow id (minheight / maxheight / forceOverlay / display of arrowConfig) */
|
|
191
204
|
private drawArrows;
|
|
192
205
|
/** barcolor: repainted over the host's main series (nothing without a main series) */
|
|
@@ -215,6 +228,7 @@ export declare class IndicatorRenderer {
|
|
|
215
228
|
* color.black (#363A45).
|
|
216
229
|
*/
|
|
217
230
|
private drawTables;
|
|
231
|
+
private stopTables;
|
|
218
232
|
/** Lay out the tables after the chart has laid out its panes */
|
|
219
233
|
private scheduleTableLayout;
|
|
220
234
|
private layoutTables;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EASL,KAAK,SAAS,EACd,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/render/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EASL,KAAK,SAAS,EACd,KAAK,UAAU,EAOf,KAAK,UAAU,EAQf,KAAK,IAAI,EAQV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,GAAG,EACH,UAAU,EACV,WAAW,EACX,UAAU,EAEV,WAAW,EAEX,eAAe,EAChB,MAAM,aAAa,CAAC;AAerB,OAAO,EAIL,KAAK,WAAW,EAyBjB,MAAM,cAAc,CAAC;AAGtB,yGAAyG;AACzG,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,WAAW,CAA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UAAU;IAuBlB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,aAAa;IAIrB,kHAAkH;IAClH,OAAO,CAAC,cAAc;IAUtB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAqClB,OAAO,CAAC,UAAU;IAOlB,gEAAgE;IAChE,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,YAAY;CAoBrB"}
|
package/dist/render.mjs
CHANGED
|
@@ -1833,6 +1833,7 @@ var ThinHistogramPaneView = class {
|
|
|
1833
1833
|
|
|
1834
1834
|
// src/render/renderer.ts
|
|
1835
1835
|
var LINE_STYLES = { solid: LineStyle.Solid, dashed: LineStyle.Dashed, dotted: LineStyle.Dotted };
|
|
1836
|
+
var NEVER_ATTACHED = {};
|
|
1836
1837
|
var IndicatorRenderer = class {
|
|
1837
1838
|
constructor(chart, options = {}) {
|
|
1838
1839
|
this.chart = chart;
|
|
@@ -1849,9 +1850,22 @@ var IndicatorRenderer = class {
|
|
|
1849
1850
|
/** The previous render's attached slots a reuseSeries render can take again (by attach order); null = taken */
|
|
1850
1851
|
slotPool = [];
|
|
1851
1852
|
markerPlugins = [];
|
|
1853
|
+
/** The previous render's markers plugins a reuseSeries render can take again (by order); null = taken */
|
|
1854
|
+
markerPool = [];
|
|
1852
1855
|
tables = [];
|
|
1856
|
+
/** The previous render's tables a reuseSeries render can take again (by order); null = taken */
|
|
1857
|
+
tablePool = [];
|
|
1853
1858
|
tableObserver = null;
|
|
1854
1859
|
tableFrame = 0;
|
|
1860
|
+
/** A drawing asked for an update during the render: one light update when it ends */
|
|
1861
|
+
rendering = false;
|
|
1862
|
+
lightPending = false;
|
|
1863
|
+
lightUpdate = () => {
|
|
1864
|
+
if (this.rendering)
|
|
1865
|
+
this.lightPending = true;
|
|
1866
|
+
else
|
|
1867
|
+
this.chart.panes()[0]?.detachPrimitive(NEVER_ATTACHED);
|
|
1868
|
+
};
|
|
1855
1869
|
renderOpts = {};
|
|
1856
1870
|
/** Series of this render in creation order, with their type (series definition or custom pane view class) */
|
|
1857
1871
|
created = [];
|
|
@@ -1887,6 +1901,7 @@ var IndicatorRenderer = class {
|
|
|
1887
1901
|
const paneApi = pane > 0 ? this.chart.panes()[pane] : void 0;
|
|
1888
1902
|
const preserved = paneApi?.preserveEmptyPane();
|
|
1889
1903
|
paneApi?.setPreserveEmptyPane(true);
|
|
1904
|
+
this.rendering = true;
|
|
1890
1905
|
try {
|
|
1891
1906
|
this.clearOwned(options.reuseSeries === true);
|
|
1892
1907
|
this.renderOpts = options;
|
|
@@ -1904,6 +1919,17 @@ var IndicatorRenderer = class {
|
|
|
1904
1919
|
for (const p of this.pool.splice(0))
|
|
1905
1920
|
if (p)
|
|
1906
1921
|
this.chart.removeSeries(p.series);
|
|
1922
|
+
for (const m of this.markerPool.splice(0))
|
|
1923
|
+
m?.plugin.detach();
|
|
1924
|
+
for (const t of this.tablePool.splice(0))
|
|
1925
|
+
t?.el.remove();
|
|
1926
|
+
if (!this.tables.length)
|
|
1927
|
+
this.stopTables();
|
|
1928
|
+
this.rendering = false;
|
|
1929
|
+
if (this.lightPending) {
|
|
1930
|
+
this.lightPending = false;
|
|
1931
|
+
this.lightUpdate();
|
|
1932
|
+
}
|
|
1907
1933
|
if (paneApi && !this.opts.preserveEmptyPane)
|
|
1908
1934
|
paneApi.setPreserveEmptyPane(preserved ?? false);
|
|
1909
1935
|
}
|
|
@@ -1968,8 +1994,11 @@ var IndicatorRenderer = class {
|
|
|
1968
1994
|
for (const { series, primitive } of this.attached)
|
|
1969
1995
|
series.detachPrimitive(primitive);
|
|
1970
1996
|
this.attached = [];
|
|
1971
|
-
|
|
1972
|
-
|
|
1997
|
+
if (keepSeries)
|
|
1998
|
+
this.markerPool = this.markerPlugins;
|
|
1999
|
+
else
|
|
2000
|
+
for (const m of this.markerPlugins)
|
|
2001
|
+
m.plugin.detach();
|
|
1973
2002
|
this.markerPlugins = [];
|
|
1974
2003
|
if (keepSeries)
|
|
1975
2004
|
this.pool = this.created;
|
|
@@ -1980,14 +2009,14 @@ var IndicatorRenderer = class {
|
|
|
1980
2009
|
this.reused.clear();
|
|
1981
2010
|
this.plotSeries = [];
|
|
1982
2011
|
this.otherSeries = [];
|
|
1983
|
-
|
|
1984
|
-
|
|
2012
|
+
if (keepSeries)
|
|
2013
|
+
this.tablePool = this.tables;
|
|
2014
|
+
else {
|
|
2015
|
+
for (const { el } of this.tables)
|
|
2016
|
+
el.remove();
|
|
2017
|
+
this.stopTables();
|
|
2018
|
+
}
|
|
1985
2019
|
this.tables = [];
|
|
1986
|
-
this.tableObserver?.disconnect();
|
|
1987
|
-
this.tableObserver = null;
|
|
1988
|
-
if (this.tableFrame)
|
|
1989
|
-
cancelAnimationFrame(this.tableFrame);
|
|
1990
|
-
this.tableFrame = 0;
|
|
1991
2020
|
}
|
|
1992
2021
|
// ─── Series helpers ──────────────────────────────────────────────────────
|
|
1993
2022
|
/** Options of a series in `pane`: left out of the autoscale in the price pane when autoscale is off */
|
|
@@ -2119,7 +2148,7 @@ var IndicatorRenderer = class {
|
|
|
2119
2148
|
this.attached.push(kept);
|
|
2120
2149
|
return;
|
|
2121
2150
|
}
|
|
2122
|
-
const fresh = new PrimitiveSlot(primitive);
|
|
2151
|
+
const fresh = new PrimitiveSlot(primitive, this.lightUpdate);
|
|
2123
2152
|
series.attachPrimitive(fresh);
|
|
2124
2153
|
this.attached.push({ series, primitive: fresh });
|
|
2125
2154
|
}
|
|
@@ -2481,7 +2510,7 @@ var IndicatorRenderer = class {
|
|
|
2481
2510
|
if (!main)
|
|
2482
2511
|
this.setData(target, anchorData(this.grid.bars.map((b) => ({ time: b.time, value: b.close })), this.grid));
|
|
2483
2512
|
if (onPrice.native.length)
|
|
2484
|
-
this.
|
|
2513
|
+
this.nativeMarkers(target, onPrice.native);
|
|
2485
2514
|
if (onPrice.extended.length) {
|
|
2486
2515
|
const primitive = new ExtendedMarkerPrimitive(this.grid);
|
|
2487
2516
|
this.attach(target, primitive);
|
|
@@ -2494,7 +2523,7 @@ var IndicatorRenderer = class {
|
|
|
2494
2523
|
const anchor = this.anchor(pane);
|
|
2495
2524
|
this.setData(anchor, anchorData(paneMarkers.map((m) => ({ time: m.time, value: m.price })), this.grid));
|
|
2496
2525
|
if (parts.native.length)
|
|
2497
|
-
this.
|
|
2526
|
+
this.nativeMarkers(anchor, parts.native);
|
|
2498
2527
|
if (parts.extended.length) {
|
|
2499
2528
|
const primitive = new ExtendedMarkerPrimitive(this.grid);
|
|
2500
2529
|
this.attach(anchor, primitive);
|
|
@@ -2502,6 +2531,25 @@ var IndicatorRenderer = class {
|
|
|
2502
2531
|
}
|
|
2503
2532
|
}
|
|
2504
2533
|
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Native markers on `series`. A reuseSeries render takes the previous render's plugin of the same series again (by
|
|
2536
|
+
* order) and sets its markers only when they changed: creating, detaching or setting a plugin is a full update.
|
|
2537
|
+
*/
|
|
2538
|
+
nativeMarkers(series, markers) {
|
|
2539
|
+
const key = JSON.stringify(markers);
|
|
2540
|
+
const at = this.markerPlugins.length;
|
|
2541
|
+
const kept = this.markerPool[at];
|
|
2542
|
+
if (kept && kept.series === series) {
|
|
2543
|
+
this.markerPool[at] = null;
|
|
2544
|
+
if (kept.key !== key) {
|
|
2545
|
+
kept.plugin.setMarkers(markers);
|
|
2546
|
+
kept.key = key;
|
|
2547
|
+
}
|
|
2548
|
+
this.markerPlugins.push(kept);
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
this.markerPlugins.push({ series, plugin: createSeriesMarkers(series, markers), key });
|
|
2552
|
+
}
|
|
2505
2553
|
/** plotarrow arrows, one group per plotarrow id (minheight / maxheight / forceOverlay / display of arrowConfig) */
|
|
2506
2554
|
drawArrows(arrows, configs, pane, overlay) {
|
|
2507
2555
|
const byId = /* @__PURE__ */ new Map();
|
|
@@ -2662,18 +2710,47 @@ var IndicatorRenderer = class {
|
|
|
2662
2710
|
*/
|
|
2663
2711
|
drawTables(tables, pane) {
|
|
2664
2712
|
const host = this.chart.chartElement();
|
|
2665
|
-
|
|
2666
|
-
host.style.position = "relative";
|
|
2713
|
+
let changed = false;
|
|
2667
2714
|
for (const table of tables) {
|
|
2715
|
+
const at = table.forceOverlay ? 0 : pane;
|
|
2716
|
+
const key = JSON.stringify(table);
|
|
2717
|
+
const kept = this.tablePool[this.tables.length];
|
|
2718
|
+
if (kept) {
|
|
2719
|
+
this.tablePool[this.tables.length] = null;
|
|
2720
|
+
if (kept.key !== key || kept.pane !== at) {
|
|
2721
|
+
Object.assign(kept, { table, pane: at, key });
|
|
2722
|
+
changed = true;
|
|
2723
|
+
}
|
|
2724
|
+
this.tables.push(kept);
|
|
2725
|
+
continue;
|
|
2726
|
+
}
|
|
2727
|
+
if (getComputedStyle(host).position === "static")
|
|
2728
|
+
host.style.position = "relative";
|
|
2668
2729
|
const el = document.createElement("div");
|
|
2669
2730
|
el.className = "chart-table-overlay";
|
|
2670
2731
|
el.style.cssText = "position:absolute;z-index:10;pointer-events:none;visibility:hidden";
|
|
2671
2732
|
host.appendChild(el);
|
|
2672
|
-
this.tables.push({ table, pane:
|
|
2733
|
+
this.tables.push({ table, pane: at, el, key });
|
|
2734
|
+
changed = true;
|
|
2735
|
+
}
|
|
2736
|
+
if (!this.tableObserver) {
|
|
2737
|
+
this.tableObserver = new ResizeObserver(() => this.scheduleTableLayout());
|
|
2738
|
+
this.tableObserver.observe(host);
|
|
2739
|
+
for (const p of this.chart.panes()) {
|
|
2740
|
+
const el = p.getHTMLElement();
|
|
2741
|
+
if (el)
|
|
2742
|
+
this.tableObserver.observe(el);
|
|
2743
|
+
}
|
|
2673
2744
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2745
|
+
if (changed)
|
|
2746
|
+
this.scheduleTableLayout();
|
|
2747
|
+
}
|
|
2748
|
+
stopTables() {
|
|
2749
|
+
this.tableObserver?.disconnect();
|
|
2750
|
+
this.tableObserver = null;
|
|
2751
|
+
if (this.tableFrame)
|
|
2752
|
+
cancelAnimationFrame(this.tableFrame);
|
|
2753
|
+
this.tableFrame = 0;
|
|
2677
2754
|
}
|
|
2678
2755
|
/** Lay out the tables after the chart has laid out its panes */
|
|
2679
2756
|
scheduleTableLayout() {
|
|
@@ -2705,8 +2782,9 @@ var IndicatorRenderer = class {
|
|
|
2705
2782
|
}
|
|
2706
2783
|
};
|
|
2707
2784
|
var PrimitiveSlot = class {
|
|
2708
|
-
constructor(inner) {
|
|
2785
|
+
constructor(inner, lightUpdate) {
|
|
2709
2786
|
this.inner = inner;
|
|
2787
|
+
this.lightUpdate = lightUpdate;
|
|
2710
2788
|
}
|
|
2711
2789
|
param = null;
|
|
2712
2790
|
/** `next` is of the kind this slot holds */
|
|
@@ -2719,11 +2797,11 @@ var PrimitiveSlot = class {
|
|
|
2719
2797
|
if (!this.param)
|
|
2720
2798
|
return;
|
|
2721
2799
|
next.attached?.(this.param);
|
|
2722
|
-
this.
|
|
2800
|
+
this.lightUpdate();
|
|
2723
2801
|
}
|
|
2724
2802
|
attached(param) {
|
|
2725
|
-
this.param = param;
|
|
2726
|
-
this.inner.attached?.(param);
|
|
2803
|
+
this.param = { ...param, requestUpdate: this.lightUpdate };
|
|
2804
|
+
this.inner.attached?.(this.param);
|
|
2727
2805
|
}
|
|
2728
2806
|
detached() {
|
|
2729
2807
|
this.inner.detached?.();
|