@forgecharts/sdk 1.5.46 → 1.5.48

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.
package/dist/internal.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TextStyle, Application, Container, Graphics, Text, FillGradient, CanvasTextMetrics } from 'pixi.js';
2
2
  import { forwardRef, useRef, useState, useEffect, useImperativeHandle, useCallback, createContext, useMemo, useContext } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import ReactDOM from 'react-dom';
4
+ import ReactDOM, { createPortal } from 'react-dom';
5
5
 
6
6
  // ../shared/src/time/timeframeRegistry.ts
7
7
  function isCalendarTimeframe(key) {
@@ -21292,60 +21292,64 @@ function ChartContextMenu({
21292
21292
  onClearIndicators,
21293
21293
  onResetView
21294
21294
  }) {
21295
- return /* @__PURE__ */ jsxs(Fragment, { children: [
21296
- /* @__PURE__ */ jsx("div", { className: "chart-ctx-backdrop", onClick: onClose, onContextMenu: (e) => {
21297
- e.preventDefault();
21298
- onClose();
21299
- } }),
21300
- /* @__PURE__ */ jsxs("div", { className: "chart-ctx-menu", style: { left: x, top: y }, children: [
21301
- /* @__PURE__ */ jsx(
21302
- "button",
21303
- {
21304
- className: "chart-ctx-item",
21305
- onClick: () => {
21306
- onSettings();
21307
- onClose();
21308
- },
21309
- children: "Settings\u2026"
21310
- }
21311
- ),
21312
- /* @__PURE__ */ jsx("div", { className: "chart-ctx-divider" }),
21313
- /* @__PURE__ */ jsx(
21314
- "button",
21315
- {
21316
- className: "chart-ctx-item",
21317
- onClick: () => {
21318
- onResetView();
21319
- onClose();
21320
- },
21321
- children: "Reset Chart View"
21322
- }
21323
- ),
21324
- /* @__PURE__ */ jsx("div", { className: "chart-ctx-divider" }),
21325
- /* @__PURE__ */ jsx(
21326
- "button",
21327
- {
21328
- className: "chart-ctx-item chart-ctx-item--danger",
21329
- onClick: () => {
21330
- onClearIndicators();
21331
- onClose();
21332
- },
21333
- children: "Clear Indicators"
21334
- }
21335
- ),
21336
- /* @__PURE__ */ jsx(
21337
- "button",
21338
- {
21339
- className: "chart-ctx-item chart-ctx-item--danger",
21340
- onClick: () => {
21341
- onClearDrawings();
21342
- onClose();
21343
- },
21344
- children: "Clear Drawings"
21345
- }
21346
- )
21347
- ] })
21348
- ] });
21295
+ if (typeof document === "undefined") return null;
21296
+ return createPortal(
21297
+ /* @__PURE__ */ jsxs(Fragment, { children: [
21298
+ /* @__PURE__ */ jsx("div", { className: "chart-ctx-backdrop", onClick: onClose, onContextMenu: (e) => {
21299
+ e.preventDefault();
21300
+ onClose();
21301
+ } }),
21302
+ /* @__PURE__ */ jsxs("div", { className: "chart-ctx-menu", style: { left: x, top: y }, children: [
21303
+ /* @__PURE__ */ jsx(
21304
+ "button",
21305
+ {
21306
+ className: "chart-ctx-item",
21307
+ onClick: () => {
21308
+ onSettings();
21309
+ onClose();
21310
+ },
21311
+ children: "Settings\u2026"
21312
+ }
21313
+ ),
21314
+ /* @__PURE__ */ jsx("div", { className: "chart-ctx-divider" }),
21315
+ /* @__PURE__ */ jsx(
21316
+ "button",
21317
+ {
21318
+ className: "chart-ctx-item",
21319
+ onClick: () => {
21320
+ onResetView();
21321
+ onClose();
21322
+ },
21323
+ children: "Reset Chart View"
21324
+ }
21325
+ ),
21326
+ /* @__PURE__ */ jsx("div", { className: "chart-ctx-divider" }),
21327
+ /* @__PURE__ */ jsx(
21328
+ "button",
21329
+ {
21330
+ className: "chart-ctx-item chart-ctx-item--danger",
21331
+ onClick: () => {
21332
+ onClearIndicators();
21333
+ onClose();
21334
+ },
21335
+ children: "Clear Indicators"
21336
+ }
21337
+ ),
21338
+ /* @__PURE__ */ jsx(
21339
+ "button",
21340
+ {
21341
+ className: "chart-ctx-item chart-ctx-item--danger",
21342
+ onClick: () => {
21343
+ onClearDrawings();
21344
+ onClose();
21345
+ },
21346
+ children: "Clear Drawings"
21347
+ }
21348
+ )
21349
+ ] })
21350
+ ] }),
21351
+ document.body
21352
+ );
21349
21353
  }
21350
21354
  var SECTIONS = [
21351
21355
  { id: "symbol", label: "Symbol", icon: "\u{1D446}" },
@@ -25522,6 +25526,57 @@ var demonstrationTool = {
25522
25526
  cursorStyle: DEMONSTRATION_STYLE
25523
25527
  };
25524
25528
 
25525
- export { CROSSHAIR_LABEL, CROSSHAIR_STYLE, CURRENT_SCHEMA_VERSION, CURSOR_LABEL, CURSOR_STYLE, CandleEngine, Chart, ChartRuntimeResolver, CoordTransform, Crosshair, DEFAULT_SYNC_OPTIONS, DEMONSTRATION_COLOR, DEMONSTRATION_FILL, DEMONSTRATION_LABEL, DEMONSTRATION_RADIUS, DEMONSTRATION_STROKE, DEMONSTRATION_STYLE, DOT_COLOR, DOT_LABEL, DOT_RADIUS, DOT_STYLE, DatafeedConnector, DirtyFlags, ForgeScriptIndicator, ForgeScriptRuntime, Series2 as ForgeScriptSeries, GridChartContainer, GridSyncProvider, IndicatorDAG, InteractionManager, KIT_FEATURE_TO_CAPABILITY, LayerName, LayoutTemplateSelector, LicenseManager, ManagedTradingController, PACKAGE_GATED_CAPABILITIES, PRODUCT_TIERS, PaneManager, PixiBenchmark, PixiChart, PixiLayerManager, PriceScale, ReferenceAPI, Series, TChart, TimeScale, TradingOverlayStore, UNMAPPED_KIT_FEATURES, UnmanagedIngestion, assertCanPlaceOrders, assertCanUseBrackets, assertCanUseDraggableOrders, assertCanUseManagedTrading, assertManagedMode, canPlaceBrackets, canPlaceOrders, canRenderBracketControls, canRenderBuySellButtons, canRenderCandles, canRenderDrawings, canRenderExternalOverlayOnlyMode, canRenderFills, canRenderIndicators, canRenderManagedTradingControls, canRenderOrderEntry, canRenderOrderModificationControls, canRenderOrderTicket, canRenderOverlays, canRenderPositions, canUseAiAgent, canUseAlerts, canUseBarReplay, canUseBracketOrders, canUseChartTypes, canUseCustomIndicators, canUseCustomTimeframes, canUseDataExport, canUseDraggable, canUseDraggableOrders, canUseDrawingTools, canUseExtendedDrawings, canUseExternalIngestion, canUseForgeScript, canUseHistoricalData, canUseIndicators, canUseManagedTrading, canUseManagedTradingHook, canUseMultiChartLayout, canUseMultiPane, canUseMultipleProviders, canUseMultipleWorkspaces, canUseOrderEntry, canUsePositionsOverlay, canUseRealtimeData, canUseSavedLayouts, canUseTrailingStops, canUseWatchlists, clearTelemetryListeners, computeEMA, computeEMAFromSeries, computeMACD, computeRSI, computeSMA, computeSMAFromSeries, computeVolume, computeWMAFromSeries, createChart, crosshairTool, cursorTool, demonstrationTool, detectLanguage, detectLanguageWithFallback, dotTool, evaluateSaveGate, exchangeNow, extractField, getBucketStart2 as getBucketStart, getCapabilities, getDefaultCapabilities, getDefaultStyle, getGridTemplate, getGroupedTemplates, getMissingBarCount, getStyleSlots, hasFeature, initServerClock, isManagedCapable, isManagedMode, isUnmanagedMode, isValidCombination, lineStyleToDash, mergeBars, migrateLegacyPayload, onConversionEvent, packageAllows, resolveStyle, runSandbox, serverClockOffset, serverNow, timeframeToMs2 as timeframeToMs, toCapabilityFlags, useGridSync, validateForgeScript, validateLicensePolicy };
25529
+ // src/version.ts
25530
+ var FORGECHARTS_VERSION = "1.5.48" ;
25531
+
25532
+ // src/compatibility.ts
25533
+ var MIN_KIT_API = 1;
25534
+ var MAX_KIT_API = 1;
25535
+ function checkKitCompatibility(kit) {
25536
+ const sdkVersion = FORGECHARTS_VERSION;
25537
+ const kitVersion = kit?.version ?? null;
25538
+ const apiRaw = kit?.apiVersion;
25539
+ const kitApiVersion = typeof apiRaw === "number" && Number.isFinite(apiRaw) ? apiRaw : null;
25540
+ const supported = { min: MIN_KIT_API, max: MAX_KIT_API };
25541
+ const base = { sdkVersion, kitVersion, kitApiVersion, supported };
25542
+ if (!kit) {
25543
+ return {
25544
+ ...base,
25545
+ level: "unknown",
25546
+ message: "Could not reach the ForgeCharts Kit to check compatibility."
25547
+ };
25548
+ }
25549
+ if (kitApiVersion === null) {
25550
+ return {
25551
+ ...base,
25552
+ level: "unknown",
25553
+ message: "This Kit does not report an API version, so compatibility cannot be checked. Update the Kit to 1.5.47 or later."
25554
+ };
25555
+ }
25556
+ if (kitApiVersion < MIN_KIT_API) {
25557
+ return {
25558
+ ...base,
25559
+ level: "incompatible",
25560
+ message: `This Kit speaks API v${kitApiVersion}, older than the v${MIN_KIT_API} this SDK requires. Update the Kit.`
25561
+ };
25562
+ }
25563
+ if (kitApiVersion > MAX_KIT_API) {
25564
+ return {
25565
+ ...base,
25566
+ level: "incompatible",
25567
+ message: `This Kit speaks API v${kitApiVersion}, newer than the v${MAX_KIT_API} this SDK understands. Update @forgecharts/sdk in the host application.`
25568
+ };
25569
+ }
25570
+ if (kitVersion && kitVersion !== sdkVersion) {
25571
+ return {
25572
+ ...base,
25573
+ level: "drifted",
25574
+ message: `Compatible, but the bundled SDK (${sdkVersion}) and the Kit (${kitVersion}) are different releases. Chart-side fixes reach the app only when @forgecharts/sdk is updated.`
25575
+ };
25576
+ }
25577
+ return { ...base, level: "ok", message: `SDK ${sdkVersion} matches the Kit.` };
25578
+ }
25579
+
25580
+ export { CROSSHAIR_LABEL, CROSSHAIR_STYLE, CURRENT_SCHEMA_VERSION, CURSOR_LABEL, CURSOR_STYLE, CandleEngine, Chart, ChartRuntimeResolver, CoordTransform, Crosshair, DEFAULT_SYNC_OPTIONS, DEMONSTRATION_COLOR, DEMONSTRATION_FILL, DEMONSTRATION_LABEL, DEMONSTRATION_RADIUS, DEMONSTRATION_STROKE, DEMONSTRATION_STYLE, DOT_COLOR, DOT_LABEL, DOT_RADIUS, DOT_STYLE, DatafeedConnector, DirtyFlags, ForgeScriptIndicator, ForgeScriptRuntime, Series2 as ForgeScriptSeries, GridChartContainer, GridSyncProvider, IndicatorDAG, InteractionManager, KIT_FEATURE_TO_CAPABILITY, LayerName, LayoutTemplateSelector, LicenseManager, MAX_KIT_API, MIN_KIT_API, ManagedTradingController, PACKAGE_GATED_CAPABILITIES, PRODUCT_TIERS, PaneManager, PixiBenchmark, PixiChart, PixiLayerManager, PriceScale, ReferenceAPI, Series, TChart, TimeScale, TradingOverlayStore, UNMAPPED_KIT_FEATURES, UnmanagedIngestion, assertCanPlaceOrders, assertCanUseBrackets, assertCanUseDraggableOrders, assertCanUseManagedTrading, assertManagedMode, canPlaceBrackets, canPlaceOrders, canRenderBracketControls, canRenderBuySellButtons, canRenderCandles, canRenderDrawings, canRenderExternalOverlayOnlyMode, canRenderFills, canRenderIndicators, canRenderManagedTradingControls, canRenderOrderEntry, canRenderOrderModificationControls, canRenderOrderTicket, canRenderOverlays, canRenderPositions, canUseAiAgent, canUseAlerts, canUseBarReplay, canUseBracketOrders, canUseChartTypes, canUseCustomIndicators, canUseCustomTimeframes, canUseDataExport, canUseDraggable, canUseDraggableOrders, canUseDrawingTools, canUseExtendedDrawings, canUseExternalIngestion, canUseForgeScript, canUseHistoricalData, canUseIndicators, canUseManagedTrading, canUseManagedTradingHook, canUseMultiChartLayout, canUseMultiPane, canUseMultipleProviders, canUseMultipleWorkspaces, canUseOrderEntry, canUsePositionsOverlay, canUseRealtimeData, canUseSavedLayouts, canUseTrailingStops, canUseWatchlists, checkKitCompatibility, clearTelemetryListeners, computeEMA, computeEMAFromSeries, computeMACD, computeRSI, computeSMA, computeSMAFromSeries, computeVolume, computeWMAFromSeries, createChart, crosshairTool, cursorTool, demonstrationTool, detectLanguage, detectLanguageWithFallback, dotTool, evaluateSaveGate, exchangeNow, extractField, getBucketStart2 as getBucketStart, getCapabilities, getDefaultCapabilities, getDefaultStyle, getGridTemplate, getGroupedTemplates, getMissingBarCount, getStyleSlots, hasFeature, initServerClock, isManagedCapable, isManagedMode, isUnmanagedMode, isValidCombination, lineStyleToDash, mergeBars, migrateLegacyPayload, onConversionEvent, packageAllows, resolveStyle, runSandbox, serverClockOffset, serverNow, timeframeToMs2 as timeframeToMs, toCapabilityFlags, useGridSync, validateForgeScript, validateLicensePolicy };
25526
25581
  //# sourceMappingURL=internal.js.map
25527
25582
  //# sourceMappingURL=internal.js.map