@datalabz_/dashboard-kit 4.0.1 → 4.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/v4.js +24 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalabz_/dashboard-kit",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "DashboardKit runtime + styles, served from jsDelivr",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
package/v4.js CHANGED
@@ -1,4 +1,4 @@
1
- /* DashboardKit v4.js */
1
+ /* DashboardKit v4.js — released from dashboard-kit/ by bitbucket-pipelines.yml on kit-v* tags */
2
2
  (function (global) {
3
3
  'use strict';
4
4
 
@@ -20,7 +20,7 @@
20
20
  let _activeTabId = '';
21
21
  let _sections = []; // { id, label, load, loaded, errors }
22
22
  let _title = '';
23
- let _gitVer = '4862dc5'; // replaced at deploy: sed -i "s/4862dc5/$(git rev-parse --short HEAD)/g" v4.js
23
+ let _gitVer = '857821c'; // replaced at deploy: sed -i "s/857821c/$(git rev-parse --short HEAD)/g" v4.js
24
24
  let _calls = []; // System Info call log
25
25
  let _sectionErrors = {}; // sectionId → error count
26
26
  let _generation = 0;
@@ -784,6 +784,23 @@
784
784
 
785
785
  const clone = document.documentElement.cloneNode(true);
786
786
 
787
+ // A canvas clones blank — its pixels aren't part of the DOM — so each chart
788
+ // goes into the snapshot as an image of what it currently shows. The size
789
+ // comes from the inline style Chart.js sets, not clientWidth: a chart on an
790
+ // inactive tab is display:none and measures 0.
791
+ const liveCanvases = document.querySelectorAll('canvas');
792
+ clone.querySelectorAll('canvas').forEach(function (cv, i) {
793
+ const src = liveCanvases[i];
794
+ if (!src) return;
795
+ const img = document.createElement('img');
796
+ try { img.src = src.toDataURL('image/png'); } catch { return; }
797
+ img.style.display = 'block';
798
+ img.style.maxWidth = '100%';
799
+ img.style.width = src.style.width || '100%';
800
+ if (src.style.height) img.style.height = src.style.height;
801
+ cv.replaceWith(img);
802
+ });
803
+
787
804
  // Strip auth token from System Info pre elements
788
805
  if (_authToken) {
789
806
  clone.querySelectorAll('pre').forEach(function (pre) {
@@ -985,6 +1002,11 @@
985
1002
  if (opts.gitVersion) _gitVer = opts.gitVersion;
986
1003
  _initTooltip();
987
1004
 
1005
+ // A snapshot copies each canvas as it is at that instant, so a chart still
1006
+ // animating goes into the file half-drawn. A chart that sets its own
1007
+ // `animation` overrides this default.
1008
+ if (global.Chart) global.Chart.defaults.animation = false;
1009
+
988
1010
  // Build internal section list, append System Info last
989
1011
  _sections = (opts.sections || []).map(function (s) {
990
1012
  return { id: s.id, label: s.label, tooltip: s.tooltip, load: s.load, loaded: false, errors: 0 };