pxengine 0.1.79 → 0.1.81

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.mjs CHANGED
@@ -38676,6 +38676,14 @@ var ShareIcon = () => /* @__PURE__ */ jsxs108("svg", { width: "14", height: "14"
38676
38676
  ] });
38677
38677
  var CheckIcon = () => /* @__PURE__ */ jsx147("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx147("polyline", { points: "20 6 9 17 4 12" }) });
38678
38678
  var FORMATS = [
38679
+ {
38680
+ key: "pptx_url",
38681
+ label: "PowerPoint",
38682
+ ext: ".pptx",
38683
+ emoji: "\u{1F4CA}",
38684
+ desc: "Editable slides \u2014 open in PowerPoint, Keynote, or Google Slides",
38685
+ accent: { text: "text-orange-400", bg: "bg-orange-500/10 border-orange-500/20" }
38686
+ },
38679
38687
  {
38680
38688
  key: "pdf_url",
38681
38689
  label: "PDF",
@@ -38844,23 +38852,6 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
38844
38852
  ) })
38845
38853
  ] });
38846
38854
  };
38847
- var PROCESSING_STAGES = [
38848
- { minProgress: 0, message: "Initializing..." },
38849
- { minProgress: 12, message: "Analyzing request..." },
38850
- { minProgress: 25, message: "Generating content..." },
38851
- { minProgress: 45, message: "Building slides..." },
38852
- { minProgress: 65, message: "Applying design..." },
38853
- { minProgress: 80, message: "Rendering outputs..." },
38854
- { minProgress: 92, message: "Finalizing..." }
38855
- ];
38856
- function getStageMessage(progress) {
38857
- for (let i = PROCESSING_STAGES.length - 1; i >= 0; i--) {
38858
- if (progress >= PROCESSING_STAGES[i].minProgress) {
38859
- return PROCESSING_STAGES[i].message;
38860
- }
38861
- }
38862
- return PROCESSING_STAGES[0].message;
38863
- }
38864
38855
  var PresentationJobCard = ({
38865
38856
  job_id: _job_id,
38866
38857
  title: initialTitle,
@@ -38885,42 +38876,9 @@ var PresentationJobCard = ({
38885
38876
  const [copied, setCopied] = useState10(false);
38886
38877
  const [currentSlide, setCurrentSlide] = useState10(1);
38887
38878
  const [previewScale, setPreviewScale] = useState10(1);
38888
- const [iframeReady, setIframeReady] = useState10(false);
38889
- const [pendingSlide, setPendingSlide] = useState10(null);
38890
- const [progress, setProgress] = useState10(0);
38891
- const startTimeRef = useRef5(Date.now());
38892
38879
  const intervalRef = useRef5(null);
38893
- const progressIntervalRef = useRef5(null);
38894
38880
  const previewRef = useRef5(null);
38895
38881
  const iframeRef = useRef5(null);
38896
- useEffect6(() => {
38897
- const isLoading = status === "pending" || status === "running";
38898
- if (!isLoading) {
38899
- if (progressIntervalRef.current) {
38900
- clearInterval(progressIntervalRef.current);
38901
- progressIntervalRef.current = null;
38902
- }
38903
- if (status === "complete") setProgress(100);
38904
- return;
38905
- }
38906
- startTimeRef.current = Date.now();
38907
- progressIntervalRef.current = setInterval(() => {
38908
- const elapsed = (Date.now() - startTimeRef.current) / 1e3;
38909
- const estimated = Math.min(90, 90 * (1 - Math.exp(-elapsed / 60)));
38910
- setProgress((prev) => Math.max(prev, Math.round(estimated)));
38911
- }, 500);
38912
- return () => {
38913
- if (progressIntervalRef.current) {
38914
- clearInterval(progressIntervalRef.current);
38915
- progressIntervalRef.current = null;
38916
- }
38917
- };
38918
- }, [status]);
38919
- useEffect6(() => {
38920
- if (status === "running") {
38921
- setProgress((prev) => Math.max(prev, 15));
38922
- }
38923
- }, [status]);
38924
38882
  const updateScale = useCallback4(() => {
38925
38883
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
38926
38884
  }, []);
@@ -38931,10 +38889,6 @@ var PresentationJobCard = ({
38931
38889
  if (previewRef.current) ro.observe(previewRef.current);
38932
38890
  return () => ro.disconnect();
38933
38891
  }, [updateScale, formats.html_url]);
38934
- useEffect6(() => {
38935
- setIframeReady(false);
38936
- setPendingSlide(null);
38937
- }, [formats.html_url]);
38938
38892
  useEffect6(() => {
38939
38893
  const handler = (e) => {
38940
38894
  if (e.data?.type === "slideChanged") {
@@ -38945,25 +38899,9 @@ var PresentationJobCard = ({
38945
38899
  window.addEventListener("message", handler);
38946
38900
  return () => window.removeEventListener("message", handler);
38947
38901
  }, [slideCount]);
38948
- useEffect6(() => {
38949
- if (!iframeReady || pendingSlide === null) return;
38950
- iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: pendingSlide }, "*");
38951
- setPendingSlide(null);
38952
- }, [iframeReady, pendingSlide]);
38953
38902
  const sendSlideCommand = (command) => {
38954
- if (!iframeReady) return;
38955
38903
  iframeRef.current?.contentWindow?.postMessage({ type: command }, "*");
38956
38904
  };
38957
- const goToSlide = (n) => {
38958
- const total2 = slideCount || 1;
38959
- const target = (n - 1 + total2) % total2 + 1;
38960
- setCurrentSlide(target);
38961
- if (iframeReady) {
38962
- iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: target }, "*");
38963
- return;
38964
- }
38965
- setPendingSlide(target);
38966
- };
38967
38905
  const isTerminal = status === "complete" || status === "failed";
38968
38906
  const onCompleteRef = useRef5(onComplete);
38969
38907
  const onFailedRef = useRef5(onFailed);
@@ -39034,46 +38972,13 @@ var PresentationJobCard = ({
39034
38972
  }
39035
38973
  };
39036
38974
  if (status === "pending" || status === "running") {
39037
- const stageMessage = getStageMessage(progress);
39038
- return /* @__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: [
39039
- /* @__PURE__ */ jsx147("div", { className: "h-1 bg-zinc-800", children: /* @__PURE__ */ jsx147(
39040
- "div",
39041
- {
39042
- className: "h-full bg-gradient-to-r from-indigo-500 via-violet-500 to-purple-500 transition-all duration-500 ease-out",
39043
- style: { width: `${progress}%` }
39044
- }
39045
- ) }),
39046
- /* @__PURE__ */ jsxs108("div", { className: "p-5", children: [
39047
- /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-3 mb-5", children: [
39048
- /* @__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", children: /* @__PURE__ */ jsx147(SlidesIcon, {}) }),
39049
- /* @__PURE__ */ jsxs108("div", { className: "flex-1 min-w-0", children: [
39050
- /* @__PURE__ */ jsx147("p", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating presentation..." }),
39051
- /* @__PURE__ */ jsx147("p", { className: "text-xs text-zinc-500 mt-0.5", children: "Creating slides..." })
39052
- ] })
39053
- ] }),
39054
- /* @__PURE__ */ jsxs108("div", { className: "relative overflow-hidden rounded-xl bg-zinc-900 border border-zinc-800/70 aspect-[16/9]", children: [
39055
- /* @__PURE__ */ jsx147("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_14%_16%,rgba(99,102,241,0.12),transparent_30%),radial-gradient(circle_at_86%_84%,rgba(168,85,247,0.10),transparent_28%),linear-gradient(135deg,rgba(30,32,48,0.98),rgba(18,18,24,0.99))]" }),
39056
- /* @__PURE__ */ jsxs108("div", { className: "absolute inset-0 p-6 flex flex-col justify-center", children: [
39057
- /* @__PURE__ */ jsx147("div", { className: "h-4 w-48 rounded-full bg-white/10 animate-pulse mb-4" }),
39058
- /* @__PURE__ */ jsx147("div", { className: "h-3 w-72 rounded-full bg-white/8 animate-pulse mb-3", style: { animationDelay: "100ms" } }),
39059
- /* @__PURE__ */ jsx147("div", { className: "h-3 w-56 rounded-full bg-white/8 animate-pulse", style: { animationDelay: "200ms" } })
39060
- ] }),
39061
- /* @__PURE__ */ jsx147("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-white/6 to-transparent" })
39062
- ] }),
39063
- /* @__PURE__ */ jsxs108("div", { className: "flex items-center justify-between pt-4 border-t border-zinc-800/60", children: [
39064
- /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-2.5", children: [
39065
- /* @__PURE__ */ jsxs108("span", { className: "relative flex h-2 w-2", children: [
39066
- /* @__PURE__ */ jsx147("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-500 opacity-75" }),
39067
- /* @__PURE__ */ jsx147("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-indigo-500" })
39068
- ] }),
39069
- /* @__PURE__ */ jsx147("span", { className: "text-xs text-indigo-400/80 font-medium", children: stageMessage })
39070
- ] }),
39071
- /* @__PURE__ */ jsxs108("span", { className: "text-xs text-zinc-500 tabular-nums font-medium", children: [
39072
- progress,
39073
- "%"
39074
- ] })
39075
- ] })
39076
- ] })
38975
+ return /* @__PURE__ */ jsx147("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs108("div", { className: "relative overflow-hidden rounded-xl border border-zinc-200/70 dark:border-zinc-800/70 bg-zinc-100 dark:bg-zinc-900 aspect-[16/9]", children: [
38976
+ /* @__PURE__ */ jsxs108("div", { className: "absolute inset-0 p-[8%] flex flex-col justify-center", children: [
38977
+ /* @__PURE__ */ jsx147("div", { className: "h-[18px] w-[42%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse mb-3" }),
38978
+ /* @__PURE__ */ jsx147("div", { className: "h-[11px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mb-2", style: { animationDelay: "120ms" } }),
38979
+ /* @__PURE__ */ jsx147("div", { className: "h-[11px] w-[52%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "240ms" } })
38980
+ ] }),
38981
+ /* @__PURE__ */ jsx147("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite] bg-gradient-to-r from-transparent via-white/10 to-transparent" })
39077
38982
  ] }) });
39078
38983
  }
39079
38984
  if (status === "failed") {
@@ -39157,7 +39062,6 @@ var PresentationJobCard = ({
39157
39062
  ref: iframeRef,
39158
39063
  src: formats.html_url,
39159
39064
  title,
39160
- onLoad: () => setIframeReady(true),
39161
39065
  sandbox: "allow-same-origin allow-scripts",
39162
39066
  style: {
39163
39067
  width: 1280,
@@ -39183,7 +39087,7 @@ var PresentationJobCard = ({
39183
39087
  {
39184
39088
  onClick: (e) => {
39185
39089
  e.stopPropagation();
39186
- slideCount > 1 ? goToSlide(currentSlide - 1) : sendSlideCommand("prevSlide");
39090
+ sendSlideCommand("prevSlide");
39187
39091
  },
39188
39092
  disabled: !hasHtml,
39189
39093
  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",
@@ -39201,7 +39105,7 @@ var PresentationJobCard = ({
39201
39105
  {
39202
39106
  onClick: (e) => {
39203
39107
  e.stopPropagation();
39204
- slideCount > 1 ? goToSlide(currentSlide + 1) : sendSlideCommand("nextSlide");
39108
+ sendSlideCommand("nextSlide");
39205
39109
  },
39206
39110
  disabled: !hasHtml,
39207
39111
  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",