apexsankey 1.2.1 β†’ 1.2.5

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.
@@ -0,0 +1,20 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-node@v4
14
+ with:
15
+ node-version: '20'
16
+ registry-url: 'https://registry.npmjs.org' # Or your custom registry
17
+ - run: npm install
18
+ - run: npm publish
19
+ env:
20
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [1.2.4](https://github.com/apexcharts/apexsankey/compare/v1.2.3...v1.2.4) (2025-07-27)
6
+
7
+ ### [1.2.3](https://github.com/apexcharts/apexsankey/compare/v1.2.2...v1.2.3) (2025-07-27)
8
+
9
+ ### 1.2.2 (2025-07-27)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add auto versioning and release ([2cdd7f7](https://github.com/apexcharts/apexsankey/commit/2cdd7f7650e3508226106538c06f2752d90eef7a))
package/LICENSE ADDED
@@ -0,0 +1,80 @@
1
+ ## πŸ“„ License Options for ApexCharts
2
+
3
+ ApexCharts is offered under a **dual-license model** to support individuals, startups, and commercial products of all sizes.
4
+
5
+ ---
6
+
7
+ ### πŸ”“ Community License (Free)
8
+
9
+ For individuals, non-profits, educators, and small businesses with **less than $2 million USD in annual revenue**.
10
+
11
+ βœ… What’s allowed:
12
+
13
+ - Personal, educational, or non-profit use
14
+ - Commercial use by small orgs (< $2M annual revenue)
15
+ - Modifications and redistribution (with attribution)
16
+
17
+ 🚫 Not allowed:
18
+
19
+ - Use by companies or entities over $2M/year revenue
20
+ - Use in competing charting products
21
+ - Sublicensing under different terms
22
+
23
+ ➑ By using ApexCharts under this license, you confirm that **you qualify as a Small Organization**.
24
+
25
+ ---
26
+
27
+ ### πŸ’Ό Commercial License (Paid)
28
+
29
+ Required if **you or your affiliated organization earns $2 million USD or more per year**.
30
+
31
+ βœ… What's included:
32
+
33
+ - Use in internal tools and commercial applications
34
+ - Modifications and app-level distribution
35
+ - 12-month subscription with updates & support
36
+
37
+ 🚫 Not allowed:
38
+
39
+ - Redistribution in toolkits, SDKs, or platforms
40
+ - Use by unlicensed developers
41
+ - Competing charting products
42
+
43
+ ---
44
+
45
+ ### πŸ”„ OEM / Redistribution License (Paid)
46
+
47
+ Required if you are **embedding ApexCharts into a product or platform used by other people**, such as:
48
+
49
+ - No-code dashboards
50
+ - Developer platforms
51
+ - Embedded BI tools
52
+ - White-labeled apps or SDKs
53
+
54
+ βœ… What's included:
55
+
56
+ - Redistribution rights for 1 application or product
57
+ - 12-month subscription with updates & support
58
+
59
+ βœ… OEM **not required** if your app simply renders static charts and users **cannot** configure or interact with them.
60
+
61
+ ---
62
+
63
+ ### ⚠️ License Acceptance
64
+
65
+ By installing ApexCharts (e.g., via `npm install apexcharts`), you are agreeing to the applicable license based on your usage:
66
+
67
+ - Community License (if under $2M revenue)
68
+ - Commercial License (if over $2M revenue)
69
+ - OEM License (if redistributing to third-party users)
70
+
71
+ ---
72
+
73
+ ### πŸ›  Need a License or Have Questions?
74
+
75
+ πŸ“§ Contact us at [sales@apexcharts.com](mailto:sales@apexcharts.com)
76
+ πŸ“š Read full license agreements here: [https://apexcharts.com/license](https://apexcharts.com/license)
77
+
78
+ ---
79
+
80
+ Thank you for supporting ApexCharts! Your licensing helps keep it free and open for individuals and small teams.
@@ -395,6 +395,8 @@ const generateStyles = (styleObject = {}) => {
395
395
  }
396
396
  return styles.join(" ");
397
397
  };
398
+ function noop() {
399
+ }
398
400
  class Export {
399
401
  constructor(canvas, prefix = "apex") {
400
402
  this.canvas = canvas;
@@ -423,6 +425,131 @@ class Export {
423
425
  this.triggerDownload(this.svgUrl(), `${this.prefix}-${(/* @__PURE__ */ new Date()).getTime()}.svg`);
424
426
  }
425
427
  }
428
+ const _LicenseManager = class _LicenseManager {
429
+ /**
430
+ * Decode license data from encoded string
431
+ * This is a simple base64 + JSON approach - you can make it more sophisticated
432
+ */
433
+ static decodeLicenseData(encodedData) {
434
+ try {
435
+ const decodedString = window.atob(encodedData);
436
+ const data = JSON.parse(decodedString);
437
+ if (!data.issueDate || !data.expiryDate || !data.plan) {
438
+ return null;
439
+ }
440
+ return {
441
+ expiryDate: data.expiryDate,
442
+ issueDate: data.issueDate,
443
+ plan: data.plan,
444
+ valid: true
445
+ };
446
+ } catch {
447
+ return null;
448
+ }
449
+ }
450
+ /**
451
+ * Generate a license key (for your internal use)
452
+ * You would use this on your server/admin panel to generate keys for customers
453
+ */
454
+ static generateLicenseKey(issueDate, expiryDate, plan = "standard") {
455
+ const licenseData = {
456
+ expiryDate,
457
+ issueDate,
458
+ plan
459
+ };
460
+ const encodedData = window.btoa(JSON.stringify(licenseData));
461
+ return `APEX-${encodedData}`;
462
+ }
463
+ /**
464
+ * Get current license validation result
465
+ */
466
+ static getLicenseStatus() {
467
+ if (!this.licenseKey) {
468
+ return { expired: false, valid: false };
469
+ }
470
+ if (!this.validationResult) {
471
+ this.validationResult = this.validateLicense(this.licenseKey);
472
+ }
473
+ return this.validationResult;
474
+ }
475
+ /**
476
+ * Check if current license is valid
477
+ */
478
+ static isLicenseValid() {
479
+ if (!this.licenseKey) {
480
+ return false;
481
+ }
482
+ if (!this.validationResult) {
483
+ this.validationResult = this.validateLicense(this.licenseKey);
484
+ }
485
+ return this.validationResult.valid;
486
+ }
487
+ /**
488
+ * Set the global license key
489
+ */
490
+ static setLicense(key) {
491
+ this.licenseKey = key;
492
+ this.validationResult = this.validateLicense(key);
493
+ if (!this.validationResult.valid) {
494
+ console.error(`[Apex] ${this.validationResult.message}`);
495
+ }
496
+ }
497
+ /**
498
+ * Validate license key format and content
499
+ */
500
+ static validateLicense(key) {
501
+ try {
502
+ if (!key.startsWith("APEX-")) {
503
+ return {
504
+ expired: false,
505
+ message: 'Invalid license key format. License key must start with "APEX-".',
506
+ valid: false
507
+ };
508
+ }
509
+ const parts = key.split("-");
510
+ if (parts.length !== 2) {
511
+ return {
512
+ expired: false,
513
+ message: "Invalid license key format. Expected format: APEX-{encoded-data}.",
514
+ valid: false
515
+ };
516
+ }
517
+ const encodedData = parts[1];
518
+ const licenseData = this.decodeLicenseData(encodedData);
519
+ if (!licenseData) {
520
+ return {
521
+ expired: false,
522
+ message: "Invalid license key. Unable to decode license data.",
523
+ valid: false
524
+ };
525
+ }
526
+ const now = /* @__PURE__ */ new Date();
527
+ const expiryDate = new Date(licenseData.expiryDate);
528
+ if (expiryDate < now) {
529
+ return {
530
+ data: licenseData,
531
+ expired: true,
532
+ message: `License expired on ${licenseData.expiryDate}. Please renew your license.`,
533
+ valid: false
534
+ };
535
+ }
536
+ return {
537
+ data: licenseData,
538
+ expired: false,
539
+ valid: true
540
+ };
541
+ } catch {
542
+ return {
543
+ expired: false,
544
+ message: "Invalid license key format or corrupted data.",
545
+ valid: false
546
+ };
547
+ }
548
+ }
549
+ };
550
+ _LicenseManager.licenseKey = null;
551
+ _LicenseManager.validationResult = null;
552
+ let LicenseManager = _LicenseManager;
426
553
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
427
554
  function getDefaultExportFromCjs(x) {
428
555
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -5962,8 +6089,6 @@ function drawPath(pathString, {
5962
6089
  path.fill(edgeColor).opacity(opacity);
5963
6090
  return path;
5964
6091
  }
5965
- function noop() {
5966
- }
5967
6092
  const ExportIcon = "data:image/svg+xml,%3csvg%20fill='%23000000'%20width='20px'%20height='20px'%20viewBox='0%200%2024%2024'%20id='export-2'%20xmlns='http://www.w3.org/2000/svg'%20class='icon%20line'%3e%3cpolyline%20id='primary'%20points='15%203%2021%203%2021%209'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/polyline%3e%3cpath%20id='primary-2'%20data-name='primary'%20d='M21,13v7a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V4A1,1,0,0,1,4,3h7'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/path%3e%3cline%20id='primary-3'%20data-name='primary'%20x1='11'%20y1='13'%20x2='21'%20y2='3'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/line%3e%3c/svg%3e";
5968
6093
  const FitScreenIcon = "data:image/svg+xml,%3csvg%20width='20px'%20height='20px'%20viewBox='0%200%2032%2032'%20id='icon'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='8%202%202%202%202%208%204%208%204%204%208%204%208%202'/%3e%3cpolygon%20points='24%202%2030%202%2030%208%2028%208%2028%204%2024%204%2024%202'/%3e%3cpolygon%20points='8%2030%202%2030%202%2024%204%2024%204%2028%208%2028%208%2030'/%3e%3cpolygon%20points='24%2030%2030%2030%2030%2024%2028%2024%2028%2028%2024%2028%2024%2030'/%3e%3cpath%20d='M24,24H8a2.0023,2.0023,0,0,1-2-2V10A2.0023,2.0023,0,0,1,8,8H24a2.0023,2.0023,0,0,1,2,2V22A2.0023,2.0023,0,0,1,24,24ZM8,10V22H24V10Z'/%3e%3crect%20fill='none'%20width='32'%20height='32'/%3e%3c/svg%3e";
5969
6094
  const ZoomInIcon = "data:image/svg+xml,%3csvg%20width='20px'%20height='20px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sketch='http://www.bohemiancoding.com/sketch/ns'%3e%3cg%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(-308.000000,%20-1139.000000)'%20fill='%23000000'%3e%3cpath%20d='M321.46,1163.45%20C315.17,1163.45%20310.07,1158.44%20310.07,1152.25%20C310.07,1146.06%20315.17,1141.04%20321.46,1141.04%20C327.75,1141.04%20332.85,1146.06%20332.85,1152.25%20C332.85,1158.44%20327.75,1163.45%20321.46,1163.45%20L321.46,1163.45%20Z%20M339.688,1169.25%20L331.429,1161.12%20C333.592,1158.77%20334.92,1155.67%20334.92,1152.25%20C334.92,1144.93%20328.894,1139%20321.46,1139%20C314.026,1139%20308,1144.93%20308,1152.25%20C308,1159.56%20314.026,1165.49%20321.46,1165.49%20C324.672,1165.49%20327.618,1164.38%20329.932,1162.53%20L338.225,1170.69%20C338.629,1171.09%20339.284,1171.09%20339.688,1170.69%20C340.093,1170.3%20340.093,1169.65%20339.688,1169.25%20L339.688,1169.25%20Z%20M326.519,1151.41%20L322.522,1151.41%20L322.522,1147.41%20C322.522,1146.85%20322.075,1146.41%20321.523,1146.41%20C320.972,1146.41%20320.524,1146.85%20320.524,1147.41%20L320.524,1151.41%20L316.529,1151.41%20C315.978,1151.41%20315.53,1151.59%20315.53,1152.14%20C315.53,1152.7%20315.978,1153.41%20316.529,1153.41%20L320.524,1153.41%20L320.524,1157.41%20C320.524,1157.97%20320.972,1158.41%20321.523,1158.41%20C322.075,1158.41%20322.522,1157.97%20322.522,1157.41%20L322.522,1153.41%20L326.519,1153.41%20C327.07,1153.41%20327.518,1152.96%20327.518,1152.41%20C327.518,1151.86%20327.07,1151.41%20326.519,1151.41%20L326.519,1151.41%20Z'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
@@ -6069,6 +6194,52 @@ class Toolbar {
6069
6194
  (_a = this.element) == null ? void 0 : _a.append(container);
6070
6195
  }
6071
6196
  }
6197
+ const _Watermark = class _Watermark {
6198
+ /**
6199
+ * Add watermark to a container element
6200
+ */
6201
+ static add(container) {
6202
+ this.remove(container);
6203
+ const watermark = document.createElement("div");
6204
+ watermark.className = this.WATERMARK_CLASS;
6205
+ watermark.textContent = this.WATERMARK_TEXT;
6206
+ Object.assign(watermark.style, {
6207
+ bottom: "5px",
6208
+ color: "#666",
6209
+ fontFamily: "Arial, sans-serif",
6210
+ fontSize: "14px",
6211
+ msUserSelect: "none",
6212
+ pointerEvents: "none",
6213
+ position: "absolute",
6214
+ right: "5px",
6215
+ userSelect: "none",
6216
+ webkitUserSelect: "none",
6217
+ zIndex: "1000"
6218
+ });
6219
+ if (getComputedStyle(container).position === "static") {
6220
+ container.style.position = "relative";
6221
+ }
6222
+ container.appendChild(watermark);
6223
+ }
6224
+ /**
6225
+ * Check if watermark exists in container
6226
+ */
6227
+ static exists(container) {
6228
+ return !!container.querySelector(`.${this.WATERMARK_CLASS}`);
6229
+ }
6230
+ /**
6231
+ * Remove watermark from a container element
6232
+ */
6233
+ static remove(container) {
6234
+ const existingWatermark = container.querySelector(`.${this.WATERMARK_CLASS}`);
6235
+ if (existingWatermark) {
6236
+ existingWatermark.remove();
6237
+ }
6238
+ }
6239
+ };
6240
+ _Watermark.WATERMARK_CLASS = "apexgantt-watermark";
6241
+ _Watermark.WATERMARK_TEXT = "Powered by apexcharts.com";
6242
+ let Watermark = _Watermark;
6072
6243
  function linkDirection(G2, link) {
6073
6244
  if (link.w === null)
6074
6245
  return 0;
@@ -12516,6 +12687,7 @@ class Paper {
12516
12687
  constructor(element, options) {
12517
12688
  this.element = element;
12518
12689
  this.options = options;
12690
+ element.innerHTML = "";
12519
12691
  this.canvas = SVG().addTo(element).size("100%", "100%").viewbox(
12520
12692
  `-${this.spacing} -${this.spacing + this.getYShift()} ${this.width + this.spacing * 2} ${this.height + this.spacing + this.getYShift()}`
12521
12693
  ).attr({ style: this.options.canvasStyle });
@@ -12751,6 +12923,25 @@ class ApexSankey {
12751
12923
  this.element.style.width = `${calculatedWidth}${isPercentValues ? "%" : "px"}`;
12752
12924
  this.element.style.height = `${calculatedHeight}${isPercentValues ? "%" : "px"}`;
12753
12925
  this.element.style.position = "relative";
12926
+ this.handleWatermark();
12927
+ }
12928
+ // Static method to set global license
12929
+ static setLicense(key) {
12930
+ LicenseManager.setLicense(key);
12931
+ }
12932
+ /**
12933
+ * Handle watermark display based on license validation
12934
+ */
12935
+ handleWatermark() {
12936
+ const container = this.element;
12937
+ if (!container) {
12938
+ return;
12939
+ }
12940
+ if (LicenseManager.isLicenseValid()) {
12941
+ Watermark.remove(container);
12942
+ } else {
12943
+ Watermark.add(container);
12944
+ }
12754
12945
  }
12755
12946
  render(data) {
12756
12947
  if (!this.element) {
@@ -12768,6 +12959,10 @@ class ApexSankey {
12768
12959
  return this.graph;
12769
12960
  }
12770
12961
  }
12962
+ if (typeof window !== "undefined") {
12963
+ window.ApexSankey = ApexSankey;
12964
+ }
12771
12965
  export {
12966
+ ApexSankey,
12772
12967
  ApexSankey as default
12773
12968
  };