pxengine 0.1.134 → 0.1.135
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 +87 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +88 -21
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -15787,7 +15787,7 @@ var NextStepCard = ({
|
|
|
15787
15787
|
};
|
|
15788
15788
|
|
|
15789
15789
|
// src/molecules/generic/PresentationJobCard/PresentationJobCard.tsx
|
|
15790
|
-
import { useCallback as useCallback4, useEffect as useEffect7, useRef as useRef9, useState as useState10 } from "react";
|
|
15790
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef9, useState as useState10 } from "react";
|
|
15791
15791
|
|
|
15792
15792
|
// src/lib/shared-poll.ts
|
|
15793
15793
|
import { useEffect as useEffect6, useRef as useRef8 } from "react";
|
|
@@ -16044,6 +16044,40 @@ function formatTemplateLabel(templateId) {
|
|
|
16044
16044
|
if (!templateId) return null;
|
|
16045
16045
|
return templateId.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
16046
16046
|
}
|
|
16047
|
+
var DECK_CANVAS = { w: 1280, h: 720 };
|
|
16048
|
+
function useDeckFitScale(canvasW = DECK_CANVAS.w, canvasH = DECK_CANVAS.h) {
|
|
16049
|
+
const containerRef = useRef9(null);
|
|
16050
|
+
const [scale, setScale] = useState10(1);
|
|
16051
|
+
useLayoutEffect2(() => {
|
|
16052
|
+
const el = containerRef.current;
|
|
16053
|
+
if (!el) return;
|
|
16054
|
+
const update = () => {
|
|
16055
|
+
const w = el.clientWidth;
|
|
16056
|
+
const h = el.clientHeight;
|
|
16057
|
+
if (w <= 0 || h <= 0) return;
|
|
16058
|
+
setScale(Math.min(w / canvasW, h / canvasH));
|
|
16059
|
+
};
|
|
16060
|
+
update();
|
|
16061
|
+
const ro = new ResizeObserver(update);
|
|
16062
|
+
ro.observe(el);
|
|
16063
|
+
return () => ro.disconnect();
|
|
16064
|
+
}, [canvasW, canvasH]);
|
|
16065
|
+
return { containerRef, scale, canvasW, canvasH };
|
|
16066
|
+
}
|
|
16067
|
+
function hideDeckChrome(iframe) {
|
|
16068
|
+
try {
|
|
16069
|
+
const doc = iframe?.contentDocument;
|
|
16070
|
+
if (!doc) return;
|
|
16071
|
+
let style = doc.getElementById("pxe-embed-chrome");
|
|
16072
|
+
if (!style) {
|
|
16073
|
+
style = doc.createElement("style");
|
|
16074
|
+
style.id = "pxe-embed-chrome";
|
|
16075
|
+
(doc.head || doc.documentElement).appendChild(style);
|
|
16076
|
+
}
|
|
16077
|
+
style.textContent = ".nav,.progress-bar,.dots{display:none!important}";
|
|
16078
|
+
} catch {
|
|
16079
|
+
}
|
|
16080
|
+
}
|
|
16047
16081
|
function deriveJobStatusUrl(newJobId, pollUrl, regenerateUrl) {
|
|
16048
16082
|
const base = pollUrl?.replace(/\/api\/jobs\/[^/]+\/status.*$/, "") ?? regenerateUrl?.replace(/\/api\/presentations\/[^/]+\/regenerate.*$/, "") ?? "";
|
|
16049
16083
|
return `${base}/api/jobs/${newJobId}/status`;
|
|
@@ -16148,6 +16182,7 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
|
|
|
16148
16182
|
const [currentSlide, setCurrentSlide] = useState10(initialSlide);
|
|
16149
16183
|
const [iframeReady, setIframeReady] = useState10(false);
|
|
16150
16184
|
const iframeRef = useRef9(null);
|
|
16185
|
+
const { containerRef, scale, canvasW, canvasH } = useDeckFitScale();
|
|
16151
16186
|
useEffect7(() => {
|
|
16152
16187
|
const onKey = (e) => {
|
|
16153
16188
|
if (e.key === "Escape") onClose();
|
|
@@ -16230,19 +16265,33 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
|
|
|
16230
16265
|
)
|
|
16231
16266
|
] })
|
|
16232
16267
|
] }),
|
|
16233
|
-
/* @__PURE__ */ jsx151("div", { className: "flex-1 relative", children: /* @__PURE__ */ jsx151(
|
|
16234
|
-
"
|
|
16268
|
+
/* @__PURE__ */ jsx151("div", { ref: containerRef, className: "flex-1 relative flex items-center justify-center overflow-hidden", children: /* @__PURE__ */ jsx151(
|
|
16269
|
+
"div",
|
|
16235
16270
|
{
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16271
|
+
className: "relative",
|
|
16272
|
+
style: { width: canvasW * scale, height: canvasH * scale },
|
|
16273
|
+
children: /* @__PURE__ */ jsx151(
|
|
16274
|
+
"iframe",
|
|
16275
|
+
{
|
|
16276
|
+
ref: iframeRef,
|
|
16277
|
+
src: url,
|
|
16278
|
+
title,
|
|
16279
|
+
onLoad: () => {
|
|
16280
|
+
setIframeReady(true);
|
|
16281
|
+
hideDeckChrome(iframeRef.current);
|
|
16282
|
+
iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: initialSlide }, "*");
|
|
16283
|
+
},
|
|
16284
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
16285
|
+
allow: "fullscreen",
|
|
16286
|
+
className: "absolute top-0 left-0 border-0",
|
|
16287
|
+
style: {
|
|
16288
|
+
width: canvasW,
|
|
16289
|
+
height: canvasH,
|
|
16290
|
+
transform: `scale(${scale})`,
|
|
16291
|
+
transformOrigin: "top left"
|
|
16292
|
+
}
|
|
16293
|
+
}
|
|
16294
|
+
)
|
|
16246
16295
|
}
|
|
16247
16296
|
) })
|
|
16248
16297
|
] });
|
|
@@ -16307,6 +16356,7 @@ var PresentationJobCard = ({
|
|
|
16307
16356
|
const [currentSlide, setCurrentSlide] = useState10(1);
|
|
16308
16357
|
const [iframeReady, setIframeReady] = useState10(false);
|
|
16309
16358
|
const iframeRef = useRef9(null);
|
|
16359
|
+
const { containerRef: previewFitRef, scale: previewScale, canvasW, canvasH } = useDeckFitScale();
|
|
16310
16360
|
useEffect7(() => {
|
|
16311
16361
|
setStatus(initialStatus);
|
|
16312
16362
|
}, [initialStatus]);
|
|
@@ -17167,19 +17217,36 @@ var PresentationJobCard = ({
|
|
|
17167
17217
|
/* @__PURE__ */ jsxs109(
|
|
17168
17218
|
"div",
|
|
17169
17219
|
{
|
|
17220
|
+
ref: previewFitRef,
|
|
17170
17221
|
onClick: () => setShowFullscreen(true),
|
|
17171
|
-
className: "group relative aspect-video w-full overflow-hidden rounded-xl bg-zinc-950 border border-zinc-800/50 cursor-pointer",
|
|
17222
|
+
className: "group relative aspect-video w-full overflow-hidden rounded-xl bg-zinc-950 border border-zinc-800/50 cursor-pointer flex items-center justify-center",
|
|
17172
17223
|
title: "Click to open fullscreen",
|
|
17173
17224
|
children: [
|
|
17174
17225
|
/* @__PURE__ */ jsx151(
|
|
17175
|
-
"
|
|
17226
|
+
"div",
|
|
17176
17227
|
{
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
|
|
17228
|
+
className: "relative",
|
|
17229
|
+
style: { width: canvasW * previewScale, height: canvasH * previewScale },
|
|
17230
|
+
children: /* @__PURE__ */ jsx151(
|
|
17231
|
+
"iframe",
|
|
17232
|
+
{
|
|
17233
|
+
ref: iframeRef,
|
|
17234
|
+
src: formats.html_url,
|
|
17235
|
+
title,
|
|
17236
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
17237
|
+
onLoad: () => {
|
|
17238
|
+
setIframeReady(true);
|
|
17239
|
+
hideDeckChrome(iframeRef.current);
|
|
17240
|
+
},
|
|
17241
|
+
className: "absolute top-0 left-0 border-0 pointer-events-none",
|
|
17242
|
+
style: {
|
|
17243
|
+
width: canvasW,
|
|
17244
|
+
height: canvasH,
|
|
17245
|
+
transform: `scale(${previewScale})`,
|
|
17246
|
+
transformOrigin: "top left"
|
|
17247
|
+
}
|
|
17248
|
+
}
|
|
17249
|
+
)
|
|
17183
17250
|
}
|
|
17184
17251
|
),
|
|
17185
17252
|
/* @__PURE__ */ jsx151("div", { className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/30 transition-colors", children: /* @__PURE__ */ jsxs109("span", { className: "opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-2 bg-zinc-900/80 backdrop-blur-sm border border-zinc-700 rounded-lg px-3 py-1.5 text-xs text-zinc-200 font-medium", children: [
|