@particle-academy/fancy-slides 0.6.0 → 0.6.1
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.cjs +21 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +28 -7
package/dist/index.d.cts
CHANGED
|
@@ -181,6 +181,16 @@ interface SlideThumbnailProps {
|
|
|
181
181
|
* presenter view, and anywhere else a deck wants to show its slides as
|
|
182
182
|
* thumbnails. Re-uses the shared <Slide> so the layout matches the viewer
|
|
183
183
|
* exactly — no second rendering path.
|
|
184
|
+
*
|
|
185
|
+
* The slide is rendered at its full DESIGN width and the whole thing is
|
|
186
|
+
* CSS-`scale()`d down to the thumbnail size (the same approach fancy-artboard
|
|
187
|
+
* uses for its piece previews). Scaling the rendered output — rather than
|
|
188
|
+
* rendering the slide *at* the thumbnail width — is what makes heavy embedded
|
|
189
|
+
* surfaces (ECharts charts, the fancy-code editor) shrink proportionally:
|
|
190
|
+
* those render at fixed internal font sizes that ignore `slideWidthPx`, so a
|
|
191
|
+
* directly-undersized render leaves them oversized in the thumb. A uniform
|
|
192
|
+
* transform shrinks everything identically, so the thumb is a faithful
|
|
193
|
+
* miniature of the live slide.
|
|
184
194
|
*/
|
|
185
195
|
declare function SlideThumbnail({ slide, theme, width, active, onClick, onContextMenu, renderElement, className, style, }: SlideThumbnailProps): react_jsx_runtime.JSX.Element;
|
|
186
196
|
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,16 @@ interface SlideThumbnailProps {
|
|
|
181
181
|
* presenter view, and anywhere else a deck wants to show its slides as
|
|
182
182
|
* thumbnails. Re-uses the shared <Slide> so the layout matches the viewer
|
|
183
183
|
* exactly — no second rendering path.
|
|
184
|
+
*
|
|
185
|
+
* The slide is rendered at its full DESIGN width and the whole thing is
|
|
186
|
+
* CSS-`scale()`d down to the thumbnail size (the same approach fancy-artboard
|
|
187
|
+
* uses for its piece previews). Scaling the rendered output — rather than
|
|
188
|
+
* rendering the slide *at* the thumbnail width — is what makes heavy embedded
|
|
189
|
+
* surfaces (ECharts charts, the fancy-code editor) shrink proportionally:
|
|
190
|
+
* those render at fixed internal font sizes that ignore `slideWidthPx`, so a
|
|
191
|
+
* directly-undersized render leaves them oversized in the thumb. A uniform
|
|
192
|
+
* transform shrinks everything identically, so the thumb is a faithful
|
|
193
|
+
* miniature of the live slide.
|
|
184
194
|
*/
|
|
185
195
|
declare function SlideThumbnail({ slide, theme, width, active, onClick, onContextMenu, renderElement, className, style, }: SlideThumbnailProps): react_jsx_runtime.JSX.Element;
|
|
186
196
|
|
package/dist/index.js
CHANGED
|
@@ -1407,6 +1407,11 @@ function SlideThumbnail({
|
|
|
1407
1407
|
className,
|
|
1408
1408
|
style
|
|
1409
1409
|
}) {
|
|
1410
|
+
const resolved = resolveTheme(theme);
|
|
1411
|
+
const ratio = resolved.aspectRatio ?? 16 / 9;
|
|
1412
|
+
const designWidth = resolved.slideWidth ?? 1280;
|
|
1413
|
+
const scale = width / designWidth;
|
|
1414
|
+
const height = width / ratio;
|
|
1410
1415
|
return /* @__PURE__ */ jsx(
|
|
1411
1416
|
"div",
|
|
1412
1417
|
{
|
|
@@ -1419,12 +1424,27 @@ function SlideThumbnail({
|
|
|
1419
1424
|
boxShadow: active ? "0 0 0 3px rgba(139, 92, 246, 0.2)" : "0 1px 2px rgba(0,0,0,0.05)",
|
|
1420
1425
|
background: "#ffffff",
|
|
1421
1426
|
width,
|
|
1427
|
+
height,
|
|
1422
1428
|
...style
|
|
1423
1429
|
},
|
|
1424
1430
|
onClick,
|
|
1425
1431
|
onContextMenu,
|
|
1426
1432
|
"data-fancy-slides-thumbnail": slide.id,
|
|
1427
|
-
children: /* @__PURE__ */ jsx(
|
|
1433
|
+
children: /* @__PURE__ */ jsx(
|
|
1434
|
+
"div",
|
|
1435
|
+
{
|
|
1436
|
+
style: {
|
|
1437
|
+
width: designWidth,
|
|
1438
|
+
height: designWidth / ratio,
|
|
1439
|
+
transform: `scale(${scale})`,
|
|
1440
|
+
transformOrigin: "top left",
|
|
1441
|
+
// The thumb owns interaction — charts/code/iframes inside the
|
|
1442
|
+
// scaled slide shouldn't capture clicks.
|
|
1443
|
+
pointerEvents: "none"
|
|
1444
|
+
},
|
|
1445
|
+
children: /* @__PURE__ */ jsx(Slide, { slide, theme, width: designWidth, renderElement })
|
|
1446
|
+
}
|
|
1447
|
+
)
|
|
1428
1448
|
}
|
|
1429
1449
|
);
|
|
1430
1450
|
}
|