@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.d.mts CHANGED
@@ -245,14 +245,6 @@ interface Column3DChartConfig extends ChartConfig {
245
245
  maxCameraRadius?: number;
246
246
  /** Minimum camera radius */
247
247
  minCameraRadius?: number;
248
- /** Minimum yaw angle in degrees (horizontal). Default -179. */
249
- minYaw?: number;
250
- /** Maximum yaw angle in degrees (horizontal). Default 179. */
251
- maxYaw?: number;
252
- /** Minimum pitch angle in degrees (vertical). Default 0. */
253
- minPitch?: number;
254
- /** Maximum pitch angle in degrees (vertical). Default 88. */
255
- maxPitch?: number;
256
248
  /** Camera preset positions */
257
249
  cameraPresets?: CameraPreset[];
258
250
  /** Use cylinder point markers instead of columns */
@@ -295,9 +287,8 @@ declare class Column3DChart {
295
287
  */
296
288
  private createSurface;
297
289
  /**
298
- * Setup camera clamping to restrict camera movement.
299
- * Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
300
- * Pitch clamped to [0, 89]. Radius clamped to [495, 805].
290
+ * Setup camera clamping to restrict camera movement
291
+ * Matches the original ThreeDGraph.jsx behavior
301
292
  */
302
293
  private setupCameraClamping;
303
294
  /**
@@ -360,11 +351,6 @@ declare class Column3DChart {
360
351
  * Get the SciChart surface for advanced operations
361
352
  */
362
353
  getSurface(): SciChart3DSurface | null;
363
- /**
364
- * Notify SciChart that the container has resized so the WebGL canvas
365
- * adjusts to the new dimensions. Call after maximize / minimize.
366
- */
367
- resize(): void;
368
354
  /**
369
355
  * Destroy and clean up
370
356
  */
@@ -542,12 +528,217 @@ declare function lerp(start: number, end: number, t: number): number;
542
528
  */
543
529
  declare function hexToRgba(hex: string, alpha?: number): string;
544
530
 
531
+ /**
532
+ * Generic encryption/decryption utilities using Web Crypto API
533
+ * Provides obfuscation for license keys stored in localStorage
534
+ *
535
+ * Note: This provides obfuscation, not true security.
536
+ * The decryption key is in client code, so determined attackers can still decrypt.
537
+ * For production, combine with SciChart's domain-locking for real protection.
538
+ */
539
+ /**
540
+ * Encrypt a license key string
541
+ * @param licenseKey - The plain text license key
542
+ * @param passphrase - The passphrase to derive encryption key from
543
+ * @returns Base64 encoded encrypted data
544
+ */
545
+ declare function encryptLicense(licenseKey: string, passphrase: string): Promise<string>;
546
+ /**
547
+ * Decrypt an encrypted license key
548
+ * @param encryptedData - Base64 encoded encrypted data
549
+ * @param passphrase - The passphrase to derive decryption key from
550
+ * @returns The decrypted license key or null if decryption fails
551
+ */
552
+ declare function decryptLicense(encryptedData: string, passphrase: string): Promise<string | null>;
553
+ /**
554
+ * Save encrypted license to localStorage
555
+ * @param licenseKey - The plain text license key
556
+ * @param passphrase - The passphrase for encryption
557
+ */
558
+ declare function saveEncryptedLicense(licenseKey: string, passphrase: string): Promise<void>;
559
+ /**
560
+ * Load and decrypt license from localStorage
561
+ * @param passphrase - The passphrase for decryption
562
+ * @returns The decrypted license key or null if not found/decryption fails
563
+ */
564
+ declare function loadEncryptedLicense(passphrase: string): Promise<string | null>;
565
+ /**
566
+ * Check if an encrypted license exists in localStorage
567
+ */
568
+ declare function hasEncryptedLicense(): boolean;
569
+ /**
570
+ * Clear stored license from localStorage
571
+ */
572
+ declare function clearStoredLicense(): void;
573
+ /**
574
+ * Get the storage key used for license data
575
+ */
576
+ declare function getLicenseStorageKey(): string;
577
+
578
+ /**
579
+ * License management module for @rm-graph packages
580
+ *
581
+ * Provides encrypted storage and retrieval of SciChart license keys.
582
+ * License keys are encrypted using AES-256-GCM before storing in localStorage.
583
+ *
584
+ * @example
585
+ * ```typescript
586
+ * import { setLicense, loadLicense, configureLicenseEncryption } from '@rm-graph/core';
587
+ *
588
+ * // Optional: Configure custom passphrase
589
+ * configureLicenseEncryption({ passphrase: 'your-app-secret' });
590
+ *
591
+ * // Save a license (encrypts and stores in localStorage)
592
+ * await setLicense('your-scichart-license-key');
593
+ *
594
+ * // Load license on app startup
595
+ * await loadLicense();
596
+ * ```
597
+ */
598
+
599
+ /**
600
+ * Configuration options for license encryption
601
+ */
602
+ interface LicenseConfig {
603
+ /** Custom passphrase for encryption/decryption (optional) */
604
+ passphrase?: string;
605
+ }
606
+ /**
607
+ * License status information
608
+ */
609
+ interface LicenseStatus {
610
+ /** Whether a license is stored */
611
+ hasLicense: boolean;
612
+ /** Whether the license was successfully loaded and applied */
613
+ isApplied: boolean;
614
+ /** Error message if any */
615
+ error?: string;
616
+ }
617
+ /**
618
+ * Configure the license encryption passphrase
619
+ * Call this before saving or loading licenses if you want to use a custom passphrase
620
+ *
621
+ * @param config - Configuration options
622
+ *
623
+ * @example
624
+ * ```typescript
625
+ * configureLicenseEncryption({ passphrase: 'my-app-secret-key' });
626
+ * ```
627
+ */
628
+ declare function configureLicenseEncryption(config: LicenseConfig): void;
629
+ /**
630
+ * Get the current passphrase (for internal use)
631
+ */
632
+ declare function getCurrentPassphrase(): string;
633
+ /**
634
+ * Reset passphrase to default
635
+ */
636
+ declare function resetPassphrase(): void;
637
+ /**
638
+ * Save and apply a SciChart license key
639
+ * Encrypts the key and stores it in localStorage, then applies it to SciChart
640
+ *
641
+ * @param licenseKey - The SciChart license key to save
642
+ * @returns Promise resolving to true if successful, false otherwise
643
+ *
644
+ * @example
645
+ * ```typescript
646
+ * const success = await setLicense('your-scichart-license-key');
647
+ * if (success) {
648
+ * console.log('License saved and applied!');
649
+ * }
650
+ * ```
651
+ */
652
+ declare function setLicense(licenseKey: string): Promise<boolean>;
653
+ /**
654
+ * Load license from localStorage and apply to SciChart
655
+ *
656
+ * @returns Promise resolving to true if license was found and applied, false otherwise
657
+ *
658
+ * @example
659
+ * ```typescript
660
+ * // Call on app startup
661
+ * const loaded = await loadLicense();
662
+ * if (loaded) {
663
+ * console.log('License loaded from storage');
664
+ * } else {
665
+ * console.log('No license found - charts will show watermark');
666
+ * }
667
+ * ```
668
+ */
669
+ declare function loadLicense(): Promise<boolean>;
670
+ /**
671
+ * Check if a license is stored in localStorage
672
+ *
673
+ * @returns true if a license exists in storage
674
+ */
675
+ declare function hasStoredLicense(): boolean;
676
+ /**
677
+ * Check if a license has been applied to SciChart in this session
678
+ *
679
+ * @returns true if a license has been applied
680
+ */
681
+ declare function isLicenseApplied(): boolean;
682
+ /**
683
+ * Remove stored license from localStorage
684
+ * Note: This doesn't remove the license from SciChart (requires page reload)
685
+ */
686
+ declare function removeLicense(): void;
687
+ /**
688
+ * Apply a license key directly without storing it
689
+ * Useful for temporary/session-only license application
690
+ *
691
+ * @param licenseKey - The SciChart license key
692
+ */
693
+ declare function applyLicenseKey(licenseKey: string): void;
694
+ /**
695
+ * Get current license status
696
+ *
697
+ * @returns License status information
698
+ */
699
+ declare function getLicenseStatus(): LicenseStatus;
700
+ /**
701
+ * Validate a license key format (basic validation)
702
+ * Note: This doesn't validate if the license is actually valid with SciChart
703
+ *
704
+ * @param licenseKey - The license key to validate
705
+ * @returns true if the format appears valid
706
+ */
707
+ declare function validateLicenseFormat(licenseKey: string): boolean;
708
+
545
709
  /**
546
710
  * SciChart UI - A customizable charting library built on SciChart
547
711
  *
548
712
  * @packageDocumentation
549
713
  */
550
714
 
715
+ /**
716
+ * Setup SciChart license from multiple sources (legacy API - kept for backward compatibility)
717
+ * Tries sources in order: env variable → localStorage → direct key
718
+ *
719
+ * @deprecated Use loadLicense() or setLicense() instead
720
+ *
721
+ * @example
722
+ * ```ts
723
+ * import { setupSciChartLicense } from '@rm-graph/core';
724
+ *
725
+ * setupSciChartLicense({
726
+ * fromEnv: true,
727
+ * fromLocalStorage: true,
728
+ * licenseKey: 'fallback-key'
729
+ * });
730
+ * ```
731
+ */
732
+ declare function setupSciChartLicense(options: {
733
+ fromEnv?: boolean;
734
+ fromLocalStorage?: boolean;
735
+ licenseKey?: string;
736
+ }): Promise<boolean>;
737
+ /**
738
+ * Configure SciChart license key directly (legacy API)
739
+ * @deprecated Use setLicense() for encrypted storage or applyLicenseKey() for direct application
740
+ */
741
+ declare function configureSciChartLicense(licenseKey: string): void;
551
742
  declare const VERSION = "0.1.1";
552
743
 
553
744
  /**
@@ -569,4 +760,4 @@ declare function configureSciChart(options: {
569
760
  wasmUrl?: string;
570
761
  }): void;
571
762
 
572
- export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };
763
+ export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, type LicenseConfig, type LicenseStatus, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, applyLicenseKey, calculateDataRange, clamp, clearStoredLicense, configureLicenseEncryption, configureSciChart, configureSciChartLicense, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, decryptLicense, deepMerge, encryptLicense, extractXValues, extractYValues, formatNumber, generateId, getCurrentPassphrase, getLicenseStatus, getLicenseStorageKey, hasEncryptedLicense, hasStoredLicense, hexToRgba, isLicenseApplied, lerp, loadEncryptedLicense, loadLicense, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, removeLicense, resetPassphrase, saveEncryptedLicense, setLicense, setupSciChartLicense, throttle, validateLicenseFormat };
package/dist/index.d.ts CHANGED
@@ -245,14 +245,6 @@ interface Column3DChartConfig extends ChartConfig {
245
245
  maxCameraRadius?: number;
246
246
  /** Minimum camera radius */
247
247
  minCameraRadius?: number;
248
- /** Minimum yaw angle in degrees (horizontal). Default -179. */
249
- minYaw?: number;
250
- /** Maximum yaw angle in degrees (horizontal). Default 179. */
251
- maxYaw?: number;
252
- /** Minimum pitch angle in degrees (vertical). Default 0. */
253
- minPitch?: number;
254
- /** Maximum pitch angle in degrees (vertical). Default 88. */
255
- maxPitch?: number;
256
248
  /** Camera preset positions */
257
249
  cameraPresets?: CameraPreset[];
258
250
  /** Use cylinder point markers instead of columns */
@@ -295,9 +287,8 @@ declare class Column3DChart {
295
287
  */
296
288
  private createSurface;
297
289
  /**
298
- * Setup camera clamping to restrict camera movement.
299
- * Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
300
- * Pitch clamped to [0, 89]. Radius clamped to [495, 805].
290
+ * Setup camera clamping to restrict camera movement
291
+ * Matches the original ThreeDGraph.jsx behavior
301
292
  */
302
293
  private setupCameraClamping;
303
294
  /**
@@ -360,11 +351,6 @@ declare class Column3DChart {
360
351
  * Get the SciChart surface for advanced operations
361
352
  */
362
353
  getSurface(): SciChart3DSurface | null;
363
- /**
364
- * Notify SciChart that the container has resized so the WebGL canvas
365
- * adjusts to the new dimensions. Call after maximize / minimize.
366
- */
367
- resize(): void;
368
354
  /**
369
355
  * Destroy and clean up
370
356
  */
@@ -542,12 +528,217 @@ declare function lerp(start: number, end: number, t: number): number;
542
528
  */
543
529
  declare function hexToRgba(hex: string, alpha?: number): string;
544
530
 
531
+ /**
532
+ * Generic encryption/decryption utilities using Web Crypto API
533
+ * Provides obfuscation for license keys stored in localStorage
534
+ *
535
+ * Note: This provides obfuscation, not true security.
536
+ * The decryption key is in client code, so determined attackers can still decrypt.
537
+ * For production, combine with SciChart's domain-locking for real protection.
538
+ */
539
+ /**
540
+ * Encrypt a license key string
541
+ * @param licenseKey - The plain text license key
542
+ * @param passphrase - The passphrase to derive encryption key from
543
+ * @returns Base64 encoded encrypted data
544
+ */
545
+ declare function encryptLicense(licenseKey: string, passphrase: string): Promise<string>;
546
+ /**
547
+ * Decrypt an encrypted license key
548
+ * @param encryptedData - Base64 encoded encrypted data
549
+ * @param passphrase - The passphrase to derive decryption key from
550
+ * @returns The decrypted license key or null if decryption fails
551
+ */
552
+ declare function decryptLicense(encryptedData: string, passphrase: string): Promise<string | null>;
553
+ /**
554
+ * Save encrypted license to localStorage
555
+ * @param licenseKey - The plain text license key
556
+ * @param passphrase - The passphrase for encryption
557
+ */
558
+ declare function saveEncryptedLicense(licenseKey: string, passphrase: string): Promise<void>;
559
+ /**
560
+ * Load and decrypt license from localStorage
561
+ * @param passphrase - The passphrase for decryption
562
+ * @returns The decrypted license key or null if not found/decryption fails
563
+ */
564
+ declare function loadEncryptedLicense(passphrase: string): Promise<string | null>;
565
+ /**
566
+ * Check if an encrypted license exists in localStorage
567
+ */
568
+ declare function hasEncryptedLicense(): boolean;
569
+ /**
570
+ * Clear stored license from localStorage
571
+ */
572
+ declare function clearStoredLicense(): void;
573
+ /**
574
+ * Get the storage key used for license data
575
+ */
576
+ declare function getLicenseStorageKey(): string;
577
+
578
+ /**
579
+ * License management module for @rm-graph packages
580
+ *
581
+ * Provides encrypted storage and retrieval of SciChart license keys.
582
+ * License keys are encrypted using AES-256-GCM before storing in localStorage.
583
+ *
584
+ * @example
585
+ * ```typescript
586
+ * import { setLicense, loadLicense, configureLicenseEncryption } from '@rm-graph/core';
587
+ *
588
+ * // Optional: Configure custom passphrase
589
+ * configureLicenseEncryption({ passphrase: 'your-app-secret' });
590
+ *
591
+ * // Save a license (encrypts and stores in localStorage)
592
+ * await setLicense('your-scichart-license-key');
593
+ *
594
+ * // Load license on app startup
595
+ * await loadLicense();
596
+ * ```
597
+ */
598
+
599
+ /**
600
+ * Configuration options for license encryption
601
+ */
602
+ interface LicenseConfig {
603
+ /** Custom passphrase for encryption/decryption (optional) */
604
+ passphrase?: string;
605
+ }
606
+ /**
607
+ * License status information
608
+ */
609
+ interface LicenseStatus {
610
+ /** Whether a license is stored */
611
+ hasLicense: boolean;
612
+ /** Whether the license was successfully loaded and applied */
613
+ isApplied: boolean;
614
+ /** Error message if any */
615
+ error?: string;
616
+ }
617
+ /**
618
+ * Configure the license encryption passphrase
619
+ * Call this before saving or loading licenses if you want to use a custom passphrase
620
+ *
621
+ * @param config - Configuration options
622
+ *
623
+ * @example
624
+ * ```typescript
625
+ * configureLicenseEncryption({ passphrase: 'my-app-secret-key' });
626
+ * ```
627
+ */
628
+ declare function configureLicenseEncryption(config: LicenseConfig): void;
629
+ /**
630
+ * Get the current passphrase (for internal use)
631
+ */
632
+ declare function getCurrentPassphrase(): string;
633
+ /**
634
+ * Reset passphrase to default
635
+ */
636
+ declare function resetPassphrase(): void;
637
+ /**
638
+ * Save and apply a SciChart license key
639
+ * Encrypts the key and stores it in localStorage, then applies it to SciChart
640
+ *
641
+ * @param licenseKey - The SciChart license key to save
642
+ * @returns Promise resolving to true if successful, false otherwise
643
+ *
644
+ * @example
645
+ * ```typescript
646
+ * const success = await setLicense('your-scichart-license-key');
647
+ * if (success) {
648
+ * console.log('License saved and applied!');
649
+ * }
650
+ * ```
651
+ */
652
+ declare function setLicense(licenseKey: string): Promise<boolean>;
653
+ /**
654
+ * Load license from localStorage and apply to SciChart
655
+ *
656
+ * @returns Promise resolving to true if license was found and applied, false otherwise
657
+ *
658
+ * @example
659
+ * ```typescript
660
+ * // Call on app startup
661
+ * const loaded = await loadLicense();
662
+ * if (loaded) {
663
+ * console.log('License loaded from storage');
664
+ * } else {
665
+ * console.log('No license found - charts will show watermark');
666
+ * }
667
+ * ```
668
+ */
669
+ declare function loadLicense(): Promise<boolean>;
670
+ /**
671
+ * Check if a license is stored in localStorage
672
+ *
673
+ * @returns true if a license exists in storage
674
+ */
675
+ declare function hasStoredLicense(): boolean;
676
+ /**
677
+ * Check if a license has been applied to SciChart in this session
678
+ *
679
+ * @returns true if a license has been applied
680
+ */
681
+ declare function isLicenseApplied(): boolean;
682
+ /**
683
+ * Remove stored license from localStorage
684
+ * Note: This doesn't remove the license from SciChart (requires page reload)
685
+ */
686
+ declare function removeLicense(): void;
687
+ /**
688
+ * Apply a license key directly without storing it
689
+ * Useful for temporary/session-only license application
690
+ *
691
+ * @param licenseKey - The SciChart license key
692
+ */
693
+ declare function applyLicenseKey(licenseKey: string): void;
694
+ /**
695
+ * Get current license status
696
+ *
697
+ * @returns License status information
698
+ */
699
+ declare function getLicenseStatus(): LicenseStatus;
700
+ /**
701
+ * Validate a license key format (basic validation)
702
+ * Note: This doesn't validate if the license is actually valid with SciChart
703
+ *
704
+ * @param licenseKey - The license key to validate
705
+ * @returns true if the format appears valid
706
+ */
707
+ declare function validateLicenseFormat(licenseKey: string): boolean;
708
+
545
709
  /**
546
710
  * SciChart UI - A customizable charting library built on SciChart
547
711
  *
548
712
  * @packageDocumentation
549
713
  */
550
714
 
715
+ /**
716
+ * Setup SciChart license from multiple sources (legacy API - kept for backward compatibility)
717
+ * Tries sources in order: env variable → localStorage → direct key
718
+ *
719
+ * @deprecated Use loadLicense() or setLicense() instead
720
+ *
721
+ * @example
722
+ * ```ts
723
+ * import { setupSciChartLicense } from '@rm-graph/core';
724
+ *
725
+ * setupSciChartLicense({
726
+ * fromEnv: true,
727
+ * fromLocalStorage: true,
728
+ * licenseKey: 'fallback-key'
729
+ * });
730
+ * ```
731
+ */
732
+ declare function setupSciChartLicense(options: {
733
+ fromEnv?: boolean;
734
+ fromLocalStorage?: boolean;
735
+ licenseKey?: string;
736
+ }): Promise<boolean>;
737
+ /**
738
+ * Configure SciChart license key directly (legacy API)
739
+ * @deprecated Use setLicense() for encrypted storage or applyLicenseKey() for direct application
740
+ */
741
+ declare function configureSciChartLicense(licenseKey: string): void;
551
742
  declare const VERSION = "0.1.1";
552
743
 
553
744
  /**
@@ -569,4 +760,4 @@ declare function configureSciChart(options: {
569
760
  wasmUrl?: string;
570
761
  }): void;
571
762
 
572
- export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };
763
+ export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, type LicenseConfig, type LicenseStatus, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, applyLicenseKey, calculateDataRange, clamp, clearStoredLicense, configureLicenseEncryption, configureSciChart, configureSciChartLicense, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, decryptLicense, deepMerge, encryptLicense, extractXValues, extractYValues, formatNumber, generateId, getCurrentPassphrase, getLicenseStatus, getLicenseStorageKey, hasEncryptedLicense, hasStoredLicense, hexToRgba, isLicenseApplied, lerp, loadEncryptedLicense, loadLicense, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, removeLicense, resetPassphrase, saveEncryptedLicense, setLicense, setupSciChartLicense, throttle, validateLicenseFormat };