@forgecharts/sdk 1.5.78 → 1.5.79

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.
@@ -11124,6 +11124,9 @@ var KIT_FEATURE_TO_CAPABILITY = {
11124
11124
  extended_drawing_tools: "extendedDrawings",
11125
11125
  indicators: "indicators",
11126
11126
  multi_pane: "multiPane",
11127
+ // Renamed candle_types in migration 050 (it gates the series-style picker);
11128
+ // the legacy key stays mapped so an un-migrated catalog keeps working.
11129
+ candle_types: "chartTypes",
11127
11130
  chart_types: "chartTypes",
11128
11131
  bar_replay: "barReplay",
11129
11132
  custom_timeframes: "customTimeframes",
@@ -11580,6 +11583,7 @@ var ChartRuntimeResolver = class _ChartRuntimeResolver {
11580
11583
  }
11581
11584
  };
11582
11585
  var resolver = () => ChartRuntimeResolver.getInstance();
11586
+ var canUseChartTypes = () => resolver().canUseChartTypes();
11583
11587
  var canUseExtendedDrawings = () => resolver().canUseExtendedDrawings();
11584
11588
  var canUseMultiPane = () => resolver().canUseMultiPane();
11585
11589
  var canUseDraggableOrders = () => resolver().canUseDraggableOrders();
@@ -12210,6 +12214,30 @@ var TChart = class _TChart {
12210
12214
  this._series.applyOptions(options);
12211
12215
  this._core.markDirty();
12212
12216
  }
12217
+ /**
12218
+ * Switch the primary series' render style (candlestick, heikinashi, line,
12219
+ * area, histogram). The renderers have always supported every style — the
12220
+ * draw pass branches on the series' type option — this is the missing
12221
+ * public switch, gated by the candle_types package feature (capability
12222
+ * `chartTypes`). Ungated attempts warn and keep the current style rather
12223
+ * than throwing: the toolbar hides the picker when ungated, so a call
12224
+ * landing here is a host integration slip, not a user action.
12225
+ */
12226
+ setSeriesType(type) {
12227
+ this._assertAlive();
12228
+ if (!canUseChartTypes()) {
12229
+ console.warn("[ForgeCharts] Series-style switching (candle_types) is not enabled on the active plan.");
12230
+ return;
12231
+ }
12232
+ this._series.applyOptions({ type });
12233
+ this._core.markDirty();
12234
+ this._bus.emit("seriesTypeChanged", { type });
12235
+ }
12236
+ /** The primary series' current render style. */
12237
+ getSeriesType() {
12238
+ this._assertAlive();
12239
+ return this._series.options().type;
12240
+ }
12213
12241
  /** Scrolls the viewport so the latest bar is visible at the right edge. */
12214
12242
  scrollToEnd() {
12215
12243
  this._assertAlive();
@@ -18331,7 +18359,7 @@ var DEMONSTRATION_STROKE = "rgba(255, 200, 50, 0.7)";
18331
18359
  var DEMONSTRATION_COLOR = "var(--crosshair-overlay, rgba(255,255,255,0.75))";
18332
18360
 
18333
18361
  // src/version.ts
18334
- var FORGECHARTS_VERSION = "1.5.78" ;
18362
+ var FORGECHARTS_VERSION = "1.5.79" ;
18335
18363
  function applyRuntimeConfig(caps, config) {
18336
18364
  if (!config) return caps;
18337
18365
  const orderEntry = config.enableOrderEntry === false ? false : caps.orderEntry;
@@ -23175,6 +23203,7 @@ var ChartCanvas = forwardRef(
23175
23203
  initialActiveTool,
23176
23204
  onPointerToolChange,
23177
23205
  initialPointerTool,
23206
+ initialSeriesType,
23178
23207
  initialMagnetMode,
23179
23208
  onMagnetModeChange,
23180
23209
  drawingFavorites: drawingFavoritesProp,
@@ -23293,6 +23322,7 @@ var ChartCanvas = forwardRef(
23293
23322
  chartRef.current?.loadLayout(layout);
23294
23323
  },
23295
23324
  addIndicator: (config) => chartRef.current?.addIndicator(config) ?? null,
23325
+ setSeriesType: (type) => chartRef.current?.setSeriesType(type),
23296
23326
  removeIndicator: (id) => chartRef.current?.removeIndicator(id),
23297
23327
  moveIndicatorToOverlay: (id) => chartRef.current?.moveIndicatorToOverlay(id),
23298
23328
  moveIndicatorToPane: (id, targetPaneId) => chartRef.current?.moveIndicatorToPane(id, targetPaneId),
@@ -24312,7 +24342,12 @@ var ChartCanvas = forwardRef(
24312
24342
  handleToolSelectRef.current = handleToolSelect;
24313
24343
  selectPointerToolRef.current = handleToolSelect;
24314
24344
  const initialPointerAppliedRef = useRef(false);
24345
+ const initialSeriesAppliedRef = useRef(false);
24315
24346
  useEffect(() => {
24347
+ if (!initialSeriesAppliedRef.current && initialSeriesType && chartRef.current) {
24348
+ initialSeriesAppliedRef.current = true;
24349
+ chartRef.current.setSeriesType(initialSeriesType);
24350
+ }
24316
24351
  if (initialPointerAppliedRef.current || !initialPointerTool) return;
24317
24352
  initialPointerAppliedRef.current = true;
24318
24353
  selectPointerToolRef.current(initialPointerTool);
@@ -26455,6 +26490,28 @@ function RollRuleDropdown({
26455
26490
  ))
26456
26491
  ] });
26457
26492
  }
26493
+ var SERIES_STYLES = [
26494
+ { id: "candlestick", label: "Candles", icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "currentColor", children: [
26495
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "3", height: "6", rx: "0.5" }),
26496
+ /* @__PURE__ */ jsx("line", { x1: "4.5", y1: "2", x2: "4.5", y2: "14", stroke: "currentColor", strokeWidth: "1" }),
26497
+ /* @__PURE__ */ jsx("rect", { x: "10", y: "3", width: "3", height: "7", rx: "0.5" }),
26498
+ /* @__PURE__ */ jsx("line", { x1: "11.5", y1: "1", x2: "11.5", y2: "13", stroke: "currentColor", strokeWidth: "1" })
26499
+ ] }) },
26500
+ { id: "heikinashi", label: "Heikin Ashi", icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "currentColor", children: [
26501
+ /* @__PURE__ */ jsx("rect", { x: "2.5", y: "6", width: "3.4", height: "6", rx: "1.6" }),
26502
+ /* @__PURE__ */ jsx("rect", { x: "9.5", y: "3", width: "3.4", height: "6", rx: "1.6" })
26503
+ ] }) },
26504
+ { id: "line", label: "Line", icon: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", children: /* @__PURE__ */ jsx("polyline", { points: "2,12 6,7 10,10 14,4" }) }) },
26505
+ { id: "area", label: "Area", icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "13", height: "13", children: [
26506
+ /* @__PURE__ */ jsx("polyline", { points: "2,12 6,7 10,10 14,4", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
26507
+ /* @__PURE__ */ jsx("polygon", { points: "2,12 6,7 10,10 14,4 14,14 2,14", fill: "currentColor", opacity: "0.35" })
26508
+ ] }) },
26509
+ { id: "histogram", label: "Histogram", icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "currentColor", children: [
26510
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "9", width: "2.6", height: "5" }),
26511
+ /* @__PURE__ */ jsx("rect", { x: "6.5", y: "5", width: "2.6", height: "9" }),
26512
+ /* @__PURE__ */ jsx("rect", { x: "11", y: "7", width: "2.6", height: "7" })
26513
+ ] }) }
26514
+ ];
26458
26515
  function TopToolbar({
26459
26516
  symbol,
26460
26517
  timeframe,
@@ -26466,6 +26523,8 @@ function TopToolbar({
26466
26523
  onAddCustomTimeframe,
26467
26524
  onRemoveCustomTimeframe,
26468
26525
  onFavoritesChange,
26526
+ seriesType,
26527
+ onSeriesTypeChange,
26469
26528
  onAddIndicator,
26470
26529
  maxIndicators,
26471
26530
  indicatorsOpen,
@@ -26506,6 +26565,16 @@ function TopToolbar({
26506
26565
  showMultiChartLayout
26507
26566
  }) {
26508
26567
  const [tfOpen, setTfOpen] = useState(false);
26568
+ const [styleOpen, setStyleOpen] = useState(false);
26569
+ const styleRef = useRef(null);
26570
+ useEffect(() => {
26571
+ if (!styleOpen) return;
26572
+ const handler = (e) => {
26573
+ if (styleRef.current && !styleRef.current.contains(e.target)) setStyleOpen(false);
26574
+ };
26575
+ document.addEventListener("mousedown", handler);
26576
+ return () => document.removeEventListener("mousedown", handler);
26577
+ }, [styleOpen]);
26509
26578
  const [symOpen, setSymOpen] = useState(false);
26510
26579
  const [ssOpen, setSsOpen] = useState(false);
26511
26580
  const [rollOpen, setRollOpen] = useState(false);
@@ -26641,6 +26710,39 @@ function TopToolbar({
26641
26710
  }
26642
26711
  )
26643
26712
  ] }),
26713
+ seriesType !== void 0 && onSeriesTypeChange !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
26714
+ /* @__PURE__ */ jsx("div", { className: "toolbar-sep" }),
26715
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, ref: styleRef, children: [
26716
+ /* @__PURE__ */ jsxs(
26717
+ "button",
26718
+ {
26719
+ className: `ind-trigger${styleOpen ? " active" : ""}`,
26720
+ onClick: () => setStyleOpen((o) => !o),
26721
+ title: "Chart style",
26722
+ children: [
26723
+ (SERIES_STYLES.find((s) => s.id === seriesType) ?? SERIES_STYLES[0]).icon,
26724
+ (SERIES_STYLES.find((s) => s.id === seriesType) ?? SERIES_STYLES[0]).label
26725
+ ]
26726
+ }
26727
+ ),
26728
+ styleOpen && /* @__PURE__ */ jsx("div", { className: "tf-dropdown", style: { minWidth: 150 }, children: SERIES_STYLES.map((style) => /* @__PURE__ */ jsx(
26729
+ "button",
26730
+ {
26731
+ className: "tf-dropdown-row",
26732
+ style: style.id === seriesType ? { fontWeight: 600 } : void 0,
26733
+ onClick: () => {
26734
+ onSeriesTypeChange(style.id);
26735
+ setStyleOpen(false);
26736
+ },
26737
+ children: /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
26738
+ style.icon,
26739
+ style.label
26740
+ ] })
26741
+ },
26742
+ style.id
26743
+ )) })
26744
+ ] })
26745
+ ] }),
26644
26746
  /* @__PURE__ */ jsx("div", { className: "toolbar-sep" }),
26645
26747
  showIndicators !== false && /* @__PURE__ */ jsxs(Fragment, { children: [
26646
26748
  /* @__PURE__ */ jsxs(
@@ -31506,6 +31608,9 @@ function ChartWorkspace({
31506
31608
  onRollRuleChange,
31507
31609
  quotesWsUrl,
31508
31610
  getQuotesAuthToken,
31611
+ seriesType,
31612
+ onSeriesTypeChange,
31613
+ showSeriesTypes,
31509
31614
  extraTfGroups,
31510
31615
  // RightToolbar
31511
31616
  watchlistOpen,
@@ -31615,6 +31720,7 @@ function ChartWorkspace({
31615
31720
  const effShowDataExport = gate(showDataExport, capabilities.dataExport);
31616
31721
  const effShowMultiChartLayout = gate(showMultiChartLayout, capabilities.multiChartLayout);
31617
31722
  const effShowMultipleTabs = gate(showMultipleTabs, capabilities.multipleWorkspaces);
31723
+ const effShowSeriesTypes = gate(showSeriesTypes, capabilities.chartTypes) && onSeriesTypeChange !== void 0;
31618
31724
  const tabItems = tabs.map((t) => ({
31619
31725
  id: t.id,
31620
31726
  label: t.label,
@@ -31692,6 +31798,7 @@ function ChartWorkspace({
31692
31798
  favorites: favoriteTfs,
31693
31799
  onSymbolChange,
31694
31800
  onTimeframeChange,
31801
+ ...effShowSeriesTypes ? { seriesType: seriesType ?? "candlestick", onSeriesTypeChange } : {},
31695
31802
  onAddCustomTimeframe,
31696
31803
  onRemoveCustomTimeframe,
31697
31804
  onFavoritesChange: onFavoriteTfsChange,
@@ -35891,6 +35998,11 @@ var ManagedAppShell = forwardRef(
35891
35998
  setIsLicensed(isFullShellLicensed());
35892
35999
  }), []);
35893
36000
  const chartInstancesRef = useRef(/* @__PURE__ */ new Map());
36001
+ const [seriesType, setSeriesType] = useState("candlestick");
36002
+ const handleSeriesTypeChange = useCallback((type) => {
36003
+ setSeriesType(type);
36004
+ chartHandleRef.current?.setSeriesType(type);
36005
+ }, []);
35894
36006
  const chartHandleRef = useRef(null);
35895
36007
  useImperativeHandle(ref, () => ({
35896
36008
  getActiveChartHandle: () => chartHandleRef.current
@@ -36857,6 +36969,8 @@ var ManagedAppShell = forwardRef(
36857
36969
  favoriteTfs,
36858
36970
  onSymbolChange: handleSymbolChange,
36859
36971
  onTimeframeChange: handleTimeframeChange,
36972
+ seriesType,
36973
+ onSeriesTypeChange: handleSeriesTypeChange,
36860
36974
  onAddCustomTimeframe: handleAddCustomTimeframe,
36861
36975
  onRemoveCustomTimeframe: handleRemoveCustomTimeframe,
36862
36976
  onFavoriteTfsChange: setFavoriteTfs,