@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.
@@ -1,4 +1,4 @@
1
- import React11, { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useCallback, useMemo, useContext, useReducer } from 'react';
1
+ import React11, { createContext, forwardRef, useRef, useState, useEffect, useImperativeHandle, useCallback, useMemo, useContext, useReducer } from 'react';
2
2
  import { TextStyle, Application, Container, Graphics, Text, FillGradient, CanvasTextMetrics } from 'pixi.js';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import ReactDOM from 'react-dom';
@@ -7879,9 +7879,6 @@ var PixiTradingRenderer = class {
7879
7879
  } else {
7880
7880
  this._lineGfx.moveTo(0, y).lineTo(plotWidth, y).stroke({ color, width: lineCrisp.width, alpha });
7881
7881
  }
7882
- if (isDraggableRole(order.role)) {
7883
- this._drawDragHandle(plotWidth - 26, y, color, alpha);
7884
- }
7885
7882
  const boxY = y - LINE_H / 2;
7886
7883
  const roleStr = orderRoleLabel(order.role);
7887
7884
  const text = roleStr ? `${roleStr} ${order.qty}` : `${order.side.toUpperCase()} ${order.qty}`;
@@ -7890,6 +7887,9 @@ var PixiTradingRenderer = class {
7890
7887
  const pillX = Math.max(0, plotWidth - LABEL_GAP - pillW);
7891
7888
  this._boxGfx.roundRect(pillX, boxY, pillW, LINE_H, PILL_R).fill({ color, alpha });
7892
7889
  labelIdx = this._drawLabel(text, pillX + pillW / 2, y, labelIdx, labelStyle, true);
7890
+ if (isDraggableRole(order.role)) {
7891
+ this._drawPillDragArrows(pillX + pillW / 2, boxY, color, alpha);
7892
+ }
7893
7893
  this._boxGfx.rect(plotWidth, boxY, psWidth, LINE_H).fill({ color, alpha });
7894
7894
  labelIdx = this._drawLabel(order.price.toFixed(2), plotWidth + 4, y, labelIdx, labelStyle);
7895
7895
  if (isDraggableRole(order.role)) {
@@ -8021,12 +8021,19 @@ var PixiTradingRenderer = class {
8021
8021
  * with an up and a down chevron, centred on the line. Signals "drag me
8022
8022
  * vertically" the way TradingView's order-line handles do.
8023
8023
  */
8024
- _drawDragHandle(x, y, color, alpha) {
8025
- const s = 4;
8026
- const gap = 3;
8027
- this._boxGfx.roundRect(x - 8, y - 13, 16, 26, 4).fill({ color, alpha: alpha * 0.18 });
8028
- this._boxGfx.poly([x, y - gap - 2 * s, x + s, y - gap, x - s, y - gap]).fill({ color, alpha });
8029
- this._boxGfx.poly([x, y + gap + 2 * s, x + s, y + gap, x - s, y + gap]).fill({ color, alpha });
8024
+ /**
8025
+ * Up/down chevrons hugging a label pill, marking it draggable.
8026
+ *
8027
+ * Anchored to the pill rather than a fixed x so the affordance stays with
8028
+ * the label wherever it is laid out.
8029
+ */
8030
+ _drawPillDragArrows(cx, boxY, color, alpha) {
8031
+ const s = 3.5;
8032
+ const gap = 2;
8033
+ const upBase = boxY - gap;
8034
+ this._boxGfx.poly([cx, upBase - s * 1.6, cx + s, upBase, cx - s, upBase]).fill({ color, alpha: alpha * 0.9 });
8035
+ const downBase = boxY + LINE_H + gap;
8036
+ this._boxGfx.poly([cx, downBase + s * 1.6, cx + s, downBase, cx - s, downBase]).fill({ color, alpha: alpha * 0.9 });
8030
8037
  }
8031
8038
  /** Draws or reuses a label at the given position and returns the next label index. */
8032
8039
  _drawLabel(text, x, y, labelIdx, style, centered) {
@@ -23015,6 +23022,19 @@ var ChartCanvas = forwardRef(
23015
23022
  );
23016
23023
  const drawOverlayRef = useRef(null);
23017
23024
  const [priceFraction, setPriceFraction] = useState(priceFractionProp ?? 0.6);
23025
+ const [effectiveTheme, setEffectiveTheme] = useState(theme);
23026
+ useEffect(() => {
23027
+ setEffectiveTheme(theme);
23028
+ }, [theme]);
23029
+ useEffect(() => {
23030
+ const chart = chartRef.current;
23031
+ if (!chart) return;
23032
+ const onThemeChanged = ({ theme: t }) => setEffectiveTheme(t);
23033
+ chart.on("themeChanged", onThemeChanged);
23034
+ return () => {
23035
+ chart.off?.("themeChanged", onThemeChanged);
23036
+ };
23037
+ }, [dataBlocked]);
23018
23038
  const selectPointerToolRef = useRef(() => {
23019
23039
  });
23020
23040
  useImperativeHandle(ref, () => ({
@@ -24137,29 +24157,41 @@ var ChartCanvas = forwardRef(
24137
24157
  },
24138
24158
  children: [
24139
24159
  /* @__PURE__ */ jsx(
24140
- "a",
24160
+ "div",
24141
24161
  {
24142
- href: "https://forgecharts.com",
24143
- target: "_blank",
24144
- rel: "noopener noreferrer",
24145
24162
  style: {
24146
24163
  position: "absolute",
24147
24164
  bottom: 38,
24148
24165
  left: 6,
24149
24166
  zIndex: 5,
24150
- lineHeight: 0
24167
+ display: "flex",
24168
+ flexDirection: "column",
24169
+ alignItems: "flex-start",
24170
+ gap: 1,
24171
+ // Never intercept clicks meant for the chart; the logo re-enables
24172
+ // pointer events on itself below.
24173
+ pointerEvents: "none"
24151
24174
  },
24152
24175
  children: /* @__PURE__ */ jsx(
24153
- "img",
24176
+ "a",
24154
24177
  {
24155
- src: theme === "light" ? logo_light_default : logo_dark_default,
24156
- alt: "ForgeCharts",
24157
- style: {
24158
- height: 48,
24159
- width: "auto",
24160
- opacity: 0.55,
24161
- userSelect: "none"
24162
- }
24178
+ href: "https://forgecharts.com",
24179
+ target: "_blank",
24180
+ rel: "noopener noreferrer",
24181
+ style: { lineHeight: 0, pointerEvents: "auto" },
24182
+ children: /* @__PURE__ */ jsx(
24183
+ "img",
24184
+ {
24185
+ src: effectiveTheme === "light" ? logo_light_default : logo_dark_default,
24186
+ alt: "ForgeCharts",
24187
+ style: {
24188
+ height: 48,
24189
+ width: "auto",
24190
+ opacity: 0.55,
24191
+ userSelect: "none"
24192
+ }
24193
+ }
24194
+ )
24163
24195
  }
24164
24196
  )
24165
24197
  }
@@ -26742,6 +26774,9 @@ function _guessFrontMonth(product, months) {
26742
26774
  }
26743
26775
  return `${product}${months[0]}${currentYear + 1}`;
26744
26776
  }
26777
+
26778
+ // src/version.ts
26779
+ var FORGECHARTS_VERSION = "1.5.26" ;
26745
26780
  var TIMEZONE_OPTIONS = [
26746
26781
  { label: "UTC", value: "UTC" },
26747
26782
  { label: "Exchange", value: "exchange" },
@@ -26968,6 +27003,17 @@ function BottomToolbar({ symbol, timezone, onTimezoneChange, session, onSessionC
26968
27003
  }, [sessionOpen]);
26969
27004
  return /* @__PURE__ */ jsxs("div", { className: "bottom-bar", children: [
26970
27005
  /* @__PURE__ */ jsxs("div", { className: "bottom-bar-left", children: [
27006
+ /* @__PURE__ */ jsxs(
27007
+ "span",
27008
+ {
27009
+ className: "bottom-bar-version",
27010
+ title: `ForgeCharts SDK ${FORGECHARTS_VERSION}`,
27011
+ children: [
27012
+ "v",
27013
+ FORGECHARTS_VERSION
27014
+ ]
27015
+ }
27016
+ ),
26971
27017
  showScriptButton !== false && /* @__PURE__ */ jsxs(
26972
27018
  "button",
26973
27019
  {