@luxalgo/vela 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataProvider-oH78tYXL.d.ts → DataProvider-BUdlkx9I.d.ts} +1 -1
- package/dist/{DataProvider-wbtJ3-Sa.d.cts → DataProvider-DdqMxKdl.d.cts} +1 -1
- package/dist/{chunk-KWI3YDBW.js → chunk-ALTGHKIM.js} +584 -25
- package/dist/{chunk-TO3GIK7Z.js → chunk-AUOB7A5Y.js} +2 -2
- package/dist/{chunk-2IPXYM4B.js → chunk-BN4DNS3O.js} +114 -11
- package/dist/{chunk-VHGACEHO.js → chunk-I2U4NZD2.js} +7 -1
- package/dist/{chunk-HMHA733L.js → chunk-QYIO37K7.js} +2407 -829
- package/dist/{chunk-G7B7ZCBF.js → chunk-WY5H4S4I.js} +1 -1
- package/dist/{contributions-HGqnNb_P.d.ts → contributions-D8xuYc9U.d.cts} +91 -8
- package/dist/{contributions-BhOBRenr.d.cts → contributions-P9fBBuY1.d.ts} +91 -8
- package/dist/index.cjs +3064 -921
- package/dist/index.d.cts +25 -15
- package/dist/index.d.ts +25 -15
- package/dist/index.js +4 -4
- package/dist/{options-lMUwmRwh.d.cts → options-BI5Tp32b.d.cts} +100 -5
- package/dist/{options-lMUwmRwh.d.ts → options-BI5Tp32b.d.ts} +100 -5
- package/dist/{plugin-Do5J5xuF.d.cts → plugin-B8F1nor8.d.cts} +14 -8
- package/dist/{plugin-Cr2Pj8q8.d.ts → plugin-D5Z-Q6TX.d.ts} +14 -8
- package/dist/plugin.cjs +555 -17
- package/dist/plugin.d.cts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.js +2 -2
- package/dist/providers/binance.d.cts +2 -2
- package/dist/providers/binance.d.ts +2 -2
- package/dist/providers/coinbase.d.cts +2 -2
- package/dist/providers/coinbase.d.ts +2 -2
- package/dist/providers/hyperliquid.d.cts +2 -2
- package/dist/providers/hyperliquid.d.ts +2 -2
- package/dist/{statusline-model-CY1wzxHg.d.ts → statusline-model-CTwtDIca.d.cts} +19 -4
- package/dist/{statusline-model-B-2xGlB_.d.cts → statusline-model-D9kWC9X5.d.ts} +19 -4
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +3 -3
- package/dist/vela.global.js +3071 -928
- package/dist/vela.global.min.js +125 -55
- package/dist/widget.cjs +3314 -1068
- package/dist/widget.d.cts +6 -6
- package/dist/widget.d.ts +6 -6
- package/dist/widget.js +7 -7
- package/dist/workspace.cjs +3314 -1068
- package/dist/workspace.d.cts +19 -5
- package/dist/workspace.d.ts +19 -5
- package/dist/workspace.js +6 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-
|
|
2
|
-
import { injectStyles, holdForExit, announceSurface } from './chunk-
|
|
1
|
+
import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-WY5H4S4I.js';
|
|
2
|
+
import { injectStyles, holdForExit, announceSurface } from './chunk-I2U4NZD2.js';
|
|
3
3
|
import * as tooltip from '@zag-js/tooltip';
|
|
4
4
|
import * as dialog from '@zag-js/dialog';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { parseSymbol, priceStyleIds, BUILTIN_PRICE_STYLES, SecondClock, isGroupRow, defaultMemberOf, groupKeyOf, groupMembers, LEGEND_AT_TOP_ATTR, normalizeSession, Vela, TypedEventBus, timeframeToMs, MultiProviderFeed, registerBuiltinChartTypes, resolveTheme, buildToolbar, createCustomMark, createAttributionMark, DrawingToolbar, applyAttributionMarkTheme, sharedBarStore, CANDLE_OVERRIDE_KEYS } from './chunk-
|
|
2
|
-
import { chartType, resolveTopbarComposition, topbarActionOverride, TOPBAR_BUILTIN_IDS, widgetActions, tzButtonLabel, resolveTimezone, timezoneMenuRows, SidePanel, sidePanels, DEFAULT_PANEL_ORDER, symbolRanking, paneScaleAt, composeMenu, priceAxisItems, scaleChoiceOf, timeAxisItems, bodyItems, scaleWrites, invertWrite, settingsSectionOf, resolveEngines, legendActionsProviderFor, legendCalloutsProviderFor, normalizeTimezone, isExchangeTimezone, statePersistenceHandlers, topbarHas, rendererDefaults, mobilePlacement, widgetAttachments, getDrawingType, inputDeltas } from './chunk-
|
|
3
|
-
import { Tooltip, KeymapManager, isEditableTarget, Drawer } from './chunk-
|
|
4
|
-
import { Menu, Dialog, CalloutBubble, applyPlotOverlayTokens, ensureUIHost } from './chunk-
|
|
5
|
-
import { registerIcon, svg16, injectStyles, iconEl, iconMarkup, iconAt, SESSION_OFF, SESSION_POST, SESSION_PRE, announceSurface, holdForExit, icon, categoricalColor } from './chunk-
|
|
1
|
+
import { parseSymbol, priceStyleIds, BUILTIN_PRICE_STYLES, SecondClock, isGroupRow, defaultMemberOf, groupKeyOf, groupMembers, LEGEND_AT_TOP_ATTR, normalizeSession, Vela, TypedEventBus, timeframeToMs, MultiProviderFeed, registerBuiltinChartTypes, resolveTheme, buildToolbar, createCustomMark, createAttributionMark, DrawingToolbar, applyAttributionMarkTheme, sharedBarStore, CANDLE_OVERRIDE_KEYS } from './chunk-QYIO37K7.js';
|
|
2
|
+
import { chartType, resolveTopbarComposition, topbarActionOverride, TOPBAR_BUILTIN_IDS, widgetActions, tzButtonLabel, resolveTimezone, timezoneMenuRows, SidePanel, sidePanels, DEFAULT_PANEL_ORDER, symbolRanking, paneScaleAt, composeMenu, priceAxisItems, scaleChoiceOf, timeAxisItems, bodyItems, scaleWrites, invertWrite, settingsSectionOf, resolveEngines, legendActionsProviderFor, legendCalloutsProviderFor, normalizeTimezone, isExchangeTimezone, statePersistenceHandlers, topbarHas, rendererDefaults, mobilePlacement, widgetAttachments, getDrawingType, inputDeltas } from './chunk-ALTGHKIM.js';
|
|
3
|
+
import { Tooltip, KeymapManager, isEditableTarget, Drawer } from './chunk-AUOB7A5Y.js';
|
|
4
|
+
import { Menu, Dialog, CalloutBubble, applyPlotOverlayTokens, ensureUIHost } from './chunk-WY5H4S4I.js';
|
|
5
|
+
import { registerIcon, svg16, injectStyles, iconEl, iconMarkup, iconAt, SESSION_OFF, SESSION_POST, SESSION_PRE, announceSurface, holdForExit, icon, categoricalColor } from './chunk-I2U4NZD2.js';
|
|
6
6
|
import { baseOf } from './chunk-W4EJWLEO.js';
|
|
7
7
|
|
|
8
8
|
// src/widget/timeframe.ts
|
|
@@ -1435,9 +1435,14 @@ function paneItems(snap, pane, units) {
|
|
|
1435
1435
|
return [...unitItems, ...rows2];
|
|
1436
1436
|
}
|
|
1437
1437
|
const zOf = new Map(snap.zOrder.map((e) => [e.id, e.z]));
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
|
|
1438
|
+
const rank = new Map(snap.zOrder.map((e, i) => [e.id, i]));
|
|
1439
|
+
const rows = pane.indicators.map((i) => ({
|
|
1440
|
+
item: { kind: "row", row: indicatorRow(i) },
|
|
1441
|
+
z: zOf.get(i.id) ?? 0,
|
|
1442
|
+
rank: rank.get(i.id) ?? -1
|
|
1443
|
+
}));
|
|
1444
|
+
if (pane.kind === "price") rows.push({ item: { kind: "row", row: priceRow() }, z: snap.candleZ, rank: -Infinity });
|
|
1445
|
+
rows.sort((a, b) => b.z - a.z || b.rank - a.rank);
|
|
1441
1446
|
if (!snap.interleave) return [...unitItems, ...rows.map((r) => r.item)];
|
|
1442
1447
|
const entries = [...rows, ...units.map((unit) => ({ item: { kind: "unit", unit }, z: unitZ(unit) }))];
|
|
1443
1448
|
entries.sort((a, b) => a.z === b.z ? Number(a.item.kind === "unit") - Number(b.item.kind === "unit") : b.z - a.z);
|
|
@@ -1734,6 +1739,7 @@ var ObjectTree = class extends SidePanel {
|
|
|
1734
1739
|
for (const ev of REFRESH_EVENTS) {
|
|
1735
1740
|
this.unsubs.push(chart.on(ev, () => this.refresh()));
|
|
1736
1741
|
}
|
|
1742
|
+
this.unsubs.push(chart.renderer.onConfigChanged(() => this.refresh()));
|
|
1737
1743
|
this.unsubs.push(
|
|
1738
1744
|
chart.on("drawing:selected", ({ ids }) => {
|
|
1739
1745
|
this.selectedDrawings = new Set(ids);
|
|
@@ -3931,6 +3937,8 @@ function sanitizeState(doc) {
|
|
|
3931
3937
|
const favs = d.timeframeFavorites.filter((f) => typeof f === "string");
|
|
3932
3938
|
if (favs.length > 0) out.timeframeFavorites = favs;
|
|
3933
3939
|
}
|
|
3940
|
+
const tools = sanitizeDrawingTools(d.drawingTools);
|
|
3941
|
+
if (tools) out.drawingTools = tools;
|
|
3934
3942
|
const sync = sanitizeSync(d.sync);
|
|
3935
3943
|
if (sync) out.sync = sync;
|
|
3936
3944
|
const tracks = sanitizeTrackSizes(d.trackSizes);
|
|
@@ -3949,6 +3957,42 @@ function sanitizeExt(raw) {
|
|
|
3949
3957
|
}
|
|
3950
3958
|
return Object.keys(out).length > 0 ? out : null;
|
|
3951
3959
|
}
|
|
3960
|
+
function sanitizeDrawingTools(raw) {
|
|
3961
|
+
if (raw == null || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
3962
|
+
const r = raw;
|
|
3963
|
+
const out = {};
|
|
3964
|
+
if (r.defaults != null && typeof r.defaults === "object" && !Array.isArray(r.defaults)) {
|
|
3965
|
+
const defaults = {};
|
|
3966
|
+
for (const [type, value] of Object.entries(r.defaults)) {
|
|
3967
|
+
if (type.length > 0 && value != null && typeof value === "object" && !Array.isArray(value)) defaults[type] = value;
|
|
3968
|
+
}
|
|
3969
|
+
if (Object.keys(defaults).length > 0) out.defaults = defaults;
|
|
3970
|
+
}
|
|
3971
|
+
if (r.templates != null && typeof r.templates === "object" && !Array.isArray(r.templates)) {
|
|
3972
|
+
const templates = {};
|
|
3973
|
+
for (const [type, list] of Object.entries(r.templates)) {
|
|
3974
|
+
if (type.length > 0 && Array.isArray(list) && list.length > 0) templates[type] = list;
|
|
3975
|
+
}
|
|
3976
|
+
if (Object.keys(templates).length > 0) out.templates = templates;
|
|
3977
|
+
}
|
|
3978
|
+
if (r.magnet === "off" || r.magnet === "weak" || r.magnet === "strong") out.magnet = r.magnet;
|
|
3979
|
+
if (typeof r.stay === "boolean") out.stay = r.stay;
|
|
3980
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
3981
|
+
}
|
|
3982
|
+
function successorNative(entry) {
|
|
3983
|
+
const type = typeof entry === "string" ? entry : entry.type;
|
|
3984
|
+
if (type !== "linear-regression") return entry;
|
|
3985
|
+
const hidden = typeof entry === "object" && entry.hidden === true;
|
|
3986
|
+
const { mode, lineColor, ...rest } = typeof entry === "object" ? entry.inputs ?? {} : {};
|
|
3987
|
+
const slope = mode === "Slope";
|
|
3988
|
+
const inputs = slope ? { ...rest, ...lineColor !== void 0 ? { lineColor } : {} } : (
|
|
3989
|
+
// Saved deltas omit the curve's 100-bar default, which the LSMA's default is not.
|
|
3990
|
+
{ length: 100, ...rest, ...lineColor !== void 0 ? { neutralColor: lineColor } : {} }
|
|
3991
|
+
);
|
|
3992
|
+
const next = slope ? "linear-regression-slope" : "lsma";
|
|
3993
|
+
const hasInputs = Object.keys(inputs).length > 0;
|
|
3994
|
+
return hasInputs || hidden ? { type: next, ...hasInputs ? { inputs } : {}, ...hidden ? { hidden } : {} } : next;
|
|
3995
|
+
}
|
|
3952
3996
|
function sanitizeCell(raw) {
|
|
3953
3997
|
if (raw == null || typeof raw !== "object") return null;
|
|
3954
3998
|
const c = raw;
|
|
@@ -3988,7 +4032,7 @@ function sanitizeCell(raw) {
|
|
|
3988
4032
|
return [inputs || hidden ? { type: e.type, ...inputs ? { inputs } : {}, ...hidden ? { hidden } : {} } : e.type];
|
|
3989
4033
|
}
|
|
3990
4034
|
return [];
|
|
3991
|
-
}) : [];
|
|
4035
|
+
}).map(successorNative) : [];
|
|
3992
4036
|
out.indicators = { manifest, natives };
|
|
3993
4037
|
}
|
|
3994
4038
|
const ext = sanitizeExt(c.ext);
|
|
@@ -4863,7 +4907,7 @@ var Watermark = class {
|
|
|
4863
4907
|
// src/widget/context-menu.ts
|
|
4864
4908
|
var PRICE_AXIS_W = 60;
|
|
4865
4909
|
var TIME_AXIS_H = 26;
|
|
4866
|
-
var OFF_PLOT = { price: null, time: null, paneKind: null };
|
|
4910
|
+
var OFF_PLOT = { price: null, time: null, paneKind: null, paneId: null };
|
|
4867
4911
|
var ChartContextMenu = class {
|
|
4868
4912
|
constructor(host, cbs) {
|
|
4869
4913
|
this.cbs = cbs;
|
|
@@ -4906,7 +4950,7 @@ var ChartContextMenu = class {
|
|
|
4906
4950
|
this.chart = chart;
|
|
4907
4951
|
this.crosshair = OFF_PLOT;
|
|
4908
4952
|
this.offCrosshair = chart.renderer.onCrosshairMove((e) => {
|
|
4909
|
-
this.crosshair = { price: e.price, time: e.time, paneKind: e.paneKind ?? null };
|
|
4953
|
+
this.crosshair = { price: e.price, time: e.time, paneKind: e.paneKind ?? null, paneId: e.paneId ?? null };
|
|
4910
4954
|
});
|
|
4911
4955
|
}
|
|
4912
4956
|
destroy() {
|
|
@@ -8794,6 +8838,12 @@ var VelaWorkspace = class {
|
|
|
8794
8838
|
this.historyUnsub = null;
|
|
8795
8839
|
/** Favorite drawing tools — a WORKSPACE preference (one star set, every cell). */
|
|
8796
8840
|
this.favs = [];
|
|
8841
|
+
/** Every drawing tool's remembered settings — a SHARED pref, mirrored onto every cell. */
|
|
8842
|
+
this.toolDefs = {};
|
|
8843
|
+
/** Every drawing tool's saved looks — a SHARED pref like the remembered settings. */
|
|
8844
|
+
this.toolTemplates = {};
|
|
8845
|
+
/** Re-entrancy guard while one cell's remembered settings fan out to the others. */
|
|
8846
|
+
this.toolDefsBusy = false;
|
|
8797
8847
|
/** Favorite timeframes — the shared topbar's quick-switch chips, one set for the grid. */
|
|
8798
8848
|
this.tfFavs = [];
|
|
8799
8849
|
/** Live sync configuration (mutable copy of the option). */
|
|
@@ -8897,6 +8947,7 @@ var VelaWorkspace = class {
|
|
|
8897
8947
|
this.timezone = boot?.timezone ?? opts.timezone ?? "Etc/UTC";
|
|
8898
8948
|
if (boot?.favorites) this.favs = [...boot.favorites];
|
|
8899
8949
|
if (boot?.timeframeFavorites) this.tfFavs = [...boot.timeframeFavorites];
|
|
8950
|
+
if (boot?.drawingTools) this.adoptDrawingTools(boot.drawingTools);
|
|
8900
8951
|
const sync = boot?.sync ?? opts.sync;
|
|
8901
8952
|
for (const kind of SYNC_KINDS) this.applySyncSetting(kind, sync?.[kind]);
|
|
8902
8953
|
this.monoLayout = opts.layout === false;
|
|
@@ -9304,6 +9355,8 @@ var VelaWorkspace = class {
|
|
|
9304
9355
|
if (this.activeId) state.activeCellId = this.activeId;
|
|
9305
9356
|
if (this.favs.length > 0) state.favorites = [...this.favs];
|
|
9306
9357
|
if (this.tfFavs.length > 0) state.timeframeFavorites = [...this.tfFavs];
|
|
9358
|
+
const tools = this.drawingToolsState();
|
|
9359
|
+
if (tools) state.drawingTools = tools;
|
|
9307
9360
|
if (this.trackSizes.size > 0) state.trackSizes = Object.fromEntries([...this.trackSizes].map(([k, v]) => [k, { ...v }]));
|
|
9308
9361
|
const panels = this.dock.getState();
|
|
9309
9362
|
if (panels) state.panels = panels;
|
|
@@ -9337,6 +9390,7 @@ var VelaWorkspace = class {
|
|
|
9337
9390
|
const st = sanitizeState(state);
|
|
9338
9391
|
if (!st) return;
|
|
9339
9392
|
if (st.favorites) this.favs = [...st.favorites];
|
|
9393
|
+
if (st.drawingTools) this.adoptDrawingTools(st.drawingTools);
|
|
9340
9394
|
if (st.timeframeFavorites) {
|
|
9341
9395
|
this.tfFavs = [...st.timeframeFavorites];
|
|
9342
9396
|
this.topbar.setTimeframeFavorites(this.tfFavs);
|
|
@@ -9352,6 +9406,7 @@ var VelaWorkspace = class {
|
|
|
9352
9406
|
if (st.favorites) {
|
|
9353
9407
|
for (const cell of this.cellsById.values()) cell.chart.drawings.setFavorites(this.favs);
|
|
9354
9408
|
}
|
|
9409
|
+
if (st.drawingTools) this.pushToolDefaults(null);
|
|
9355
9410
|
this.drawingLinks.clear();
|
|
9356
9411
|
this.styleSyncBusy = true;
|
|
9357
9412
|
try {
|
|
@@ -9667,6 +9722,37 @@ var VelaWorkspace = class {
|
|
|
9667
9722
|
refocusActive() {
|
|
9668
9723
|
if (this.activeId) this.cellsById.get(this.activeId)?.chart.renderer.focus();
|
|
9669
9724
|
}
|
|
9725
|
+
/** Take a document's drawing-tool prefs as the shared mirrors (cells pick them up as they
|
|
9726
|
+
* are built, or from {@link pushToolDefaults} / the active-cell projection). */
|
|
9727
|
+
adoptDrawingTools(tools) {
|
|
9728
|
+
if (tools.defaults) this.toolDefs = { ...tools.defaults };
|
|
9729
|
+
if (tools.templates) this.toolTemplates = { ...tools.templates };
|
|
9730
|
+
if (tools.magnet) this.globalSnap = tools.magnet;
|
|
9731
|
+
if (tools.stay !== void 0) this.globalStay = tools.stay;
|
|
9732
|
+
}
|
|
9733
|
+
/** Mirror the shared remembered settings onto every cell but `from` (the cell they came from).
|
|
9734
|
+
* Receiving them is not an edit: the cells' `drawing:defaults` echoes are ignored. */
|
|
9735
|
+
pushToolDefaults(from, cells = this.cellsById.values()) {
|
|
9736
|
+
this.toolDefsBusy = true;
|
|
9737
|
+
try {
|
|
9738
|
+
for (const other of cells) {
|
|
9739
|
+
if (other === from) continue;
|
|
9740
|
+
other.chart.drawings.setToolDefaults(this.toolDefs);
|
|
9741
|
+
other.chart.drawings.setToolTemplates(this.toolTemplates);
|
|
9742
|
+
}
|
|
9743
|
+
} finally {
|
|
9744
|
+
this.toolDefsBusy = false;
|
|
9745
|
+
}
|
|
9746
|
+
}
|
|
9747
|
+
/** The drawing-tool prefs worth saving; null when every one is at its default. */
|
|
9748
|
+
drawingToolsState() {
|
|
9749
|
+
const out = {};
|
|
9750
|
+
if (Object.keys(this.toolDefs).length > 0) out.defaults = { ...this.toolDefs };
|
|
9751
|
+
if (Object.keys(this.toolTemplates).length > 0) out.templates = { ...this.toolTemplates };
|
|
9752
|
+
if (this.globalSnap !== "off") out.magnet = this.globalSnap;
|
|
9753
|
+
if (this.globalStay) out.stay = true;
|
|
9754
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
9755
|
+
}
|
|
9670
9756
|
/** Debounced dirty mark: one `state:changed` (+ one storage write in persist mode)
|
|
9671
9757
|
* per burst of edits, flushed hard on unload/destroy. */
|
|
9672
9758
|
markStateDirty() {
|
|
@@ -9889,6 +9975,7 @@ var VelaWorkspace = class {
|
|
|
9889
9975
|
cell.chart.renderer.setWallClock(this.clock);
|
|
9890
9976
|
cell.setControlsSuspended(this.layoutCtl.current === "mobile");
|
|
9891
9977
|
if (this.favs.length > 0) cell.chart.drawings.setFavorites(this.favs);
|
|
9978
|
+
if (Object.keys(this.toolDefs).length > 0 || Object.keys(this.toolTemplates).length > 0) this.pushToolDefaults(null, [cell]);
|
|
9892
9979
|
cell.setManifest(this.manifest, pooled?.indicators == null);
|
|
9893
9980
|
cell.restorePersistedExt();
|
|
9894
9981
|
this.events.emit("cell:created", { id });
|
|
@@ -9921,6 +10008,18 @@ var VelaWorkspace = class {
|
|
|
9921
10008
|
this.drawToolbar?.setFavorites(favorites);
|
|
9922
10009
|
this.markStateDirty();
|
|
9923
10010
|
});
|
|
10011
|
+
chart.on("drawing:defaults", () => {
|
|
10012
|
+
if (this.toolDefsBusy) return;
|
|
10013
|
+
this.toolDefs = chart.drawings.toolDefaults();
|
|
10014
|
+
this.pushToolDefaults(cell);
|
|
10015
|
+
this.markStateDirty();
|
|
10016
|
+
});
|
|
10017
|
+
chart.on("drawing:templates", () => {
|
|
10018
|
+
if (this.toolDefsBusy) return;
|
|
10019
|
+
this.toolTemplates = chart.drawings.toolTemplates();
|
|
10020
|
+
this.pushToolDefaults(cell);
|
|
10021
|
+
this.markStateDirty();
|
|
10022
|
+
});
|
|
9924
10023
|
chart.renderer.onCrosshairMove((e) => this.propagateCrosshair(cell.id, e.time, e.paneKind === "price" ? e.price : null));
|
|
9925
10024
|
chart.on("drawing:created", ({ id }) => {
|
|
9926
10025
|
this.propagateDrawing(cell.id, id);
|
|
@@ -9942,13 +10041,17 @@ var VelaWorkspace = class {
|
|
|
9942
10041
|
});
|
|
9943
10042
|
chart.on("drawing:snap", ({ mode }) => {
|
|
9944
10043
|
if (cell.id !== this.activeId) return;
|
|
10044
|
+
const changed = mode !== this.globalSnap;
|
|
9945
10045
|
this.globalSnap = mode;
|
|
9946
10046
|
this.drawToolbar?.setMagnetMode(mode);
|
|
10047
|
+
if (changed) this.markStateDirty();
|
|
9947
10048
|
});
|
|
9948
10049
|
chart.on("drawing:stay", ({ on }) => {
|
|
9949
10050
|
if (cell.id !== this.activeId) return;
|
|
10051
|
+
const changed = on !== this.globalStay;
|
|
9950
10052
|
this.globalStay = on;
|
|
9951
10053
|
this.drawToolbar?.setStayMode(on);
|
|
10054
|
+
if (changed) this.markStateDirty();
|
|
9952
10055
|
});
|
|
9953
10056
|
chart.on("drawing:mode", ({ mode }) => {
|
|
9954
10057
|
if (cell.id !== this.activeId) return;
|
|
@@ -239,6 +239,12 @@ function mix(base, top, alpha) {
|
|
|
239
239
|
const c = (x, y) => Math.round(x + (y - x) * alpha);
|
|
240
240
|
return `rgb(${c(b.r, t.r)},${c(b.g, t.g)},${c(b.b, t.b)})`;
|
|
241
241
|
}
|
|
242
|
+
function toHex6(color, fallback = "#888888") {
|
|
243
|
+
const c = parseRgb(color);
|
|
244
|
+
if (!c) return fallback;
|
|
245
|
+
const h = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
246
|
+
return `#${h(c.r)}${h(c.g)}${h(c.b)}`;
|
|
247
|
+
}
|
|
242
248
|
function isDarkColor(color) {
|
|
243
249
|
const c = parseRgb(color);
|
|
244
250
|
if (!c) return true;
|
|
@@ -331,4 +337,4 @@ function holdForExit(els, done, opts = {}) {
|
|
|
331
337
|
};
|
|
332
338
|
}
|
|
333
339
|
|
|
334
|
-
export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, holdForExit, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, withAlpha };
|
|
340
|
+
export { ACCENT, ACCENT_BRIGHT, BEARISH, BULLISH, CATEGORICAL, CHIP_PLATE, CROSSHAIR, FIELD_FOCUS_CSS, FIELD_FOCUS_RING, HIGHLIGHT, INFO, INVALID, MARKER, NEUTRAL, SERIES_LINE, SESSION_OFF, SESSION_POST, SESSION_PRE, SLATE, SLATE_DEEP, SURFACE_CLOSE_EVENT, SURFACE_OPEN_EVENT, TRADE_EXIT, TRADE_LONG, TRADE_SHORT, VALID, WARNING, announceSurface, categoricalColor, holdForExit, icon, iconAt, iconEl, iconMarkup, injectStyles, isDarkColor, mix, overlayScrollbarCss, registerIcon, svg16, svg24, svg24Solid, toHex6, withAlpha };
|