pxengine 0.1.88 → 0.1.89

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
@@ -39207,6 +39207,7 @@ var PresentationJobCard = ({
39207
39207
  slide_count: initialSlideCount,
39208
39208
  formats: initialFormats = {},
39209
39209
  error: initialError,
39210
+ progress: initialProgress,
39210
39211
  pollUrl,
39211
39212
  authToken,
39212
39213
  shareUrl,
@@ -39219,6 +39220,7 @@ var PresentationJobCard = ({
39219
39220
  const [slideCount, setSlideCount] = (0, import_react75.useState)(initialSlideCount ?? 0);
39220
39221
  const [formats, setFormats] = (0, import_react75.useState)(initialFormats);
39221
39222
  const [error, setError] = (0, import_react75.useState)(initialError);
39223
+ const [progress, setProgress] = (0, import_react75.useState)(initialProgress);
39222
39224
  const [showExport, setShowExport] = (0, import_react75.useState)(false);
39223
39225
  const [showFullscreen, setShowFullscreen] = (0, import_react75.useState)(false);
39224
39226
  const [copied, setCopied] = (0, import_react75.useState)(false);
@@ -39228,6 +39230,27 @@ var PresentationJobCard = ({
39228
39230
  const intervalRef = (0, import_react75.useRef)(null);
39229
39231
  const previewRef = (0, import_react75.useRef)(null);
39230
39232
  const iframeRef = (0, import_react75.useRef)(null);
39233
+ (0, import_react75.useEffect)(() => {
39234
+ setStatus(initialStatus);
39235
+ }, [initialStatus]);
39236
+ const progressPct = initialProgress?.percentage;
39237
+ const progressStep = initialProgress?.current_step;
39238
+ (0, import_react75.useEffect)(() => {
39239
+ if (initialProgress) setProgress(initialProgress);
39240
+ }, [progressPct, progressStep]);
39241
+ (0, import_react75.useEffect)(() => {
39242
+ if (initialError) setError(initialError);
39243
+ }, [initialError]);
39244
+ (0, import_react75.useEffect)(() => {
39245
+ if (initialSlideCount !== void 0) setSlideCount(initialSlideCount);
39246
+ }, [initialSlideCount]);
39247
+ const htmlUrl = initialFormats?.html_url;
39248
+ (0, import_react75.useEffect)(() => {
39249
+ if (initialFormats) setFormats(initialFormats);
39250
+ }, [htmlUrl]);
39251
+ (0, import_react75.useEffect)(() => {
39252
+ if (initialTitle) setTitle(initialTitle);
39253
+ }, [initialTitle]);
39231
39254
  const updateScale = (0, import_react75.useCallback)(() => {
39232
39255
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
39233
39256
  }, []);
@@ -39282,6 +39305,9 @@ var PresentationJobCard = ({
39282
39305
  const data = await res.json();
39283
39306
  const newStatus = data.status;
39284
39307
  setStatus(newStatus);
39308
+ if (data.progress) {
39309
+ setProgress(data.progress);
39310
+ }
39285
39311
  if (newStatus === "complete" && data.output) {
39286
39312
  const newTitle = data.output.title || initialTitle;
39287
39313
  const newSlideCount = data.output.slide_count || 0;
@@ -39333,14 +39359,93 @@ var PresentationJobCard = ({
39333
39359
  }
39334
39360
  };
39335
39361
  if (status === "pending" || status === "running") {
39336
- 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: [
39337
- /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "absolute inset-0 p-[8%] flex flex-col justify-center", children: [
39338
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-[18px] w-[42%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse mb-3" }),
39339
- /* @__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" } }),
39340
- /* @__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" } })
39362
+ const pct = progress?.percentage ?? 0;
39363
+ const step = progress?.current_step ?? "Starting...";
39364
+ const details = progress?.details;
39365
+ const slidesCompleted = details?.slides_completed ?? 0;
39366
+ const slidesTotal = details?.slides_total ?? 0;
39367
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39368
+ const getPhaseIcon = () => {
39369
+ switch (phase) {
39370
+ case "ai_generation":
39371
+ return "\u{1F3A8}";
39372
+ case "processing":
39373
+ return "\u2699\uFE0F";
39374
+ case "uploading":
39375
+ return "\u2601\uFE0F";
39376
+ default:
39377
+ return "\u2728";
39378
+ }
39379
+ };
39380
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: cn("w-full", className), children: [
39381
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39382
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39383
+ "div",
39384
+ {
39385
+ className: "h-[3px] bg-gradient-to-r from-indigo-500 via-purple-500 to-indigo-500 bg-[length:200%_100%] animate-[gradient-shift_2s_ease-in-out_infinite]",
39386
+ style: {
39387
+ backgroundSize: "200% 100%",
39388
+ animation: "gradient-shift 2s ease-in-out infinite"
39389
+ }
39390
+ }
39391
+ ),
39392
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "p-5", children: [
39393
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-start gap-3", children: [
39394
+ /* @__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)("span", { className: "text-lg", children: getPhaseIcon() }) }),
39395
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex-1 min-w-0", children: [
39396
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Creating Presentation" }),
39397
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39398
+ slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation",
39399
+ " \xB7 In progress"
39400
+ ] })
39401
+ ] })
39402
+ ] }),
39403
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "mt-4 space-y-3", children: [
39404
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative", children: [
39405
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39406
+ "div",
39407
+ {
39408
+ className: "h-full bg-gradient-to-r from-indigo-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39409
+ style: { width: `${Math.max(pct, 2)}%` }
39410
+ }
39411
+ ) }),
39412
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39413
+ pct,
39414
+ "%"
39415
+ ] })
39416
+ ] }),
39417
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-2", children: [
39418
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-pulse" }),
39419
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "text-xs text-zinc-400", children: step })
39420
+ ] }),
39421
+ phase === "ai_generation" && slidesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-center gap-2 pt-1", children: [
39422
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex gap-1", children: Array.from({ length: slidesTotal }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
39423
+ "div",
39424
+ {
39425
+ className: cn(
39426
+ "w-6 h-1.5 rounded-full transition-all duration-300",
39427
+ i < slidesCompleted ? "bg-indigo-500" : i === slidesCompleted ? "bg-indigo-500/50 animate-pulse" : "bg-zinc-700"
39428
+ )
39429
+ },
39430
+ i
39431
+ )) }),
39432
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("span", { className: "text-xs text-zinc-500 ml-1", children: [
39433
+ slidesCompleted,
39434
+ "/",
39435
+ slidesTotal,
39436
+ " slides"
39437
+ ] })
39438
+ ] })
39439
+ ] })
39440
+ ] })
39341
39441
  ] }),
39342
- /* @__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" })
39343
- ] }) });
39442
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("style", { children: `
39443
+ @keyframes gradient-shift {
39444
+ 0%, 100% { background-position: 0% 50%; }
39445
+ 50% { background-position: 100% 50%; }
39446
+ }
39447
+ ` })
39448
+ ] });
39344
39449
  }
39345
39450
  if (status === "failed") {
39346
39451
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex items-start gap-3", children: [
@@ -39581,6 +39686,7 @@ var ResearchReportJobCard = (props) => {
39581
39686
  html_url: initialHtmlUrl,
39582
39687
  theme: initialTheme,
39583
39688
  error: initialError,
39689
+ progress: initialProgress,
39584
39690
  pollUrl,
39585
39691
  authToken,
39586
39692
  className,
@@ -39599,6 +39705,7 @@ var ResearchReportJobCard = (props) => {
39599
39705
  const [htmlUrl, setHtmlUrl] = (0, import_react76.useState)(initialHtmlUrl || "");
39600
39706
  const [theme, setTheme] = (0, import_react76.useState)(initialTheme || DEFAULT_THEME);
39601
39707
  const [error, setError] = (0, import_react76.useState)(initialError);
39708
+ const [progress, setProgress] = (0, import_react76.useState)(initialProgress);
39602
39709
  const [showPreview, setShowPreview] = (0, import_react76.useState)(false);
39603
39710
  const [previewScale, setPreviewScale] = (0, import_react76.useState)(1);
39604
39711
  const previewRef = (0, import_react76.useRef)(null);
@@ -39633,12 +39740,18 @@ var ResearchReportJobCard = (props) => {
39633
39740
  (0, import_react76.useEffect)(() => {
39634
39741
  if (initialSummary) setSummary(initialSummary);
39635
39742
  }, [initialSummary]);
39743
+ const themePrimary = initialTheme?.primary;
39636
39744
  (0, import_react76.useEffect)(() => {
39637
39745
  if (initialTheme) setTheme(initialTheme);
39638
- }, [initialTheme]);
39746
+ }, [themePrimary]);
39639
39747
  (0, import_react76.useEffect)(() => {
39640
39748
  if (initialError) setError(initialError);
39641
39749
  }, [initialError]);
39750
+ const progressPct = initialProgress?.percentage;
39751
+ const progressStep = initialProgress?.current_step;
39752
+ (0, import_react76.useEffect)(() => {
39753
+ if (initialProgress) setProgress(initialProgress);
39754
+ }, [progressPct, progressStep]);
39642
39755
  const isTerminal = status === "complete" || status === "failed";
39643
39756
  const primaryColor = theme?.primary || DEFAULT_THEME.primary;
39644
39757
  const hasHTML = Boolean(htmlUrl);
@@ -39667,6 +39780,9 @@ var ResearchReportJobCard = (props) => {
39667
39780
  const data = await res.json();
39668
39781
  const newStatus = data.status;
39669
39782
  setStatus(newStatus);
39783
+ if (data.progress) {
39784
+ setProgress(data.progress);
39785
+ }
39670
39786
  if (newStatus === "complete" && data.output) {
39671
39787
  const output = data.output;
39672
39788
  setTitle(output.title || initialTitle);
@@ -39712,27 +39828,96 @@ var ResearchReportJobCard = (props) => {
39712
39828
  return count.toString();
39713
39829
  };
39714
39830
  if (!status || status === "pending" || status === "running") {
39715
- return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "relative overflow-hidden rounded-2xl border border-zinc-200/70 dark:border-zinc-800 bg-zinc-100 dark:bg-zinc-900", children: [
39716
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[3px] bg-gradient-to-r from-zinc-300 dark:from-zinc-700 via-zinc-200 dark:via-zinc-600 to-zinc-300 dark:to-zinc-700 animate-pulse" }),
39717
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "p-5", children: [
39718
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [
39719
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-10 h-10 rounded-xl bg-zinc-200 dark:bg-zinc-800 animate-pulse flex-shrink-0" }),
39720
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex-1 min-w-0", children: [
39721
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[14px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-700 animate-pulse" }),
39722
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[10px] w-[45%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mt-2", style: { animationDelay: "80ms" } })
39831
+ const pct = progress?.percentage ?? 0;
39832
+ const step = progress?.current_step ?? "Starting...";
39833
+ const details = progress?.details;
39834
+ const searchesCompleted = details?.searches_completed ?? 0;
39835
+ const searchesTotal = details?.searches_total ?? 0;
39836
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39837
+ const getPhaseIcon = () => {
39838
+ switch (phase) {
39839
+ case "ai_generation":
39840
+ return "\u{1F50D}";
39841
+ case "processing":
39842
+ return "\u{1F4DD}";
39843
+ case "uploading":
39844
+ return "\u2601\uFE0F";
39845
+ default:
39846
+ return "\u2728";
39847
+ }
39848
+ };
39849
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: cn("w-full", className), children: [
39850
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39851
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39852
+ "div",
39853
+ {
39854
+ className: "h-[3px] bg-gradient-to-r from-violet-500 via-purple-500 to-violet-500",
39855
+ style: {
39856
+ backgroundSize: "200% 100%",
39857
+ animation: "gradient-shift 2s ease-in-out infinite"
39858
+ }
39859
+ }
39860
+ ),
39861
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "p-5", children: [
39862
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [
39863
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-10 h-10 rounded-xl bg-violet-500/10 border border-violet-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-lg", children: getPhaseIcon() }) }),
39864
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex-1 min-w-0", children: [
39865
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating Research Report" }),
39866
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39867
+ depth && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "capitalize", children: depth }),
39868
+ depth && " \xB7 ",
39869
+ "In progress"
39870
+ ] })
39871
+ ] })
39723
39872
  ] }),
39724
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-1.5 flex-shrink-0", children: [
39725
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-[72px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
39726
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-[88px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-700 animate-pulse", style: { animationDelay: "160ms" } })
39873
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "mt-4 space-y-3", children: [
39874
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "relative", children: [
39875
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39876
+ "div",
39877
+ {
39878
+ className: "h-full bg-gradient-to-r from-violet-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39879
+ style: { width: `${Math.max(pct, 2)}%` }
39880
+ }
39881
+ ) }),
39882
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39883
+ pct,
39884
+ "%"
39885
+ ] })
39886
+ ] }),
39887
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-2", children: [
39888
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-2 h-2 rounded-full bg-violet-500 animate-pulse" }),
39889
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-xs text-zinc-400", children: step })
39890
+ ] }),
39891
+ phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "pt-1", children: [
39892
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center justify-between mb-1.5", children: [
39893
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
39894
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
39895
+ searchesCompleted,
39896
+ "/",
39897
+ searchesTotal
39898
+ ] })
39899
+ ] }),
39900
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "flex gap-1", children: Array.from({ length: Math.min(searchesTotal, 20) }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
39901
+ "div",
39902
+ {
39903
+ className: cn(
39904
+ "flex-1 h-1 rounded-full transition-all duration-300",
39905
+ i < searchesCompleted ? "bg-violet-500" : i === searchesCompleted ? "bg-violet-500/50 animate-pulse" : "bg-zinc-700"
39906
+ )
39907
+ },
39908
+ i
39909
+ )) })
39910
+ ] })
39727
39911
  ] })
39728
- ] }),
39729
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "mt-4 flex items-center gap-2", children: [
39730
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-2 h-2 rounded-full bg-amber-500/60 animate-pulse" }),
39731
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-[10px] w-[120px] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "200ms" } })
39732
39912
  ] })
39733
39913
  ] }),
39734
- /* @__PURE__ */ (0, import_jsx_runtime148.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" })
39735
- ] }) });
39914
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("style", { children: `
39915
+ @keyframes gradient-shift {
39916
+ 0%, 100% { background-position: 0% 50%; }
39917
+ 50% { background-position: 100% 50%; }
39918
+ }
39919
+ ` })
39920
+ ] });
39736
39921
  }
39737
39922
  if (status === "failed") {
39738
39923
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-3", children: [