@forgecharts/sdk 1.5.24 → 1.5.26

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.
@@ -1554,6 +1554,19 @@ select {
1554
1554
  position: relative;
1555
1555
  }
1556
1556
 
1557
+ /* Build identity in the status bar. Muted and monospace so it reads as
1558
+ metadata rather than a control, and never competes with the toolbar
1559
+ buttons beside it. */
1560
+ .bottom-bar-version {
1561
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1562
+ font-size: 10px;
1563
+ line-height: 1;
1564
+ padding: 0 6px 0 2px;
1565
+ opacity: 0.5;
1566
+ user-select: text;
1567
+ white-space: nowrap;
1568
+ }
1569
+
1557
1570
  .bottom-bar-right {
1558
1571
  display: flex;
1559
1572
  align-items: center;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TextStyle, Application, Container, Graphics, Text, FillGradient, CanvasTextMetrics } from 'pixi.js';
2
- import { forwardRef, useRef, useState, useImperativeHandle, useEffect, useCallback, createContext, useMemo, useContext } from 'react';
2
+ import { forwardRef, useRef, useState, useEffect, useImperativeHandle, useCallback, createContext, useMemo, useContext } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import ReactDOM from 'react-dom';
5
5
 
@@ -7931,9 +7931,6 @@ var PixiTradingRenderer = class {
7931
7931
  } else {
7932
7932
  this._lineGfx.moveTo(0, y).lineTo(plotWidth, y).stroke({ color, width: lineCrisp.width, alpha });
7933
7933
  }
7934
- if (isDraggableRole(order.role)) {
7935
- this._drawDragHandle(plotWidth - 26, y, color, alpha);
7936
- }
7937
7934
  const boxY = y - LINE_H / 2;
7938
7935
  const roleStr = orderRoleLabel(order.role);
7939
7936
  const text = roleStr ? `${roleStr} ${order.qty}` : `${order.side.toUpperCase()} ${order.qty}`;
@@ -7942,6 +7939,9 @@ var PixiTradingRenderer = class {
7942
7939
  const pillX = Math.max(0, plotWidth - LABEL_GAP - pillW);
7943
7940
  this._boxGfx.roundRect(pillX, boxY, pillW, LINE_H, PILL_R).fill({ color, alpha });
7944
7941
  labelIdx = this._drawLabel(text, pillX + pillW / 2, y, labelIdx, labelStyle, true);
7942
+ if (isDraggableRole(order.role)) {
7943
+ this._drawPillDragArrows(pillX + pillW / 2, boxY, color, alpha);
7944
+ }
7945
7945
  this._boxGfx.rect(plotWidth, boxY, psWidth, LINE_H).fill({ color, alpha });
7946
7946
  labelIdx = this._drawLabel(order.price.toFixed(2), plotWidth + 4, y, labelIdx, labelStyle);
7947
7947
  if (isDraggableRole(order.role)) {
@@ -8073,12 +8073,19 @@ var PixiTradingRenderer = class {
8073
8073
  * with an up and a down chevron, centred on the line. Signals "drag me
8074
8074
  * vertically" the way TradingView's order-line handles do.
8075
8075
  */
8076
- _drawDragHandle(x, y, color, alpha) {
8077
- const s = 4;
8078
- const gap = 3;
8079
- this._boxGfx.roundRect(x - 8, y - 13, 16, 26, 4).fill({ color, alpha: alpha * 0.18 });
8080
- this._boxGfx.poly([x, y - gap - 2 * s, x + s, y - gap, x - s, y - gap]).fill({ color, alpha });
8081
- this._boxGfx.poly([x, y + gap + 2 * s, x + s, y + gap, x - s, y + gap]).fill({ color, alpha });
8076
+ /**
8077
+ * Up/down chevrons hugging a label pill, marking it draggable.
8078
+ *
8079
+ * Anchored to the pill rather than a fixed x so the affordance stays with
8080
+ * the label wherever it is laid out.
8081
+ */
8082
+ _drawPillDragArrows(cx, boxY, color, alpha) {
8083
+ const s = 3.5;
8084
+ const gap = 2;
8085
+ const upBase = boxY - gap;
8086
+ this._boxGfx.poly([cx, upBase - s * 1.6, cx + s, upBase, cx - s, upBase]).fill({ color, alpha: alpha * 0.9 });
8087
+ const downBase = boxY + LINE_H + gap;
8088
+ this._boxGfx.poly([cx, downBase + s * 1.6, cx + s, downBase, cx - s, downBase]).fill({ color, alpha: alpha * 0.9 });
8082
8089
  }
8083
8090
  /** Draws or reuses a label at the given position and returns the next label index. */
8084
8091
  _drawLabel(text, x, y, labelIdx, style, centered) {
@@ -23068,6 +23075,19 @@ var ChartCanvas = forwardRef(
23068
23075
  );
23069
23076
  const drawOverlayRef = useRef(null);
23070
23077
  const [priceFraction, setPriceFraction] = useState(priceFractionProp ?? 0.6);
23078
+ const [effectiveTheme, setEffectiveTheme] = useState(theme);
23079
+ useEffect(() => {
23080
+ setEffectiveTheme(theme);
23081
+ }, [theme]);
23082
+ useEffect(() => {
23083
+ const chart = chartRef.current;
23084
+ if (!chart) return;
23085
+ const onThemeChanged = ({ theme: t }) => setEffectiveTheme(t);
23086
+ chart.on("themeChanged", onThemeChanged);
23087
+ return () => {
23088
+ chart.off?.("themeChanged", onThemeChanged);
23089
+ };
23090
+ }, [dataBlocked]);
23071
23091
  const selectPointerToolRef = useRef(() => {
23072
23092
  });
23073
23093
  useImperativeHandle(ref, () => ({
@@ -24190,29 +24210,41 @@ var ChartCanvas = forwardRef(
24190
24210
  },
24191
24211
  children: [
24192
24212
  /* @__PURE__ */ jsx(
24193
- "a",
24213
+ "div",
24194
24214
  {
24195
- href: "https://forgecharts.com",
24196
- target: "_blank",
24197
- rel: "noopener noreferrer",
24198
24215
  style: {
24199
24216
  position: "absolute",
24200
24217
  bottom: 38,
24201
24218
  left: 6,
24202
24219
  zIndex: 5,
24203
- lineHeight: 0
24220
+ display: "flex",
24221
+ flexDirection: "column",
24222
+ alignItems: "flex-start",
24223
+ gap: 1,
24224
+ // Never intercept clicks meant for the chart; the logo re-enables
24225
+ // pointer events on itself below.
24226
+ pointerEvents: "none"
24204
24227
  },
24205
24228
  children: /* @__PURE__ */ jsx(
24206
- "img",
24229
+ "a",
24207
24230
  {
24208
- src: theme === "light" ? logo_light_default : logo_dark_default,
24209
- alt: "ForgeCharts",
24210
- style: {
24211
- height: 48,
24212
- width: "auto",
24213
- opacity: 0.55,
24214
- userSelect: "none"
24215
- }
24231
+ href: "https://forgecharts.com",
24232
+ target: "_blank",
24233
+ rel: "noopener noreferrer",
24234
+ style: { lineHeight: 0, pointerEvents: "auto" },
24235
+ children: /* @__PURE__ */ jsx(
24236
+ "img",
24237
+ {
24238
+ src: effectiveTheme === "light" ? logo_light_default : logo_dark_default,
24239
+ alt: "ForgeCharts",
24240
+ style: {
24241
+ height: 48,
24242
+ width: "auto",
24243
+ opacity: 0.55,
24244
+ userSelect: "none"
24245
+ }
24246
+ }
24247
+ )
24216
24248
  }
24217
24249
  )
24218
24250
  }