@pradeepjadhav/trading-reload-chart 1.0.4 → 1.1.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/README.md +135 -21
- package/dist/trading-reload-chart.js +642 -614
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ For architecture, conventions, and agent guidelines, see [AGENTS.md](./AGENTS.md
|
|
|
18
18
|
|
|
19
19
|
## Quick start (local development)
|
|
20
20
|
|
|
21
|
-
1.
|
|
21
|
+
### 1. Clone and install
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
git clone <repository-url>
|
|
@@ -26,7 +26,9 @@ cd trading-reload-chart
|
|
|
26
26
|
npm install
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
2.
|
|
29
|
+
### 2. Run the demo
|
|
30
|
+
|
|
31
|
+
Hot reload, port **8999** by default.
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
34
|
npm run dev
|
|
@@ -34,12 +36,12 @@ npm run dev
|
|
|
34
36
|
|
|
35
37
|
Open the URL Vite prints (typically `http://localhost:8999`). The demo mounts `TradingReload` with sample API/WebSocket wiring in `demo/`.
|
|
36
38
|
|
|
37
|
-
3.
|
|
39
|
+
### 3. Optional checks
|
|
38
40
|
|
|
39
41
|
```bash
|
|
40
|
-
npm run typecheck
|
|
41
|
-
npm run lint
|
|
42
|
-
npm run format
|
|
42
|
+
npm run typecheck
|
|
43
|
+
npm run lint
|
|
44
|
+
npm run format
|
|
43
45
|
```
|
|
44
46
|
|
|
45
47
|
---
|
|
@@ -75,16 +77,111 @@ npm run preview
|
|
|
75
77
|
|
|
76
78
|
---
|
|
77
79
|
|
|
80
|
+
## Publishing to npm
|
|
81
|
+
|
|
82
|
+
### 1. Login to npm
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm login
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Verify the active account:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm whoami
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The username should match the npm account that owns the package scope.
|
|
95
|
+
|
|
96
|
+
### 2. Authenticate in your browser
|
|
97
|
+
|
|
98
|
+
If npm prompts for browser-based authentication:
|
|
99
|
+
|
|
100
|
+
1. Open the URL shown in the terminal.
|
|
101
|
+
2. Sign in to npm.
|
|
102
|
+
3. Complete the verification flow.
|
|
103
|
+
4. Return to the terminal.
|
|
104
|
+
|
|
105
|
+
Verify authentication:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm whoami
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Build the package
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm run build
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 4. Verify package contents
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm pack --dry-run
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Ensure only the intended files are included.
|
|
124
|
+
|
|
125
|
+
### 5. Publish
|
|
126
|
+
|
|
127
|
+
For a public scoped package:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm publish --access public
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Publishing a new version
|
|
134
|
+
|
|
135
|
+
Update the version:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npm version patch
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
or
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm version minor
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
or
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm version major
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Then publish:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm publish --access public
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Useful commands
|
|
160
|
+
|
|
161
|
+
Check the currently authenticated npm user:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm whoami
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
View package information:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm view @pradeepjadhav/trading-reload-chart
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
78
175
|
## Using the library in React / Next.js
|
|
79
176
|
|
|
80
177
|
The chart is **client-only** (canvas + DOM). It does **not** support SSR.
|
|
81
178
|
|
|
82
179
|
### 1. Install the package
|
|
83
180
|
|
|
84
|
-
**From npm
|
|
181
|
+
**From npm**:
|
|
85
182
|
|
|
86
183
|
```bash
|
|
87
|
-
npm install trading-reload-chart react react-dom
|
|
184
|
+
npm install @pradeepjadhav/trading-reload-chart react react-dom
|
|
88
185
|
```
|
|
89
186
|
|
|
90
187
|
**Directly from GitHub**:
|
|
@@ -99,6 +196,7 @@ npm install git+https://github.com/Pradeep17Jadhav/trading-reload-chart.git#main
|
|
|
99
196
|
# In trading-reload-chart repo
|
|
100
197
|
npm run build
|
|
101
198
|
npm pack
|
|
199
|
+
|
|
102
200
|
# In your app
|
|
103
201
|
npm install /path/to/trading-reload-chart/trading-reload-chart-1.0.0.tgz
|
|
104
202
|
```
|
|
@@ -107,7 +205,7 @@ Or link during development:
|
|
|
107
205
|
|
|
108
206
|
```bash
|
|
109
207
|
cd trading-reload-chart && npm run build && npm link
|
|
110
|
-
cd your-app && npm link trading-reload-chart
|
|
208
|
+
cd your-app && npm link @pradeepjadhav/trading-reload-chart
|
|
111
209
|
```
|
|
112
210
|
|
|
113
211
|
### 2. Next.js App Router
|
|
@@ -124,7 +222,7 @@ import {
|
|
|
124
222
|
type Shape,
|
|
125
223
|
type ShapeToolType,
|
|
126
224
|
type OpenTrade,
|
|
127
|
-
} from "trading-reload-chart";
|
|
225
|
+
} from "@pradeepjadhav/trading-reload-chart";
|
|
128
226
|
|
|
129
227
|
export function ChartPanel() {
|
|
130
228
|
const [candles, setCandles] = useState<Candle[]>([]);
|
|
@@ -151,15 +249,17 @@ export function ChartPanel() {
|
|
|
151
249
|
}
|
|
152
250
|
```
|
|
153
251
|
|
|
154
|
-
- Give the parent a **defined height** (flex child, `h-full`, or fixed `min-height`).
|
|
252
|
+
- Give the parent a **defined height** (flex child, `h-full`, or fixed `min-height`).
|
|
253
|
+
- `TradingReload` fills **100%** of that container.
|
|
155
254
|
- Do **not** import chart CSS manually; styles ship with the component (`src/styles/chart.css`).
|
|
156
255
|
|
|
157
256
|
### 3. Vite / Create React App
|
|
158
257
|
|
|
159
|
-
Same import; wrap the chart in a sized container:
|
|
160
|
-
|
|
161
258
|
```tsx
|
|
162
|
-
import {
|
|
259
|
+
import {
|
|
260
|
+
TradingReload,
|
|
261
|
+
type Candle,
|
|
262
|
+
} from "@pradeepjadhav/trading-reload-chart";
|
|
163
263
|
|
|
164
264
|
export function App() {
|
|
165
265
|
return (
|
|
@@ -188,9 +288,23 @@ Import from the package root:
|
|
|
188
288
|
| `ChartConfig`, `CHART_CONFIG`, `DeepPartial` | Configuration |
|
|
189
289
|
| `ClosedTradeIndicator`, trade handle types | Trade overlay types |
|
|
190
290
|
|
|
191
|
-
Controlled props (parent owns state):
|
|
291
|
+
Controlled props (parent owns state):
|
|
292
|
+
|
|
293
|
+
- `candles`
|
|
294
|
+
- `liveCandle`
|
|
295
|
+
- `openTrades`
|
|
296
|
+
- `closedTrades`
|
|
297
|
+
- `shapes`
|
|
298
|
+
- `activeShapeTool`
|
|
299
|
+
- `config`
|
|
300
|
+
- `activeSymbol`
|
|
192
301
|
|
|
193
|
-
Callbacks:
|
|
302
|
+
Callbacks:
|
|
303
|
+
|
|
304
|
+
- `onShapeAdded`
|
|
305
|
+
- `onShapeModified`
|
|
306
|
+
- `onActiveShapeToolChange`
|
|
307
|
+
- `onTradeModify`
|
|
194
308
|
|
|
195
309
|
See [AGENTS.md](./AGENTS.md) for the full props contract.
|
|
196
310
|
|
|
@@ -213,10 +327,10 @@ trading-reload-chart/
|
|
|
213
327
|
│ └── styles/ # chart.css
|
|
214
328
|
├── dist/ # Library build output
|
|
215
329
|
├── AGENTS.md
|
|
216
|
-
└── vite.config.ts #
|
|
330
|
+
└── vite.config.ts # dev = demo; build --mode library = package
|
|
217
331
|
```
|
|
218
332
|
|
|
219
|
-
Type declarations live in
|
|
333
|
+
Type declarations live in `*.types.ts` files next to implementation code (see AGENTS.md).
|
|
220
334
|
|
|
221
335
|
---
|
|
222
336
|
|
|
@@ -251,6 +365,6 @@ Modern evergreen browsers with Canvas 2D (Chrome, Edge, Firefox, Safari).
|
|
|
251
365
|
|
|
252
366
|
## License
|
|
253
367
|
|
|
254
|
-
Commercial, proprietary license. Use of this library requires a paid license,
|
|
255
|
-
|
|
256
|
-
[LICENSE](./LICENSE).
|
|
368
|
+
Commercial, proprietary license. Use of this library requires a paid license, subscription, or other written authorization from Pradeep Jadhav.
|
|
369
|
+
|
|
370
|
+
See [LICENSE](./LICENSE).
|