@lark-apaas/coding-registry-buildless 0.1.8-alpha.20260720122519 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-registry-buildless",
3
- "version": "0.1.8-alpha.20260720122519",
3
+ "version": "0.1.8",
4
4
  "description": "Miaoda registry (buildless runtime) — shadcn-style copy-in SDKs (globals + CDN-pinned, browser Babel) for buildless static HTML stacks",
5
5
  "type": "module",
6
6
  "files": [
@@ -140,6 +140,7 @@
140
140
  const MOB_RADIUS = 8; // card corner radius
141
141
  const MOB_BADGE_IDLE_MS = 2000; // scroll idle before the page badge fades
142
142
  const MOB_UI_HIDE_MS = 3000; // presenting controls auto-hide
143
+ const CANVAS_RECAP_MS = 1200; // re-snapshot canvas thumbs once chart entrance animations settle
143
144
 
144
145
  const pad2 = (n) => String(n).padStart(2, '0');
145
146
 
@@ -1038,6 +1039,7 @@
1038
1039
  if (this._scaleRaf) cancelAnimationFrame(this._scaleRaf);
1039
1040
  if (this._liveObserver) this._liveObserver.disconnect();
1040
1041
  if (this._railObserver) this._railObserver.disconnect();
1042
+ (this._thumbs || []).forEach((t) => clearTimeout(t._canvasRecapTimer));
1041
1043
  if (this._onTweakChange) window.removeEventListener('tweakchange', this._onTweakChange);
1042
1044
  }
1043
1045
 
@@ -2076,6 +2078,7 @@
2076
2078
  // Orphans — slides removed since last render.
2077
2079
  bySlide.forEach((t) => {
2078
2080
  if (this._railObserver) this._railObserver.unobserve(t.frame);
2081
+ clearTimeout(t._canvasRecapTimer);
2079
2082
  t.thumb.remove();
2080
2083
  });
2081
2084
  // Put thumbs into document order to match _slides. insertBefore on
@@ -2289,6 +2292,7 @@
2289
2292
  // drawings appear in the thumbnail instead of a blank rectangle.
2290
2293
  const origCanvases = entry.slide.querySelectorAll('canvas');
2291
2294
  const cloneCanvases = clone.querySelectorAll('canvas');
2295
+ const canvasImgs = []; // {orig, img} pairs kept for the delayed re-snapshot below
2292
2296
  cloneCanvases.forEach((el, ci) => {
2293
2297
  const orig = origCanvases[ci];
2294
2298
  if (!orig || !orig.width || !orig.height) return;
@@ -2300,6 +2304,7 @@
2300
2304
  ';width:' + orig.offsetWidth + 'px;height:' + orig.offsetHeight + 'px;';
2301
2305
  img.className = el.className;
2302
2306
  el.replaceWith(img);
2307
+ canvasImgs.push({ orig, img });
2303
2308
  } catch (e) {}
2304
2309
  });
2305
2310
  // Images: defer decode and let the browser pick the smallest
@@ -2364,6 +2369,23 @@
2364
2369
  // Once materialized the IO callback is a no-op early-return —
2365
2370
  // unobserve so scroll doesn't keep firing it.
2366
2371
  if (this._railObserver) this._railObserver.unobserve(entry.frame);
2372
+ // Chart libraries (ECharts/Chart.js) animate their entrance over ~1s and
2373
+ // draw straight to the canvas bitmap — no DOM mutation, so _liveObserver
2374
+ // never sees the finished frame and the toDataURL snapshot above may have
2375
+ // caught a blank or mid-animation canvas. Re-snapshot once after the
2376
+ // animation settles and overwrite each <img>. Guarded so a thumb that was
2377
+ // refreshed (host swapped) or removed (img detached) since is left alone.
2378
+ if (canvasImgs.length) {
2379
+ clearTimeout(entry._canvasRecapTimer);
2380
+ entry._canvasRecapTimer = setTimeout(() => {
2381
+ entry._canvasRecapTimer = null;
2382
+ if (entry.host !== host) return;
2383
+ canvasImgs.forEach(({ orig, img }) => {
2384
+ if (!img.isConnected || !orig.width || !orig.height) return;
2385
+ try { img.src = orig.toDataURL(); } catch (e) {}
2386
+ });
2387
+ }, CANVAS_RECAP_MS);
2388
+ }
2367
2389
  }
2368
2390
 
2369
2391
  /** Re-clone a single thumb (live-update path). No-op if the thumb
@@ -2372,6 +2394,7 @@
2372
2394
  _refreshThumb(slide) {
2373
2395
  const entry = (this._thumbs || []).find((t) => t.slide === slide);
2374
2396
  if (!entry || !entry.host) return;
2397
+ clearTimeout(entry._canvasRecapTimer);
2375
2398
  entry.host.remove();
2376
2399
  entry.host = entry.clone = null;
2377
2400
  this._materialize(entry);