@luxalgo/vela 0.6.18 → 0.6.19

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.
@@ -3835,9 +3835,10 @@ async function resolveIndicators(config, fetchImpl = fetch) {
3835
3835
  return out;
3836
3836
  }
3837
3837
  var ledgerEntryName = (e) => typeof e === "string" ? e : e.name;
3838
+ var ledgerNativeType = (e) => typeof e === "string" ? e : e.type;
3838
3839
  function indicatorLedger(i) {
3839
3840
  const natives = [...i.present];
3840
- if (i.volumePending && !natives.includes("volume")) natives.push("volume");
3841
+ if (i.volumePending && !natives.some((e) => ledgerNativeType(e) === "volume")) natives.push("volume");
3841
3842
  return {
3842
3843
  manifest: i.manifestSettled ? [...i.instanceEntries] : [...i.pendingManifest ?? i.instanceEntries],
3843
3844
  natives
@@ -3921,18 +3922,28 @@ function sanitizeCell(raw) {
3921
3922
  if (c.drawings != null && typeof c.drawings === "object") out.drawings = c.drawings;
3922
3923
  const ind = c.indicators;
3923
3924
  if (ind != null && typeof ind === "object") {
3925
+ const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
3924
3926
  const manifest = Array.isArray(ind.manifest) ? ind.manifest.flatMap((n) => {
3925
3927
  if (typeof n === "string") return [n];
3926
3928
  if (n != null && typeof n === "object" && typeof n.name === "string") {
3927
3929
  const e = n;
3928
- const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
3929
3930
  const inputs = bag(e.inputs);
3930
3931
  const props = bag(e.props);
3931
- return [inputs || props ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {} } : e.name];
3932
+ const hidden = e.hidden === true;
3933
+ return [inputs || props || hidden ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {}, ...hidden ? { hidden } : {} } : e.name];
3934
+ }
3935
+ return [];
3936
+ }) : [];
3937
+ const natives = Array.isArray(ind.natives) ? ind.natives.flatMap((n) => {
3938
+ if (typeof n === "string") return [n];
3939
+ if (n != null && typeof n === "object" && typeof n.type === "string") {
3940
+ const e = n;
3941
+ const inputs = bag(e.inputs);
3942
+ const hidden = e.hidden === true;
3943
+ return [inputs || hidden ? { type: e.type, ...inputs ? { inputs } : {}, ...hidden ? { hidden } : {} } : e.type];
3932
3944
  }
3933
3945
  return [];
3934
3946
  }) : [];
3935
- const natives = Array.isArray(ind.natives) ? ind.natives.filter((n) => typeof n === "string") : [];
3936
3947
  out.indicators = { manifest, natives };
3937
3948
  }
3938
3949
  const ext = sanitizeExt(c.ext);
@@ -5507,6 +5518,11 @@ function cellDrawings(opt) {
5507
5518
  if (opt === true || opt == null) return { toolbar: false };
5508
5519
  return { ...opt, toolbar: false };
5509
5520
  }
5521
+ function nativeLedgerEntry(handle) {
5522
+ const inputs = inputDeltas(handle.inputs, handle.inputValues());
5523
+ const hidden = !handle.visible;
5524
+ return inputs || hidden ? { type: handle.nativeType, ...inputs ? { inputs } : {}, ...hidden ? { hidden: true } : {} } : handle.nativeType;
5525
+ }
5510
5526
  function instanceDeltas(handle) {
5511
5527
  if (!handle) return void 0;
5512
5528
  const inputs = inputDeltas(handle.inputs, handle.inputValues());
@@ -5629,10 +5645,13 @@ var ChartCell = class {
5629
5645
  if (seed.rendererConfig != null) this.inner.renderer.applyConfig(seed.rendererConfig);
5630
5646
  if (seed.drawings != null) this.inner.drawings.fromJSON(seed.drawings);
5631
5647
  if (seed.indicators) {
5632
- for (const type of seed.indicators.natives) this.inner.addNativeIndicator(type);
5648
+ for (const entry of seed.indicators.natives) {
5649
+ const handle = this.inner.addNativeIndicator(ledgerNativeType(entry));
5650
+ this.applyNativeLedgerEntry(handle, entry);
5651
+ }
5633
5652
  this.pendingManifestNames = [...seed.indicators.manifest];
5634
5653
  }
5635
- this.volumeIntent = seed.indicators ? seed.indicators.natives.includes("volume") : deps.volume;
5654
+ this.volumeIntent = seed.indicators ? seed.indicators.natives.some((e) => ledgerNativeType(e) === "volume") : deps.volume;
5636
5655
  this.extState = { ...seed.ext ?? {} };
5637
5656
  this.inner.on("load:end", () => {
5638
5657
  this.volumeMayBePending = false;
@@ -5704,6 +5723,7 @@ var ChartCell = class {
5704
5723
  this.refreshNativeCatalog();
5705
5724
  });
5706
5725
  this.inner.on("indicator:inputs", () => this.deps.onStateDirty());
5726
+ this.inner.on("indicator:visibility", () => this.deps.onStateDirty());
5707
5727
  this.inner.on("indicator:removed", ({ id: id2 }) => {
5708
5728
  if (this.destroyed) return;
5709
5729
  const idx = this.instances.findIndex((it) => it.handle?.id === id2);
@@ -6148,7 +6168,7 @@ var ChartCell = class {
6148
6168
  if (list.length === 0) return;
6149
6169
  for (const led of this.pendingManifestNames) {
6150
6170
  const entry = list.find((e) => e.name === ledgerEntryName(led));
6151
- if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props } : {} });
6171
+ if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props, hidden: led.hidden } : {} });
6152
6172
  }
6153
6173
  this.pendingManifestNames = null;
6154
6174
  return;
@@ -6167,23 +6187,35 @@ var ChartCell = class {
6167
6187
  applyIndicatorLedger(led) {
6168
6188
  const chart = this.inner;
6169
6189
  if (!chart) return;
6170
- this.volumeIntent = led.natives.includes("volume");
6190
+ this.volumeIntent = led.natives.some((e) => ledgerNativeType(e) === "volume");
6171
6191
  this.history.silently(() => {
6172
6192
  const owed = /* @__PURE__ */ new Map();
6173
- for (const type of led.natives) owed.set(type, (owed.get(type) ?? 0) + 1);
6193
+ for (const e of led.natives) {
6194
+ const type = ledgerNativeType(e);
6195
+ const queue = owed.get(type);
6196
+ if (queue) queue.push(e);
6197
+ else owed.set(type, [e]);
6198
+ }
6174
6199
  for (const h of this.nativeHandles()) {
6175
- const type = h.nativeType;
6176
- const n = owed.get(type) ?? 0;
6177
- if (n > 0) owed.set(type, n - 1);
6200
+ const entry = owed.get(h.nativeType)?.shift();
6201
+ if (entry !== void 0) this.applyNativeLedgerEntry(h, entry);
6178
6202
  else h.remove();
6179
6203
  }
6180
- for (const [type, n] of owed) for (let i = 0; i < n; i++) chart.addNativeIndicator(type);
6204
+ for (const queue of owed.values()) {
6205
+ for (const e of queue) {
6206
+ const h = chart.addNativeIndicator(ledgerNativeType(e));
6207
+ this.applyNativeLedgerEntry(h, e);
6208
+ }
6209
+ }
6181
6210
  for (const it of [...this.instances]) this.dropInstance(it);
6182
6211
  if (this.manifest.length > 0) {
6183
6212
  for (const item of led.manifest) {
6184
6213
  const entry = this.manifest.find((e) => e.name === ledgerEntryName(item));
6185
6214
  if (entry)
6186
- this.addManifestInstance(entry, { record: false, ...typeof item === "object" ? { inputs: item.inputs, props: item.props } : {} });
6215
+ this.addManifestInstance(entry, {
6216
+ record: false,
6217
+ ...typeof item === "object" ? { inputs: item.inputs, props: item.props, hidden: item.hidden } : {}
6218
+ });
6187
6219
  }
6188
6220
  this.pendingManifestNames = null;
6189
6221
  } else if (!this.deps.manifestSettled()) {
@@ -6250,6 +6282,7 @@ var ChartCell = class {
6250
6282
  if (this.destroyed) return;
6251
6283
  const values = opts.inputs || opts.props ? { inputs: opts.inputs, props: opts.props } : void 0;
6252
6284
  const it = { entry, handle: this.addToChart(entry, values), ...opts.external ? { external: true } : {}, ...values ? { values } : {} };
6285
+ if (opts.hidden) it.handle?.setVisible(false);
6253
6286
  this.instances.push(it);
6254
6287
  this.deps.onIndicatorsChanged(this.id);
6255
6288
  if (opts.record === false) return;
@@ -6293,6 +6326,29 @@ var ChartCell = class {
6293
6326
  /** Add a native indicator. A multi-instance type gets a fresh instance every time; a
6294
6327
  * single-instance type already on the chart hands back its existing one — nothing
6295
6328
  * changed, so nothing enters the undo timeline. */
6329
+ /**
6330
+ * Converge one native handle to a restored ledger entry: every schema key gets the
6331
+ * entry's value or its declaration default (the DOCUMENT is the truth — a live
6332
+ * tweak must not survive a restore that says otherwise), and visibility follows
6333
+ * the `hidden` flag. Skips the input write when nothing differs — `setInputs`
6334
+ * re-runs the indicator, and a no-op restore must not flicker every native.
6335
+ */
6336
+ applyNativeLedgerEntry(handle, entry) {
6337
+ const wanted = typeof entry === "string" ? void 0 : entry.inputs;
6338
+ if (handle.inputs.length > 0) {
6339
+ const current = handle.inputValues();
6340
+ const next = {};
6341
+ for (const schema of handle.inputs) {
6342
+ const target = wanted?.[schema.key] ?? schema.defval;
6343
+ if (JSON.stringify(current[schema.key]) !== JSON.stringify(target)) next[schema.key] = target;
6344
+ }
6345
+ if (Object.keys(next).length > 0) handle.setInputs(next);
6346
+ } else if (wanted) {
6347
+ handle.setInputs(wanted);
6348
+ }
6349
+ const visible = !(typeof entry === "object" && entry.hidden);
6350
+ if (handle.visible !== visible) handle.setVisible(visible);
6351
+ }
6296
6352
  addNative(type) {
6297
6353
  const chart = this.inner;
6298
6354
  if (!chart) return;
@@ -6456,10 +6512,13 @@ var ChartCell = class {
6456
6512
  // (`ctx.addIndicator`) stay out: their names would never resolve against the
6457
6513
  // manifest — their plugin persists them via the `ext` seam instead.
6458
6514
  indicators: indicatorLedger({
6459
- present: this.inner ? this.inner.presentNativeIndicators() : [],
6515
+ // Live handles carry what the registry read cannot: the input DELTAS and
6516
+ // the hidden flag, so native settings/visibility survive the round-trip.
6517
+ present: this.inner ? this.nativeHandles().map((h) => nativeLedgerEntry(h)) : [],
6460
6518
  instanceEntries: this.instances.filter((it) => !it.external).map((it) => {
6461
6519
  const d = it.handle ? instanceDeltas(it.handle) : it.values;
6462
- return d ? { name: it.entry.name, ...d } : it.entry.name;
6520
+ const hidden = it.handle ? !it.handle.visible : false;
6521
+ return d || hidden ? { name: it.entry.name, ...d ?? {}, ...hidden ? { hidden: true } : {} } : it.entry.name;
6463
6522
  }),
6464
6523
  pendingManifest: this.pendingManifestNames,
6465
6524
  manifestSettled: this.deps.manifestSettled(),
@@ -66,12 +66,13 @@ interface CellState {
66
66
  rendererConfig?: unknown;
67
67
  /** The user-drawings document (`drawings.toJSON()`). */
68
68
  drawings?: unknown;
69
- /** The indicator ledger: manifest entries + present native types. A manifest entry
70
- * is the bare NAME when every value sits on its declaration default, else the
71
- * name plus the input/prop DELTAS (defaults are never frozen into documents). */
69
+ /** The indicator ledger: manifest entries + native entries. Either side persists
70
+ * the bare NAME/TYPE when every value sits on its declaration default and the
71
+ * indicator is visible, else the name/type plus the input(/prop) DELTAS and a
72
+ * `hidden` flag (defaults are never frozen into documents). */
72
73
  indicators?: {
73
74
  manifest: PersistedManifestEntry[];
74
- natives: string[];
75
+ natives: PersistedNativeEntry[];
75
76
  };
76
77
  /** Third-party per-chart state, by namespaced key (`'vendor.feature'`) — written and
77
78
  * read by registered state-persistence handlers (`registerStatePersistence`, scope
@@ -85,6 +86,15 @@ type PersistedManifestEntry = string | {
85
86
  name: string;
86
87
  inputs?: Record<string, unknown>;
87
88
  props?: Record<string, unknown>;
89
+ hidden?: boolean;
90
+ };
91
+ /** One persisted native-indicator entry (see `CellState.indicators`). The bare TYPE is
92
+ * the historical shape and still the common case; the object form carries the input
93
+ * DELTAS and/or the hidden flag so native settings and visibility survive a reload. */
94
+ type PersistedNativeEntry = string | {
95
+ type: string;
96
+ inputs?: Record<string, unknown>;
97
+ hidden?: boolean;
88
98
  };
89
99
  /** One entry of the document's `charts` array: a chart's state plus its cell IDENTITY. */
90
100
  interface ChartState extends CellState {
@@ -66,12 +66,13 @@ interface CellState {
66
66
  rendererConfig?: unknown;
67
67
  /** The user-drawings document (`drawings.toJSON()`). */
68
68
  drawings?: unknown;
69
- /** The indicator ledger: manifest entries + present native types. A manifest entry
70
- * is the bare NAME when every value sits on its declaration default, else the
71
- * name plus the input/prop DELTAS (defaults are never frozen into documents). */
69
+ /** The indicator ledger: manifest entries + native entries. Either side persists
70
+ * the bare NAME/TYPE when every value sits on its declaration default and the
71
+ * indicator is visible, else the name/type plus the input(/prop) DELTAS and a
72
+ * `hidden` flag (defaults are never frozen into documents). */
72
73
  indicators?: {
73
74
  manifest: PersistedManifestEntry[];
74
- natives: string[];
75
+ natives: PersistedNativeEntry[];
75
76
  };
76
77
  /** Third-party per-chart state, by namespaced key (`'vendor.feature'`) — written and
77
78
  * read by registered state-persistence handlers (`registerStatePersistence`, scope
@@ -85,6 +86,15 @@ type PersistedManifestEntry = string | {
85
86
  name: string;
86
87
  inputs?: Record<string, unknown>;
87
88
  props?: Record<string, unknown>;
89
+ hidden?: boolean;
90
+ };
91
+ /** One persisted native-indicator entry (see `CellState.indicators`). The bare TYPE is
92
+ * the historical shape and still the common case; the object form carries the input
93
+ * DELTAS and/or the hidden flag so native settings and visibility survive a reload. */
94
+ type PersistedNativeEntry = string | {
95
+ type: string;
96
+ inputs?: Record<string, unknown>;
97
+ hidden?: boolean;
88
98
  };
89
99
  /** One entry of the document's `charts` array: a chart's state plus its cell IDENTITY. */
90
100
  interface ChartState extends CellState {
package/dist/widget.cjs CHANGED
@@ -17186,9 +17186,10 @@ async function resolveIndicators(config, fetchImpl = fetch) {
17186
17186
  return out;
17187
17187
  }
17188
17188
  var ledgerEntryName = (e) => typeof e === "string" ? e : e.name;
17189
+ var ledgerNativeType = (e) => typeof e === "string" ? e : e.type;
17189
17190
  function indicatorLedger(i) {
17190
17191
  const natives = [...i.present];
17191
- if (i.volumePending && !natives.includes("volume")) natives.push("volume");
17192
+ if (i.volumePending && !natives.some((e) => ledgerNativeType(e) === "volume")) natives.push("volume");
17192
17193
  return {
17193
17194
  manifest: i.manifestSettled ? [...i.instanceEntries] : [...i.pendingManifest ?? i.instanceEntries],
17194
17195
  natives
@@ -18143,18 +18144,28 @@ function sanitizeCell(raw) {
18143
18144
  if (c.drawings != null && typeof c.drawings === "object") out.drawings = c.drawings;
18144
18145
  const ind = c.indicators;
18145
18146
  if (ind != null && typeof ind === "object") {
18147
+ const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
18146
18148
  const manifest = Array.isArray(ind.manifest) ? ind.manifest.flatMap((n) => {
18147
18149
  if (typeof n === "string") return [n];
18148
18150
  if (n != null && typeof n === "object" && typeof n.name === "string") {
18149
18151
  const e = n;
18150
- const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
18151
18152
  const inputs = bag(e.inputs);
18152
18153
  const props = bag(e.props);
18153
- return [inputs || props ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {} } : e.name];
18154
+ const hidden = e.hidden === true;
18155
+ return [inputs || props || hidden ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {}, ...hidden ? { hidden } : {} } : e.name];
18156
+ }
18157
+ return [];
18158
+ }) : [];
18159
+ const natives = Array.isArray(ind.natives) ? ind.natives.flatMap((n) => {
18160
+ if (typeof n === "string") return [n];
18161
+ if (n != null && typeof n === "object" && typeof n.type === "string") {
18162
+ const e = n;
18163
+ const inputs = bag(e.inputs);
18164
+ const hidden = e.hidden === true;
18165
+ return [inputs || hidden ? { type: e.type, ...inputs ? { inputs } : {}, ...hidden ? { hidden } : {} } : e.type];
18154
18166
  }
18155
18167
  return [];
18156
18168
  }) : [];
18157
- const natives = Array.isArray(ind.natives) ? ind.natives.filter((n) => typeof n === "string") : [];
18158
18169
  out.indicators = { manifest, natives };
18159
18170
  }
18160
18171
  const ext = sanitizeExt(c.ext);
@@ -41804,6 +41815,11 @@ function cellDrawings(opt) {
41804
41815
  if (opt === true || opt == null) return { toolbar: false };
41805
41816
  return { ...opt, toolbar: false };
41806
41817
  }
41818
+ function nativeLedgerEntry(handle) {
41819
+ const inputs = inputDeltas(handle.inputs, handle.inputValues());
41820
+ const hidden = !handle.visible;
41821
+ return inputs || hidden ? { type: handle.nativeType, ...inputs ? { inputs } : {}, ...hidden ? { hidden: true } : {} } : handle.nativeType;
41822
+ }
41807
41823
  function instanceDeltas(handle) {
41808
41824
  if (!handle) return void 0;
41809
41825
  const inputs = inputDeltas(handle.inputs, handle.inputValues());
@@ -41926,10 +41942,13 @@ var ChartCell = class {
41926
41942
  if (seed.rendererConfig != null) this.inner.renderer.applyConfig(seed.rendererConfig);
41927
41943
  if (seed.drawings != null) this.inner.drawings.fromJSON(seed.drawings);
41928
41944
  if (seed.indicators) {
41929
- for (const type of seed.indicators.natives) this.inner.addNativeIndicator(type);
41945
+ for (const entry of seed.indicators.natives) {
41946
+ const handle = this.inner.addNativeIndicator(ledgerNativeType(entry));
41947
+ this.applyNativeLedgerEntry(handle, entry);
41948
+ }
41930
41949
  this.pendingManifestNames = [...seed.indicators.manifest];
41931
41950
  }
41932
- this.volumeIntent = seed.indicators ? seed.indicators.natives.includes("volume") : deps.volume;
41951
+ this.volumeIntent = seed.indicators ? seed.indicators.natives.some((e) => ledgerNativeType(e) === "volume") : deps.volume;
41933
41952
  this.extState = { ...seed.ext ?? {} };
41934
41953
  this.inner.on("load:end", () => {
41935
41954
  this.volumeMayBePending = false;
@@ -42001,6 +42020,7 @@ var ChartCell = class {
42001
42020
  this.refreshNativeCatalog();
42002
42021
  });
42003
42022
  this.inner.on("indicator:inputs", () => this.deps.onStateDirty());
42023
+ this.inner.on("indicator:visibility", () => this.deps.onStateDirty());
42004
42024
  this.inner.on("indicator:removed", ({ id: id2 }) => {
42005
42025
  if (this.destroyed) return;
42006
42026
  const idx = this.instances.findIndex((it) => it.handle?.id === id2);
@@ -42445,7 +42465,7 @@ var ChartCell = class {
42445
42465
  if (list.length === 0) return;
42446
42466
  for (const led of this.pendingManifestNames) {
42447
42467
  const entry = list.find((e) => e.name === ledgerEntryName(led));
42448
- if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props } : {} });
42468
+ if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props, hidden: led.hidden } : {} });
42449
42469
  }
42450
42470
  this.pendingManifestNames = null;
42451
42471
  return;
@@ -42464,23 +42484,35 @@ var ChartCell = class {
42464
42484
  applyIndicatorLedger(led) {
42465
42485
  const chart = this.inner;
42466
42486
  if (!chart) return;
42467
- this.volumeIntent = led.natives.includes("volume");
42487
+ this.volumeIntent = led.natives.some((e) => ledgerNativeType(e) === "volume");
42468
42488
  this.history.silently(() => {
42469
42489
  const owed = /* @__PURE__ */ new Map();
42470
- for (const type of led.natives) owed.set(type, (owed.get(type) ?? 0) + 1);
42490
+ for (const e of led.natives) {
42491
+ const type = ledgerNativeType(e);
42492
+ const queue = owed.get(type);
42493
+ if (queue) queue.push(e);
42494
+ else owed.set(type, [e]);
42495
+ }
42471
42496
  for (const h of this.nativeHandles()) {
42472
- const type = h.nativeType;
42473
- const n = owed.get(type) ?? 0;
42474
- if (n > 0) owed.set(type, n - 1);
42497
+ const entry = owed.get(h.nativeType)?.shift();
42498
+ if (entry !== void 0) this.applyNativeLedgerEntry(h, entry);
42475
42499
  else h.remove();
42476
42500
  }
42477
- for (const [type, n] of owed) for (let i = 0; i < n; i++) chart.addNativeIndicator(type);
42501
+ for (const queue of owed.values()) {
42502
+ for (const e of queue) {
42503
+ const h = chart.addNativeIndicator(ledgerNativeType(e));
42504
+ this.applyNativeLedgerEntry(h, e);
42505
+ }
42506
+ }
42478
42507
  for (const it of [...this.instances]) this.dropInstance(it);
42479
42508
  if (this.manifest.length > 0) {
42480
42509
  for (const item of led.manifest) {
42481
42510
  const entry = this.manifest.find((e) => e.name === ledgerEntryName(item));
42482
42511
  if (entry)
42483
- this.addManifestInstance(entry, { record: false, ...typeof item === "object" ? { inputs: item.inputs, props: item.props } : {} });
42512
+ this.addManifestInstance(entry, {
42513
+ record: false,
42514
+ ...typeof item === "object" ? { inputs: item.inputs, props: item.props, hidden: item.hidden } : {}
42515
+ });
42484
42516
  }
42485
42517
  this.pendingManifestNames = null;
42486
42518
  } else if (!this.deps.manifestSettled()) {
@@ -42547,6 +42579,7 @@ var ChartCell = class {
42547
42579
  if (this.destroyed) return;
42548
42580
  const values = opts.inputs || opts.props ? { inputs: opts.inputs, props: opts.props } : void 0;
42549
42581
  const it = { entry, handle: this.addToChart(entry, values), ...opts.external ? { external: true } : {}, ...values ? { values } : {} };
42582
+ if (opts.hidden) it.handle?.setVisible(false);
42550
42583
  this.instances.push(it);
42551
42584
  this.deps.onIndicatorsChanged(this.id);
42552
42585
  if (opts.record === false) return;
@@ -42590,6 +42623,29 @@ var ChartCell = class {
42590
42623
  /** Add a native indicator. A multi-instance type gets a fresh instance every time; a
42591
42624
  * single-instance type already on the chart hands back its existing one — nothing
42592
42625
  * changed, so nothing enters the undo timeline. */
42626
+ /**
42627
+ * Converge one native handle to a restored ledger entry: every schema key gets the
42628
+ * entry's value or its declaration default (the DOCUMENT is the truth — a live
42629
+ * tweak must not survive a restore that says otherwise), and visibility follows
42630
+ * the `hidden` flag. Skips the input write when nothing differs — `setInputs`
42631
+ * re-runs the indicator, and a no-op restore must not flicker every native.
42632
+ */
42633
+ applyNativeLedgerEntry(handle, entry) {
42634
+ const wanted = typeof entry === "string" ? void 0 : entry.inputs;
42635
+ if (handle.inputs.length > 0) {
42636
+ const current = handle.inputValues();
42637
+ const next = {};
42638
+ for (const schema of handle.inputs) {
42639
+ const target = wanted?.[schema.key] ?? schema.defval;
42640
+ if (JSON.stringify(current[schema.key]) !== JSON.stringify(target)) next[schema.key] = target;
42641
+ }
42642
+ if (Object.keys(next).length > 0) handle.setInputs(next);
42643
+ } else if (wanted) {
42644
+ handle.setInputs(wanted);
42645
+ }
42646
+ const visible = !(typeof entry === "object" && entry.hidden);
42647
+ if (handle.visible !== visible) handle.setVisible(visible);
42648
+ }
42593
42649
  addNative(type) {
42594
42650
  const chart = this.inner;
42595
42651
  if (!chart) return;
@@ -42753,10 +42809,13 @@ var ChartCell = class {
42753
42809
  // (`ctx.addIndicator`) stay out: their names would never resolve against the
42754
42810
  // manifest — their plugin persists them via the `ext` seam instead.
42755
42811
  indicators: indicatorLedger({
42756
- present: this.inner ? this.inner.presentNativeIndicators() : [],
42812
+ // Live handles carry what the registry read cannot: the input DELTAS and
42813
+ // the hidden flag, so native settings/visibility survive the round-trip.
42814
+ present: this.inner ? this.nativeHandles().map((h) => nativeLedgerEntry(h)) : [],
42757
42815
  instanceEntries: this.instances.filter((it) => !it.external).map((it) => {
42758
42816
  const d = it.handle ? instanceDeltas(it.handle) : it.values;
42759
- return d ? { name: it.entry.name, ...d } : it.entry.name;
42817
+ const hidden = it.handle ? !it.handle.visible : false;
42818
+ return d || hidden ? { name: it.entry.name, ...d ?? {}, ...hidden ? { hidden: true } : {} } : it.entry.name;
42760
42819
  }),
42761
42820
  pendingManifest: this.pendingManifestNames,
42762
42821
  manifestSettled: this.deps.manifestSettled(),
package/dist/widget.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V as Vela, W as WidgetContext, K as SidePanelButton } from './contributions-DEPRtkmG.cjs';
2
2
  export { C as CellStateContext, az as DEFAULT_PANEL_ORDER, E as ExternalIndicatorEntry, O as OVERRIDABLE_TOPBAR_IDS, M as SidePanelDescriptor, Q as SidePanelHandle, U as StatePersistenceHandler, _ as SymbolRankingHook, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-DEPRtkmG.cjs';
3
3
  import { b as VelaOptions, d as MarketSession, T as ThemeName, c as VelaTheme, s as DataWindowReadout } from './options-BCRmYALw.cjs';
4
- import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-7ECSDtgt.cjs';
5
- export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-7ECSDtgt.cjs';
4
+ import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-hY9cK4BS.cjs';
5
+ export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-hY9cK4BS.cjs';
6
6
  import { K as KeymapManager } from './keymap-CGOz5F5f.cjs';
7
7
  import { a as SymbolDescriptor } from './DataProvider-UtWw2CgJ.cjs';
8
8
  import { d as SidePanel } from './side-panel-HF0IAzwf.cjs';
package/dist/widget.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V as Vela, W as WidgetContext, K as SidePanelButton } from './contributions-5nz3PLRe.js';
2
2
  export { C as CellStateContext, az as DEFAULT_PANEL_ORDER, E as ExternalIndicatorEntry, O as OVERRIDABLE_TOPBAR_IDS, M as SidePanelDescriptor, Q as SidePanelHandle, U as StatePersistenceHandler, _ as SymbolRankingHook, a3 as WidgetActionDescriptor, a4 as WidgetActionTarget, a5 as WidgetAttachment, af as registerSidePanel, ag as registerStatePersistence, ah as registerSymbolRanking, ai as registerWidgetAction, aj as registerWidgetAttachment, al as sidePanels, am as statePersistenceHandlers, an as symbolRanking, ao as topbarActionOverride, at as unregisterSidePanel, au as unregisterStatePersistence, av as unregisterWidgetAction, aw as unregisterWidgetAttachment, ax as widgetActions, ay as widgetAttachments } from './contributions-5nz3PLRe.js';
3
3
  import { b as VelaOptions, d as MarketSession, T as ThemeName, c as VelaTheme, s as DataWindowReadout } from './options-BCRmYALw.js';
4
- import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-D1Fhs8Dk.js';
5
- export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-D1Fhs8Dk.js';
4
+ import { c as VelaShellOptions, W as WidgetHistory, b as RangePreset, f as WorkspaceState, j as TopbarComposition, a as StatuslinePart, P as PanelsState } from './statusline-model-wW3m4in1.js';
5
+ export { B as Bottombar, k as BottombarOptions, C as CellState, g as ChartState, I as IndicatorLoader, l as IndicatorManifest, m as IndicatorManifestEntry, n as RANGE_PRESETS, R as ResolvedIndicator, o as ResolvedTopbarComposition, p as TOPBAR_BUILTIN_IDS, q as TOPBAR_DEFAULT_LEFT, r as TOPBAR_DEFAULT_RIGHT, V as VelaStorage, t as WidgetStorage, h as decodeState, i as encodeState, u as localStorageAdapter, v as pinnedTopbarActionIds, w as resolveIndicators, x as resolveTopbarComposition, s as sanitizeState, y as topbarHas } from './statusline-model-wW3m4in1.js';
6
6
  import { K as KeymapManager } from './keymap-CGOz5F5f.js';
7
7
  import { a as SymbolDescriptor } from './DataProvider-Cb-2lC5O.js';
8
8
  import { d as SidePanel } from './side-panel-HF0IAzwf.js';
package/dist/widget.js CHANGED
@@ -1,5 +1,5 @@
1
- import { VelaWorkspace } from './chunk-BXF7VNNE.js';
2
- export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, localStorageAdapter, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, timeframeLabel, timeframeMs } from './chunk-BXF7VNNE.js';
1
+ import { VelaWorkspace } from './chunk-627A5HEV.js';
2
+ export { Bottombar, ChartContextMenu, DataWindow, IndicatorPicker, ObjectTree, PanelDock, RANGE_PRESETS, ShortcutsHelp, Statusline, SymbolPicker, TimeframeQuick, Topbar, Watermark, dataWindowSections, decimalsFor, decodeState, encodeState, filterSymbols, fmtChange, fmtPrice, localStorageAdapter, parseTimeframe, priceStyleLabel, resolveIndicators, sanitizeState, timeframeLabel, timeframeMs } from './chunk-627A5HEV.js';
3
3
  export { TIMEZONES, normalizeTimezone, tzButtonLabel, tzMenuLabel, tzOffset } from './chunk-22QJKGXX.js';
4
4
  export { DEFAULT_PANEL_MAX_WIDTH, DEFAULT_PANEL_MIN_WIDTH, DEFAULT_PANEL_ORDER, DEFAULT_PANEL_WIDTH, OVERRIDABLE_TOPBAR_IDS, SidePanel, TOPBAR_BUILTIN_IDS, TOPBAR_DEFAULT_LEFT, TOPBAR_DEFAULT_RIGHT, clampPanelWidth, pinnedTopbarActionIds, registerSidePanel, registerStatePersistence, registerSymbolRanking, registerWidgetAction, registerWidgetAttachment, resolveTopbarComposition, sidePanels, statePersistenceHandlers, symbolRanking, topbarActionOverride, topbarHas, unregisterSidePanel, unregisterStatePersistence, unregisterWidgetAction, unregisterWidgetAttachment, widgetActions, widgetAttachments } from './chunk-IFJJPXSV.js';
5
5
  import './chunk-XCBJU674.js';
@@ -17104,9 +17104,10 @@ async function resolveIndicators(config, fetchImpl = fetch) {
17104
17104
  return out;
17105
17105
  }
17106
17106
  var ledgerEntryName = (e) => typeof e === "string" ? e : e.name;
17107
+ var ledgerNativeType = (e) => typeof e === "string" ? e : e.type;
17107
17108
  function indicatorLedger(i) {
17108
17109
  const natives = [...i.present];
17109
- if (i.volumePending && !natives.includes("volume")) natives.push("volume");
17110
+ if (i.volumePending && !natives.some((e) => ledgerNativeType(e) === "volume")) natives.push("volume");
17110
17111
  return {
17111
17112
  manifest: i.manifestSettled ? [...i.instanceEntries] : [...i.pendingManifest ?? i.instanceEntries],
17112
17113
  natives
@@ -18061,18 +18062,28 @@ function sanitizeCell(raw) {
18061
18062
  if (c.drawings != null && typeof c.drawings === "object") out.drawings = c.drawings;
18062
18063
  const ind = c.indicators;
18063
18064
  if (ind != null && typeof ind === "object") {
18065
+ const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
18064
18066
  const manifest = Array.isArray(ind.manifest) ? ind.manifest.flatMap((n) => {
18065
18067
  if (typeof n === "string") return [n];
18066
18068
  if (n != null && typeof n === "object" && typeof n.name === "string") {
18067
18069
  const e = n;
18068
- const bag = (v) => v != null && typeof v === "object" && !Array.isArray(v) ? v : void 0;
18069
18070
  const inputs = bag(e.inputs);
18070
18071
  const props = bag(e.props);
18071
- return [inputs || props ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {} } : e.name];
18072
+ const hidden = e.hidden === true;
18073
+ return [inputs || props || hidden ? { name: e.name, ...inputs ? { inputs } : {}, ...props ? { props } : {}, ...hidden ? { hidden } : {} } : e.name];
18074
+ }
18075
+ return [];
18076
+ }) : [];
18077
+ const natives = Array.isArray(ind.natives) ? ind.natives.flatMap((n) => {
18078
+ if (typeof n === "string") return [n];
18079
+ if (n != null && typeof n === "object" && typeof n.type === "string") {
18080
+ const e = n;
18081
+ const inputs = bag(e.inputs);
18082
+ const hidden = e.hidden === true;
18083
+ return [inputs || hidden ? { type: e.type, ...inputs ? { inputs } : {}, ...hidden ? { hidden } : {} } : e.type];
18072
18084
  }
18073
18085
  return [];
18074
18086
  }) : [];
18075
- const natives = Array.isArray(ind.natives) ? ind.natives.filter((n) => typeof n === "string") : [];
18076
18087
  out.indicators = { manifest, natives };
18077
18088
  }
18078
18089
  const ext = sanitizeExt(c.ext);
@@ -41736,6 +41747,11 @@ function cellDrawings(opt) {
41736
41747
  if (opt === true || opt == null) return { toolbar: false };
41737
41748
  return { ...opt, toolbar: false };
41738
41749
  }
41750
+ function nativeLedgerEntry(handle) {
41751
+ const inputs = inputDeltas(handle.inputs, handle.inputValues());
41752
+ const hidden = !handle.visible;
41753
+ return inputs || hidden ? { type: handle.nativeType, ...inputs ? { inputs } : {}, ...hidden ? { hidden: true } : {} } : handle.nativeType;
41754
+ }
41739
41755
  function instanceDeltas(handle) {
41740
41756
  if (!handle) return void 0;
41741
41757
  const inputs = inputDeltas(handle.inputs, handle.inputValues());
@@ -41858,10 +41874,13 @@ var ChartCell = class {
41858
41874
  if (seed.rendererConfig != null) this.inner.renderer.applyConfig(seed.rendererConfig);
41859
41875
  if (seed.drawings != null) this.inner.drawings.fromJSON(seed.drawings);
41860
41876
  if (seed.indicators) {
41861
- for (const type of seed.indicators.natives) this.inner.addNativeIndicator(type);
41877
+ for (const entry of seed.indicators.natives) {
41878
+ const handle = this.inner.addNativeIndicator(ledgerNativeType(entry));
41879
+ this.applyNativeLedgerEntry(handle, entry);
41880
+ }
41862
41881
  this.pendingManifestNames = [...seed.indicators.manifest];
41863
41882
  }
41864
- this.volumeIntent = seed.indicators ? seed.indicators.natives.includes("volume") : deps.volume;
41883
+ this.volumeIntent = seed.indicators ? seed.indicators.natives.some((e) => ledgerNativeType(e) === "volume") : deps.volume;
41865
41884
  this.extState = { ...seed.ext ?? {} };
41866
41885
  this.inner.on("load:end", () => {
41867
41886
  this.volumeMayBePending = false;
@@ -41933,6 +41952,7 @@ var ChartCell = class {
41933
41952
  this.refreshNativeCatalog();
41934
41953
  });
41935
41954
  this.inner.on("indicator:inputs", () => this.deps.onStateDirty());
41955
+ this.inner.on("indicator:visibility", () => this.deps.onStateDirty());
41936
41956
  this.inner.on("indicator:removed", ({ id: id2 }) => {
41937
41957
  if (this.destroyed) return;
41938
41958
  const idx = this.instances.findIndex((it) => it.handle?.id === id2);
@@ -42377,7 +42397,7 @@ var ChartCell = class {
42377
42397
  if (list.length === 0) return;
42378
42398
  for (const led of this.pendingManifestNames) {
42379
42399
  const entry = list.find((e) => e.name === ledgerEntryName(led));
42380
- if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props } : {} });
42400
+ if (entry) this.addManifestInstance(entry, { record: false, ...typeof led === "object" ? { inputs: led.inputs, props: led.props, hidden: led.hidden } : {} });
42381
42401
  }
42382
42402
  this.pendingManifestNames = null;
42383
42403
  return;
@@ -42396,23 +42416,35 @@ var ChartCell = class {
42396
42416
  applyIndicatorLedger(led) {
42397
42417
  const chart = this.inner;
42398
42418
  if (!chart) return;
42399
- this.volumeIntent = led.natives.includes("volume");
42419
+ this.volumeIntent = led.natives.some((e) => ledgerNativeType(e) === "volume");
42400
42420
  this.history.silently(() => {
42401
42421
  const owed = /* @__PURE__ */ new Map();
42402
- for (const type of led.natives) owed.set(type, (owed.get(type) ?? 0) + 1);
42422
+ for (const e of led.natives) {
42423
+ const type = ledgerNativeType(e);
42424
+ const queue = owed.get(type);
42425
+ if (queue) queue.push(e);
42426
+ else owed.set(type, [e]);
42427
+ }
42403
42428
  for (const h of this.nativeHandles()) {
42404
- const type = h.nativeType;
42405
- const n = owed.get(type) ?? 0;
42406
- if (n > 0) owed.set(type, n - 1);
42429
+ const entry = owed.get(h.nativeType)?.shift();
42430
+ if (entry !== void 0) this.applyNativeLedgerEntry(h, entry);
42407
42431
  else h.remove();
42408
42432
  }
42409
- for (const [type, n] of owed) for (let i = 0; i < n; i++) chart.addNativeIndicator(type);
42433
+ for (const queue of owed.values()) {
42434
+ for (const e of queue) {
42435
+ const h = chart.addNativeIndicator(ledgerNativeType(e));
42436
+ this.applyNativeLedgerEntry(h, e);
42437
+ }
42438
+ }
42410
42439
  for (const it of [...this.instances]) this.dropInstance(it);
42411
42440
  if (this.manifest.length > 0) {
42412
42441
  for (const item of led.manifest) {
42413
42442
  const entry = this.manifest.find((e) => e.name === ledgerEntryName(item));
42414
42443
  if (entry)
42415
- this.addManifestInstance(entry, { record: false, ...typeof item === "object" ? { inputs: item.inputs, props: item.props } : {} });
42444
+ this.addManifestInstance(entry, {
42445
+ record: false,
42446
+ ...typeof item === "object" ? { inputs: item.inputs, props: item.props, hidden: item.hidden } : {}
42447
+ });
42416
42448
  }
42417
42449
  this.pendingManifestNames = null;
42418
42450
  } else if (!this.deps.manifestSettled()) {
@@ -42479,6 +42511,7 @@ var ChartCell = class {
42479
42511
  if (this.destroyed) return;
42480
42512
  const values = opts.inputs || opts.props ? { inputs: opts.inputs, props: opts.props } : void 0;
42481
42513
  const it = { entry, handle: this.addToChart(entry, values), ...opts.external ? { external: true } : {}, ...values ? { values } : {} };
42514
+ if (opts.hidden) it.handle?.setVisible(false);
42482
42515
  this.instances.push(it);
42483
42516
  this.deps.onIndicatorsChanged(this.id);
42484
42517
  if (opts.record === false) return;
@@ -42522,6 +42555,29 @@ var ChartCell = class {
42522
42555
  /** Add a native indicator. A multi-instance type gets a fresh instance every time; a
42523
42556
  * single-instance type already on the chart hands back its existing one — nothing
42524
42557
  * changed, so nothing enters the undo timeline. */
42558
+ /**
42559
+ * Converge one native handle to a restored ledger entry: every schema key gets the
42560
+ * entry's value or its declaration default (the DOCUMENT is the truth — a live
42561
+ * tweak must not survive a restore that says otherwise), and visibility follows
42562
+ * the `hidden` flag. Skips the input write when nothing differs — `setInputs`
42563
+ * re-runs the indicator, and a no-op restore must not flicker every native.
42564
+ */
42565
+ applyNativeLedgerEntry(handle, entry) {
42566
+ const wanted = typeof entry === "string" ? void 0 : entry.inputs;
42567
+ if (handle.inputs.length > 0) {
42568
+ const current = handle.inputValues();
42569
+ const next = {};
42570
+ for (const schema of handle.inputs) {
42571
+ const target = wanted?.[schema.key] ?? schema.defval;
42572
+ if (JSON.stringify(current[schema.key]) !== JSON.stringify(target)) next[schema.key] = target;
42573
+ }
42574
+ if (Object.keys(next).length > 0) handle.setInputs(next);
42575
+ } else if (wanted) {
42576
+ handle.setInputs(wanted);
42577
+ }
42578
+ const visible = !(typeof entry === "object" && entry.hidden);
42579
+ if (handle.visible !== visible) handle.setVisible(visible);
42580
+ }
42525
42581
  addNative(type) {
42526
42582
  const chart = this.inner;
42527
42583
  if (!chart) return;
@@ -42685,10 +42741,13 @@ var ChartCell = class {
42685
42741
  // (`ctx.addIndicator`) stay out: their names would never resolve against the
42686
42742
  // manifest — their plugin persists them via the `ext` seam instead.
42687
42743
  indicators: indicatorLedger({
42688
- present: this.inner ? this.inner.presentNativeIndicators() : [],
42744
+ // Live handles carry what the registry read cannot: the input DELTAS and
42745
+ // the hidden flag, so native settings/visibility survive the round-trip.
42746
+ present: this.inner ? this.nativeHandles().map((h) => nativeLedgerEntry(h)) : [],
42689
42747
  instanceEntries: this.instances.filter((it) => !it.external).map((it) => {
42690
42748
  const d = it.handle ? instanceDeltas(it.handle) : it.values;
42691
- return d ? { name: it.entry.name, ...d } : it.entry.name;
42749
+ const hidden = it.handle ? !it.handle.visible : false;
42750
+ return d || hidden ? { name: it.entry.name, ...d ?? {}, ...hidden ? { hidden: true } : {} } : it.entry.name;
42692
42751
  }),
42693
42752
  pendingManifest: this.pendingManifestNames,
42694
42753
  manifestSettled: this.deps.manifestSettled(),
@@ -1,6 +1,6 @@
1
1
  import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BCRmYALw.cjs';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-7ECSDtgt.cjs';
3
- export { g as ChartState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-7ECSDtgt.cjs';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-hY9cK4BS.cjs';
3
+ export { g as ChartState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-hY9cK4BS.cjs';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.cjs';
5
5
  import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, a as ScriptRun } from './contributions-DEPRtkmG.cjs';
6
6
  import { M as MarketDataFeed } from './DataProvider-UtWw2CgJ.cjs';
@@ -360,12 +360,21 @@ declare class ChartCell {
360
360
  external?: boolean;
361
361
  inputs?: Record<string, InputValue>;
362
362
  props?: Record<string, InputValue>;
363
+ hidden?: boolean;
363
364
  }): void;
364
365
  private removeInstance;
365
366
  private dropInstance;
366
367
  /** Add a native indicator. A multi-instance type gets a fresh instance every time; a
367
368
  * single-instance type already on the chart hands back its existing one — nothing
368
369
  * changed, so nothing enters the undo timeline. */
370
+ /**
371
+ * Converge one native handle to a restored ledger entry: every schema key gets the
372
+ * entry's value or its declaration default (the DOCUMENT is the truth — a live
373
+ * tweak must not survive a restore that says otherwise), and visibility follows
374
+ * the `hidden` flag. Skips the input write when nothing differs — `setInputs`
375
+ * re-runs the indicator, and a no-op restore must not flicker every native.
376
+ */
377
+ private applyNativeLedgerEntry;
369
378
  addNative(type: string): void;
370
379
  private removeNative;
371
380
  /** The chart's native instances, insertion order — the picker's on-chart rows and
@@ -1,6 +1,6 @@
1
1
  import { O as OHLCV, V as VisibleRangePreset, a as VisibleRange, b as VelaOptions, I as InputValue, c as VelaTheme, N as NativeBackend, d as MarketSession } from './options-BCRmYALw.js';
2
- import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-D1Fhs8Dk.js';
3
- export { g as ChartState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-D1Fhs8Dk.js';
2
+ import { S as SyncSetting, V as VelaStorage, C as CellState, W as WidgetHistory, R as ResolvedIndicator, a as StatuslinePart, b as RangePreset, T as TrackSizes, c as VelaShellOptions, d as SyncOptions, e as SyncKind, f as WorkspaceState } from './statusline-model-wW3m4in1.js';
3
+ export { g as ChartState, P as PanelsState, h as decodeState, i as encodeState, s as sanitizeState } from './statusline-model-wW3m4in1.js';
4
4
  import { K as KeymapManager } from './keymap-CGOz5F5f.js';
5
5
  import { I as IndicatorHandle, S as ScriptingEngine, W as WidgetContext, V as Vela, E as ExternalIndicatorEntry, a as ScriptRun } from './contributions-5nz3PLRe.js';
6
6
  import { M as MarketDataFeed } from './DataProvider-Cb-2lC5O.js';
@@ -360,12 +360,21 @@ declare class ChartCell {
360
360
  external?: boolean;
361
361
  inputs?: Record<string, InputValue>;
362
362
  props?: Record<string, InputValue>;
363
+ hidden?: boolean;
363
364
  }): void;
364
365
  private removeInstance;
365
366
  private dropInstance;
366
367
  /** Add a native indicator. A multi-instance type gets a fresh instance every time; a
367
368
  * single-instance type already on the chart hands back its existing one — nothing
368
369
  * changed, so nothing enters the undo timeline. */
370
+ /**
371
+ * Converge one native handle to a restored ledger entry: every schema key gets the
372
+ * entry's value or its declaration default (the DOCUMENT is the truth — a live
373
+ * tweak must not survive a restore that says otherwise), and visibility follows
374
+ * the `hidden` flag. Skips the input write when nothing differs — `setInputs`
375
+ * re-runs the indicator, and a no-op restore must not flicker every native.
376
+ */
377
+ private applyNativeLedgerEntry;
369
378
  addNative(type: string): void;
370
379
  private removeNative;
371
380
  /** The chart's native instances, insertion order — the picker's on-chart rows and
package/dist/workspace.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ChartCell, GRID_PICKER_MAX, VelaWorkspace, activeAfterLayout, decodeState, encodeState, ensureLayout, evenTracks, gridStyles, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, sanitizeState, syncTargets, trackOffsets, unregisterLayout } from './chunk-BXF7VNNE.js';
1
+ export { ChartCell, GRID_PICKER_MAX, VelaWorkspace, activeAfterLayout, decodeState, encodeState, ensureLayout, evenTracks, gridStyles, layoutDefinition, layoutForGrid, layoutShape, layouts, memoryStorageAdapter, rangesWithin, registerBuiltinLayouts, registerLayout, resizeTracks, sanitizeState, syncTargets, trackOffsets, unregisterLayout } from './chunk-627A5HEV.js';
2
2
  import './chunk-22QJKGXX.js';
3
3
  import './chunk-IFJJPXSV.js';
4
4
  import './chunk-XCBJU674.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxalgo/vela",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "Open-source charting library with a native high-performance renderer, drawing tools, pluggable chart types and pluggable scripting engines.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://luxalgo.com/vela",