lightweight-charts-drawing 0.3.0 → 0.5.0
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/CHANGELOG.md +29 -0
- package/README.md +7 -0
- package/dist/index.d.ts +33 -4
- package/dist/lightweight-charts-drawing.es.js +306 -247
- package/dist/lightweight-charts-drawing.es.js.map +1 -1
- package/dist/lightweight-charts-drawing.umd.cjs +7 -7
- package/dist/lightweight-charts-drawing.umd.cjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 (08/10/2026)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `DrawingManager.setHidden(id, hidden)`: hide / show one drawing without
|
|
8
|
+
removing it (the drawing's `hidden` flag, saved with it).
|
|
9
|
+
- `DrawingManager.setDrawingsVisible(visible)` / `drawingsVisible()` and the
|
|
10
|
+
`visibility` event: hide / show every drawing at once (TradingView "Hide
|
|
11
|
+
all drawings"). Not saved, the drawings are untouched. Hiding disarms the
|
|
12
|
+
tool; arming a tool shows the drawings again.
|
|
13
|
+
- Demo: hide all button, hide button in the selection bar.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- A drawing that stops being shown (`hidden`, per-interval visibility) leaves
|
|
18
|
+
the selection and the hover: Delete could remove a drawing that was not
|
|
19
|
+
drawn.
|
|
20
|
+
|
|
21
|
+
## 0.4.0 (02/10/2026)
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `fibLevelAt` is exported from the package entry.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- `VERSION` is read from `package.json` at build time (vite `define`), so it
|
|
30
|
+
cannot stay behind the package version again.
|
|
31
|
+
|
|
3
32
|
## 0.3.0 (02/10/2026)
|
|
4
33
|
|
|
5
34
|
### Added
|
package/README.md
CHANGED
|
@@ -61,6 +61,8 @@ intraday of date labels), `stayInDrawingMode` (TV Keep drawing).
|
|
|
61
61
|
| `setTool(kind \| null, { glyph? })`, `tool()` | arm / disarm a tool (`kind` from docs/TOOLS.md) |
|
|
62
62
|
| `setMagnet(mode)`, `setInterval(i)`, `setStayInDrawingMode(on)` | settings |
|
|
63
63
|
| `add(drawing)`, `update(drawing)`, `remove(id)`, `clear()`, `get(id)`, `drawings()` | drawings |
|
|
64
|
+
| `setHidden(id, hidden)` | hide / show one drawing without removing it (the drawing's `hidden` flag, saved with it) |
|
|
65
|
+
| `setDrawingsVisible(visible)`, `drawingsVisible()` | hide / show every drawing at once (TV "Hide all drawings"; not saved, the drawings are untouched) |
|
|
64
66
|
| `select(ids)`, `selection()` | selection (multi-select with Ctrl / Cmd) |
|
|
65
67
|
| `bringToFront(id)`, `sendToBack(id)` | z-order |
|
|
66
68
|
| `toggleAnchored(id)` | TV "Anchor drawing" for Text, Pin and Table: the drawing keeps its pane position when the chart scrolls (`isAnchorable(kind)`) |
|
|
@@ -71,6 +73,7 @@ intraday of date labels), `stayInDrawingMode` (TV Keep drawing).
|
|
|
71
73
|
| `redraw()`, `destroy()` | |
|
|
72
74
|
|
|
73
75
|
Events: `change`, `add`, `update`, `remove`, `selection`, `tool`,
|
|
76
|
+
`visibility` (every drawing hidden / shown again),
|
|
74
77
|
`textEdit` (a text tool was placed or double-clicked: open your editor at
|
|
75
78
|
the given pane point and `update` the drawing's `text`), `tableEdit` (a click
|
|
76
79
|
on a cell of the selected table: open your editor over the given cell box),
|
|
@@ -84,6 +87,10 @@ steps / square boxes and magnet off, Ctrl / Cmd inverts the magnet; Escape
|
|
|
84
87
|
drops pending points, then the tool, then the selection; Delete removes the
|
|
85
88
|
selection (locked drawings stay).
|
|
86
89
|
|
|
90
|
+
Drawing flags: `locked` (selectable, but no drag and no Delete) and `hidden`
|
|
91
|
+
(not drawn, hit or selected). A drawing that gets hidden leaves the
|
|
92
|
+
selection. Arming a tool while every drawing is hidden shows them again.
|
|
93
|
+
|
|
87
94
|
The host keeps what is not drawing logic: undo stack, storage, settings
|
|
88
95
|
dialogs, text / table editors, toolbar, context menu.
|
|
89
96
|
|
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,8 @@ export declare class DrawingManager {
|
|
|
183
183
|
private readonly listeners;
|
|
184
184
|
private list;
|
|
185
185
|
private selected;
|
|
186
|
+
/** TV "Hide all drawings": off = nothing is drawn or hit (not saved). */
|
|
187
|
+
private visible;
|
|
186
188
|
private hovered;
|
|
187
189
|
private spec;
|
|
188
190
|
private glyph;
|
|
@@ -206,6 +208,7 @@ export declare class DrawingManager {
|
|
|
206
208
|
on(event: "remove", cb: DrawingManagerEvents["remove"]): () => void;
|
|
207
209
|
on(event: "selection", cb: DrawingManagerEvents["selection"]): () => void;
|
|
208
210
|
on(event: "tool", cb: DrawingManagerEvents["tool"]): () => void;
|
|
211
|
+
on(event: "visibility", cb: DrawingManagerEvents["visibility"]): () => void;
|
|
209
212
|
on(event: "textEdit", cb: DrawingManagerEvents["textEdit"]): () => void;
|
|
210
213
|
on(event: "gestureEnd", cb: DrawingManagerEvents["gestureEnd"]): () => void;
|
|
211
214
|
on(event: "tableEdit", cb: DrawingManagerEvents["tableEdit"]): () => void;
|
|
@@ -217,12 +220,20 @@ export declare class DrawingManager {
|
|
|
217
220
|
tool(): DrawingKind | null;
|
|
218
221
|
setMagnet(mode: MagnetMode): void;
|
|
219
222
|
setInterval(interval: string | undefined): void;
|
|
223
|
+
/** TV "Hide all drawings": hide / show every drawing without touching
|
|
224
|
+
* them (the drawings' own `hidden` flag and the saved JSON stay as they
|
|
225
|
+
* are). Hiding disarms the tool and clears the selection. */
|
|
226
|
+
setDrawingsVisible(visible: boolean): void;
|
|
227
|
+
drawingsVisible(): boolean;
|
|
220
228
|
setStayInDrawingMode(on: boolean): void;
|
|
221
229
|
drawings(): readonly Drawing[];
|
|
222
230
|
get(id: string): Drawing | undefined;
|
|
223
231
|
/** Add a drawing (default style of its kind when none); returns its id. */
|
|
224
232
|
add(nd: NewDrawing | Drawing): string;
|
|
225
233
|
update(d: Drawing): void;
|
|
234
|
+
/** Hide / show one drawing (its `hidden` flag, saved with it): a hidden
|
|
235
|
+
* drawing is not drawn, hit or selected. */
|
|
236
|
+
setHidden(id: string, hidden: boolean): void;
|
|
226
237
|
remove(id: string): void;
|
|
227
238
|
clear(): void;
|
|
228
239
|
/** Z-order (TV Visual order): the list order is the draw order. */
|
|
@@ -287,6 +298,9 @@ export declare class DrawingManager {
|
|
|
287
298
|
private changed;
|
|
288
299
|
private reorder;
|
|
289
300
|
private shown;
|
|
301
|
+
/** Drawings that are no longer shown leave the selection and the hover:
|
|
302
|
+
* Delete must not remove a drawing the user cannot see. */
|
|
303
|
+
private dropHidden;
|
|
290
304
|
private paneSize;
|
|
291
305
|
/** Pointer position in pane coordinates. */
|
|
292
306
|
private panePoint;
|
|
@@ -334,6 +348,9 @@ export declare type DrawingManagerEvents = {
|
|
|
334
348
|
selection: (ids: readonly string[]) => void;
|
|
335
349
|
/** The armed tool changed (null = none). */
|
|
336
350
|
tool: (kind: DrawingKind | null) => void;
|
|
351
|
+
/** Every drawing was hidden or shown again (setDrawingsVisible, or a tool
|
|
352
|
+
* armed while they were hidden). */
|
|
353
|
+
visibility: (visible: boolean) => void;
|
|
337
354
|
/** A text tool was placed (or double-clicked): the host opens its editor
|
|
338
355
|
* at `screen` (pane coordinates) and calls update with the text. */
|
|
339
356
|
textEdit: (d: Drawing, screen: Pt) => void;
|
|
@@ -637,6 +654,19 @@ export declare function drawScene(ctx: Ctx, items: SceneItem[], o: CanvasSceneOp
|
|
|
637
654
|
* saved default (TV restoreFactoryDefaults / "Apply defaults"). */
|
|
638
655
|
export declare function factoryStyleFor(kind: DrawingKind): DrawingStyle;
|
|
639
656
|
|
|
657
|
+
/** The fib retracement / trend-based extension level line under `cursor`
|
|
658
|
+
* (within 6 px, inside the levels' x-range): its index in the drawing's
|
|
659
|
+
* level list (`style.levels` or the factory list), y, x-range and the
|
|
660
|
+
* position of its level text (the Text alignment). Null elsewhere. Used by
|
|
661
|
+
* hosts to edit a level's text on the chart. */
|
|
662
|
+
export declare function fibLevelAt(d: Drawing, pts: Pt[], cursor: Pt, w: number, coords: Coords | null): {
|
|
663
|
+
index: number;
|
|
664
|
+
y: number;
|
|
665
|
+
left: number;
|
|
666
|
+
right: number;
|
|
667
|
+
textX: number;
|
|
668
|
+
} | null;
|
|
669
|
+
|
|
640
670
|
export declare function findOverlaySpec(toolId: string | null): OverlaySpec | undefined;
|
|
641
671
|
|
|
642
672
|
/** A finished placement: the clicked points -> the new drawing with the data
|
|
@@ -1363,7 +1393,7 @@ declare type UnitVisibility = {
|
|
|
1363
1393
|
to: number;
|
|
1364
1394
|
};
|
|
1365
1395
|
|
|
1366
|
-
export declare const VERSION
|
|
1396
|
+
export declare const VERSION: string;
|
|
1367
1397
|
|
|
1368
1398
|
/** Volume profile tools: the reference VbPFixed / VbPAnchored study
|
|
1369
1399
|
* defaults (24 rows, Up/Down, 70% value area, histogram 30% of the box,
|
|
@@ -1461,9 +1491,8 @@ declare type WithId<T> = T & {
|
|
|
1461
1491
|
closed?: boolean;
|
|
1462
1492
|
/** Locked drawings can be selected but not dragged or deleted via Delete-key. */
|
|
1463
1493
|
locked?: boolean;
|
|
1464
|
-
/** Hidden drawings are not rendered
|
|
1465
|
-
*
|
|
1466
|
-
* (not yet built). */
|
|
1494
|
+
/** Hidden drawings are not rendered, hit-tested or selected; the flag is
|
|
1495
|
+
* saved with the drawing (DrawingManager.setHidden). */
|
|
1467
1496
|
hidden?: boolean;
|
|
1468
1497
|
/** Per-interval visibility matrix (Settings → Visibility). Absent = always
|
|
1469
1498
|
* visible (the default for drawings saved before this field existed). */
|