pxengine 0.1.83 → 0.1.85

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.d.cts CHANGED
@@ -3205,6 +3205,12 @@ interface ResearchReportJobCardProps {
3205
3205
  onComplete?: (output: ResearchReportJobOutput) => void;
3206
3206
  /** Callback when job fails */
3207
3207
  onFailed?: (error: string) => void;
3208
+ /**
3209
+ * Compact mode - only shows title and action buttons.
3210
+ * The embedded iframe preview is hidden; use Preview button to view full report.
3211
+ * @default false
3212
+ */
3213
+ compact?: boolean;
3208
3214
  }
3209
3215
  interface ResearchReportJobOutput {
3210
3216
  title: string;
package/dist/index.d.ts CHANGED
@@ -3205,6 +3205,12 @@ interface ResearchReportJobCardProps {
3205
3205
  onComplete?: (output: ResearchReportJobOutput) => void;
3206
3206
  /** Callback when job fails */
3207
3207
  onFailed?: (error: string) => void;
3208
+ /**
3209
+ * Compact mode - only shows title and action buttons.
3210
+ * The embedded iframe preview is hidden; use Preview button to view full report.
3211
+ * @default false
3212
+ */
3213
+ compact?: boolean;
3208
3214
  }
3209
3215
  interface ResearchReportJobOutput {
3210
3216
  title: string;
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(1);
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") setCurrentSlide(e.data.slide);
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 send = (type) => iframeRef.current?.contentWindow?.postMessage({ type }, "*");
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: () => send("prevSlide"),
38816
- 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",
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: () => send("nextSlide"),
38825
- 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",
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: () => iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: currentSlide }, "*"),
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?.contentWindow?.postMessage({ type: command }, "*");
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);
@@ -38995,7 +39029,7 @@ var PresentationJobCard = ({
38995
39029
  const hasHtml = Boolean(formats.html_url);
38996
39030
  return /* @__PURE__ */ jsxs108(Fragment5, { children: [
38997
39031
  /* @__PURE__ */ jsx147("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs108("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
38998
- /* @__PURE__ */ jsx147("div", { className: "h-[3px] bg-gradient-to-r from-indigo-600 via-violet-500 to-purple-600" }),
39032
+ /* @__PURE__ */ jsx147("div", { className: "h-[3px]", style: { background: "linear-gradient(90deg, #8B7D5E, #C0AE82, #DCC99B)" } }),
38999
39033
  /* @__PURE__ */ jsxs108("div", { className: "p-5", children: [
39000
39034
  /* @__PURE__ */ jsxs108("div", { className: "flex items-start gap-3", children: [
39001
39035
  /* @__PURE__ */ jsx147("div", { className: "w-10 h-10 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center flex-shrink-0 text-indigo-400", children: /* @__PURE__ */ jsx147(SlidesIcon, {}) }),
@@ -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
  )
@@ -39222,7 +39258,8 @@ var ResearchReportJobCard = ({
39222
39258
  authToken,
39223
39259
  className,
39224
39260
  onComplete,
39225
- onFailed
39261
+ onFailed,
39262
+ compact = false
39226
39263
  }) => {
39227
39264
  const [status, setStatus] = useState11(initialStatus);
39228
39265
  const [title, setTitle] = useState11(initialTitle);
@@ -39243,6 +39280,36 @@ var ResearchReportJobCard = ({
39243
39280
  const hasNotifiedRef = useRef6(false);
39244
39281
  onCompleteRef.current = onComplete;
39245
39282
  onFailedRef.current = onFailed;
39283
+ useEffect7(() => {
39284
+ setStatus(initialStatus);
39285
+ }, [initialStatus]);
39286
+ useEffect7(() => {
39287
+ if (initialTitle) setTitle(initialTitle);
39288
+ }, [initialTitle]);
39289
+ useEffect7(() => {
39290
+ if (initialHtmlUrl) setHtmlUrl(initialHtmlUrl);
39291
+ }, [initialHtmlUrl]);
39292
+ useEffect7(() => {
39293
+ if (initialDepth) setDepth(initialDepth);
39294
+ }, [initialDepth]);
39295
+ useEffect7(() => {
39296
+ if (initialSectionCount !== void 0) setSectionCount(initialSectionCount);
39297
+ }, [initialSectionCount]);
39298
+ useEffect7(() => {
39299
+ if (initialSourceCount !== void 0) setSourceCount(initialSourceCount);
39300
+ }, [initialSourceCount]);
39301
+ useEffect7(() => {
39302
+ if (initialWordCount !== void 0) setWordCount(initialWordCount);
39303
+ }, [initialWordCount]);
39304
+ useEffect7(() => {
39305
+ if (initialSummary) setSummary(initialSummary);
39306
+ }, [initialSummary]);
39307
+ useEffect7(() => {
39308
+ if (initialTheme) setTheme(initialTheme);
39309
+ }, [initialTheme]);
39310
+ useEffect7(() => {
39311
+ if (initialError) setError(initialError);
39312
+ }, [initialError]);
39246
39313
  const isTerminal = status === "complete" || status === "failed";
39247
39314
  const primaryColor = theme?.primary || DEFAULT_THEME.primary;
39248
39315
  const hasHTML = Boolean(htmlUrl);
@@ -39367,7 +39434,7 @@ var ResearchReportJobCard = ({
39367
39434
  {
39368
39435
  className: "h-[3px]",
39369
39436
  style: {
39370
- background: `linear-gradient(90deg, ${primaryColor}, ${theme?.secondary || "#a78bfa"}, ${theme?.accent || "#c4b5fd"})`
39437
+ background: "linear-gradient(90deg, #8B7D5E, #C0AE82, #DCC99B)"
39371
39438
  }
39372
39439
  }
39373
39440
  ),
@@ -39427,7 +39494,7 @@ var ResearchReportJobCard = ({
39427
39494
  )
39428
39495
  ] })
39429
39496
  ] }),
39430
- hasHTML && /* @__PURE__ */ jsx148("div", { className: "mt-4", children: /* @__PURE__ */ jsxs109(
39497
+ hasHTML && !compact && /* @__PURE__ */ jsx148("div", { className: "mt-4", children: /* @__PURE__ */ jsxs109(
39431
39498
  "div",
39432
39499
  {
39433
39500
  ref: previewRef,
@@ -39460,7 +39527,7 @@ var ResearchReportJobCard = ({
39460
39527
  ]
39461
39528
  }
39462
39529
  ) }),
39463
- !hasHTML && summary && /* @__PURE__ */ jsx148("div", { className: "mt-4 pt-4 border-t border-zinc-800/60", children: /* @__PURE__ */ jsx148("p", { className: "text-sm text-zinc-400 leading-relaxed line-clamp-3", children: summary }) })
39530
+ !hasHTML && !compact && summary && /* @__PURE__ */ jsx148("div", { className: "mt-4 pt-4 border-t border-zinc-800/60", children: /* @__PURE__ */ jsx148("p", { className: "text-sm text-zinc-400 leading-relaxed line-clamp-3", children: summary }) })
39464
39531
  ] })
39465
39532
  ] }) }),
39466
39533
  showPreview && hasHTML && /* @__PURE__ */ jsx148(