@rm-graph/core 0.1.9 → 0.1.11

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/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkKATRK3C3_js = require('./chunk-KATRK3C3.js');
3
+ var chunk4JQVY6S5_js = require('./chunk-4JQVY6S5.js');
4
+ var chunkQFDC4NU3_js = require('./chunk-QFDC4NU3.js');
5
+ var chunkDGUM43GV_js = require('./chunk-DGUM43GV.js');
4
6
  var scichart = require('scichart');
5
7
  var SciChartJSLightTheme = require('scichart/Charting/Themes/SciChartJSLightTheme');
6
8
 
9
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
10
  // src/utils/helpers.ts
8
11
  function generateId(prefix = "chart") {
9
12
  return `${prefix}-${Math.random().toString(36).substring(2, 11)}`;
@@ -158,7 +161,7 @@ var BaseChart = class {
158
161
  this.resizeObserver = null;
159
162
  this.id = config.id ?? generateId("chart");
160
163
  this.config = config;
161
- this.theme = chunkKATRK3C3_js.ThemeManager.getInstance().resolveTheme(config.theme);
164
+ this.theme = chunk4JQVY6S5_js.ThemeManager.getInstance().resolveTheme(config.theme);
162
165
  this.debouncedResize = debounce(() => this.handleResize(), 100);
163
166
  }
164
167
  /**
@@ -213,7 +216,7 @@ var BaseChart = class {
213
216
  setOptions(options) {
214
217
  this.config = { ...this.config, ...options };
215
218
  if (options.theme) {
216
- this.theme = chunkKATRK3C3_js.ThemeManager.getInstance().resolveTheme(options.theme);
219
+ this.theme = chunk4JQVY6S5_js.ThemeManager.getInstance().resolveTheme(options.theme);
217
220
  this.applyTheme();
218
221
  }
219
222
  this.update();
@@ -226,7 +229,7 @@ var BaseChart = class {
226
229
  this.surface.background = this.theme.backgroundColor ?? "#ffffff";
227
230
  try {
228
231
  const themeName = this.config.theme;
229
- const { SciChartJSDarkTheme, SciChartJSLightTheme: SciChartJSLightTheme3 } = chunkKATRK3C3_js.__require("scichart");
232
+ const { SciChartJSDarkTheme, SciChartJSLightTheme: SciChartJSLightTheme3 } = chunkDGUM43GV_js.__require("scichart");
230
233
  const nextThemeProvider = themeName === "light" ? new SciChartJSLightTheme3() : new SciChartJSDarkTheme();
231
234
  this.surface.applyTheme?.(nextThemeProvider);
232
235
  } catch {
@@ -800,12 +803,13 @@ var Column3DChart = class {
800
803
  this.addTooltip();
801
804
  }
802
805
  /**
803
- * Setup camera clamping to restrict camera movement.
804
- * Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
805
- * Pitch clamped to [0, 89]. Radius clamped to [495, 805].
806
+ * Setup camera clamping to restrict camera movement
807
+ * Matches the original ThreeDGraph.jsx behavior
806
808
  */
807
809
  setupCameraClamping() {
808
810
  if (!this.surface) return;
811
+ const maxCameraRadius = this.config.maxCameraRadius ?? 805;
812
+ const minCameraRadius = this.config.minCameraRadius ?? 575;
809
813
  let isClamping = false;
810
814
  this.surface.camera.propertyChanged.subscribe(() => {
811
815
  if (isClamping) return;
@@ -815,8 +819,6 @@ var Column3DChart = class {
815
819
  let yaw = this.surface.camera.orbitalYaw;
816
820
  let pitch = this.surface.camera.orbitalPitch;
817
821
  let cameraRadius = this.surface.camera.radius;
818
- const maxCameraRadius = this.config.maxCameraRadius ?? 805;
819
- const minCameraRadius = this.config.minCameraRadius ?? 495;
820
822
  if (Math.floor(yaw) > 100) {
821
823
  yaw = -180;
822
824
  } else if (Math.floor(yaw) >= 0) {
@@ -825,7 +827,7 @@ var Column3DChart = class {
825
827
  if (pitch <= 0) {
826
828
  pitch = 0;
827
829
  } else if (pitch >= 89) {
828
- pitch = 89;
830
+ pitch = 88;
829
831
  }
830
832
  if (cameraRadius >= maxCameraRadius) {
831
833
  cameraRadius = maxCameraRadius;
@@ -842,7 +844,9 @@ var Column3DChart = class {
842
844
  this.surface.camera.radius = cameraRadius;
843
845
  }
844
846
  } finally {
845
- isClamping = false;
847
+ setTimeout(() => {
848
+ isClamping = false;
849
+ }, 0);
846
850
  }
847
851
  });
848
852
  }
@@ -869,8 +873,8 @@ var Column3DChart = class {
869
873
  flippedCoordinates: true,
870
874
  axisBandsFill: "#d2d2d2",
871
875
  planeBorderThickness: 3,
872
- axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
873
- labelStyle: { color: "#000000", fontFamily: "Arial" }
876
+ axisTitleStyle: { color: "#000000" },
877
+ labelStyle: { color: "#000000" }
874
878
  });
875
879
  this.surface.yAxis = new scichart.NumericAxis3D(wasmContext, {
876
880
  axisTitle: yAxisTitle,
@@ -879,8 +883,8 @@ var Column3DChart = class {
879
883
  drawMinorGridLines: false,
880
884
  majorGridLineStyle: { color: "#7e7e7e" },
881
885
  axisBandsFill: "#b1b1b1",
882
- axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
883
- labelStyle: { color: "#000000", fontFamily: "Arial" }
886
+ axisTitleStyle: { color: "#000000" },
887
+ labelStyle: { color: "#000000" }
884
888
  });
885
889
  this.surface.zAxis = new scichart.NumericAxis3D(wasmContext, {
886
890
  axisTitle: this.config.zAxisTitle ?? "Cycle",
@@ -892,8 +896,8 @@ var Column3DChart = class {
892
896
  axisBandsFill: "#d0d0d0",
893
897
  planeBorderThickness: 3,
894
898
  labelPrecision: 0,
895
- axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
896
- labelStyle: { color: "#000000", fontFamily: "Arial" }
899
+ axisTitleStyle: { color: "#000000" },
900
+ labelStyle: { color: "#000000" }
897
901
  });
898
902
  if (wasmContext.eSCRTTextAlignement) {
899
903
  this.surface.yAxis.labelStyle.alignment = wasmContext.eSCRTTextAlignement.SCRT_TEXT_ALIGNEMENT_SCREEN_AUTOROTATED;
@@ -1115,17 +1119,6 @@ var Column3DChart = class {
1115
1119
  getSurface() {
1116
1120
  return this.surface;
1117
1121
  }
1118
- /**
1119
- * Notify SciChart that the container has resized so the WebGL canvas
1120
- * adjusts to the new dimensions. Call after maximize / minimize.
1121
- */
1122
- resize() {
1123
- if (!this.surface || this.isDestroyed) return;
1124
- try {
1125
- this.surface.invalidateElement?.();
1126
- } catch {
1127
- }
1128
- }
1129
1122
  /**
1130
1123
  * Destroy and clean up
1131
1124
  */
@@ -1763,6 +1756,38 @@ async function createPRPDChart(container, config) {
1763
1756
  await chart.init(container);
1764
1757
  return chart;
1765
1758
  }
1759
+ async function setupSciChartLicense(options) {
1760
+ const { loadLicense: loadLicense2 } = await import('./license-VBO3ZTOJ.js');
1761
+ const { SciChartSurface: SciChartSurface4 } = await import('scichart');
1762
+ let licenseKey;
1763
+ if (options.fromEnv) {
1764
+ if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) }) !== "undefined" && undefined?.VITE_SCICHART_LICENSE_KEY) {
1765
+ licenseKey = undefined.VITE_SCICHART_LICENSE_KEY;
1766
+ } else if (typeof process !== "undefined" && process.env?.SCICHART_LICENSE_KEY) {
1767
+ licenseKey = process.env.SCICHART_LICENSE_KEY;
1768
+ }
1769
+ }
1770
+ if (!licenseKey && options.fromLocalStorage) {
1771
+ const loaded = await loadLicense2();
1772
+ if (loaded) {
1773
+ return true;
1774
+ }
1775
+ }
1776
+ if (!licenseKey && options.licenseKey) {
1777
+ licenseKey = options.licenseKey;
1778
+ }
1779
+ if (licenseKey) {
1780
+ SciChartSurface4.setRuntimeLicenseKey(licenseKey);
1781
+ return true;
1782
+ }
1783
+ return false;
1784
+ }
1785
+ function configureSciChartLicense(licenseKey) {
1786
+ if (licenseKey) {
1787
+ const { SciChartSurface: SciChartSurface4 } = chunkDGUM43GV_js.__require("scichart");
1788
+ SciChartSurface4.setRuntimeLicenseKey(licenseKey);
1789
+ }
1790
+ }
1766
1791
  var VERSION = "0.1.1";
1767
1792
  var SCICHART_VERSION5 = "4.0.933";
1768
1793
  var DEFAULT_WASM_URL = `https://cdn.jsdelivr.net/npm/scichart@${SCICHART_VERSION5}/_wasm/scichart2d.wasm`;
@@ -1770,7 +1795,7 @@ var isConfigured = false;
1770
1795
  function autoConfigureSciChart() {
1771
1796
  if (isConfigured) return;
1772
1797
  try {
1773
- const { SciChartSurface: SciChartSurface4 } = chunkKATRK3C3_js.__require("scichart");
1798
+ const { SciChartSurface: SciChartSurface4 } = chunkDGUM43GV_js.__require("scichart");
1774
1799
  SciChartSurface4.configure({
1775
1800
  wasmUrl: DEFAULT_WASM_URL
1776
1801
  });
@@ -1781,7 +1806,7 @@ function autoConfigureSciChart() {
1781
1806
  autoConfigureSciChart();
1782
1807
  function configureSciChart(options) {
1783
1808
  try {
1784
- const { SciChartSurface: SciChartSurface4 } = chunkKATRK3C3_js.__require("scichart");
1809
+ const { SciChartSurface: SciChartSurface4 } = chunkDGUM43GV_js.__require("scichart");
1785
1810
  SciChartSurface4.configure({
1786
1811
  wasmUrl: options.wasmUrl || DEFAULT_WASM_URL
1787
1812
  });
@@ -1792,27 +1817,99 @@ function configureSciChart(options) {
1792
1817
 
1793
1818
  Object.defineProperty(exports, "ThemeManager", {
1794
1819
  enumerable: true,
1795
- get: function () { return chunkKATRK3C3_js.ThemeManager; }
1820
+ get: function () { return chunk4JQVY6S5_js.ThemeManager; }
1796
1821
  });
1797
1822
  Object.defineProperty(exports, "darkTheme", {
1798
1823
  enumerable: true,
1799
- get: function () { return chunkKATRK3C3_js.darkTheme; }
1824
+ get: function () { return chunk4JQVY6S5_js.darkTheme; }
1800
1825
  });
1801
1826
  Object.defineProperty(exports, "getThemeManager", {
1802
1827
  enumerable: true,
1803
- get: function () { return chunkKATRK3C3_js.getThemeManager; }
1828
+ get: function () { return chunk4JQVY6S5_js.getThemeManager; }
1804
1829
  });
1805
1830
  Object.defineProperty(exports, "lightTheme", {
1806
1831
  enumerable: true,
1807
- get: function () { return chunkKATRK3C3_js.lightTheme; }
1832
+ get: function () { return chunk4JQVY6S5_js.lightTheme; }
1808
1833
  });
1809
1834
  Object.defineProperty(exports, "midnightTheme", {
1810
1835
  enumerable: true,
1811
- get: function () { return chunkKATRK3C3_js.midnightTheme; }
1836
+ get: function () { return chunk4JQVY6S5_js.midnightTheme; }
1812
1837
  });
1813
1838
  Object.defineProperty(exports, "modernTheme", {
1814
1839
  enumerable: true,
1815
- get: function () { return chunkKATRK3C3_js.modernTheme; }
1840
+ get: function () { return chunk4JQVY6S5_js.modernTheme; }
1841
+ });
1842
+ Object.defineProperty(exports, "applyLicenseKey", {
1843
+ enumerable: true,
1844
+ get: function () { return chunkQFDC4NU3_js.applyLicenseKey; }
1845
+ });
1846
+ Object.defineProperty(exports, "clearStoredLicense", {
1847
+ enumerable: true,
1848
+ get: function () { return chunkQFDC4NU3_js.clearStoredLicense; }
1849
+ });
1850
+ Object.defineProperty(exports, "configureLicenseEncryption", {
1851
+ enumerable: true,
1852
+ get: function () { return chunkQFDC4NU3_js.configureLicenseEncryption; }
1853
+ });
1854
+ Object.defineProperty(exports, "decryptLicense", {
1855
+ enumerable: true,
1856
+ get: function () { return chunkQFDC4NU3_js.decryptLicense; }
1857
+ });
1858
+ Object.defineProperty(exports, "encryptLicense", {
1859
+ enumerable: true,
1860
+ get: function () { return chunkQFDC4NU3_js.encryptLicense; }
1861
+ });
1862
+ Object.defineProperty(exports, "getCurrentPassphrase", {
1863
+ enumerable: true,
1864
+ get: function () { return chunkQFDC4NU3_js.getCurrentPassphrase; }
1865
+ });
1866
+ Object.defineProperty(exports, "getLicenseStatus", {
1867
+ enumerable: true,
1868
+ get: function () { return chunkQFDC4NU3_js.getLicenseStatus; }
1869
+ });
1870
+ Object.defineProperty(exports, "getLicenseStorageKey", {
1871
+ enumerable: true,
1872
+ get: function () { return chunkQFDC4NU3_js.getLicenseStorageKey; }
1873
+ });
1874
+ Object.defineProperty(exports, "hasEncryptedLicense", {
1875
+ enumerable: true,
1876
+ get: function () { return chunkQFDC4NU3_js.hasEncryptedLicense; }
1877
+ });
1878
+ Object.defineProperty(exports, "hasStoredLicense", {
1879
+ enumerable: true,
1880
+ get: function () { return chunkQFDC4NU3_js.hasStoredLicense; }
1881
+ });
1882
+ Object.defineProperty(exports, "isLicenseApplied", {
1883
+ enumerable: true,
1884
+ get: function () { return chunkQFDC4NU3_js.isLicenseApplied; }
1885
+ });
1886
+ Object.defineProperty(exports, "loadEncryptedLicense", {
1887
+ enumerable: true,
1888
+ get: function () { return chunkQFDC4NU3_js.loadEncryptedLicense; }
1889
+ });
1890
+ Object.defineProperty(exports, "loadLicense", {
1891
+ enumerable: true,
1892
+ get: function () { return chunkQFDC4NU3_js.loadLicense; }
1893
+ });
1894
+ Object.defineProperty(exports, "removeLicense", {
1895
+ enumerable: true,
1896
+ get: function () { return chunkQFDC4NU3_js.removeLicense; }
1897
+ });
1898
+ Object.defineProperty(exports, "resetPassphrase", {
1899
+ enumerable: true,
1900
+ get: function () { return chunkQFDC4NU3_js.resetPassphrase; }
1901
+ });
1902
+ Object.defineProperty(exports, "saveEncryptedLicense", {
1903
+ enumerable: true,
1904
+ get: function () { return chunkQFDC4NU3_js.saveEncryptedLicense; }
1905
+ });
1906
+ Object.defineProperty(exports, "setLicense", {
1907
+ enumerable: true,
1908
+ get: function () { return chunkQFDC4NU3_js.setLicense; }
1909
+ });
1910
+ Object.defineProperty(exports, "validateLicenseFormat", {
1911
+ enumerable: true,
1912
+ get: function () { return chunkQFDC4NU3_js.validateLicenseFormat; }
1816
1913
  });
1817
1914
  Object.defineProperty(exports, "SciChartSurface", {
1818
1915
  enumerable: true,
@@ -1828,6 +1925,7 @@ exports.VERSION = VERSION;
1828
1925
  exports.calculateDataRange = calculateDataRange;
1829
1926
  exports.clamp = clamp;
1830
1927
  exports.configureSciChart = configureSciChart;
1928
+ exports.configureSciChartLicense = configureSciChartLicense;
1831
1929
  exports.createColumn3DChart = createColumn3DChart;
1832
1930
  exports.createPRPDChart = createPRPDChart;
1833
1931
  exports.createSurface3DChart = createSurface3DChart;
@@ -1843,6 +1941,7 @@ exports.mVpToDb = mVpToDb;
1843
1941
  exports.mVrmsToDbm = mVrmsToDbm;
1844
1942
  exports.normalizeDataPoints = normalizeDataPoints;
1845
1943
  exports.parseSize = parseSize;
1944
+ exports.setupSciChartLicense = setupSciChartLicense;
1846
1945
  exports.throttle = throttle;
1847
1946
  //# sourceMappingURL=index.js.map
1848
1947
  //# sourceMappingURL=index.js.map