@luxalgo/vela 0.7.5 → 0.7.6

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.
Files changed (37) hide show
  1. package/dist/{DataProvider-Dut6lXGM.d.cts → DataProvider-CGa4KHRa.d.cts} +1 -1
  2. package/dist/{DataProvider-DLeFs1gE.d.ts → DataProvider-CmWUtDVL.d.ts} +1 -1
  3. package/dist/{chunk-MNG5XPLV.js → chunk-EMB53WNQ.js} +11 -7
  4. package/dist/{chunk-MCLI6B3S.js → chunk-JSVCWYBF.js} +45 -8
  5. package/dist/{contributions-CEkgJKTU.d.ts → contributions-C7Wsm_S9.d.ts} +8 -2
  6. package/dist/{contributions-DYtiRtES.d.cts → contributions-D6p1RB38.d.cts} +8 -2
  7. package/dist/index.cjs +45 -8
  8. package/dist/index.d.cts +6 -6
  9. package/dist/index.d.ts +6 -6
  10. package/dist/index.js +1 -1
  11. package/dist/{options-DNBoMKkX.d.cts → options-D1AJKsn_.d.cts} +10 -0
  12. package/dist/{options-DNBoMKkX.d.ts → options-D1AJKsn_.d.ts} +10 -0
  13. package/dist/{plugin-DtkeQVAO.d.cts → plugin-CxWfg6vK.d.cts} +3 -3
  14. package/dist/{plugin-CLn--oP6.d.ts → plugin-SodaQhjQ.d.ts} +3 -3
  15. package/dist/plugin.d.cts +4 -4
  16. package/dist/plugin.d.ts +4 -4
  17. package/dist/providers/binance.d.cts +2 -2
  18. package/dist/providers/binance.d.ts +2 -2
  19. package/dist/providers/coinbase.d.cts +2 -2
  20. package/dist/providers/coinbase.d.ts +2 -2
  21. package/dist/providers/hyperliquid.d.cts +2 -2
  22. package/dist/providers/hyperliquid.d.ts +2 -2
  23. package/dist/{statusline-model-gA__yaog.d.cts → statusline-model-gWHrsOy3.d.cts} +3 -3
  24. package/dist/{statusline-model-DypGXjtr.d.ts → statusline-model-xBiVsKoE.d.ts} +3 -3
  25. package/dist/ui.d.cts +1 -1
  26. package/dist/ui.d.ts +1 -1
  27. package/dist/vela.global.js +45 -8
  28. package/dist/vela.global.min.js +32 -32
  29. package/dist/widget.cjs +55 -14
  30. package/dist/widget.d.cts +6 -6
  31. package/dist/widget.d.ts +6 -6
  32. package/dist/widget.js +3 -3
  33. package/dist/workspace.cjs +55 -14
  34. package/dist/workspace.d.cts +10 -5
  35. package/dist/workspace.d.ts +10 -5
  36. package/dist/workspace.js +2 -2
  37. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { D as DataProvider } from './DataProvider-Dut6lXGM.cjs';
2
- import { S as ScriptingEngine, V as Vela } from './contributions-DYtiRtES.cjs';
3
- import { W as WallClock, V as VisibleRangePreset } from './options-DNBoMKkX.cjs';
1
+ import { D as DataProvider } from './DataProvider-CGa4KHRa.cjs';
2
+ import { S as ScriptingEngine, V as Vela } from './contributions-D6p1RB38.cjs';
3
+ import { W as WallClock, V as VisibleRangePreset } from './options-D1AJKsn_.cjs';
4
4
 
5
5
  /** The linkable dimensions. `crosshair` mirrors the pointer time onto same-group
6
6
  * cells as GHOST crosshairs (renderers without the optional `setExternalCrosshair`
@@ -1,6 +1,6 @@
1
- import { D as DataProvider } from './DataProvider-DLeFs1gE.js';
2
- import { S as ScriptingEngine, V as Vela } from './contributions-CEkgJKTU.js';
3
- import { W as WallClock, V as VisibleRangePreset } from './options-DNBoMKkX.js';
1
+ import { D as DataProvider } from './DataProvider-CmWUtDVL.js';
2
+ import { S as ScriptingEngine, V as Vela } from './contributions-C7Wsm_S9.js';
3
+ import { W as WallClock, V as VisibleRangePreset } from './options-D1AJKsn_.js';
4
4
 
5
5
  /** The linkable dimensions. `crosshair` mirrors the pointer time onto same-group
6
6
  * cells as GHOST crosshairs (renderers without the optional `setExternalCrosshair`
package/dist/ui.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VelaTheme } from './options-DNBoMKkX.cjs';
1
+ import { c as VelaTheme } from './options-D1AJKsn_.cjs';
2
2
  import { MachineSchema, Service, Machine } from '@zag-js/core';
3
3
  export { a as KeyBindingDescriptor, K as KeymapManager, b as KeymapOptions, R as ResolvedBinding } from './keymap-CGOz5F5f.cjs';
4
4
  import * as tooltip from '@zag-js/tooltip';
package/dist/ui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VelaTheme } from './options-DNBoMKkX.js';
1
+ import { c as VelaTheme } from './options-D1AJKsn_.js';
2
2
  import { MachineSchema, Service, Machine } from '@zag-js/core';
3
3
  export { a as KeyBindingDescriptor, K as KeymapManager, b as KeymapOptions, R as ResolvedBinding } from './keymap-CGOz5F5f.js';
4
4
  import * as tooltip from '@zag-js/tooltip';
@@ -105,10 +105,18 @@ var Vela = (function (exports) {
105
105
  this.records = /* @__PURE__ */ new Map();
106
106
  this.counter = 0;
107
107
  }
108
- /** Allocate a unique, stable per-instance id. */
109
- nextId(prefix = "ind") {
110
- this.counter += 1;
111
- return `${prefix}-${this.counter}`;
108
+ /**
109
+ * Mint a unique per-instance id. Host-supplied ids share the namespace, so a minted
110
+ * id skips anything already recorded — and anything `taken` reports live elsewhere
111
+ * (a handle the orchestrator holds outside the records, e.g. a fail-soft native).
112
+ */
113
+ nextId(prefix = "ind", taken = () => false) {
114
+ let id;
115
+ do {
116
+ this.counter += 1;
117
+ id = `${prefix}-${this.counter}`;
118
+ } while (this.records.has(id) || taken(id));
119
+ return id;
112
120
  }
113
121
  add(record) {
114
122
  this.records.set(record.id, record);
@@ -8653,7 +8661,7 @@ var Vela = (function (exports) {
8653
8661
  this.engines.set(language, engine);
8654
8662
  }
8655
8663
  addIndicator(source, options = {}) {
8656
- const id = this.registry.nextId();
8664
+ const id = this.claimIndicatorId(options.id);
8657
8665
  const title = options.title ?? "Indicator";
8658
8666
  const handle = new IndicatorHandleImpl(id, title, this, source);
8659
8667
  this.handles.set(id, handle);
@@ -8675,7 +8683,7 @@ var Vela = (function (exports) {
8675
8683
  const existing = this.registry.all().find((r) => r.native?.type === type);
8676
8684
  if (existing) return this.handles.get(existing.id) ?? new IndicatorHandleImpl(existing.id, existing.title, this, void 0, type);
8677
8685
  }
8678
- const id = this.registry.nextId("native");
8686
+ const id = this.registry.nextId("native", (candidate) => this.handles.has(candidate));
8679
8687
  const title = descriptor?.title ?? type;
8680
8688
  const handle = new IndicatorHandleImpl(id, title, this, void 0, type);
8681
8689
  this.handles.set(id, handle);
@@ -8953,6 +8961,24 @@ var Vela = (function (exports) {
8953
8961
  this.events.clear();
8954
8962
  }
8955
8963
  // ── internals ───────────────────────────────────────────────
8964
+ /**
8965
+ * The id a new script indicator runs under: the host's when supplied, else a minted
8966
+ * one. A host id is opaque but must be a non-empty string, and it must not be live
8967
+ * on this chart — a duplicate is a programming error surfaced synchronously, never
8968
+ * renamed behind the caller's back (the whole point of supplying one is that
8969
+ * `handle.id` equals what was passed). "Live" reads both the records and the handle
8970
+ * map: a fail-soft handle never enters the registry but still owns its id.
8971
+ */
8972
+ claimIndicatorId(requested) {
8973
+ if (requested === void 0) return this.registry.nextId("ind", (candidate) => this.handles.has(candidate));
8974
+ if (typeof requested !== "string" || requested.length === 0) {
8975
+ throw new TypeError("[vela] addIndicator: `id` must be a non-empty string");
8976
+ }
8977
+ if (this.handles.has(requested) || this.registry.get(requested)) {
8978
+ throw new Error(`[vela] addIndicator: indicator id "${requested}" is already live on this chart`);
8979
+ }
8980
+ return requested;
8981
+ }
8956
8982
  async startIndicator(id, source, options, handle) {
8957
8983
  try {
8958
8984
  await this.readyPromise;
@@ -43003,6 +43029,7 @@ ${overlayScrollbarCss(".vela-sd-pane")}
43003
43029
  }
43004
43030
 
43005
43031
  // src/Vela.ts
43032
+ var asError = (err) => err instanceof Error ? err : new Error(String(err));
43006
43033
  var Vela = class {
43007
43034
  constructor(container, options = {}, deps = {}) {
43008
43035
  registerBuiltinChartTypes();
@@ -43126,7 +43153,12 @@ ${overlayScrollbarCss(".vela-sd-pane")}
43126
43153
  * fetch from — the same relationship `script:run` has to `context:changed`.
43127
43154
  */
43128
43155
  runScript(source, options) {
43129
- const handle = this.addIndicator(source, options);
43156
+ let handle;
43157
+ try {
43158
+ handle = this.addIndicator(source, options);
43159
+ } catch (err) {
43160
+ return Promise.resolve({ ok: false, run: null, error: asError(err), onUpdate: () => () => void 0, remove: () => void 0 });
43161
+ }
43130
43162
  const updates = /* @__PURE__ */ new Set();
43131
43163
  const drop = () => {
43132
43164
  try {
@@ -43170,7 +43202,12 @@ ${overlayScrollbarCss(".vela-sd-pane")}
43170
43202
  });
43171
43203
  }
43172
43204
  runIndicator(source, options) {
43173
- const handle = this.addIndicator(source, options);
43205
+ let handle;
43206
+ try {
43207
+ handle = this.addIndicator(source, options);
43208
+ } catch (err) {
43209
+ return Promise.resolve({ ok: false, handle: null, error: asError(err), context: null });
43210
+ }
43174
43211
  return new Promise((resolve) => {
43175
43212
  const offReady = handle.on("ready", () => {
43176
43213
  offReady();