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.cjs CHANGED
@@ -38999,6 +38999,14 @@ var ShareIcon = () => /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("svg", { w
38999
38999
  ] });
39000
39000
  var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("polyline", { points: "20 6 9 17 4 12" }) });
39001
39001
  var FORMATS = [
39002
+ {
39003
+ key: "pptx_url",
39004
+ label: "PowerPoint",
39005
+ ext: ".pptx",
39006
+ emoji: "\u{1F4CA}",
39007
+ desc: "Editable slides \u2014 open in PowerPoint, Keynote, or Google Slides",
39008
+ accent: { text: "text-orange-400", bg: "bg-orange-500/10 border-orange-500/20" }
39009
+ },
39002
39010
  {
39003
39011
  key: "pdf_url",
39004
39012
  label: "PDF",
@@ -39167,23 +39175,6 @@ var FullscreenModal = ({ url, title, slideCount, onClose }) => {
39167
39175
  ) })
39168
39176
  ] });
39169
39177
  };
39170
- var PROCESSING_STAGES = [
39171
- { minProgress: 0, message: "Initializing..." },
39172
- { minProgress: 12, message: "Analyzing request..." },
39173
- { minProgress: 25, message: "Generating content..." },
39174
- { minProgress: 45, message: "Building slides..." },
39175
- { minProgress: 65, message: "Applying design..." },
39176
- { minProgress: 80, message: "Rendering outputs..." },
39177
- { minProgress: 92, message: "Finalizing..." }
39178
- ];
39179
- function getStageMessage(progress) {
39180
- for (let i = PROCESSING_STAGES.length - 1; i >= 0; i--) {
39181
- if (progress >= PROCESSING_STAGES[i].minProgress) {
39182
- return PROCESSING_STAGES[i].message;
39183
- }
39184
- }
39185
- return PROCESSING_STAGES[0].message;
39186
- }
39187
39178
  var PresentationJobCard = ({
39188
39179
  job_id: _job_id,
39189
39180
  title: initialTitle,
@@ -39208,42 +39199,9 @@ var PresentationJobCard = ({
39208
39199
  const [copied, setCopied] = (0, import_react75.useState)(false);
39209
39200
  const [currentSlide, setCurrentSlide] = (0, import_react75.useState)(1);
39210
39201
  const [previewScale, setPreviewScale] = (0, import_react75.useState)(1);
39211
- const [iframeReady, setIframeReady] = (0, import_react75.useState)(false);
39212
- const [pendingSlide, setPendingSlide] = (0, import_react75.useState)(null);
39213
- const [progress, setProgress] = (0, import_react75.useState)(0);
39214
- const startTimeRef = (0, import_react75.useRef)(Date.now());
39215
39202
  const intervalRef = (0, import_react75.useRef)(null);
39216
- const progressIntervalRef = (0, import_react75.useRef)(null);
39217
39203
  const previewRef = (0, import_react75.useRef)(null);
39218
39204
  const iframeRef = (0, import_react75.useRef)(null);
39219
- (0, import_react75.useEffect)(() => {
39220
- const isLoading = status === "pending" || status === "running";
39221
- if (!isLoading) {
39222
- if (progressIntervalRef.current) {
39223
- clearInterval(progressIntervalRef.current);
39224
- progressIntervalRef.current = null;
39225
- }
39226
- if (status === "complete") setProgress(100);
39227
- return;
39228
- }
39229
- startTimeRef.current = Date.now();
39230
- progressIntervalRef.current = setInterval(() => {
39231
- const elapsed = (Date.now() - startTimeRef.current) / 1e3;
39232
- const estimated = Math.min(90, 90 * (1 - Math.exp(-elapsed / 60)));
39233
- setProgress((prev) => Math.max(prev, Math.round(estimated)));
39234
- }, 500);
39235
- return () => {
39236
- if (progressIntervalRef.current) {
39237
- clearInterval(progressIntervalRef.current);
39238
- progressIntervalRef.current = null;
39239
- }
39240
- };
39241
- }, [status]);
39242
- (0, import_react75.useEffect)(() => {
39243
- if (status === "running") {
39244
- setProgress((prev) => Math.max(prev, 15));
39245
- }
39246
- }, [status]);
39247
39205
  const updateScale = (0, import_react75.useCallback)(() => {
39248
39206
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
39249
39207
  }, []);
@@ -39254,10 +39212,6 @@ var PresentationJobCard = ({
39254
39212
  if (previewRef.current) ro.observe(previewRef.current);
39255
39213
  return () => ro.disconnect();
39256
39214
  }, [updateScale, formats.html_url]);
39257
- (0, import_react75.useEffect)(() => {
39258
- setIframeReady(false);
39259
- setPendingSlide(null);
39260
- }, [formats.html_url]);
39261
39215
  (0, import_react75.useEffect)(() => {
39262
39216
  const handler = (e) => {
39263
39217
  if (e.data?.type === "slideChanged") {
@@ -39268,25 +39222,9 @@ var PresentationJobCard = ({
39268
39222
  window.addEventListener("message", handler);
39269
39223
  return () => window.removeEventListener("message", handler);
39270
39224
  }, [slideCount]);
39271
- (0, import_react75.useEffect)(() => {
39272
- if (!iframeReady || pendingSlide === null) return;
39273
- iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: pendingSlide }, "*");
39274
- setPendingSlide(null);
39275
- }, [iframeReady, pendingSlide]);
39276
39225
  const sendSlideCommand = (command) => {
39277
- if (!iframeReady) return;
39278
39226
  iframeRef.current?.contentWindow?.postMessage({ type: command }, "*");
39279
39227
  };
39280
- const goToSlide = (n) => {
39281
- const total2 = slideCount || 1;
39282
- const target = (n - 1 + total2) % total2 + 1;
39283
- setCurrentSlide(target);
39284
- if (iframeReady) {
39285
- iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: target }, "*");
39286
- return;
39287
- }
39288
- setPendingSlide(target);
39289
- };
39290
39228
  const isTerminal = status === "complete" || status === "failed";
39291
39229
  const onCompleteRef = (0, import_react75.useRef)(onComplete);
39292
39230
  const onFailedRef = (0, import_react75.useRef)(onFailed);
@@ -39357,46 +39295,13 @@ var PresentationJobCard = ({
39357
39295
  }
39358
39296
  };
39359
39297
  if (status === "pending" || status === "running") {
39360
- const stageMessage = getStageMessage(progress);
39361
- return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39362
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-1 bg-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39363
- "div",
39364
- {
39365
- className: "h-full bg-gradient-to-r from-indigo-500 via-violet-500 to-purple-500 transition-all duration-500 ease-out",
39366
- style: { width: `${progress}%` }
39367
- }
39368
- ) }),
39369
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "p-5", children: [
39370
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-3 mb-5", children: [
39371
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("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__ */ (0, import_jsx_runtime147.jsx)(SlidesIcon, {}) }),
39372
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex-1 min-w-0", children: [
39373
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating presentation..." }),
39374
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5", children: "Creating slides..." })
39375
- ] })
39376
- ] }),
39377
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative overflow-hidden rounded-xl bg-zinc-900 border border-zinc-800/70 aspect-[16/9]", children: [
39378
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("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))]" }),
39379
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "absolute inset-0 p-6 flex flex-col justify-center", children: [
39380
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-4 w-48 rounded-full bg-white/10 animate-pulse mb-4" }),
39381
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-3 w-72 rounded-full bg-white/8 animate-pulse mb-3", style: { animationDelay: "100ms" } }),
39382
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-3 w-56 rounded-full bg-white/8 animate-pulse", style: { animationDelay: "200ms" } })
39383
- ] }),
39384
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-white/6 to-transparent" })
39385
- ] }),
39386
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center justify-between pt-4 border-t border-zinc-800/60", children: [
39387
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-2.5", children: [
39388
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "relative flex h-2 w-2", children: [
39389
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-500 opacity-75" }),
39390
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-indigo-500" })
39391
- ] }),
39392
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "text-xs text-indigo-400/80 font-medium", children: stageMessage })
39393
- ] }),
39394
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "text-xs text-zinc-500 tabular-nums font-medium", children: [
39395
- progress,
39396
- "%"
39397
- ] })
39398
- ] })
39399
- ] })
39298
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("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: [
39299
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "absolute inset-0 p-[8%] flex flex-col justify-center", children: [
39300
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[18px] w-[42%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse mb-3" }),
39301
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[11px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mb-2", style: { animationDelay: "120ms" } }),
39302
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[11px] w-[52%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "240ms" } })
39303
+ ] }),
39304
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("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" })
39400
39305
  ] }) });
39401
39306
  }
39402
39307
  if (status === "failed") {
@@ -39480,7 +39385,6 @@ var PresentationJobCard = ({
39480
39385
  ref: iframeRef,
39481
39386
  src: formats.html_url,
39482
39387
  title,
39483
- onLoad: () => setIframeReady(true),
39484
39388
  sandbox: "allow-same-origin allow-scripts",
39485
39389
  style: {
39486
39390
  width: 1280,
@@ -39506,7 +39410,7 @@ var PresentationJobCard = ({
39506
39410
  {
39507
39411
  onClick: (e) => {
39508
39412
  e.stopPropagation();
39509
- slideCount > 1 ? goToSlide(currentSlide - 1) : sendSlideCommand("prevSlide");
39413
+ sendSlideCommand("prevSlide");
39510
39414
  },
39511
39415
  disabled: !hasHtml,
39512
39416
  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",
@@ -39524,7 +39428,7 @@ var PresentationJobCard = ({
39524
39428
  {
39525
39429
  onClick: (e) => {
39526
39430
  e.stopPropagation();
39527
- slideCount > 1 ? goToSlide(currentSlide + 1) : sendSlideCommand("nextSlide");
39431
+ sendSlideCommand("nextSlide");
39528
39432
  },
39529
39433
  disabled: !hasHtml,
39530
39434
  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",