lightweight-charts-react-components 0.0.1
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/LICENCE +19 -0
- package/README.md +48 -0
- package/dist/index.d.ts +144 -0
- package/dist/lightweight-charts-react-components.cjs +12 -0
- package/dist/lightweight-charts-react-components.cjs.map +1 -0
- package/dist/lightweight-charts-react-components.js +12 -0
- package/dist/lightweight-charts-react-components.js.map +1 -0
- package/dist/lightweight-charts-react-components.standalone.js +2389 -0
- package/package.json +50 -0
package/LICENCE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>lightweight-charts-react-components 📈</h1>
|
|
3
|
+
<p>A React library of <a href="https://github.com/tradingview/lightweight-charts" target="_blank">Lightweight-charts</a> components written on Typescript</p>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/lightweight-charts-react-components">
|
|
8
|
+
<picture>
|
|
9
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/lightweight-charts-react-components?colorA=1e2029&colorB=1e2029&style=flat">
|
|
10
|
+
<img src="https://img.shields.io/npm/v/lightweight-charts-react-components?colorA=ffcc00&colorB=ffcc00&style=flat" alt="Version">
|
|
11
|
+
</picture>
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
<a href="https://www.npmjs.com/package/lightweight-charts-react-components">
|
|
15
|
+
<picture>
|
|
16
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/lightweight-charts-react-components?colorA=1e2029&colorB=1e2029&style=flat">
|
|
17
|
+
<img src="https://img.shields.io/npm/dm/lightweight-charts-react-components?colorA=ffcc00&colorB=ffcc00&style=flat" alt="Downloads">
|
|
18
|
+
</picture>
|
|
19
|
+
</a>
|
|
20
|
+
|
|
21
|
+
<a href="https://github.com/ukorvl/lightweight-charts-react-components/actions">
|
|
22
|
+
<picture>
|
|
23
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/actions/workflow/status/ukorvl/lightweight-charts-react-components/ci.yml?colorA=1e2029&colorB=1e2029&style=flat">
|
|
24
|
+
<img src="https://img.shields.io/github/actions/workflow/status/ukorvl/lightweight-charts-react-components/ci.yml?colorA=ffcc00&colorB=ffcc00&style=flat" alt="Build Status">
|
|
25
|
+
</picture>
|
|
26
|
+
</a>
|
|
27
|
+
|
|
28
|
+
<a href="https://github.com/ukorvl/lightweight-charts-react-components/blob/main/LICENCE">
|
|
29
|
+
<picture>
|
|
30
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/ukorvl/lightweight-charts-react-components?colorA=1e2029&colorB=1e2029&style=flat">
|
|
31
|
+
<img src="https://img.shields.io/github/license/ukorvl/lightweight-charts-react-components?colorA=ffcc00&colorB=ffcc00&style=flat" alt="Licence">
|
|
32
|
+
</picture>
|
|
33
|
+
</a>
|
|
34
|
+
|
|
35
|
+
<a href="https://github.com/ukorvl/lightweight-charts-react-components">
|
|
36
|
+
<picture>
|
|
37
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/code%20style-eslint-1e2029?style=flat">
|
|
38
|
+
<img src="https://img.shields.io/badge/code%20style-eslint-ffcc00?style=flat" alt="Code Style">
|
|
39
|
+
</picture>
|
|
40
|
+
</a>
|
|
41
|
+
|
|
42
|
+
<a href="https://github.com/ukorvl/lightweight-charts-react-components">
|
|
43
|
+
<picture>
|
|
44
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/contributions-welcome-1e2029?style=flat">
|
|
45
|
+
<img src="https://img.shields.io/badge/contributions-welcome-ffcc00?style=flat" alt="Contributions">
|
|
46
|
+
</picture>
|
|
47
|
+
</a>
|
|
48
|
+
</p>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
|
|
2
|
+
/**!
|
|
3
|
+
* lightweight-charts-react-components v0.0.1
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ChartOptions as ChartOptions_2 } from 'lightweight-charts';
|
|
12
|
+
import { DeepPartial } from 'lightweight-charts';
|
|
13
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
14
|
+
import { IChartApi } from 'lightweight-charts';
|
|
15
|
+
import { IPriceLine } from 'lightweight-charts';
|
|
16
|
+
import type { IPriceScaleApi } from 'lightweight-charts';
|
|
17
|
+
import type { ISeriesApi } from 'lightweight-charts';
|
|
18
|
+
import type { ITimeScaleApi } from 'lightweight-charts';
|
|
19
|
+
import type { LogicalRangeChangeEventHandler } from 'lightweight-charts';
|
|
20
|
+
import { MouseEventHandler } from 'lightweight-charts';
|
|
21
|
+
import { PriceLineOptions } from 'lightweight-charts';
|
|
22
|
+
import type { PriceScaleOptions as PriceScaleOptions_2 } from 'lightweight-charts';
|
|
23
|
+
import type { Range as Range_2 } from 'lightweight-charts';
|
|
24
|
+
import { ReactNode } from 'react';
|
|
25
|
+
import { RefAttributes } from 'react';
|
|
26
|
+
import type { SeriesDataItemTypeMap } from 'lightweight-charts';
|
|
27
|
+
import type { SeriesMarker } from 'lightweight-charts';
|
|
28
|
+
import type { SeriesPartialOptionsMap } from 'lightweight-charts';
|
|
29
|
+
import type { SeriesType as SeriesType_2 } from 'lightweight-charts';
|
|
30
|
+
import type { SizeChangeEventHandler } from 'lightweight-charts';
|
|
31
|
+
import { Time } from 'lightweight-charts';
|
|
32
|
+
import { TimeChartOptions } from 'lightweight-charts';
|
|
33
|
+
import type { TimeRangeChangeEventHandler } from 'lightweight-charts';
|
|
34
|
+
import type { TimeScaleOptions as TimeScaleOptions_2 } from 'lightweight-charts';
|
|
35
|
+
|
|
36
|
+
export declare const AreaSeries: ForwardRefExoticComponent<SeriesProps<"Area"> & RefAttributes<SeriesApiRef<"Area">>>;
|
|
37
|
+
|
|
38
|
+
export declare const CandlestickSeries: ForwardRefExoticComponent<SeriesProps<"Candlestick"> & RefAttributes<SeriesApiRef<"Candlestick">>>;
|
|
39
|
+
|
|
40
|
+
export declare const Chart: ForwardRefExoticComponent< {
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
} & {
|
|
44
|
+
onClick?: MouseEventHandler<Time>;
|
|
45
|
+
onCrosshairMove?: MouseEventHandler<Time>;
|
|
46
|
+
onInit?: (chart: IChartApi) => void;
|
|
47
|
+
} & DeepPartial<TimeChartOptions> & RefAttributes<HTMLDivElement>>;
|
|
48
|
+
|
|
49
|
+
export declare type ChartApiRef = {
|
|
50
|
+
_chart: IChartApi | null;
|
|
51
|
+
api: () => IChartApi | null;
|
|
52
|
+
clear: () => void;
|
|
53
|
+
destroyed: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export declare type ChartOptions = {
|
|
57
|
+
onClick?: MouseEventHandler<Time>;
|
|
58
|
+
onCrosshairMove?: MouseEventHandler<Time>;
|
|
59
|
+
onInit?: (chart: IChartApi) => void;
|
|
60
|
+
} & DeepPartial<ChartOptions_2>;
|
|
61
|
+
|
|
62
|
+
export declare type ChartProps = {
|
|
63
|
+
children?: ReactNode;
|
|
64
|
+
className?: string;
|
|
65
|
+
} & ChartOptions;
|
|
66
|
+
|
|
67
|
+
export declare const HistogramSeries: ForwardRefExoticComponent<SeriesProps<"Histogram"> & RefAttributes<SeriesApiRef<"Histogram">>>;
|
|
68
|
+
|
|
69
|
+
export declare const LineSeries: ForwardRefExoticComponent<SeriesProps<"Line"> & RefAttributes<SeriesApiRef<"Line">>>;
|
|
70
|
+
|
|
71
|
+
export declare const PriceLine: ForwardRefExoticComponent<PriceLineProps & RefAttributes<PriceLineApiRef>>;
|
|
72
|
+
|
|
73
|
+
export declare type PriceLineApiRef = {
|
|
74
|
+
_priceLine: IPriceLine | null;
|
|
75
|
+
api: () => IPriceLine | null;
|
|
76
|
+
clear: () => void;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export declare type PriceLineProps = {
|
|
80
|
+
price: number;
|
|
81
|
+
options?: Omit<Partial<PriceLineOptions>, "price">;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export declare const PriceScale: ForwardRefExoticComponent<PriceScaleProps & RefAttributes<PriceScaleApiRef>>;
|
|
85
|
+
|
|
86
|
+
export declare type PriceScaleApiRef = {
|
|
87
|
+
_priceScale: IPriceScaleApi | null;
|
|
88
|
+
api: () => IPriceScaleApi | null;
|
|
89
|
+
setId: (id: string) => void;
|
|
90
|
+
clear: () => void;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export declare type PriceScaleOptions = DeepPartial<PriceScaleOptions_2>;
|
|
94
|
+
|
|
95
|
+
export declare type PriceScaleProps = {
|
|
96
|
+
options?: PriceScaleOptions;
|
|
97
|
+
id: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export declare type SeriesApiRef<T extends SeriesType> = {
|
|
101
|
+
_series: ISeriesApi<T> | null;
|
|
102
|
+
api: () => ISeriesApi<T> | null;
|
|
103
|
+
clear: () => void;
|
|
104
|
+
destroyed: boolean;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export declare type SeriesOptions<T extends SeriesType> = SeriesPartialOptionsMap[T];
|
|
108
|
+
|
|
109
|
+
export declare type SeriesParameters<T extends SeriesType> = {
|
|
110
|
+
data: SeriesDataItemTypeMap[T][];
|
|
111
|
+
markers?: SeriesMarker<Time>[];
|
|
112
|
+
reactive?: boolean;
|
|
113
|
+
options?: SeriesOptions<T>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export declare type SeriesProps<T extends SeriesType> = Omit<SeriesTemplateProps<T>, "type">;
|
|
117
|
+
|
|
118
|
+
export declare type SeriesTemplateProps<T extends SeriesType> = {
|
|
119
|
+
type: T;
|
|
120
|
+
children?: ReactNode;
|
|
121
|
+
} & SeriesParameters<T>;
|
|
122
|
+
|
|
123
|
+
export declare type SeriesType = Extract<SeriesType_2, "Line" | "Candlestick" | "Histogram" | "Area">;
|
|
124
|
+
|
|
125
|
+
export declare const TimeScale: ForwardRefExoticComponent<TimeScaleProps & RefAttributes<TimeScaleApiRef>>;
|
|
126
|
+
|
|
127
|
+
export declare type TimeScaleApiRef = {
|
|
128
|
+
_timeScale: ITimeScaleApi<Time> | null;
|
|
129
|
+
api: () => ITimeScaleApi<Time> | null;
|
|
130
|
+
clear: () => void;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export declare type TimeScaleOptions = DeepPartial<TimeScaleOptions_2>;
|
|
134
|
+
|
|
135
|
+
export declare type TimeScaleProps = {
|
|
136
|
+
onVisibleTimeRangeChange?: TimeRangeChangeEventHandler<Time>;
|
|
137
|
+
onVisibleLogicalRangeChange?: LogicalRangeChangeEventHandler;
|
|
138
|
+
onSizeChange?: SizeChangeEventHandler;
|
|
139
|
+
visibleRange?: Range_2<Time>;
|
|
140
|
+
visibleLogicalRange?: Range_2<number>;
|
|
141
|
+
options?: TimeScaleOptions;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
/**!
|
|
3
|
+
* lightweight-charts-react-components v0.0.1
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=function(e,r){for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{CandlestickSeries:function(){return CandlestickSeries},HistogramSeries:function(){return series_HistogramSeries},PriceLine:function(){return PriceLine},AreaSeries:function(){return series_AreaSeries},Chart:function(){return chart_ChartWrapper},PriceScale:function(){return PriceScale},TimeScale:function(){return TimeScale},LineSeries:function(){return LineSeries}});var jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_react_namespaceObject=require("react"),ChartContext=(0,external_react_namespaceObject.createContext)({});ChartContext.displayName="ChartContext";var external_lightweight_charts_namespaceObject=require("lightweight-charts");function _object_without_properties(e,r){if(null==e)return{};var t,n,i=_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function _object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var useInitChart=function(e){var r=e.container,t=_object_without_properties(e,["container"]),n=t.onClick,i=t.onCrosshairMove,a=t.onInit,c=_object_without_properties(t,["onClick","onCrosshairMove","onInit"]),o=(0,external_react_namespaceObject.useRef)({_chart:null,api:function(){return null===this._chart&&!this.destroyed&&(this._chart=(0,external_lightweight_charts_namespaceObject.createChart)(r,c),a&&a(this._chart)),this._chart},clear:function(){null!==this._chart&&(this._chart.remove(),this._chart=null,this.destroyed=!0)},destroyed:!1});return(0,external_react_namespaceObject.useLayoutEffect)(function(){return o.current.api(),function(){o.current.clear()}},[]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(r){if(n){var e;null===(e=o.current.api())||void 0===e||e.subscribeClick(n)}return function(){if(n){var e;null===(e=o.current.api())||void 0===e||e.unsubscribeClick(n)}}}},[n]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(r){if(i){var e;null===(e=o.current.api())||void 0===e||e.subscribeCrosshairMove(i)}return function(){if(i){var e;null===(e=o.current.api())||void 0===e||e.unsubscribeCrosshairMove(i)}}}},[i]),(0,external_react_namespaceObject.useLayoutEffect)(function(){var e;r&&(null===(e=o.current.api())||void 0===e||e.applyOptions(c))},[c]),o};function _define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){_define_property(e,r,t[r])})}return e}function ChartComponent_object_without_properties(e,r){if(null==e)return{};var t,n,i=ChartComponent_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function ChartComponent_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var ChartComponent=function(e){var r=e.children,t=useInitChart(_object_spread({container:e.container},ChartComponent_object_without_properties(e,["children","container"])));return(0,jsx_runtime_namespaceObject.jsx)(ChartContext.Provider,{value:t.current,children:r})},chart_ChartComponent=ChartComponent;function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function ChartWrapper_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _iterable_to_array_limit(e,r){var t,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a=[],c=!0,o=!1;try{for(i=i.call(e);!(c=(t=i.next()).done)&&(a.push(t.value),!r||a.length!==r);c=!0);}catch(e){o=!0,n=e}finally{try{!c&&null!=i.return&&i.return()}finally{if(o)throw n}}return a}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ChartWrapper_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){ChartWrapper_define_property(e,r,t[r])})}return e}function ChartWrapper_ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function _object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ChartWrapper_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function ChartWrapper_object_without_properties(e,r){if(null==e)return{};var t,n,i=ChartWrapper_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function ChartWrapper_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}var ChartRenderFunction=function(e,r){var t=e.children,n=e.className,i=ChartWrapper_object_without_properties(e,["children","className"]),a=_sliced_to_array((0,external_react_namespaceObject.useState)(),2),c=a[0],o=a[1],s=(0,external_react_namespaceObject.useCallback)(function(e){o(e),r&&("function"==typeof r?s(e):r.current=e)},[r]);return(0,jsx_runtime_namespaceObject.jsx)("div",{ref:s,className:n,children:!!c&&(0,jsx_runtime_namespaceObject.jsx)(chart_ChartComponent,_object_spread_props(ChartWrapper_object_spread({container:c},i),{children:t}))})},ChartWrapper=(0,external_react_namespaceObject.forwardRef)(ChartRenderFunction);ChartWrapper.displayName="ChartWrapper";var chart_ChartWrapper=ChartWrapper,useSafeContext=function(e){var r=(0,external_react_namespaceObject.useContext)(e);if(!r){var t=e.name;throw Error("".concat(t," not found. You can access context value only inside its Provider."))}return r},useInitTimeScale=function(e){var r=e.onVisibleTimeRangeChange,t=e.onVisibleLogicalRangeChange,n=e.onSizeChange,i=e.visibleRange,a=e.visibleLogicalRange,c=e.options,o=void 0===c?{}:c,s=useSafeContext(ChartContext);if(!s)throw Error("Chart context not found");var u=(0,external_react_namespaceObject.useRef)({_timeScale:null,api:function(){if(!this._timeScale){var e=s.api();if(!e)return null;this._timeScale=e.timeScale(),this._timeScale.applyOptions(o),i&&this._timeScale.setVisibleRange(i),a&&this._timeScale.setVisibleLogicalRange(a)}return this._timeScale},clear:function(){null!==this._timeScale&&(this._timeScale=null)}});return(0,external_react_namespaceObject.useLayoutEffect)(function(){return u.current.api(),function(){u.current.clear()}},[]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s&&o){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.applyOptions(o)}},[o]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s){if(n){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.subscribeSizeChange(n)}return function(){if(n){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.unsubscribeSizeChange(n)}}}},[n]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s){if(t){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.subscribeVisibleLogicalRangeChange(t)}return function(){if(t){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.unsubscribeVisibleLogicalRangeChange(t)}}}},[t]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s){if(r){var e,t;null===(t=u.current)||void 0===t||null===(e=t.api())||void 0===e||e.subscribeVisibleTimeRangeChange(r)}return function(){if(r){var e,t;null===(t=u.current)||void 0===t||null===(e=t.api())||void 0===e||e.unsubscribeVisibleTimeRangeChange(r)}}}},[r]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s&&i){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.setVisibleRange(i)}},[i]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(s&&a){var e,r;null===(r=u.current)||void 0===r||null===(e=r.api())||void 0===e||e.setVisibleLogicalRange(a)}},[a]),u},TimeScaleRenderFunction=function(e,r){var t=useInitTimeScale(e);return(0,external_react_namespaceObject.useImperativeHandle)(r,function(){return t.current},[t]),null},TimeScale_TimeScale=(0,external_react_namespaceObject.forwardRef)(TimeScaleRenderFunction);TimeScale_TimeScale.displayName="TimeScale";var TimeScale=TimeScale_TimeScale;function useInitPriceScale_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function useInitPriceScale_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){useInitPriceScale_define_property(e,r,t[r])})}return e}var useInitPriceScale=function(e){var r=e.options,t=void 0===r?{}:r,n=e.id,i=useSafeContext(ChartContext),a=(0,external_react_namespaceObject.useRef)({_priceScale:null,api:function(){if(!this._priceScale){var e=i.api();if(!e)return null;this._priceScale=e.priceScale(n),this._priceScale.applyOptions(useInitPriceScale_object_spread({},t))}return this._priceScale},setId:function(e){if(null!==this._priceScale)this._priceScale=i.api().priceScale(e)},clear:function(){null!==this._priceScale&&(this._priceScale=null)}});return(0,external_react_namespaceObject.useLayoutEffect)(function(){return a.current.api(),function(){a.current.clear()}},[]),(0,external_react_namespaceObject.useLayoutEffect)(function(){var e;i&&(null===(e=a.current)||void 0===e||e.setId(n))},[n]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(i&&t){var e,r;null===(r=a.current)||void 0===r||null===(e=r.api())||void 0===e||e.applyOptions(t)}},[t]),a},PriceScaleRenderFunction=function(e,r){var t=useInitPriceScale(e);return(0,external_react_namespaceObject.useImperativeHandle)(r,function(){return t.current},[t]),null},PriceScale_PriceScale=(0,external_react_namespaceObject.forwardRef)(PriceScaleRenderFunction);PriceScale_PriceScale.displayName="PriceScale";var PriceScale=PriceScale_PriceScale,useInitSeries=function(e){var r=e.type,t=e.data,n=e.options,i=void 0===n?{}:n,a=e.reactive,c=e.markers,o=useSafeContext(ChartContext),s=(0,external_react_namespaceObject.useRef)({_series:null,api:function(){if(!this._series&&!this.destroyed){var e=o.api();if(!e)return null;this._series=addSeries(e,r),this._series.applyOptions(i),this._series.setData(t),c&&this._series.setMarkers(c)}return this._series},clear:function(){if(null!==this._series){var e;null===(e=o.api())||void 0===e||e.removeSeries(this._series),this._series=null,this.destroyed=!0}},destroyed:!1});return(0,external_react_namespaceObject.useLayoutEffect)(function(){return s.current.api(),function(){s.current.clear()}},[]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(o&&c&&a){var e;null===(e=s.current.api())||void 0===e||e.setMarkers(c)}},[c,a]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(o&&t&&a){var e;null===(e=s.current.api())||void 0===e||e.setData(t)}},[t,a]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(o&&i){var e;null===(e=s.current.api())||void 0===e||e.applyOptions(i)}},[i]),s},addSeries=function(e,r){var t=null;switch(r){case"Line":t=e.addLineSeries();break;case"Candlestick":t=e.addCandlestickSeries();break;case"Histogram":t=e.addHistogramSeries();break;case"Area":t=e.addAreaSeries();break;default:throw Error("Unknown series type: ".concat(r))}return t},SeriesContext=(0,external_react_namespaceObject.createContext)({});function SeriesTemplate_object_without_properties(e,r){if(null==e)return{};var t,n,i=SeriesTemplate_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function SeriesTemplate_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}SeriesContext.displayName="SeriesContext";var SeriesTemplateRenderFunction=function(e,r){var t=e.children,n=useInitSeries(SeriesTemplate_object_without_properties(e,["children"]));return(0,external_react_namespaceObject.useImperativeHandle)(r,function(){return n.current},[n]),(0,jsx_runtime_namespaceObject.jsx)(SeriesContext.Provider,{value:n.current,children:t})},SeriesTemplate=(0,external_react_namespaceObject.forwardRef)(SeriesTemplateRenderFunction);SeriesTemplate.displayName="SeriesTemplate";var series_SeriesTemplate=SeriesTemplate;function LineSeries_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function LineSeries_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){LineSeries_define_property(e,r,t[r])})}return e}function LineSeries_ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function LineSeries_object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LineSeries_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function LineSeries_object_without_properties(e,r){if(null==e)return{};var t,n,i=LineSeries_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function LineSeries_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var LineSeriesRenderFunction=function(e,r){var t=e.children,n=LineSeries_object_without_properties(e,["children"]);return(0,jsx_runtime_namespaceObject.jsx)(series_SeriesTemplate,LineSeries_object_spread_props(LineSeries_object_spread({type:"Line",ref:r},n),{children:t}))},LineSeries_LineSeries=(0,external_react_namespaceObject.forwardRef)(LineSeriesRenderFunction);LineSeries_LineSeries.displayName="LineSeries";var LineSeries=LineSeries_LineSeries;function HistogramSeries_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function HistogramSeries_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){HistogramSeries_define_property(e,r,t[r])})}return e}function HistogramSeries_ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function HistogramSeries_object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HistogramSeries_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function HistogramSeries_object_without_properties(e,r){if(null==e)return{};var t,n,i=HistogramSeries_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function HistogramSeries_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var HistogramSeriesRenderFunction=function(e,r){var t=e.children,n=HistogramSeries_object_without_properties(e,["children"]);return(0,jsx_runtime_namespaceObject.jsx)(series_SeriesTemplate,HistogramSeries_object_spread_props(HistogramSeries_object_spread({type:"Histogram",ref:r},n),{children:t}))},HistogramSeries=(0,external_react_namespaceObject.forwardRef)(HistogramSeriesRenderFunction);HistogramSeries.displayName="HistogramSeries";var series_HistogramSeries=HistogramSeries;function CandlestickSeries_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function CandlestickSeries_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){CandlestickSeries_define_property(e,r,t[r])})}return e}function CandlestickSeries_ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function CandlestickSeries_object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CandlestickSeries_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function CandlestickSeries_object_without_properties(e,r){if(null==e)return{};var t,n,i=CandlestickSeries_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function CandlestickSeries_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var CandlestickSeriesRenderFunction=function(e,r){var t=e.children,n=CandlestickSeries_object_without_properties(e,["children"]);return(0,jsx_runtime_namespaceObject.jsx)(series_SeriesTemplate,CandlestickSeries_object_spread_props(CandlestickSeries_object_spread({type:"Candlestick",ref:r},n),{children:t}))},CandlestickSeries_CandlestickSeries=(0,external_react_namespaceObject.forwardRef)(CandlestickSeriesRenderFunction);CandlestickSeries_CandlestickSeries.displayName="CandlestickSeries";var CandlestickSeries=CandlestickSeries_CandlestickSeries;function AreaSeries_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function AreaSeries_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){AreaSeries_define_property(e,r,t[r])})}return e}function AreaSeries_ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function AreaSeries_object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AreaSeries_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function AreaSeries_object_without_properties(e,r){if(null==e)return{};var t,n,i=AreaSeries_object_without_properties_loose(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(t=a[n],!(r.indexOf(t)>=0))Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}}return i}function AreaSeries_object_without_properties_loose(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],!(r.indexOf(t)>=0)&&(i[t]=e[t]);return i}var AreaSeriesRenderFunction=function(e,r){var t=e.children,n=AreaSeries_object_without_properties(e,["children"]);return(0,jsx_runtime_namespaceObject.jsx)(series_SeriesTemplate,AreaSeries_object_spread_props(AreaSeries_object_spread({type:"Area",ref:r},n),{children:t}))},AreaSeries=(0,external_react_namespaceObject.forwardRef)(AreaSeriesRenderFunction);AreaSeries.displayName="AreaSeries";var series_AreaSeries=AreaSeries;function useInitPriceLine_define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function useInitPriceLine_object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(r){useInitPriceLine_define_property(e,r,t[r])})}return e}var useInitPriceLine=function(e){var r=e.options,t=e.price,n=useSafeContext(SeriesContext),i=(0,external_react_namespaceObject.useRef)({_priceLine:null,api:function(){if(!this._priceLine){var e=n.api();if(!e)return null;this._priceLine=e.createPriceLine(useInitPriceLine_object_spread({price:t},r))}return this._priceLine},clear:function(){if(null!==this._priceLine){var e;null===(e=n.api())||void 0===e||e.removePriceLine(this._priceLine),this._priceLine=null}}});return(0,external_react_namespaceObject.useLayoutEffect)(function(){return i.current.api(),function(){i.current.clear()}},[]),(0,external_react_namespaceObject.useLayoutEffect)(function(){if(n&&r){var e;null===(e=i.current.api())||void 0===e||e.applyOptions(r)}},[r]),i},PriceLineRenderFunction=function(e,r){var t=useInitPriceLine(e);return(0,external_react_namespaceObject.useImperativeHandle)(r,function(){return t.current},[t]),null},PriceLine_PriceLine=(0,external_react_namespaceObject.forwardRef)(PriceLineRenderFunction);PriceLine_PriceLine.displayName="PriceLine";var PriceLine=PriceLine_PriceLine,__webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0});
|
|
12
|
+
//# sourceMappingURL=lightweight-charts-react-components.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightweight-charts-react-components.cjs","sources":["webpack://lightweight-charts-react-components/./src/chart/ChartContext.ts","webpack://lightweight-charts-react-components/./src/chart/useInitChart.ts","webpack://lightweight-charts-react-components/./src/chart/ChartComponent.tsx","webpack://lightweight-charts-react-components/./src/chart/ChartWrapper.tsx","webpack://lightweight-charts-react-components/./src/shared/useSafeContext.ts","webpack://lightweight-charts-react-components/./src/scales/useInitTimeScale.ts","webpack://lightweight-charts-react-components/./src/scales/TimeScale.tsx","webpack://lightweight-charts-react-components/./src/scales/useInitPriceScale.ts","webpack://lightweight-charts-react-components/./src/scales/PriceScale.tsx","webpack://lightweight-charts-react-components/./src/series/useInitSeries.ts","webpack://lightweight-charts-react-components/./src/series/SeriesContext.ts","webpack://lightweight-charts-react-components/./src/series/SeriesTemplate.tsx","webpack://lightweight-charts-react-components/./src/series/LineSeries.tsx","webpack://lightweight-charts-react-components/./src/series/HistogramSeries.tsx","webpack://lightweight-charts-react-components/./src/series/CandlestickSeries.tsx","webpack://lightweight-charts-react-components/./src/series/AreaSeries.tsx","webpack://lightweight-charts-react-components/./src/priceLine/useInitPriceLine.ts","webpack://lightweight-charts-react-components/./src/priceLine/PriceLine.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { ChartApiRef } from \"./types\";\n\nexport const ChartContext = createContext({} as ChartApiRef);\nChartContext.displayName = \"ChartContext\";\n","import { useLayoutEffect, useRef } from \"react\";\nimport { createChart } from \"lightweight-charts\";\nimport { ChartApiRef, ChartOptions } from \"./types\";\n\nexport const useInitChart = ({\n container,\n ...rest\n}: {\n container: HTMLElement;\n} & ChartOptions) => {\n const { onClick, onCrosshairMove, onInit, ...restOptions } = rest;\n\n const chartApiRef = useRef<ChartApiRef>({\n _chart: null,\n api() {\n if (this._chart === null && !this.destroyed) {\n this._chart = createChart(container, restOptions);\n\n if (onInit) {\n onInit(this._chart);\n }\n }\n\n return this._chart;\n },\n clear() {\n if (this._chart !== null) {\n this._chart.remove();\n this._chart = null;\n this.destroyed = true;\n }\n },\n destroyed: false,\n });\n\n useLayoutEffect(() => {\n chartApiRef.current.api();\n\n return () => {\n chartApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n if (onClick) {\n chartApiRef.current.api()?.subscribeClick(onClick);\n }\n\n return () => {\n if (onClick) {\n chartApiRef.current.api()?.unsubscribeClick(onClick);\n }\n };\n }, [onClick]);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n if (onCrosshairMove) {\n chartApiRef.current.api()?.subscribeCrosshairMove(onCrosshairMove);\n }\n\n return () => {\n if (onCrosshairMove) {\n chartApiRef.current.api()?.unsubscribeCrosshairMove(onCrosshairMove);\n }\n };\n }, [onCrosshairMove]);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n chartApiRef.current.api()?.applyOptions(restOptions);\n }, [restOptions]);\n\n return chartApiRef;\n};\n","import { ChartContext } from \"./ChartContext\";\nimport { useInitChart } from \"./useInitChart\";\nimport { ChartProps } from \"./types\";\n\ntype ChartComponentProps = {\n container: HTMLElement;\n} & Omit<ChartProps, \"className\">;\n\nconst ChartComponent: React.FC<ChartComponentProps> = ({ children, container, ...rest }) => {\n const chartApiRef = useInitChart({ container, ...rest });\n\n return <ChartContext.Provider value={chartApiRef.current}>{children}</ChartContext.Provider>;\n};\n\nexport default ChartComponent;\n","import { ForwardRefRenderFunction, forwardRef, useCallback, useState } from \"react\";\nimport { ChartProps } from \"./types\";\nimport ChartComponent from \"./ChartComponent\";\n\nconst ChartRenderFunction: ForwardRefRenderFunction<HTMLDivElement, ChartProps> = (\n { children, className, ...rest },\n ref\n) => {\n const [container, setContainer] = useState<HTMLDivElement>();\n const containerRef = useCallback(\n (r: HTMLDivElement) => {\n setContainer(r);\n\n if (ref) {\n if (typeof ref === \"function\") {\n containerRef(r);\n } else {\n ref.current = r;\n }\n }\n },\n [ref]\n );\n\n return (\n <div ref={containerRef} className={className}>\n {!!container && (\n <ChartComponent container={container} {...rest}>\n {children}\n </ChartComponent>\n )}\n </div>\n );\n};\n\nconst ChartWrapper = forwardRef(ChartRenderFunction);\nChartWrapper.displayName = \"ChartWrapper\";\nexport default ChartWrapper;\n","import { Context, useContext } from \"react\";\n\nexport const useSafeContext = <T>(context: Context<T>) => {\n const currentContextValue = useContext(context);\n\n if (!currentContextValue) {\n const ctxName = context.name;\n throw new Error(`${ctxName} not found. You can access context value only inside its Provider.`);\n }\n\n return currentContextValue;\n};\n","import { useLayoutEffect, useRef } from \"react\";\nimport { TimeScaleApiRef, TimeScaleProps } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitTimeScale = ({\n onVisibleTimeRangeChange,\n onVisibleLogicalRangeChange,\n onSizeChange,\n visibleRange,\n visibleLogicalRange,\n options = {},\n}: TimeScaleProps) => {\n const chart = useSafeContext(ChartContext);\n\n if (!chart) {\n throw new Error(\"Chart context not found\");\n }\n\n const timeScaleApiRef = useRef<TimeScaleApiRef>({\n _timeScale: null,\n api() {\n if (!this._timeScale) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._timeScale = chartApi.timeScale();\n\n this._timeScale.applyOptions(options);\n\n if (visibleRange) {\n this._timeScale.setVisibleRange(visibleRange);\n }\n\n if (visibleLogicalRange) {\n this._timeScale.setVisibleLogicalRange(visibleLogicalRange);\n }\n }\n\n return this._timeScale;\n },\n clear() {\n if (this._timeScale !== null) {\n this._timeScale = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n timeScaleApiRef.current.api();\n\n return () => {\n timeScaleApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n timeScaleApiRef.current?.api()?.applyOptions(options);\n }\n }, [options]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onSizeChange) {\n timeScaleApiRef.current?.api()?.subscribeSizeChange(onSizeChange);\n }\n\n return () => {\n if (onSizeChange) {\n timeScaleApiRef.current?.api()?.unsubscribeSizeChange(onSizeChange);\n }\n };\n }, [onSizeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onVisibleLogicalRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.subscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);\n }\n\n return () => {\n if (onVisibleLogicalRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.unsubscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);\n }\n };\n }, [onVisibleLogicalRangeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onVisibleTimeRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.subscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);\n }\n\n return () => {\n if (onVisibleTimeRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.unsubscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);\n }\n };\n }, [onVisibleTimeRangeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (visibleRange) {\n timeScaleApiRef.current?.api()?.setVisibleRange(visibleRange);\n }\n }, [visibleRange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (visibleLogicalRange) {\n timeScaleApiRef.current\n ?.api()\n ?.setVisibleLogicalRange(visibleLogicalRange);\n }\n }, [visibleLogicalRange]);\n\n return timeScaleApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { TimeScaleApiRef, TimeScaleProps } from \"./types\";\nimport { useInitTimeScale } from \"./useInitTimeScale\";\n\nconst TimeScaleRenderFunction = (props: TimeScaleProps, ref: ForwardedRef<TimeScaleApiRef>) => {\n const timeScaleApiRef = useInitTimeScale(props);\n useImperativeHandle(ref, () => timeScaleApiRef.current, [timeScaleApiRef]);\n\n return null;\n};\n\nconst TimeScale = forwardRef(TimeScaleRenderFunction);\nTimeScale.displayName = \"TimeScale\";\nexport default TimeScale;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { PriceScaleProps, PriceScaleApiRef } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitPriceScale = ({ options = {}, id }: PriceScaleProps) => {\n const chart = useSafeContext(ChartContext);\n\n const priceScaleApiRef = useRef<PriceScaleApiRef>({\n _priceScale: null,\n api() {\n if (!this._priceScale) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._priceScale = chartApi.priceScale(id);\n\n this._priceScale.applyOptions({\n ...options,\n });\n }\n\n return this._priceScale;\n },\n setId(id) {\n if (this._priceScale === null) {\n return;\n }\n\n this._priceScale = chart.api()!.priceScale(id);\n },\n clear() {\n if (this._priceScale !== null) {\n this._priceScale = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n priceScaleApiRef.current.api();\n\n return () => {\n priceScaleApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n priceScaleApiRef.current?.setId(id);\n }, [id]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n priceScaleApiRef.current?.api()?.applyOptions(options);\n }\n }, [options]);\n\n return priceScaleApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { PriceScaleApiRef, PriceScaleProps } from \"./types\";\nimport { useInitPriceScale } from \"./useInitPriceScale\";\n\nconst PriceScaleRenderFunction = (props: PriceScaleProps, ref: ForwardedRef<PriceScaleApiRef>) => {\n const priceScaleApiRef = useInitPriceScale(props);\n useImperativeHandle(ref, () => priceScaleApiRef.current, [priceScaleApiRef]);\n\n return null;\n};\n\nconst PriceScale = forwardRef(PriceScaleRenderFunction);\nPriceScale.displayName = \"PriceScale\";\nexport default PriceScale;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { SeriesApiRef, SeriesTemplateProps, SeriesType } from \"./types\";\nimport { IChartApi, ISeriesApi } from \"lightweight-charts\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitSeries = <T extends SeriesType>({\n type,\n data,\n options = {},\n reactive,\n markers,\n}: Omit<SeriesTemplateProps<T>, \"children\">) => {\n const chart = useSafeContext(ChartContext);\n\n const seriesApiRef = useRef<SeriesApiRef<T>>({\n _series: null,\n api() {\n if (!this._series && !this.destroyed) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._series = addSeries(chartApi, type);\n\n this._series.applyOptions(options);\n\n this._series.setData(data);\n\n if (markers) {\n this._series.setMarkers(markers);\n }\n }\n\n return this._series;\n },\n clear() {\n if (this._series !== null) {\n chart.api()?.removeSeries(this._series);\n this._series = null;\n this.destroyed = true;\n }\n },\n destroyed: false,\n });\n\n useLayoutEffect(() => {\n seriesApiRef.current.api();\n\n return () => {\n seriesApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (markers && reactive) {\n seriesApiRef.current.api()?.setMarkers(markers);\n }\n }, [markers, reactive]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (data && reactive) {\n seriesApiRef.current.api()?.setData(data);\n }\n }, [data, reactive]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n seriesApiRef.current.api()?.applyOptions(options);\n }\n }, [options]);\n\n return seriesApiRef;\n};\n\nconst addSeries = <T extends SeriesType>(chart: IChartApi, type: T) => {\n let series = null;\n\n switch (type) {\n case \"Line\":\n series = chart.addLineSeries();\n break;\n case \"Candlestick\":\n series = chart.addCandlestickSeries();\n break;\n case \"Histogram\":\n series = chart.addHistogramSeries();\n break;\n case \"Area\":\n series = chart.addAreaSeries();\n break;\n default:\n throw new Error(`Unknown series type: ${type}`);\n }\n\n return series as ISeriesApi<T>;\n};\n","import { createContext } from \"react\";\nimport { SeriesApiRef, SeriesType } from \"./types\";\n\nexport const SeriesContext = createContext({} as SeriesApiRef<SeriesType>);\nSeriesContext.displayName = \"SeriesContext\";\n","import { useInitSeries } from \"./useInitSeries\";\nimport { SeriesType, SeriesTemplateProps, SeriesApiRef } from \"./types\";\nimport { SeriesContext } from \"./SeriesContext\";\nimport { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\n\nconst SeriesTemplateRenderFunction = <T extends SeriesType = \"Line\">(\n { children, ...rest }: SeriesTemplateProps<T>,\n ref: ForwardedRef<SeriesApiRef<T>>\n) => {\n const seriesApi = useInitSeries(rest);\n useImperativeHandle(ref, () => seriesApi.current, [seriesApi]);\n\n return <SeriesContext.Provider value={seriesApi.current}>{children}</SeriesContext.Provider>;\n};\n\nconst SeriesTemplate = forwardRef(SeriesTemplateRenderFunction);\nSeriesTemplate.displayName = \"SeriesTemplate\";\nexport default SeriesTemplate;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst LineSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Line\">,\n ref: ForwardedRef<SeriesApiRef<\"Line\">>\n) => {\n return (\n <SeriesTemplate type=\"Line\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst LineSeries = forwardRef(LineSeriesRenderFunction);\nLineSeries.displayName = \"LineSeries\";\nexport default LineSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst HistogramSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Histogram\">,\n ref: ForwardedRef<SeriesApiRef<\"Histogram\">>\n) => {\n return (\n <SeriesTemplate type=\"Histogram\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst HistogramSeries = forwardRef(HistogramSeriesRenderFunction);\nHistogramSeries.displayName = \"HistogramSeries\";\nexport default HistogramSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst CandlestickSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Candlestick\">,\n ref: ForwardedRef<SeriesApiRef<\"Candlestick\">>\n) => {\n return (\n <SeriesTemplate type=\"Candlestick\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst CandlestickSeries = forwardRef(CandlestickSeriesRenderFunction);\nCandlestickSeries.displayName = \"CandlestickSeries\";\nexport default CandlestickSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst AreaSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Area\">,\n ref: ForwardedRef<SeriesApiRef<\"Area\">>\n) => {\n return (\n <SeriesTemplate type=\"Area\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst AreaSeries = forwardRef(AreaSeriesRenderFunction);\nAreaSeries.displayName = \"AreaSeries\";\nexport default AreaSeries;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { PriceLineApiRef, PriceLineProps } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { SeriesContext } from \"@/series/SeriesContext\";\n\nexport const useInitPriceLine = ({ options, price }: PriceLineProps) => {\n const series = useSafeContext(SeriesContext);\n\n const priceLineApiRef = useRef<PriceLineApiRef>({\n _priceLine: null,\n api() {\n if (!this._priceLine) {\n const seriesApi = series.api();\n\n if (!seriesApi) {\n return null;\n }\n\n this._priceLine = seriesApi.createPriceLine({\n price,\n ...options,\n });\n }\n\n return this._priceLine;\n },\n clear() {\n if (this._priceLine !== null) {\n series.api()?.removePriceLine(this._priceLine);\n this._priceLine = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n priceLineApiRef.current.api();\n\n return () => {\n priceLineApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!series) return;\n\n if (options) {\n priceLineApiRef.current.api()?.applyOptions(options);\n }\n }, [options]);\n\n return priceLineApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { PriceLineApiRef, PriceLineProps } from \"./types\";\nimport { useInitPriceLine } from \"./useInitPriceLine\";\n\nconst PriceLineRenderFunction = (props: PriceLineProps, ref: ForwardedRef<PriceLineApiRef>) => {\n const priceLineApiRef = useInitPriceLine(props);\n useImperativeHandle(ref, () => priceLineApiRef.current, [priceLineApiRef]);\n\n return null;\n};\n\nconst PriceLine = forwardRef(PriceLineRenderFunction);\nPriceLine.displayName = \"PriceLine\";\nexport default PriceLine;\n"],"names":["ChartContext","createContext","useInitChart","container","rest","onClick","onCrosshairMove","onInit","restOptions","chartApiRef","useRef","createChart","useLayoutEffect","_chartApiRef_current_api","ChartComponent","children","ChartRenderFunction","ref","className","_useState","setContainer","containerRef","useCallback","r","ChartWrapper","forwardRef","useSafeContext","context","currentContextValue","useContext","ctxName","Error","useInitTimeScale","onVisibleTimeRangeChange","onVisibleLogicalRangeChange","onSizeChange","visibleRange","visibleLogicalRange","options","chart","timeScaleApiRef","chartApi","_timeScaleApiRef_current_api","TimeScaleRenderFunction","props","useImperativeHandle","TimeScale","useInitPriceScale","id","priceScaleApiRef","_priceScaleApiRef_current","_priceScaleApiRef_current_api","PriceScaleRenderFunction","PriceScale","useInitSeries","type","data","reactive","markers","seriesApiRef","addSeries","_chart_api","_seriesApiRef_current_api","series","SeriesContext","SeriesTemplateRenderFunction","seriesApi","SeriesTemplate","LineSeriesRenderFunction","LineSeries","HistogramSeriesRenderFunction","HistogramSeries","CandlestickSeriesRenderFunction","CandlestickSeries","AreaSeriesRenderFunction","AreaSeries","useInitPriceLine","price","priceLineApiRef","_series_api","_priceLineApiRef_current_api","PriceLineRenderFunction","PriceLine"],"mappings":";;;;;;;;;;qwCAGaA,aAAeC,AAAAA,GAAAA,+BAAAA,aAAAA,AAAAA,EAAc,CAAC,EAC3CD,CAAAA,aAAa,WAAW,CAAG,qjBCApB,IAAME,aAAe,gBAC1BC,EAAAA,EAAAA,SAAS,CACNC,EAAAA,2BAAAA,EAAAA,CADHD,cAKQE,EAAqDD,EAArDC,OAAO,CAAEC,EAA4CF,EAA5CE,eAAe,CAAEC,EAA2BH,EAA3BG,MAAM,CAAKC,EAAAA,2BAAgBJ,EAAAA,CAArDC,UAASC,kBAAiBC,WAE5BE,EAAcC,AAAAA,GAAAA,+BAAAA,MAAAA,AAAAA,EAAoB,CACtC,OAAQ,KACR,eASE,OARoB,OAAhB,IAAI,CAAC,MAAM,EAAa,CAAC,IAAI,CAAC,SAAS,GACzC,IAAI,CAAC,MAAM,CAAGC,AAAAA,GAAAA,4CAAAA,WAAAA,AAAAA,EAAYR,EAAWK,GAEjCD,GACFA,EAAO,IAAI,CAAC,MAAM,GAIf,IAAI,CAAC,MAAM,AACpB,EACA,iBACsB,O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found in the
|
|
6
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import*as e from"react/jsx-runtime";import*as r from"react";import*as i from"lightweight-charts";let t=(0,r.createContext)({});t.displayName="ChartContext";let a=({container:e,...t})=>{let{onClick:a,onCrosshairMove:l,onInit:s,...n}=t,u=(0,r.useRef)({_chart:null,api(){return null===this._chart&&!this.destroyed&&(this._chart=(0,i.createChart)(e,n),s&&s(this._chart)),this._chart},clear(){null!==this._chart&&(this._chart.remove(),this._chart=null,this.destroyed=!0)},destroyed:!1});return(0,r.useLayoutEffect)(()=>(u.current.api(),()=>{u.current.clear()}),[]),(0,r.useLayoutEffect)(()=>{if(e){if(a){var r;null===(r=u.current.api())||void 0===r||r.subscribeClick(a)}return()=>{if(a){var e;null===(e=u.current.api())||void 0===e||e.unsubscribeClick(a)}}}},[a]),(0,r.useLayoutEffect)(()=>{if(e){if(l){var r;null===(r=u.current.api())||void 0===r||r.subscribeCrosshairMove(l)}return()=>{if(l){var e;null===(e=u.current.api())||void 0===e||e.unsubscribeCrosshairMove(l)}}}},[l]),(0,r.useLayoutEffect)(()=>{var r;e&&(null===(r=u.current.api())||void 0===r||r.applyOptions(n))},[n]),u},l=({children:r,container:i,...l})=>{let s=a({container:i,...l});return(0,e.jsx)(t.Provider,{value:s.current,children:r})},s=(0,r.forwardRef)(({children:i,className:t,...a},s)=>{let[n,u]=(0,r.useState)(),c=(0,r.useCallback)(e=>{u(e),s&&("function"==typeof s?c(e):s.current=e)},[s]);return(0,e.jsx)("div",{ref:c,className:t,children:!!n&&(0,e.jsx)(l,{container:n,...a,children:i})})});s.displayName="ChartWrapper";let n=s,u=e=>{let i=(0,r.useContext)(e);if(!i){let r=e.name;throw Error(`${r} not found. You can access context value only inside its Provider.`)}return i},c=({onVisibleTimeRangeChange:e,onVisibleLogicalRangeChange:i,onSizeChange:a,visibleRange:l,visibleLogicalRange:s,options:n={}})=>{let c=u(t);if(!c)throw Error("Chart context not found");let o=(0,r.useRef)({_timeScale:null,api(){if(!this._timeScale){let e=c.api();if(!e)return null;this._timeScale=e.timeScale(),this._timeScale.applyOptions(n),l&&this._timeScale.setVisibleRange(l),s&&this._timeScale.setVisibleLogicalRange(s)}return this._timeScale},clear(){null!==this._timeScale&&(this._timeScale=null)}});return(0,r.useLayoutEffect)(()=>(o.current.api(),()=>{o.current.clear()}),[]),(0,r.useLayoutEffect)(()=>{if(c&&n){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.applyOptions(n)}},[n]),(0,r.useLayoutEffect)(()=>{if(c){if(a){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.subscribeSizeChange(a)}return()=>{if(a){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.unsubscribeSizeChange(a)}}}},[a]),(0,r.useLayoutEffect)(()=>{if(c){if(i){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.subscribeVisibleLogicalRangeChange(i)}return()=>{if(i){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.unsubscribeVisibleLogicalRangeChange(i)}}}},[i]),(0,r.useLayoutEffect)(()=>{if(c){if(e){var r,i;null===(i=o.current)||void 0===i||null===(r=i.api())||void 0===r||r.subscribeVisibleTimeRangeChange(e)}return()=>{if(e){var r,i;null===(i=o.current)||void 0===i||null===(r=i.api())||void 0===r||r.unsubscribeVisibleTimeRangeChange(e)}}}},[e]),(0,r.useLayoutEffect)(()=>{if(c&&l){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.setVisibleRange(l)}},[l]),(0,r.useLayoutEffect)(()=>{if(c&&s){var e,r;null===(r=o.current)||void 0===r||null===(e=r.api())||void 0===e||e.setVisibleLogicalRange(s)}},[s]),o},o=(0,r.forwardRef)((e,i)=>{let t=c(e);return(0,r.useImperativeHandle)(i,()=>t.current,[t]),null});o.displayName="TimeScale";let f=o,p=({options:e={},id:i})=>{let a=u(t),l=(0,r.useRef)({_priceScale:null,api(){if(!this._priceScale){let r=a.api();if(!r)return null;this._priceScale=r.priceScale(i),this._priceScale.applyOptions({...e})}return this._priceScale},setId(e){if(null!==this._priceScale)this._priceScale=a.api().priceScale(e)},clear(){null!==this._priceScale&&(this._priceScale=null)}});return(0,r.useLayoutEffect)(()=>(l.current.api(),()=>{l.current.clear()}),[]),(0,r.useLayoutEffect)(()=>{var e;a&&(null===(e=l.current)||void 0===e||e.setId(i))},[i]),(0,r.useLayoutEffect)(()=>{if(a&&e){var r,i;null===(i=l.current)||void 0===i||null===(r=i.api())||void 0===r||r.applyOptions(e)}},[e]),l},d=(0,r.forwardRef)((e,i)=>{let t=p(e);return(0,r.useImperativeHandle)(i,()=>t.current,[t]),null});d.displayName="PriceScale";let h=d,v=({type:e,data:i,options:a={},reactive:l,markers:s})=>{let n=u(t),c=(0,r.useRef)({_series:null,api(){if(!this._series&&!this.destroyed){let r=n.api();if(!r)return null;this._series=y(r,e),this._series.applyOptions(a),this._series.setData(i),s&&this._series.setMarkers(s)}return this._series},clear(){if(null!==this._series){var e;null===(e=n.api())||void 0===e||e.removeSeries(this._series),this._series=null,this.destroyed=!0}},destroyed:!1});return(0,r.useLayoutEffect)(()=>(c.current.api(),()=>{c.current.clear()}),[]),(0,r.useLayoutEffect)(()=>{if(n&&s&&l){var e;null===(e=c.current.api())||void 0===e||e.setMarkers(s)}},[s,l]),(0,r.useLayoutEffect)(()=>{if(n&&i&&l){var e;null===(e=c.current.api())||void 0===e||e.setData(i)}},[i,l]),(0,r.useLayoutEffect)(()=>{if(n&&a){var e;null===(e=c.current.api())||void 0===e||e.applyOptions(a)}},[a]),c},y=(e,r)=>{let i=null;switch(r){case"Line":i=e.addLineSeries();break;case"Candlestick":i=e.addCandlestickSeries();break;case"Histogram":i=e.addHistogramSeries();break;case"Area":i=e.addAreaSeries();break;default:throw Error(`Unknown series type: ${r}`)}return i},m=(0,r.createContext)({});m.displayName="SeriesContext";let _=(0,r.forwardRef)(({children:i,...t},a)=>{let l=v(t);return(0,r.useImperativeHandle)(a,()=>l.current,[l]),(0,e.jsx)(m.Provider,{value:l.current,children:i})});_.displayName="SeriesTemplate";let S=(0,r.forwardRef)(({children:r,...i},t)=>(0,e.jsx)(_,{type:"Line",ref:t,...i,children:r}));S.displayName="LineSeries";let L=S,b=(0,r.forwardRef)(({children:r,...i},t)=>(0,e.jsx)(_,{type:"Histogram",ref:t,...i,children:r}));b.displayName="HistogramSeries";let C=b,g=(0,r.forwardRef)(({children:r,...i},t)=>(0,e.jsx)(_,{type:"Candlestick",ref:t,...i,children:r}));g.displayName="CandlestickSeries";let E=g,R=(0,r.forwardRef)(({children:r,...i},t)=>(0,e.jsx)(_,{type:"Area",ref:t,...i,children:r}));R.displayName="AreaSeries";let x=R,k=({options:e,price:i})=>{let t=u(m),a=(0,r.useRef)({_priceLine:null,api(){if(!this._priceLine){let r=t.api();if(!r)return null;this._priceLine=r.createPriceLine({price:i,...e})}return this._priceLine},clear(){if(null!==this._priceLine){var e;null===(e=t.api())||void 0===e||e.removePriceLine(this._priceLine),this._priceLine=null}}});return(0,r.useLayoutEffect)(()=>(a.current.api(),()=>{a.current.clear()}),[]),(0,r.useLayoutEffect)(()=>{if(t&&e){var r;null===(r=a.current.api())||void 0===r||r.applyOptions(e)}},[e]),a},w=(0,r.forwardRef)((e,i)=>{let t=k(e);return(0,r.useImperativeHandle)(i,()=>t.current,[t]),null});w.displayName="PriceLine";let N=w;export{x as AreaSeries,E as CandlestickSeries,n as Chart,C as HistogramSeries,L as LineSeries,N as PriceLine,h as PriceScale,f as TimeScale};
|
|
12
|
+
//# sourceMappingURL=lightweight-charts-react-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightweight-charts-react-components.js","sources":["webpack://lightweight-charts-react-components/./src/chart/ChartContext.ts","webpack://lightweight-charts-react-components/./src/chart/useInitChart.ts","webpack://lightweight-charts-react-components/./src/chart/ChartComponent.tsx","webpack://lightweight-charts-react-components/./src/chart/ChartWrapper.tsx","webpack://lightweight-charts-react-components/./src/shared/useSafeContext.ts","webpack://lightweight-charts-react-components/./src/scales/useInitTimeScale.ts","webpack://lightweight-charts-react-components/./src/scales/TimeScale.tsx","webpack://lightweight-charts-react-components/./src/scales/useInitPriceScale.ts","webpack://lightweight-charts-react-components/./src/scales/PriceScale.tsx","webpack://lightweight-charts-react-components/./src/series/useInitSeries.ts","webpack://lightweight-charts-react-components/./src/series/SeriesContext.ts","webpack://lightweight-charts-react-components/./src/series/SeriesTemplate.tsx","webpack://lightweight-charts-react-components/./src/series/LineSeries.tsx","webpack://lightweight-charts-react-components/./src/series/HistogramSeries.tsx","webpack://lightweight-charts-react-components/./src/series/CandlestickSeries.tsx","webpack://lightweight-charts-react-components/./src/series/AreaSeries.tsx","webpack://lightweight-charts-react-components/./src/priceLine/useInitPriceLine.ts","webpack://lightweight-charts-react-components/./src/priceLine/PriceLine.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { ChartApiRef } from \"./types\";\n\nexport const ChartContext = createContext({} as ChartApiRef);\nChartContext.displayName = \"ChartContext\";\n","import { useLayoutEffect, useRef } from \"react\";\nimport { createChart } from \"lightweight-charts\";\nimport { ChartApiRef, ChartOptions } from \"./types\";\n\nexport const useInitChart = ({\n container,\n ...rest\n}: {\n container: HTMLElement;\n} & ChartOptions) => {\n const { onClick, onCrosshairMove, onInit, ...restOptions } = rest;\n\n const chartApiRef = useRef<ChartApiRef>({\n _chart: null,\n api() {\n if (this._chart === null && !this.destroyed) {\n this._chart = createChart(container, restOptions);\n\n if (onInit) {\n onInit(this._chart);\n }\n }\n\n return this._chart;\n },\n clear() {\n if (this._chart !== null) {\n this._chart.remove();\n this._chart = null;\n this.destroyed = true;\n }\n },\n destroyed: false,\n });\n\n useLayoutEffect(() => {\n chartApiRef.current.api();\n\n return () => {\n chartApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n if (onClick) {\n chartApiRef.current.api()?.subscribeClick(onClick);\n }\n\n return () => {\n if (onClick) {\n chartApiRef.current.api()?.unsubscribeClick(onClick);\n }\n };\n }, [onClick]);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n if (onCrosshairMove) {\n chartApiRef.current.api()?.subscribeCrosshairMove(onCrosshairMove);\n }\n\n return () => {\n if (onCrosshairMove) {\n chartApiRef.current.api()?.unsubscribeCrosshairMove(onCrosshairMove);\n }\n };\n }, [onCrosshairMove]);\n\n useLayoutEffect(() => {\n if (!container) return;\n\n chartApiRef.current.api()?.applyOptions(restOptions);\n }, [restOptions]);\n\n return chartApiRef;\n};\n","import { ChartContext } from \"./ChartContext\";\nimport { useInitChart } from \"./useInitChart\";\nimport { ChartProps } from \"./types\";\n\ntype ChartComponentProps = {\n container: HTMLElement;\n} & Omit<ChartProps, \"className\">;\n\nconst ChartComponent: React.FC<ChartComponentProps> = ({ children, container, ...rest }) => {\n const chartApiRef = useInitChart({ container, ...rest });\n\n return <ChartContext.Provider value={chartApiRef.current}>{children}</ChartContext.Provider>;\n};\n\nexport default ChartComponent;\n","import { ForwardRefRenderFunction, forwardRef, useCallback, useState } from \"react\";\nimport { ChartProps } from \"./types\";\nimport ChartComponent from \"./ChartComponent\";\n\nconst ChartRenderFunction: ForwardRefRenderFunction<HTMLDivElement, ChartProps> = (\n { children, className, ...rest },\n ref\n) => {\n const [container, setContainer] = useState<HTMLDivElement>();\n const containerRef = useCallback(\n (r: HTMLDivElement) => {\n setContainer(r);\n\n if (ref) {\n if (typeof ref === \"function\") {\n containerRef(r);\n } else {\n ref.current = r;\n }\n }\n },\n [ref]\n );\n\n return (\n <div ref={containerRef} className={className}>\n {!!container && (\n <ChartComponent container={container} {...rest}>\n {children}\n </ChartComponent>\n )}\n </div>\n );\n};\n\nconst ChartWrapper = forwardRef(ChartRenderFunction);\nChartWrapper.displayName = \"ChartWrapper\";\nexport default ChartWrapper;\n","import { Context, useContext } from \"react\";\n\nexport const useSafeContext = <T>(context: Context<T>) => {\n const currentContextValue = useContext(context);\n\n if (!currentContextValue) {\n const ctxName = context.name;\n throw new Error(`${ctxName} not found. You can access context value only inside its Provider.`);\n }\n\n return currentContextValue;\n};\n","import { useLayoutEffect, useRef } from \"react\";\nimport { TimeScaleApiRef, TimeScaleProps } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitTimeScale = ({\n onVisibleTimeRangeChange,\n onVisibleLogicalRangeChange,\n onSizeChange,\n visibleRange,\n visibleLogicalRange,\n options = {},\n}: TimeScaleProps) => {\n const chart = useSafeContext(ChartContext);\n\n if (!chart) {\n throw new Error(\"Chart context not found\");\n }\n\n const timeScaleApiRef = useRef<TimeScaleApiRef>({\n _timeScale: null,\n api() {\n if (!this._timeScale) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._timeScale = chartApi.timeScale();\n\n this._timeScale.applyOptions(options);\n\n if (visibleRange) {\n this._timeScale.setVisibleRange(visibleRange);\n }\n\n if (visibleLogicalRange) {\n this._timeScale.setVisibleLogicalRange(visibleLogicalRange);\n }\n }\n\n return this._timeScale;\n },\n clear() {\n if (this._timeScale !== null) {\n this._timeScale = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n timeScaleApiRef.current.api();\n\n return () => {\n timeScaleApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n timeScaleApiRef.current?.api()?.applyOptions(options);\n }\n }, [options]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onSizeChange) {\n timeScaleApiRef.current?.api()?.subscribeSizeChange(onSizeChange);\n }\n\n return () => {\n if (onSizeChange) {\n timeScaleApiRef.current?.api()?.unsubscribeSizeChange(onSizeChange);\n }\n };\n }, [onSizeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onVisibleLogicalRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.subscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);\n }\n\n return () => {\n if (onVisibleLogicalRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.unsubscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);\n }\n };\n }, [onVisibleLogicalRangeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (onVisibleTimeRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.subscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);\n }\n\n return () => {\n if (onVisibleTimeRangeChange) {\n timeScaleApiRef.current\n ?.api()\n ?.unsubscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);\n }\n };\n }, [onVisibleTimeRangeChange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (visibleRange) {\n timeScaleApiRef.current?.api()?.setVisibleRange(visibleRange);\n }\n }, [visibleRange]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (visibleLogicalRange) {\n timeScaleApiRef.current\n ?.api()\n ?.setVisibleLogicalRange(visibleLogicalRange);\n }\n }, [visibleLogicalRange]);\n\n return timeScaleApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { TimeScaleApiRef, TimeScaleProps } from \"./types\";\nimport { useInitTimeScale } from \"./useInitTimeScale\";\n\nconst TimeScaleRenderFunction = (props: TimeScaleProps, ref: ForwardedRef<TimeScaleApiRef>) => {\n const timeScaleApiRef = useInitTimeScale(props);\n useImperativeHandle(ref, () => timeScaleApiRef.current, [timeScaleApiRef]);\n\n return null;\n};\n\nconst TimeScale = forwardRef(TimeScaleRenderFunction);\nTimeScale.displayName = \"TimeScale\";\nexport default TimeScale;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { PriceScaleProps, PriceScaleApiRef } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitPriceScale = ({ options = {}, id }: PriceScaleProps) => {\n const chart = useSafeContext(ChartContext);\n\n const priceScaleApiRef = useRef<PriceScaleApiRef>({\n _priceScale: null,\n api() {\n if (!this._priceScale) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._priceScale = chartApi.priceScale(id);\n\n this._priceScale.applyOptions({\n ...options,\n });\n }\n\n return this._priceScale;\n },\n setId(id) {\n if (this._priceScale === null) {\n return;\n }\n\n this._priceScale = chart.api()!.priceScale(id);\n },\n clear() {\n if (this._priceScale !== null) {\n this._priceScale = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n priceScaleApiRef.current.api();\n\n return () => {\n priceScaleApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n priceScaleApiRef.current?.setId(id);\n }, [id]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n priceScaleApiRef.current?.api()?.applyOptions(options);\n }\n }, [options]);\n\n return priceScaleApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { PriceScaleApiRef, PriceScaleProps } from \"./types\";\nimport { useInitPriceScale } from \"./useInitPriceScale\";\n\nconst PriceScaleRenderFunction = (props: PriceScaleProps, ref: ForwardedRef<PriceScaleApiRef>) => {\n const priceScaleApiRef = useInitPriceScale(props);\n useImperativeHandle(ref, () => priceScaleApiRef.current, [priceScaleApiRef]);\n\n return null;\n};\n\nconst PriceScale = forwardRef(PriceScaleRenderFunction);\nPriceScale.displayName = \"PriceScale\";\nexport default PriceScale;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { SeriesApiRef, SeriesTemplateProps, SeriesType } from \"./types\";\nimport { IChartApi, ISeriesApi } from \"lightweight-charts\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { ChartContext } from \"@/chart/ChartContext\";\n\nexport const useInitSeries = <T extends SeriesType>({\n type,\n data,\n options = {},\n reactive,\n markers,\n}: Omit<SeriesTemplateProps<T>, \"children\">) => {\n const chart = useSafeContext(ChartContext);\n\n const seriesApiRef = useRef<SeriesApiRef<T>>({\n _series: null,\n api() {\n if (!this._series && !this.destroyed) {\n const chartApi = chart.api();\n\n if (!chartApi) {\n return null;\n }\n\n this._series = addSeries(chartApi, type);\n\n this._series.applyOptions(options);\n\n this._series.setData(data);\n\n if (markers) {\n this._series.setMarkers(markers);\n }\n }\n\n return this._series;\n },\n clear() {\n if (this._series !== null) {\n chart.api()?.removeSeries(this._series);\n this._series = null;\n this.destroyed = true;\n }\n },\n destroyed: false,\n });\n\n useLayoutEffect(() => {\n seriesApiRef.current.api();\n\n return () => {\n seriesApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (markers && reactive) {\n seriesApiRef.current.api()?.setMarkers(markers);\n }\n }, [markers, reactive]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (data && reactive) {\n seriesApiRef.current.api()?.setData(data);\n }\n }, [data, reactive]);\n\n useLayoutEffect(() => {\n if (!chart) return;\n\n if (options) {\n seriesApiRef.current.api()?.applyOptions(options);\n }\n }, [options]);\n\n return seriesApiRef;\n};\n\nconst addSeries = <T extends SeriesType>(chart: IChartApi, type: T) => {\n let series = null;\n\n switch (type) {\n case \"Line\":\n series = chart.addLineSeries();\n break;\n case \"Candlestick\":\n series = chart.addCandlestickSeries();\n break;\n case \"Histogram\":\n series = chart.addHistogramSeries();\n break;\n case \"Area\":\n series = chart.addAreaSeries();\n break;\n default:\n throw new Error(`Unknown series type: ${type}`);\n }\n\n return series as ISeriesApi<T>;\n};\n","import { createContext } from \"react\";\nimport { SeriesApiRef, SeriesType } from \"./types\";\n\nexport const SeriesContext = createContext({} as SeriesApiRef<SeriesType>);\nSeriesContext.displayName = \"SeriesContext\";\n","import { useInitSeries } from \"./useInitSeries\";\nimport { SeriesType, SeriesTemplateProps, SeriesApiRef } from \"./types\";\nimport { SeriesContext } from \"./SeriesContext\";\nimport { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\n\nconst SeriesTemplateRenderFunction = <T extends SeriesType = \"Line\">(\n { children, ...rest }: SeriesTemplateProps<T>,\n ref: ForwardedRef<SeriesApiRef<T>>\n) => {\n const seriesApi = useInitSeries(rest);\n useImperativeHandle(ref, () => seriesApi.current, [seriesApi]);\n\n return <SeriesContext.Provider value={seriesApi.current}>{children}</SeriesContext.Provider>;\n};\n\nconst SeriesTemplate = forwardRef(SeriesTemplateRenderFunction);\nSeriesTemplate.displayName = \"SeriesTemplate\";\nexport default SeriesTemplate;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst LineSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Line\">,\n ref: ForwardedRef<SeriesApiRef<\"Line\">>\n) => {\n return (\n <SeriesTemplate type=\"Line\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst LineSeries = forwardRef(LineSeriesRenderFunction);\nLineSeries.displayName = \"LineSeries\";\nexport default LineSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst HistogramSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Histogram\">,\n ref: ForwardedRef<SeriesApiRef<\"Histogram\">>\n) => {\n return (\n <SeriesTemplate type=\"Histogram\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst HistogramSeries = forwardRef(HistogramSeriesRenderFunction);\nHistogramSeries.displayName = \"HistogramSeries\";\nexport default HistogramSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst CandlestickSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Candlestick\">,\n ref: ForwardedRef<SeriesApiRef<\"Candlestick\">>\n) => {\n return (\n <SeriesTemplate type=\"Candlestick\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst CandlestickSeries = forwardRef(CandlestickSeriesRenderFunction);\nCandlestickSeries.displayName = \"CandlestickSeries\";\nexport default CandlestickSeries;\n","import { ForwardedRef, forwardRef } from \"react\";\nimport SeriesTemplate from \"./SeriesTemplate\";\nimport { SeriesApiRef, SeriesProps } from \"./types\";\n\nconst AreaSeriesRenderFunction = (\n { children, ...rest }: SeriesProps<\"Area\">,\n ref: ForwardedRef<SeriesApiRef<\"Area\">>\n) => {\n return (\n <SeriesTemplate type=\"Area\" ref={ref} {...rest}>\n {children}\n </SeriesTemplate>\n );\n};\n\nconst AreaSeries = forwardRef(AreaSeriesRenderFunction);\nAreaSeries.displayName = \"AreaSeries\";\nexport default AreaSeries;\n","import { useLayoutEffect, useRef } from \"react\";\nimport { PriceLineApiRef, PriceLineProps } from \"./types\";\nimport { useSafeContext } from \"@/shared/useSafeContext\";\nimport { SeriesContext } from \"@/series/SeriesContext\";\n\nexport const useInitPriceLine = ({ options, price }: PriceLineProps) => {\n const series = useSafeContext(SeriesContext);\n\n const priceLineApiRef = useRef<PriceLineApiRef>({\n _priceLine: null,\n api() {\n if (!this._priceLine) {\n const seriesApi = series.api();\n\n if (!seriesApi) {\n return null;\n }\n\n this._priceLine = seriesApi.createPriceLine({\n price,\n ...options,\n });\n }\n\n return this._priceLine;\n },\n clear() {\n if (this._priceLine !== null) {\n series.api()?.removePriceLine(this._priceLine);\n this._priceLine = null;\n }\n },\n });\n\n useLayoutEffect(() => {\n priceLineApiRef.current.api();\n\n return () => {\n priceLineApiRef.current.clear();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!series) return;\n\n if (options) {\n priceLineApiRef.current.api()?.applyOptions(options);\n }\n }, [options]);\n\n return priceLineApiRef;\n};\n","import { ForwardedRef, forwardRef, useImperativeHandle } from \"react\";\nimport { PriceLineApiRef, PriceLineProps } from \"./types\";\nimport { useInitPriceLine } from \"./useInitPriceLine\";\n\nconst PriceLineRenderFunction = (props: PriceLineProps, ref: ForwardedRef<PriceLineApiRef>) => {\n const priceLineApiRef = useInitPriceLine(props);\n useImperativeHandle(ref, () => priceLineApiRef.current, [priceLineApiRef]);\n\n return null;\n};\n\nconst PriceLine = forwardRef(PriceLineRenderFunction);\nPriceLine.displayName = \"PriceLine\";\nexport default PriceLine;\n"],"names":["ChartContext","createContext","useInitChart","container","rest","onClick","onCrosshairMove","onInit","restOptions","chartApiRef","useRef","createChart","useLayoutEffect","_chartApiRef_current_api","children","ChartWrapper","forwardRef","className","ref","setContainer","useState","containerRef","useCallback","r","ChartComponent","useSafeContext","context","currentContextValue","useContext","ctxName","Error","useInitTimeScale","onVisibleTimeRangeChange","onVisibleLogicalRangeChange","onSizeChange","visibleRange","visibleLogicalRange","options","chart","timeScaleApiRef","chartApi","_timeScaleApiRef_current_api","TimeScale","props","useImperativeHandle","useInitPriceScale","id","priceScaleApiRef","_priceScaleApiRef_current","_priceScaleApiRef_current_api","PriceScale","useInitSeries","type","data","reactive","markers","seriesApiRef","addSeries","_chart_api","_seriesApiRef_current_api","series","SeriesContext","SeriesTemplate","seriesApi","LineSeries","HistogramSeries","CandlestickSeries","AreaSeries","useInitPriceLine","price","priceLineApiRef","_series_api","_priceLineApiRef_current_api","PriceLine"],"mappings":";;;;;;;;;;iGAGO,IAAMA,EAAeC,AAAAA,GAAAA,EAAAA,aAAAA,AAAAA,EAAc,CAAC,EAC3CD,CAAAA,EAAa,WAAW,CAAG,eCApB,IAAME,EAAe,CAAC,CAC3BC,UAAAA,CAAS,CACT,GAAGC,EAGW,IACd,GAAM,CAAEC,QAAAA,CAAO,CAAEC,gBAAAA,CAAe,CAAEC,OAAAA,CAAM,CAAE,GAAGC,EAAa,CAAGJ,EAEvDK,EAAcC,AAAAA,GAAAA,EAAAA,MAAAA,AAAAA,EAAoB,CACtC,OAAQ,KACR,MASE,OARoB,OAAhB,IAAI,CAAC,MAAM,EAAa,CAAC,IAAI,CAAC,SAAS,GACzC,IAAI,CAA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