@luxalgo/vela 0.6.7 → 0.6.8

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.
@@ -20016,12 +20016,16 @@ ${overlayScrollbarCss(".vela-dialog *")}
20016
20016
  closeOnEscape: false,
20017
20017
  footer: (foot) => {
20018
20018
  foot.append(
20019
+ this.resetAction(),
20019
20020
  this.dialogButton("Cancel", false, () => this.revertAndClose()),
20020
20021
  this.dialogButton("Ok", true, () => this.close())
20021
20022
  );
20022
20023
  },
20024
+ // Stale-guard: destroying a dialog fires its machine's onOpenChange(false)
20025
+ // asynchronously — after a reset rebuild that notification must not close
20026
+ // the replacement dialog.
20023
20027
  onOpenChange: (open2) => {
20024
- if (!open2) this.close();
20028
+ if (!open2 && this.uiDialog === ui) this.close();
20025
20029
  }
20026
20030
  });
20027
20031
  applyChromeTokens(ui.panel, t);
@@ -20152,6 +20156,30 @@ ${overlayScrollbarCss(".vela-dialog *")}
20152
20156
  }
20153
20157
  this.close();
20154
20158
  }
20159
+ /** The footer's reset button — same chip as Cancel, pinned to the LEFT edge
20160
+ * (`margin-right:auto` against the footer's flex-end keeps Cancel/Ok right). */
20161
+ resetAction() {
20162
+ const b = this.dialogButton("Reset defaults", false, () => this.resetToDefaults());
20163
+ b.style.marginRight = "auto";
20164
+ return b;
20165
+ }
20166
+ /** Restore every input to its declared default (re-running the indicator), then
20167
+ * re-open the form so each control re-reads the restored values — the same
20168
+ * rebuild-after-reset move as the chart-settings dialog. The open-time snapshot
20169
+ * survives the rebuild, so Cancel after a reset still reverts the whole session. */
20170
+ resetToDefaults() {
20171
+ const row = this.row;
20172
+ if (!row) return;
20173
+ const snap = this.snapshot;
20174
+ for (const inp of row.inputs) {
20175
+ if (row.values[inp.key] !== inp.defval) {
20176
+ row.values[inp.key] = inp.defval;
20177
+ this.host.onChange?.({ indicatorId: row.id, key: inp.key, value: inp.defval });
20178
+ }
20179
+ }
20180
+ this.open(row);
20181
+ if (snap) this.snapshot = snap;
20182
+ }
20155
20183
  /** Write one edit through: store it, notify the host, and re-apply the `when` gates. */
20156
20184
  commit(row, key, value) {
20157
20185
  row.values[key] = value;
@@ -32582,6 +32610,11 @@ ${overlayScrollbarCss(".vela-sd-pane")}
32582
32610
  }
32583
32611
 
32584
32612
  // src/renderers/native/backdrop/BackdropRenderer.ts
32613
+ function clipHighlightRect(x1, x2, left, right) {
32614
+ const x = Math.max(left, x1);
32615
+ const end = Math.min(right, x2);
32616
+ return end > x ? { x, width: end - x } : null;
32617
+ }
32585
32618
  var BackdropRenderer = class {
32586
32619
  constructor() {
32587
32620
  this.canvas = null;
@@ -32614,17 +32647,22 @@ ${overlayScrollbarCss(".vela-sd-pane")}
32614
32647
  /** Renderer-owned session highlight bands: full-height (all panes), behind the grid.
32615
32648
  * Session-zone washes (pre/post-market) paint first, host highlights on top. */
32616
32649
  drawHighlights(ctx, scene, coords) {
32617
- const bands = [...scene.sessionHighlightBands(), ...scene.highlights];
32618
- if (bands.length === 0) return;
32650
+ const sessions = scene.sessionHighlightBands();
32651
+ if (sessions.length > 0) {
32652
+ const left = Math.max(0, coords.logicalToX(-0.5));
32653
+ const right = Math.min(coords.width, coords.logicalToX(coords.barCount - 0.5));
32654
+ this.drawHighlightSet(ctx, sessions, coords, left, right);
32655
+ }
32656
+ this.drawHighlightSet(ctx, scene.highlights, coords, 0, coords.width);
32657
+ }
32658
+ drawHighlightSet(ctx, bands, coords, left, right) {
32619
32659
  for (const band of bands) {
32620
32660
  const x1 = coords.timeToX(band.from);
32621
32661
  const x2 = coords.timeToX(band.to);
32622
- if (x2 < 0 || x1 > coords.width || x2 <= x1) continue;
32623
- const cx = Math.max(0, x1);
32624
- const cw = Math.min(coords.width, x2) - cx;
32625
- if (cw <= 0) continue;
32662
+ const rect = clipHighlightRect(x1, x2, left, right);
32663
+ if (!rect) continue;
32626
32664
  ctx.fillStyle = band.color;
32627
- ctx.fillRect(cx, 0, cw, coords.height);
32665
+ ctx.fillRect(rect.x, 0, rect.width, coords.height);
32628
32666
  }
32629
32667
  }
32630
32668
  // ── grid ── vert/horz gate on `scene.showGrid` AND their own per-axis visibility