@luxalgo/vela 0.5.4 → 0.6.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.
Files changed (33) hide show
  1. package/dist/{DataProvider-DgS2UyMc.d.cts → DataProvider-Ce6PuCzQ.d.cts} +9 -0
  2. package/dist/{DataProvider-Cqc_BaJ9.d.ts → DataProvider-DNx9ntBD.d.ts} +9 -0
  3. package/dist/{chunk-JBQUY2RI.js → chunk-7ROONW6H.js} +14 -12
  4. package/dist/{chunk-D6WM5IUE.js → chunk-CA3N3PYT.js} +61 -6
  5. package/dist/{contributions-DuIxJWeH.d.ts → contributions-DToMhiw3.d.ts} +8 -1
  6. package/dist/{contributions-4Nh1jbvb.d.cts → contributions-Dlc7ZWZz.d.cts} +8 -1
  7. package/dist/{history-HofqYEh2.d.cts → history-BZADxpKx.d.cts} +2 -2
  8. package/dist/{history-FsmvCIo4.d.ts → history-BuHXJZJ2.d.ts} +2 -2
  9. package/dist/index.cjs +61 -6
  10. package/dist/index.d.cts +12 -4
  11. package/dist/index.d.ts +12 -4
  12. package/dist/index.js +1 -1
  13. package/dist/{plugin-DJR6z3e0.d.cts → plugin-BNPLOQO1.d.cts} +2 -2
  14. package/dist/{plugin-N_EaXN4-.d.ts → plugin-BqjEa5r3.d.ts} +2 -2
  15. package/dist/plugin.d.cts +3 -3
  16. package/dist/plugin.d.ts +3 -3
  17. package/dist/providers/binance.d.cts +1 -1
  18. package/dist/providers/binance.d.ts +1 -1
  19. package/dist/providers/coinbase.d.cts +1 -1
  20. package/dist/providers/coinbase.d.ts +1 -1
  21. package/dist/providers/hyperliquid.d.cts +1 -1
  22. package/dist/providers/hyperliquid.d.ts +1 -1
  23. package/dist/vela.global.js +61 -6
  24. package/dist/vela.global.min.js +29 -29
  25. package/dist/widget.cjs +84 -22
  26. package/dist/widget.d.cts +10 -14
  27. package/dist/widget.d.ts +10 -14
  28. package/dist/widget.js +14 -9
  29. package/dist/workspace.cjs +78 -18
  30. package/dist/workspace.d.cts +4 -4
  31. package/dist/workspace.d.ts +4 -4
  32. package/dist/workspace.js +7 -4
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { O as OHLCV, U as Unsubscribe } from '../options-BlQ00Fju.cjs';
2
- import { D as DataProvider, P as ProviderInfo, B as BarRange, S as SymbolInfo, a as SymbolDescriptor } from '../DataProvider-DgS2UyMc.cjs';
2
+ import { D as DataProvider, P as ProviderInfo, B as BarRange, S as SymbolInfo, a as SymbolDescriptor } from '../DataProvider-Ce6PuCzQ.cjs';
3
3
 
4
4
  /**
5
5
  * Hyperliquid market-data provider, built from scratch on the public info API — no
@@ -1,5 +1,5 @@
1
1
  import { O as OHLCV, U as Unsubscribe } from '../options-BlQ00Fju.js';
2
- import { D as DataProvider, P as ProviderInfo, B as BarRange, S as SymbolInfo, a as SymbolDescriptor } from '../DataProvider-Cqc_BaJ9.js';
2
+ import { D as DataProvider, P as ProviderInfo, B as BarRange, S as SymbolInfo, a as SymbolDescriptor } from '../DataProvider-DNx9ntBD.js';
3
3
 
4
4
  /**
5
5
  * Hyperliquid market-data provider, built from scratch on the public info API — no
@@ -6916,7 +6916,7 @@ var Vela = (function (exports) {
6916
6916
  /** Register (or replace) a provider; returns a promise that settles when its index is built. */
6917
6917
  register(rawName, provider) {
6918
6918
  const name = normName(rawName);
6919
- const entry = { name, provider, index: null, descriptors: [], settled: false, settle: Promise.resolve() };
6919
+ const entry = { name, provider, index: null, prefixIndex: null, byTicker: null, descriptors: [], settled: false, settle: Promise.resolve() };
6920
6920
  this.entries.set(name, entry);
6921
6921
  entry.settle = this.buildIndex(entry);
6922
6922
  queueMicrotask(() => this.notify(false));
@@ -6929,6 +6929,9 @@ var Vela = (function (exports) {
6929
6929
  const symbols = await entry.provider.listSymbols();
6930
6930
  entry.descriptors = symbols;
6931
6931
  entry.index = new Set(symbols.map((s) => normTicker(s.ticker)));
6932
+ entry.byTicker = new Map(symbols.map((s) => [normTicker(s.ticker), s]));
6933
+ entry.prefixIndex = /* @__PURE__ */ new Map();
6934
+ for (const s of symbols) if (s.prefix) entry.prefixIndex.set(`${normName(s.prefix)}:${normTicker(s.ticker)}`, s);
6932
6935
  }
6933
6936
  } catch {
6934
6937
  entry.index = null;
@@ -6964,14 +6967,25 @@ var Vela = (function (exports) {
6964
6967
  }
6965
6968
  /**
6966
6969
  * Resolve a symbol to `{ provider, ticker }`, or null when nothing can serve it
6967
- * yet. Explicit prefix → that provider (must be registered). Bare first
6968
- * indexed provider (registration order, `opts.default` first) that contains the
6969
- * ticker; `opts.lenient` additionally allows a sole registered provider before
6970
- * its index exists.
6970
+ * yet. Explicit prefix → that provider (must be registered), else a provider whose
6971
+ * index declares that LISTING prefix for that ticker (`NASDAQ:AAPL` routes to the
6972
+ * provider serving Nasdaq-listed AAPL TradingView-strict, so `NYSE:AAPL` resolves
6973
+ * to nothing rather than auto-correcting). Bare → first indexed provider
6974
+ * (registration order, `opts.default` first) that contains the ticker;
6975
+ * `opts.lenient` additionally allows a sole registered provider before its index
6976
+ * exists.
6971
6977
  */
6972
6978
  resolve(raw, opts = {}) {
6973
6979
  const { provider, ticker } = this.parse(raw);
6974
- if (provider) return this.entries.has(provider) ? { provider, ticker } : null;
6980
+ if (provider) {
6981
+ if (this.entries.has(provider)) return { provider, ticker };
6982
+ const key = `${provider}:${normTicker(ticker)}`;
6983
+ for (const name of this.candidateOrder(opts.default)) {
6984
+ const d = this.entries.get(name).prefixIndex?.get(key);
6985
+ if (d) return { provider: name, ticker: d.ticker };
6986
+ }
6987
+ return null;
6988
+ }
6975
6989
  const norm = normTicker(ticker);
6976
6990
  for (const name of this.candidateOrder(opts.default)) {
6977
6991
  if (this.entries.get(name).index?.has(norm)) return { provider: name, ticker };
@@ -7037,6 +7051,22 @@ var Vela = (function (exports) {
7037
7051
  }
7038
7052
  return names;
7039
7053
  }
7054
+ /**
7055
+ * The DISPLAY prefix for a resolved symbol — the descriptor's LISTING prefix when the
7056
+ * data declares one, else the provider name. This is the single seam every label
7057
+ * (legend chip, committed/persisted `PREFIX:TICKER` strings) derives from, which is
7058
+ * what makes a non-canonical spelling impossible to display: the form always comes
7059
+ * from the data, never from what was typed.
7060
+ */
7061
+ displayPrefixOf(resolved) {
7062
+ const d = this.entries.get(resolved.provider)?.byTicker?.get(normTicker(resolved.ticker));
7063
+ return d?.prefix ?? resolved.provider;
7064
+ }
7065
+ /** The canonical `PREFIX:TICKER` string for a resolved symbol (descriptor spellings). */
7066
+ canonicalSymbol(resolved) {
7067
+ const d = this.entries.get(resolved.provider)?.byTicker?.get(normTicker(resolved.ticker));
7068
+ return `${d?.prefix ?? resolved.provider}:${d?.ticker ?? resolved.ticker}`;
7069
+ }
7040
7070
  /** Indexed symbols for one provider (or all, concatenated) — for autocomplete. */
7041
7071
  symbolsOf(rawName) {
7042
7072
  if (rawName != null) return this.entries.get(normName(rawName))?.descriptors ?? [];
@@ -9189,6 +9219,20 @@ var Vela = (function (exports) {
9189
9219
  resolveSymbol(raw) {
9190
9220
  return this.registry.resolve(raw, { default: this.primaryProvider });
9191
9221
  }
9222
+ /**
9223
+ * The DISPLAY prefix for `raw` — the descriptor's LISTING prefix when the data
9224
+ * declares one (`NASDAQ` for AAPL), else the resolved provider name. Null while
9225
+ * nothing resolves the symbol.
9226
+ */
9227
+ displayPrefix(raw) {
9228
+ const resolved = this.resolveSymbol(raw);
9229
+ return resolved ? this.registry.displayPrefixOf(resolved) : null;
9230
+ }
9231
+ /** The canonical `PREFIX:TICKER` form of `raw`, or null while unresolvable. */
9232
+ canonicalSymbol(raw) {
9233
+ const resolved = this.resolveSymbol(raw);
9234
+ return resolved ? this.registry.canonicalSymbol(resolved) : null;
9235
+ }
9192
9236
  /** The registered provider INSTANCE under `name` (undefined if unknown). */
9193
9237
  providerInstance(name) {
9194
9238
  return this.registry.get(name);
@@ -9394,6 +9438,17 @@ var Vela = (function (exports) {
9394
9438
  resolve(symbol) {
9395
9439
  return this.registry?.resolveSymbol(symbol) ?? null;
9396
9440
  }
9441
+ /**
9442
+ * The DISPLAY prefix for `symbol` — the listing venue its descriptor declares
9443
+ * (`NASDAQ` for AAPL) or the resolved provider name. Null while unresolvable.
9444
+ */
9445
+ displayPrefix(symbol) {
9446
+ return this.registry?.displayPrefix(symbol) ?? null;
9447
+ }
9448
+ /** The canonical `PREFIX:TICKER` form of `symbol`, or null while unresolvable. */
9449
+ canonicalSymbol(symbol) {
9450
+ return this.registry?.canonicalSymbol(symbol) ?? null;
9451
+ }
9397
9452
  /**
9398
9453
  * The registered provider INSTANCE under `name` — the seam for EXTENDED provider
9399
9454
  * surfaces: a provider may implement interfaces beyond the `DataProvider` port