pxengine 0.1.83 → 0.1.84
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 +80 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +80 -14
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -38772,8 +38772,9 @@ var ExportModal = ({ formats, title, onClose }) => {
|
|
|
38772
38772
|
] })
|
|
38773
38773
|
] });
|
|
38774
38774
|
};
|
|
38775
|
-
var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
38776
|
-
const [currentSlide, setCurrentSlide] = useState10(
|
|
38775
|
+
var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) => {
|
|
38776
|
+
const [currentSlide, setCurrentSlide] = useState10(initialSlide);
|
|
38777
|
+
const [iframeReady, setIframeReady] = useState10(false);
|
|
38777
38778
|
const iframeRef = useRef5(null);
|
|
38778
38779
|
useEffect6(() => {
|
|
38779
38780
|
const onKey = (e) => {
|
|
@@ -38781,7 +38782,10 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
|
38781
38782
|
};
|
|
38782
38783
|
const onMsg = (e) => {
|
|
38783
38784
|
if (e.data?.type === "presentationExit") onClose();
|
|
38784
|
-
if (e.data?.type === "slideChanged")
|
|
38785
|
+
if (e.data?.type === "slideChanged") {
|
|
38786
|
+
setCurrentSlide(e.data.slide);
|
|
38787
|
+
if (!iframeReady) setIframeReady(true);
|
|
38788
|
+
}
|
|
38785
38789
|
};
|
|
38786
38790
|
document.addEventListener("keydown", onKey);
|
|
38787
38791
|
window.addEventListener("message", onMsg);
|
|
@@ -38789,14 +38793,26 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
|
38789
38793
|
document.removeEventListener("keydown", onKey);
|
|
38790
38794
|
window.removeEventListener("message", onMsg);
|
|
38791
38795
|
};
|
|
38792
|
-
}, [onClose]);
|
|
38796
|
+
}, [onClose, iframeReady]);
|
|
38793
38797
|
useEffect6(() => {
|
|
38794
38798
|
document.body.style.overflow = "hidden";
|
|
38795
38799
|
return () => {
|
|
38796
38800
|
document.body.style.overflow = "";
|
|
38797
38801
|
};
|
|
38798
38802
|
}, []);
|
|
38799
|
-
const
|
|
38803
|
+
const sendSlideCommand = (command) => {
|
|
38804
|
+
const iframe = iframeRef.current;
|
|
38805
|
+
if (!iframe?.contentWindow) return;
|
|
38806
|
+
const totalSlides = slideCount || 1;
|
|
38807
|
+
let newSlide = currentSlide;
|
|
38808
|
+
if (command === "nextSlide") {
|
|
38809
|
+
newSlide = currentSlide >= totalSlides ? 1 : currentSlide + 1;
|
|
38810
|
+
} else {
|
|
38811
|
+
newSlide = currentSlide <= 1 ? totalSlides : currentSlide - 1;
|
|
38812
|
+
}
|
|
38813
|
+
setCurrentSlide(newSlide);
|
|
38814
|
+
iframe.contentWindow.postMessage({ type: command }, "*");
|
|
38815
|
+
};
|
|
38800
38816
|
return /* @__PURE__ */ jsxs108("div", { className: "fixed inset-0 z-50 bg-black flex flex-col", children: [
|
|
38801
38817
|
/* @__PURE__ */ jsxs108("div", { className: "flex items-center justify-between gap-4 px-4 h-11 bg-zinc-950/90 border-b border-zinc-800/60 flex-shrink-0", children: [
|
|
38802
38818
|
/* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
@@ -38812,8 +38828,9 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
|
38812
38828
|
/* @__PURE__ */ jsx147(
|
|
38813
38829
|
"button",
|
|
38814
38830
|
{
|
|
38815
|
-
onClick: () =>
|
|
38816
|
-
|
|
38831
|
+
onClick: () => sendSlideCommand("prevSlide"),
|
|
38832
|
+
disabled: !iframeReady,
|
|
38833
|
+
className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-indigo-500 hover:text-indigo-400 text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
38817
38834
|
"aria-label": "Previous slide",
|
|
38818
38835
|
children: /* @__PURE__ */ jsx147(ChevronLeft2, {})
|
|
38819
38836
|
}
|
|
@@ -38821,8 +38838,9 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
|
38821
38838
|
/* @__PURE__ */ jsx147(
|
|
38822
38839
|
"button",
|
|
38823
38840
|
{
|
|
38824
|
-
onClick: () =>
|
|
38825
|
-
|
|
38841
|
+
onClick: () => sendSlideCommand("nextSlide"),
|
|
38842
|
+
disabled: !iframeReady,
|
|
38843
|
+
className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-indigo-500 hover:text-indigo-400 text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
38826
38844
|
"aria-label": "Next slide",
|
|
38827
38845
|
children: /* @__PURE__ */ jsx147(ChevronRight2, {})
|
|
38828
38846
|
}
|
|
@@ -38846,7 +38864,10 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
|
|
|
38846
38864
|
ref: iframeRef,
|
|
38847
38865
|
src: url,
|
|
38848
38866
|
title,
|
|
38849
|
-
onLoad: () =>
|
|
38867
|
+
onLoad: () => {
|
|
38868
|
+
setIframeReady(true);
|
|
38869
|
+
iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: initialSlide }, "*");
|
|
38870
|
+
},
|
|
38850
38871
|
sandbox: "allow-same-origin allow-scripts allow-fullscreen",
|
|
38851
38872
|
className: "absolute inset-0 w-full h-full border-0"
|
|
38852
38873
|
}
|
|
@@ -38877,6 +38898,7 @@ var PresentationJobCard = ({
|
|
|
38877
38898
|
const [copied, setCopied] = useState10(false);
|
|
38878
38899
|
const [currentSlide, setCurrentSlide] = useState10(1);
|
|
38879
38900
|
const [previewScale, setPreviewScale] = useState10(1);
|
|
38901
|
+
const [iframeReady, setIframeReady] = useState10(false);
|
|
38880
38902
|
const intervalRef = useRef5(null);
|
|
38881
38903
|
const previewRef = useRef5(null);
|
|
38882
38904
|
const iframeRef = useRef5(null);
|
|
@@ -38885,6 +38907,7 @@ var PresentationJobCard = ({
|
|
|
38885
38907
|
}, []);
|
|
38886
38908
|
useEffect6(() => {
|
|
38887
38909
|
updateScale();
|
|
38910
|
+
setIframeReady(false);
|
|
38888
38911
|
if (typeof ResizeObserver === "undefined") return;
|
|
38889
38912
|
const ro = new ResizeObserver(updateScale);
|
|
38890
38913
|
if (previewRef.current) ro.observe(previewRef.current);
|
|
@@ -38895,13 +38918,24 @@ var PresentationJobCard = ({
|
|
|
38895
38918
|
if (e.data?.type === "slideChanged") {
|
|
38896
38919
|
setCurrentSlide(e.data.slide);
|
|
38897
38920
|
if (e.data.total && !slideCount) setSlideCount(e.data.total);
|
|
38921
|
+
if (!iframeReady) setIframeReady(true);
|
|
38898
38922
|
}
|
|
38899
38923
|
};
|
|
38900
38924
|
window.addEventListener("message", handler);
|
|
38901
38925
|
return () => window.removeEventListener("message", handler);
|
|
38902
|
-
}, [slideCount]);
|
|
38926
|
+
}, [slideCount, iframeReady]);
|
|
38903
38927
|
const sendSlideCommand = (command) => {
|
|
38904
|
-
iframeRef.current
|
|
38928
|
+
const iframe = iframeRef.current;
|
|
38929
|
+
if (!iframe?.contentWindow) return;
|
|
38930
|
+
const totalSlides = slideCount || 1;
|
|
38931
|
+
let newSlide = currentSlide;
|
|
38932
|
+
if (command === "nextSlide") {
|
|
38933
|
+
newSlide = currentSlide >= totalSlides ? 1 : currentSlide + 1;
|
|
38934
|
+
} else {
|
|
38935
|
+
newSlide = currentSlide <= 1 ? totalSlides : currentSlide - 1;
|
|
38936
|
+
}
|
|
38937
|
+
setCurrentSlide(newSlide);
|
|
38938
|
+
iframe.contentWindow.postMessage({ type: command }, "*");
|
|
38905
38939
|
};
|
|
38906
38940
|
const isTerminal = status === "complete" || status === "failed";
|
|
38907
38941
|
const onCompleteRef = useRef5(onComplete);
|
|
@@ -39064,6 +39098,7 @@ var PresentationJobCard = ({
|
|
|
39064
39098
|
src: formats.html_url,
|
|
39065
39099
|
title,
|
|
39066
39100
|
sandbox: "allow-same-origin allow-scripts",
|
|
39101
|
+
onLoad: () => setIframeReady(true),
|
|
39067
39102
|
style: {
|
|
39068
39103
|
width: 1280,
|
|
39069
39104
|
height: 720,
|
|
@@ -39090,7 +39125,7 @@ var PresentationJobCard = ({
|
|
|
39090
39125
|
e.stopPropagation();
|
|
39091
39126
|
sendSlideCommand("prevSlide");
|
|
39092
39127
|
},
|
|
39093
|
-
disabled: !hasHtml,
|
|
39128
|
+
disabled: !hasHtml || !iframeReady,
|
|
39094
39129
|
className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-indigo-500 hover:text-indigo-400 text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
39095
39130
|
"aria-label": "Previous slide",
|
|
39096
39131
|
children: /* @__PURE__ */ jsx147(ChevronLeft2, {})
|
|
@@ -39108,7 +39143,7 @@ var PresentationJobCard = ({
|
|
|
39108
39143
|
e.stopPropagation();
|
|
39109
39144
|
sendSlideCommand("nextSlide");
|
|
39110
39145
|
},
|
|
39111
|
-
disabled: !hasHtml,
|
|
39146
|
+
disabled: !hasHtml || !iframeReady,
|
|
39112
39147
|
className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-indigo-500 hover:text-indigo-400 text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
39113
39148
|
"aria-label": "Next slide",
|
|
39114
39149
|
children: /* @__PURE__ */ jsx147(ChevronRight2, {})
|
|
@@ -39125,6 +39160,7 @@ var PresentationJobCard = ({
|
|
|
39125
39160
|
url: formats.html_url,
|
|
39126
39161
|
title,
|
|
39127
39162
|
slideCount,
|
|
39163
|
+
initialSlide: currentSlide,
|
|
39128
39164
|
onClose: () => setShowFullscreen(false)
|
|
39129
39165
|
}
|
|
39130
39166
|
)
|
|
@@ -39243,6 +39279,36 @@ var ResearchReportJobCard = ({
|
|
|
39243
39279
|
const hasNotifiedRef = useRef6(false);
|
|
39244
39280
|
onCompleteRef.current = onComplete;
|
|
39245
39281
|
onFailedRef.current = onFailed;
|
|
39282
|
+
useEffect7(() => {
|
|
39283
|
+
setStatus(initialStatus);
|
|
39284
|
+
}, [initialStatus]);
|
|
39285
|
+
useEffect7(() => {
|
|
39286
|
+
if (initialTitle) setTitle(initialTitle);
|
|
39287
|
+
}, [initialTitle]);
|
|
39288
|
+
useEffect7(() => {
|
|
39289
|
+
if (initialHtmlUrl) setHtmlUrl(initialHtmlUrl);
|
|
39290
|
+
}, [initialHtmlUrl]);
|
|
39291
|
+
useEffect7(() => {
|
|
39292
|
+
if (initialDepth) setDepth(initialDepth);
|
|
39293
|
+
}, [initialDepth]);
|
|
39294
|
+
useEffect7(() => {
|
|
39295
|
+
if (initialSectionCount !== void 0) setSectionCount(initialSectionCount);
|
|
39296
|
+
}, [initialSectionCount]);
|
|
39297
|
+
useEffect7(() => {
|
|
39298
|
+
if (initialSourceCount !== void 0) setSourceCount(initialSourceCount);
|
|
39299
|
+
}, [initialSourceCount]);
|
|
39300
|
+
useEffect7(() => {
|
|
39301
|
+
if (initialWordCount !== void 0) setWordCount(initialWordCount);
|
|
39302
|
+
}, [initialWordCount]);
|
|
39303
|
+
useEffect7(() => {
|
|
39304
|
+
if (initialSummary) setSummary(initialSummary);
|
|
39305
|
+
}, [initialSummary]);
|
|
39306
|
+
useEffect7(() => {
|
|
39307
|
+
if (initialTheme) setTheme(initialTheme);
|
|
39308
|
+
}, [initialTheme]);
|
|
39309
|
+
useEffect7(() => {
|
|
39310
|
+
if (initialError) setError(initialError);
|
|
39311
|
+
}, [initialError]);
|
|
39246
39312
|
const isTerminal = status === "complete" || status === "failed";
|
|
39247
39313
|
const primaryColor = theme?.primary || DEFAULT_THEME.primary;
|
|
39248
39314
|
const hasHTML = Boolean(htmlUrl);
|