pxengine 0.1.139 → 0.1.140
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 +63 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.mjs +60 -1
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -345,12 +345,15 @@ __export(index_exports, {
|
|
|
345
345
|
defaultPersistSelection: () => defaultPersistSelection,
|
|
346
346
|
elementToQAField: () => elementToQAField,
|
|
347
347
|
emitJobSignal: () => emitJobSignal,
|
|
348
|
+
fitOverflowingSlideContent: () => fitOverflowingSlideContent,
|
|
349
|
+
forcePreviewReadOnly: () => forcePreviewReadOnly,
|
|
348
350
|
formatQAMessage: () => formatQAMessage,
|
|
349
351
|
generateFieldsFromData: () => generateFieldsFromData,
|
|
350
352
|
generateFieldsFromPropDefinitions: () => generateFieldsFromPropDefinitions,
|
|
351
353
|
getPxAuthToken: () => getPxAuthToken,
|
|
352
354
|
isInputAtom: () => isInputAtom,
|
|
353
355
|
notifyPxUnauthorized: () => notifyPxUnauthorized,
|
|
356
|
+
preparePresentationPreviewIframe: () => preparePresentationPreviewIframe,
|
|
354
357
|
refreshSharedPoll: () => refreshSharedPoll,
|
|
355
358
|
resolveComponent: () => resolveComponent,
|
|
356
359
|
setPxAuthTokenProvider: () => setPxAuthTokenProvider,
|
|
@@ -16129,6 +16132,51 @@ var NextStepCard = ({
|
|
|
16129
16132
|
var import_react81 = require("react");
|
|
16130
16133
|
var import_react_dom = require("react-dom");
|
|
16131
16134
|
|
|
16135
|
+
// src/lib/presentation-preview.ts
|
|
16136
|
+
function forcePreviewReadOnly(iframe) {
|
|
16137
|
+
try {
|
|
16138
|
+
const doc = iframe?.contentDocument;
|
|
16139
|
+
if (!doc?.body) return;
|
|
16140
|
+
doc.body.contentEditable = "false";
|
|
16141
|
+
doc.body.removeAttribute("contenteditable");
|
|
16142
|
+
doc.designMode = "off";
|
|
16143
|
+
} catch {
|
|
16144
|
+
}
|
|
16145
|
+
}
|
|
16146
|
+
function fitOverflowingSlideContent(iframe) {
|
|
16147
|
+
try {
|
|
16148
|
+
const doc = iframe?.contentDocument;
|
|
16149
|
+
if (!doc) return;
|
|
16150
|
+
const slides = Array.from(doc.querySelectorAll(".slide"));
|
|
16151
|
+
const targets = slides.filter((s) => s.classList.contains("active")).length > 0 ? slides.filter((s) => s.classList.contains("active")) : slides.slice(0, 1);
|
|
16152
|
+
targets.forEach((slide) => {
|
|
16153
|
+
const stageH = slide.clientHeight || 720;
|
|
16154
|
+
if (stageH <= 0) return;
|
|
16155
|
+
slide.style.zoom = "";
|
|
16156
|
+
const hadInlineTransform = slide.style.transform;
|
|
16157
|
+
if (/scale\s*\(/i.test(hadInlineTransform)) slide.style.transform = "";
|
|
16158
|
+
const prevOverflow = slide.style.overflow;
|
|
16159
|
+
slide.style.overflow = "visible";
|
|
16160
|
+
const contentH = slide.scrollHeight;
|
|
16161
|
+
slide.style.overflow = prevOverflow;
|
|
16162
|
+
if (contentH <= stageH + 1) return;
|
|
16163
|
+
const scale = stageH / contentH;
|
|
16164
|
+
if (typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("zoom", "1")) {
|
|
16165
|
+
slide.style.zoom = String(scale);
|
|
16166
|
+
} else {
|
|
16167
|
+
slide.style.transformOrigin = "top center";
|
|
16168
|
+
const base = hadInlineTransform && !/scale\s*\(/i.test(hadInlineTransform) ? `${hadInlineTransform} ` : "";
|
|
16169
|
+
slide.style.transform = `${base}scale(${scale})`;
|
|
16170
|
+
}
|
|
16171
|
+
});
|
|
16172
|
+
} catch {
|
|
16173
|
+
}
|
|
16174
|
+
}
|
|
16175
|
+
function preparePresentationPreviewIframe(iframe) {
|
|
16176
|
+
forcePreviewReadOnly(iframe);
|
|
16177
|
+
fitOverflowingSlideContent(iframe);
|
|
16178
|
+
}
|
|
16179
|
+
|
|
16132
16180
|
// src/lib/shared-poll.ts
|
|
16133
16181
|
var import_react79 = require("react");
|
|
16134
16182
|
var SSE_FALLBACK_POLL_MS = 2e4;
|
|
@@ -16596,6 +16644,11 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
|
|
|
16596
16644
|
document.body.style.overflow = "";
|
|
16597
16645
|
};
|
|
16598
16646
|
}, []);
|
|
16647
|
+
(0, import_react81.useEffect)(() => {
|
|
16648
|
+
if (!iframeReady) return;
|
|
16649
|
+
const t = window.setTimeout(() => fitOverflowingSlideContent(iframeRef.current), 40);
|
|
16650
|
+
return () => window.clearTimeout(t);
|
|
16651
|
+
}, [currentSlide, iframeReady]);
|
|
16599
16652
|
const sendSlideCommand = (command) => {
|
|
16600
16653
|
const iframe = iframeRef.current;
|
|
16601
16654
|
if (!iframe?.contentWindow) return;
|
|
@@ -16669,6 +16722,7 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
|
|
|
16669
16722
|
onLoad: () => {
|
|
16670
16723
|
setIframeReady(true);
|
|
16671
16724
|
hideDeckChrome(iframeRef.current);
|
|
16725
|
+
preparePresentationPreviewIframe(iframeRef.current);
|
|
16672
16726
|
iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: initialSlide }, "*");
|
|
16673
16727
|
},
|
|
16674
16728
|
sandbox: "allow-same-origin allow-scripts",
|
|
@@ -17639,6 +17693,7 @@ var PresentationJobCard = ({
|
|
|
17639
17693
|
onLoad: () => {
|
|
17640
17694
|
setIframeReady(true);
|
|
17641
17695
|
hideDeckChrome(iframeRef.current);
|
|
17696
|
+
fitOverflowingSlideContent(iframeRef.current);
|
|
17642
17697
|
},
|
|
17643
17698
|
className: "absolute top-0 left-0 border-0 pointer-events-none",
|
|
17644
17699
|
style: {
|
|
@@ -17782,7 +17837,11 @@ var FullscreenPreviewModal = ({ url, title, onClose, isPdf }) => {
|
|
|
17782
17837
|
src: url,
|
|
17783
17838
|
title,
|
|
17784
17839
|
className: "absolute inset-0 w-full h-full border-0",
|
|
17785
|
-
...isPdf ? {} : { sandbox: "allow-same-origin allow-scripts" }
|
|
17840
|
+
...isPdf ? {} : { sandbox: "allow-same-origin allow-scripts" },
|
|
17841
|
+
onLoad: (e) => {
|
|
17842
|
+
if (isPdf) return;
|
|
17843
|
+
preparePresentationPreviewIframe(e.currentTarget);
|
|
17844
|
+
}
|
|
17786
17845
|
}
|
|
17787
17846
|
) })
|
|
17788
17847
|
] });
|
|
@@ -26615,12 +26674,15 @@ PXEngineRenderer.displayName = "PXEngineRenderer";
|
|
|
26615
26674
|
defaultPersistSelection,
|
|
26616
26675
|
elementToQAField,
|
|
26617
26676
|
emitJobSignal,
|
|
26677
|
+
fitOverflowingSlideContent,
|
|
26678
|
+
forcePreviewReadOnly,
|
|
26618
26679
|
formatQAMessage,
|
|
26619
26680
|
generateFieldsFromData,
|
|
26620
26681
|
generateFieldsFromPropDefinitions,
|
|
26621
26682
|
getPxAuthToken,
|
|
26622
26683
|
isInputAtom,
|
|
26623
26684
|
notifyPxUnauthorized,
|
|
26685
|
+
preparePresentationPreviewIframe,
|
|
26624
26686
|
refreshSharedPoll,
|
|
26625
26687
|
resolveComponent,
|
|
26626
26688
|
setPxAuthTokenProvider,
|