pxengine 0.1.88 → 0.1.90

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
@@ -33639,14 +33639,22 @@ __export(molecules_exports, {
33639
33639
  TimelineCard: () => TimelineCard,
33640
33640
  TopPostsGrid: () => TopPostsGrid,
33641
33641
  WebSearchJobCard: () => WebSearchJobCard,
33642
+ WidgetThemeContext: () => WidgetThemeContext,
33642
33643
  defaultFetchSelections: () => defaultFetchSelections,
33643
33644
  defaultPersistSelection: () => defaultPersistSelection,
33644
33645
  th: () => th,
33645
33646
  useCreatorWidgetPolling: () => useCreatorWidgetPolling,
33647
+ useWidgetTheme: () => useWidgetTheme,
33646
33648
  withAlpha: () => withAlpha
33647
33649
  });
33648
33650
 
33649
33651
  // src/molecules/generic/widgetTheme.ts
33652
+ import { createContext as createContext5, useContext as useContext6 } from "react";
33653
+ var WidgetThemeContext = createContext5(void 0);
33654
+ function useWidgetTheme(explicit) {
33655
+ const ctx = useContext6(WidgetThemeContext);
33656
+ return explicit ?? ctx;
33657
+ }
33650
33658
  function withAlpha(color, alpha) {
33651
33659
  const hex = color.replace("#", "");
33652
33660
  if (hex.length === 6) {
@@ -33659,13 +33667,22 @@ function withAlpha(color, alpha) {
33659
33667
  }
33660
33668
  function th(theme) {
33661
33669
  const T = theme ?? {};
33670
+ const shape = {
33671
+ ...typeof T.borderWidth === "number" && { borderWidth: T.borderWidth },
33672
+ ...typeof T.radius === "number" && { borderRadius: T.radius },
33673
+ ...T.shadow && { boxShadow: T.shadow },
33674
+ ...T.fontFamily && { fontFamily: T.fontFamily }
33675
+ };
33662
33676
  const root = {
33663
33677
  ...T.background && { backgroundColor: T.background },
33664
- ...T.border && { borderColor: T.border }
33678
+ ...T.border && { borderColor: T.border },
33679
+ ...shape
33665
33680
  };
33666
33681
  const surface = {
33667
33682
  ...T.surface && { backgroundColor: T.surface },
33668
- ...T.border && { borderColor: T.border }
33683
+ ...T.border && { borderColor: T.border },
33684
+ ...typeof T.borderWidth === "number" && { borderWidth: T.borderWidth },
33685
+ ...typeof T.radius === "number" && { borderRadius: Math.max(0, T.radius - 4) }
33669
33686
  };
33670
33687
  const text = {
33671
33688
  ...T.text && { color: T.text }
@@ -33682,10 +33699,31 @@ function th(theme) {
33682
33699
  const accentBorder = {
33683
33700
  ...T.accent && { borderColor: T.accent }
33684
33701
  };
33702
+ const accentText = {
33703
+ ...T.accentForeground && { color: T.accentForeground }
33704
+ };
33685
33705
  const accentSubtle = (alpha = 0.12) => ({
33686
33706
  ...T.accent && { backgroundColor: withAlpha(T.accent, alpha) }
33687
33707
  });
33688
- return { root, surface, text, muted, accent, accentBg, accentBorder, accentSubtle };
33708
+ const semantic = (kind) => ({
33709
+ ...T[kind] && { color: T[kind] }
33710
+ });
33711
+ const gradientBg = {
33712
+ ...T.gradient && { backgroundImage: T.gradient }
33713
+ };
33714
+ return {
33715
+ root,
33716
+ surface,
33717
+ text,
33718
+ muted,
33719
+ accent,
33720
+ accentBg,
33721
+ accentBorder,
33722
+ accentText,
33723
+ accentSubtle,
33724
+ semantic,
33725
+ gradientBg
33726
+ };
33689
33727
  }
33690
33728
 
33691
33729
  // src/molecules/generic/EditableField/EditableField.tsx
@@ -38882,6 +38920,7 @@ var PresentationJobCard = ({
38882
38920
  slide_count: initialSlideCount,
38883
38921
  formats: initialFormats = {},
38884
38922
  error: initialError,
38923
+ progress: initialProgress,
38885
38924
  pollUrl,
38886
38925
  authToken,
38887
38926
  shareUrl,
@@ -38894,6 +38933,7 @@ var PresentationJobCard = ({
38894
38933
  const [slideCount, setSlideCount] = useState10(initialSlideCount ?? 0);
38895
38934
  const [formats, setFormats] = useState10(initialFormats);
38896
38935
  const [error, setError] = useState10(initialError);
38936
+ const [progress, setProgress] = useState10(initialProgress);
38897
38937
  const [showExport, setShowExport] = useState10(false);
38898
38938
  const [showFullscreen, setShowFullscreen] = useState10(false);
38899
38939
  const [copied, setCopied] = useState10(false);
@@ -38903,6 +38943,27 @@ var PresentationJobCard = ({
38903
38943
  const intervalRef = useRef5(null);
38904
38944
  const previewRef = useRef5(null);
38905
38945
  const iframeRef = useRef5(null);
38946
+ useEffect6(() => {
38947
+ setStatus(initialStatus);
38948
+ }, [initialStatus]);
38949
+ const progressPct = initialProgress?.percentage;
38950
+ const progressStep = initialProgress?.current_step;
38951
+ useEffect6(() => {
38952
+ if (initialProgress) setProgress(initialProgress);
38953
+ }, [progressPct, progressStep]);
38954
+ useEffect6(() => {
38955
+ if (initialError) setError(initialError);
38956
+ }, [initialError]);
38957
+ useEffect6(() => {
38958
+ if (initialSlideCount !== void 0) setSlideCount(initialSlideCount);
38959
+ }, [initialSlideCount]);
38960
+ const htmlUrl = initialFormats?.html_url;
38961
+ useEffect6(() => {
38962
+ if (initialFormats) setFormats(initialFormats);
38963
+ }, [htmlUrl]);
38964
+ useEffect6(() => {
38965
+ if (initialTitle) setTitle(initialTitle);
38966
+ }, [initialTitle]);
38906
38967
  const updateScale = useCallback4(() => {
38907
38968
  if (previewRef.current) setPreviewScale(previewRef.current.offsetWidth / 1280);
38908
38969
  }, []);
@@ -38957,6 +39018,9 @@ var PresentationJobCard = ({
38957
39018
  const data = await res.json();
38958
39019
  const newStatus = data.status;
38959
39020
  setStatus(newStatus);
39021
+ if (data.progress) {
39022
+ setProgress(data.progress);
39023
+ }
38960
39024
  if (newStatus === "complete" && data.output) {
38961
39025
  const newTitle = data.output.title || initialTitle;
38962
39026
  const newSlideCount = data.output.slide_count || 0;
@@ -39008,14 +39072,93 @@ var PresentationJobCard = ({
39008
39072
  }
39009
39073
  };
39010
39074
  if (status === "pending" || status === "running") {
39011
- 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: [
39012
- /* @__PURE__ */ jsxs108("div", { className: "absolute inset-0 p-[8%] flex flex-col justify-center", children: [
39013
- /* @__PURE__ */ jsx147("div", { className: "h-[18px] w-[42%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse mb-3" }),
39014
- /* @__PURE__ */ jsx147("div", { className: "h-[11px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mb-2", style: { animationDelay: "120ms" } }),
39015
- /* @__PURE__ */ jsx147("div", { className: "h-[11px] w-[52%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "240ms" } })
39075
+ const pct = progress?.percentage ?? 0;
39076
+ const step = progress?.current_step ?? "Starting...";
39077
+ const details = progress?.details;
39078
+ const slidesCompleted = details?.slides_completed ?? 0;
39079
+ const slidesTotal = details?.slides_total ?? 0;
39080
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39081
+ const getPhaseIcon = () => {
39082
+ switch (phase) {
39083
+ case "ai_generation":
39084
+ return "\u{1F3A8}";
39085
+ case "processing":
39086
+ return "\u2699\uFE0F";
39087
+ case "uploading":
39088
+ return "\u2601\uFE0F";
39089
+ default:
39090
+ return "\u2728";
39091
+ }
39092
+ };
39093
+ return /* @__PURE__ */ jsxs108("div", { className: cn("w-full", className), children: [
39094
+ /* @__PURE__ */ jsxs108("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39095
+ /* @__PURE__ */ jsx147(
39096
+ "div",
39097
+ {
39098
+ 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]",
39099
+ style: {
39100
+ backgroundSize: "200% 100%",
39101
+ animation: "gradient-shift 2s ease-in-out infinite"
39102
+ }
39103
+ }
39104
+ ),
39105
+ /* @__PURE__ */ jsxs108("div", { className: "p-5", children: [
39106
+ /* @__PURE__ */ jsxs108("div", { className: "flex items-start gap-3", children: [
39107
+ /* @__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("span", { className: "text-lg", children: getPhaseIcon() }) }),
39108
+ /* @__PURE__ */ jsxs108("div", { className: "flex-1 min-w-0", children: [
39109
+ /* @__PURE__ */ jsx147("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Creating Presentation" }),
39110
+ /* @__PURE__ */ jsxs108("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39111
+ slidesTotal > 0 ? `${slidesTotal} slides` : "Presentation",
39112
+ " \xB7 In progress"
39113
+ ] })
39114
+ ] })
39115
+ ] }),
39116
+ /* @__PURE__ */ jsxs108("div", { className: "mt-4 space-y-3", children: [
39117
+ /* @__PURE__ */ jsxs108("div", { className: "relative", children: [
39118
+ /* @__PURE__ */ jsx147("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx147(
39119
+ "div",
39120
+ {
39121
+ className: "h-full bg-gradient-to-r from-indigo-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39122
+ style: { width: `${Math.max(pct, 2)}%` }
39123
+ }
39124
+ ) }),
39125
+ /* @__PURE__ */ jsxs108("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39126
+ pct,
39127
+ "%"
39128
+ ] })
39129
+ ] }),
39130
+ /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-2", children: [
39131
+ /* @__PURE__ */ jsx147("div", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-pulse" }),
39132
+ /* @__PURE__ */ jsx147("span", { className: "text-xs text-zinc-400", children: step })
39133
+ ] }),
39134
+ phase === "ai_generation" && slidesTotal > 0 && /* @__PURE__ */ jsxs108("div", { className: "flex items-center gap-2 pt-1", children: [
39135
+ /* @__PURE__ */ jsx147("div", { className: "flex gap-1", children: Array.from({ length: slidesTotal }).map((_, i) => /* @__PURE__ */ jsx147(
39136
+ "div",
39137
+ {
39138
+ className: cn(
39139
+ "w-6 h-1.5 rounded-full transition-all duration-300",
39140
+ i < slidesCompleted ? "bg-indigo-500" : i === slidesCompleted ? "bg-indigo-500/50 animate-pulse" : "bg-zinc-700"
39141
+ )
39142
+ },
39143
+ i
39144
+ )) }),
39145
+ /* @__PURE__ */ jsxs108("span", { className: "text-xs text-zinc-500 ml-1", children: [
39146
+ slidesCompleted,
39147
+ "/",
39148
+ slidesTotal,
39149
+ " slides"
39150
+ ] })
39151
+ ] })
39152
+ ] })
39153
+ ] })
39016
39154
  ] }),
39017
- /* @__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" })
39018
- ] }) });
39155
+ /* @__PURE__ */ jsx147("style", { children: `
39156
+ @keyframes gradient-shift {
39157
+ 0%, 100% { background-position: 0% 50%; }
39158
+ 50% { background-position: 100% 50%; }
39159
+ }
39160
+ ` })
39161
+ ] });
39019
39162
  }
39020
39163
  if (status === "failed") {
39021
39164
  return /* @__PURE__ */ jsx147("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx147("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ jsxs108("div", { className: "flex items-start gap-3", children: [
@@ -39256,6 +39399,7 @@ var ResearchReportJobCard = (props) => {
39256
39399
  html_url: initialHtmlUrl,
39257
39400
  theme: initialTheme,
39258
39401
  error: initialError,
39402
+ progress: initialProgress,
39259
39403
  pollUrl,
39260
39404
  authToken,
39261
39405
  className,
@@ -39274,6 +39418,7 @@ var ResearchReportJobCard = (props) => {
39274
39418
  const [htmlUrl, setHtmlUrl] = useState11(initialHtmlUrl || "");
39275
39419
  const [theme, setTheme] = useState11(initialTheme || DEFAULT_THEME);
39276
39420
  const [error, setError] = useState11(initialError);
39421
+ const [progress, setProgress] = useState11(initialProgress);
39277
39422
  const [showPreview, setShowPreview] = useState11(false);
39278
39423
  const [previewScale, setPreviewScale] = useState11(1);
39279
39424
  const previewRef = useRef6(null);
@@ -39308,12 +39453,18 @@ var ResearchReportJobCard = (props) => {
39308
39453
  useEffect7(() => {
39309
39454
  if (initialSummary) setSummary(initialSummary);
39310
39455
  }, [initialSummary]);
39456
+ const themePrimary = initialTheme?.primary;
39311
39457
  useEffect7(() => {
39312
39458
  if (initialTheme) setTheme(initialTheme);
39313
- }, [initialTheme]);
39459
+ }, [themePrimary]);
39314
39460
  useEffect7(() => {
39315
39461
  if (initialError) setError(initialError);
39316
39462
  }, [initialError]);
39463
+ const progressPct = initialProgress?.percentage;
39464
+ const progressStep = initialProgress?.current_step;
39465
+ useEffect7(() => {
39466
+ if (initialProgress) setProgress(initialProgress);
39467
+ }, [progressPct, progressStep]);
39317
39468
  const isTerminal = status === "complete" || status === "failed";
39318
39469
  const primaryColor = theme?.primary || DEFAULT_THEME.primary;
39319
39470
  const hasHTML = Boolean(htmlUrl);
@@ -39342,6 +39493,9 @@ var ResearchReportJobCard = (props) => {
39342
39493
  const data = await res.json();
39343
39494
  const newStatus = data.status;
39344
39495
  setStatus(newStatus);
39496
+ if (data.progress) {
39497
+ setProgress(data.progress);
39498
+ }
39345
39499
  if (newStatus === "complete" && data.output) {
39346
39500
  const output = data.output;
39347
39501
  setTitle(output.title || initialTitle);
@@ -39387,27 +39541,96 @@ var ResearchReportJobCard = (props) => {
39387
39541
  return count.toString();
39388
39542
  };
39389
39543
  if (!status || status === "pending" || status === "running") {
39390
- return /* @__PURE__ */ jsx148("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs109("div", { className: "relative overflow-hidden rounded-2xl border border-zinc-200/70 dark:border-zinc-800 bg-zinc-100 dark:bg-zinc-900", children: [
39391
- /* @__PURE__ */ jsx148("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" }),
39392
- /* @__PURE__ */ jsxs109("div", { className: "p-5", children: [
39393
- /* @__PURE__ */ jsxs109("div", { className: "flex items-start gap-3", children: [
39394
- /* @__PURE__ */ jsx148("div", { className: "w-10 h-10 rounded-xl bg-zinc-200 dark:bg-zinc-800 animate-pulse flex-shrink-0" }),
39395
- /* @__PURE__ */ jsxs109("div", { className: "flex-1 min-w-0", children: [
39396
- /* @__PURE__ */ jsx148("div", { className: "h-[14px] w-[65%] rounded bg-zinc-200 dark:bg-zinc-700 animate-pulse" }),
39397
- /* @__PURE__ */ jsx148("div", { className: "h-[10px] w-[45%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse mt-2", style: { animationDelay: "80ms" } })
39544
+ const pct = progress?.percentage ?? 0;
39545
+ const step = progress?.current_step ?? "Starting...";
39546
+ const details = progress?.details;
39547
+ const searchesCompleted = details?.searches_completed ?? 0;
39548
+ const searchesTotal = details?.searches_total ?? 0;
39549
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39550
+ const getPhaseIcon = () => {
39551
+ switch (phase) {
39552
+ case "ai_generation":
39553
+ return "\u{1F50D}";
39554
+ case "processing":
39555
+ return "\u{1F4DD}";
39556
+ case "uploading":
39557
+ return "\u2601\uFE0F";
39558
+ default:
39559
+ return "\u2728";
39560
+ }
39561
+ };
39562
+ return /* @__PURE__ */ jsxs109("div", { className: cn("w-full", className), children: [
39563
+ /* @__PURE__ */ jsxs109("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39564
+ /* @__PURE__ */ jsx148(
39565
+ "div",
39566
+ {
39567
+ className: "h-[3px] bg-gradient-to-r from-violet-500 via-purple-500 to-violet-500",
39568
+ style: {
39569
+ backgroundSize: "200% 100%",
39570
+ animation: "gradient-shift 2s ease-in-out infinite"
39571
+ }
39572
+ }
39573
+ ),
39574
+ /* @__PURE__ */ jsxs109("div", { className: "p-5", children: [
39575
+ /* @__PURE__ */ jsxs109("div", { className: "flex items-start gap-3", children: [
39576
+ /* @__PURE__ */ jsx148("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__ */ jsx148("span", { className: "text-lg", children: getPhaseIcon() }) }),
39577
+ /* @__PURE__ */ jsxs109("div", { className: "flex-1 min-w-0", children: [
39578
+ /* @__PURE__ */ jsx148("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: title || "Generating Research Report" }),
39579
+ /* @__PURE__ */ jsxs109("p", { className: "text-xs text-zinc-500 mt-0.5", children: [
39580
+ depth && /* @__PURE__ */ jsx148("span", { className: "capitalize", children: depth }),
39581
+ depth && " \xB7 ",
39582
+ "In progress"
39583
+ ] })
39584
+ ] })
39398
39585
  ] }),
39399
- /* @__PURE__ */ jsxs109("div", { className: "flex items-center gap-1.5 flex-shrink-0", children: [
39400
- /* @__PURE__ */ jsx148("div", { className: "w-[72px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
39401
- /* @__PURE__ */ jsx148("div", { className: "w-[88px] h-7 rounded-lg bg-zinc-200 dark:bg-zinc-700 animate-pulse", style: { animationDelay: "160ms" } })
39586
+ /* @__PURE__ */ jsxs109("div", { className: "mt-4 space-y-3", children: [
39587
+ /* @__PURE__ */ jsxs109("div", { className: "relative", children: [
39588
+ /* @__PURE__ */ jsx148("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx148(
39589
+ "div",
39590
+ {
39591
+ className: "h-full bg-gradient-to-r from-violet-500 to-purple-500 rounded-full transition-all duration-500 ease-out",
39592
+ style: { width: `${Math.max(pct, 2)}%` }
39593
+ }
39594
+ ) }),
39595
+ /* @__PURE__ */ jsxs109("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39596
+ pct,
39597
+ "%"
39598
+ ] })
39599
+ ] }),
39600
+ /* @__PURE__ */ jsxs109("div", { className: "flex items-center gap-2", children: [
39601
+ /* @__PURE__ */ jsx148("div", { className: "w-2 h-2 rounded-full bg-violet-500 animate-pulse" }),
39602
+ /* @__PURE__ */ jsx148("span", { className: "text-xs text-zinc-400", children: step })
39603
+ ] }),
39604
+ phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ jsxs109("div", { className: "pt-1", children: [
39605
+ /* @__PURE__ */ jsxs109("div", { className: "flex items-center justify-between mb-1.5", children: [
39606
+ /* @__PURE__ */ jsx148("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
39607
+ /* @__PURE__ */ jsxs109("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
39608
+ searchesCompleted,
39609
+ "/",
39610
+ searchesTotal
39611
+ ] })
39612
+ ] }),
39613
+ /* @__PURE__ */ jsx148("div", { className: "flex gap-1", children: Array.from({ length: Math.min(searchesTotal, 20) }).map((_, i) => /* @__PURE__ */ jsx148(
39614
+ "div",
39615
+ {
39616
+ className: cn(
39617
+ "flex-1 h-1 rounded-full transition-all duration-300",
39618
+ i < searchesCompleted ? "bg-violet-500" : i === searchesCompleted ? "bg-violet-500/50 animate-pulse" : "bg-zinc-700"
39619
+ )
39620
+ },
39621
+ i
39622
+ )) })
39623
+ ] })
39402
39624
  ] })
39403
- ] }),
39404
- /* @__PURE__ */ jsxs109("div", { className: "mt-4 flex items-center gap-2", children: [
39405
- /* @__PURE__ */ jsx148("div", { className: "w-2 h-2 rounded-full bg-amber-500/60 animate-pulse" }),
39406
- /* @__PURE__ */ jsx148("div", { className: "h-[10px] w-[120px] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "200ms" } })
39407
39625
  ] })
39408
39626
  ] }),
39409
- /* @__PURE__ */ jsx148("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" })
39410
- ] }) });
39627
+ /* @__PURE__ */ jsx148("style", { children: `
39628
+ @keyframes gradient-shift {
39629
+ 0%, 100% { background-position: 0% 50%; }
39630
+ 50% { background-position: 100% 50%; }
39631
+ }
39632
+ ` })
39633
+ ] });
39411
39634
  }
39412
39635
  if (status === "failed") {
39413
39636
  return /* @__PURE__ */ jsx148("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx148("div", { className: "bg-red-950/20 border border-red-800/25 rounded-2xl p-5", children: /* @__PURE__ */ jsxs109("div", { className: "flex items-start gap-3", children: [
@@ -39599,6 +39822,7 @@ var WebSearchJobCard = ({
39599
39822
  summary: initialSummary,
39600
39823
  results: initialResults,
39601
39824
  error: initialError,
39825
+ progress: initialProgress,
39602
39826
  pollUrl,
39603
39827
  authToken,
39604
39828
  className,
@@ -39613,6 +39837,7 @@ var WebSearchJobCard = ({
39613
39837
  const [summary, setSummary] = useState12(initialSummary || "");
39614
39838
  const [results, setResults] = useState12(initialResults || []);
39615
39839
  const [error, setError] = useState12(initialError);
39840
+ const [progress, setProgress] = useState12(initialProgress);
39616
39841
  const intervalRef = useRef7(null);
39617
39842
  const onCompleteRef = useRef7(onComplete);
39618
39843
  const onFailedRef = useRef7(onFailed);
@@ -39643,6 +39868,11 @@ var WebSearchJobCard = ({
39643
39868
  useEffect8(() => {
39644
39869
  if (initialError) setError(initialError);
39645
39870
  }, [initialError]);
39871
+ const progressPct = initialProgress?.percentage;
39872
+ const progressStep = initialProgress?.current_step;
39873
+ useEffect8(() => {
39874
+ if (initialProgress) setProgress(initialProgress);
39875
+ }, [progressPct, progressStep]);
39646
39876
  const isTerminal = status === "complete" || status === "failed";
39647
39877
  useEffect8(() => {
39648
39878
  if (isTerminal || !pollUrl) return;
@@ -39655,6 +39885,9 @@ var WebSearchJobCard = ({
39655
39885
  const data = await res.json();
39656
39886
  const newStatus = data.status;
39657
39887
  setStatus(newStatus);
39888
+ if (data.progress) {
39889
+ setProgress(data.progress);
39890
+ }
39658
39891
  if (newStatus === "complete" && data.output) {
39659
39892
  const output = data.output;
39660
39893
  setQuery(output.query || "");
@@ -39691,31 +39924,87 @@ var WebSearchJobCard = ({
39691
39924
  }
39692
39925
  }, [isTerminal]);
39693
39926
  if (status === "pending" || status === "running") {
39694
- return /* @__PURE__ */ jsx149("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs110("div", { className: "relative overflow-hidden rounded-xl border border-zinc-200/70 dark:border-zinc-800/70 bg-zinc-100 dark:bg-zinc-900", children: [
39695
- /* @__PURE__ */ jsxs110("div", { className: "p-5 space-y-3", children: [
39696
- /* @__PURE__ */ jsxs110("div", { className: "flex items-center gap-3", children: [
39697
- /* @__PURE__ */ jsx149("div", { className: "w-10 h-10 rounded-xl bg-zinc-300 dark:bg-zinc-700 animate-pulse flex-shrink-0" }),
39698
- /* @__PURE__ */ jsxs110("div", { className: "flex-1 space-y-2", children: [
39699
- /* @__PURE__ */ jsx149("div", { className: "h-[13px] w-[60%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse" }),
39700
- /* @__PURE__ */ jsx149("div", { className: "h-[10px] w-[25%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "80ms" } })
39927
+ const pct = progress?.percentage ?? 0;
39928
+ const step = progress?.current_step ?? "Starting web search...";
39929
+ const details = progress?.details;
39930
+ const searchesCompleted = details?.searches_completed ?? 0;
39931
+ const searchesTotal = details?.searches_total ?? 0;
39932
+ const phase = details?.phase ?? progress?.step_type ?? "initializing";
39933
+ const getPhaseIcon = () => {
39934
+ switch (phase) {
39935
+ case "ai_generation":
39936
+ return "\u{1F50D}";
39937
+ case "processing":
39938
+ return "\u2699\uFE0F";
39939
+ case "uploading":
39940
+ return "\u2601\uFE0F";
39941
+ default:
39942
+ return "\u2728";
39943
+ }
39944
+ };
39945
+ return /* @__PURE__ */ jsx149("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsxs110("div", { className: "bg-zinc-900 border border-zinc-800 rounded-2xl overflow-hidden", children: [
39946
+ /* @__PURE__ */ jsx149(
39947
+ "div",
39948
+ {
39949
+ className: "h-[3px]",
39950
+ style: {
39951
+ background: "linear-gradient(90deg, #d97706, #f59e0b, #d97706)",
39952
+ backgroundSize: "200% 100%",
39953
+ animation: "gradient-shift 2s ease-in-out infinite"
39954
+ }
39955
+ }
39956
+ ),
39957
+ /* @__PURE__ */ jsxs110("div", { className: "p-5", children: [
39958
+ /* @__PURE__ */ jsxs110("div", { className: "flex items-start gap-3", children: [
39959
+ /* @__PURE__ */ jsx149("div", { className: "w-10 h-10 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx149("span", { className: "text-lg", children: getPhaseIcon() }) }),
39960
+ /* @__PURE__ */ jsxs110("div", { className: "flex-1 min-w-0", children: [
39961
+ /* @__PURE__ */ jsx149("h3", { className: "text-sm font-semibold text-zinc-100 truncate leading-tight", children: query || initialTitle || "Web Search" }),
39962
+ /* @__PURE__ */ jsx149("p", { className: "text-xs text-zinc-500 mt-0.5", children: "In progress" })
39701
39963
  ] })
39702
39964
  ] }),
39703
- /* @__PURE__ */ jsx149("div", { className: "h-[9px] w-[85%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
39704
- /* @__PURE__ */ jsx149("div", { className: "h-[9px] w-[70%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "160ms" } }),
39705
- /* @__PURE__ */ jsx149("div", { className: "space-y-2 pt-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs110(
39706
- "div",
39707
- {
39708
- className: "rounded-xl border border-zinc-200 dark:border-zinc-800 p-3 space-y-1.5",
39709
- children: [
39710
- /* @__PURE__ */ jsx149("div", { className: "h-[10px] w-[65%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse", style: { animationDelay: `${200 + i * 80}ms` } }),
39711
- /* @__PURE__ */ jsx149("div", { className: "h-[8px] w-[18%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${240 + i * 80}ms` } }),
39712
- /* @__PURE__ */ jsx149("div", { className: "h-[8px] w-[90%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${280 + i * 80}ms` } })
39713
- ]
39714
- },
39715
- i
39716
- )) })
39717
- ] }),
39718
- /* @__PURE__ */ jsx149("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" })
39965
+ /* @__PURE__ */ jsxs110("div", { className: "mt-4 space-y-3", children: [
39966
+ /* @__PURE__ */ jsxs110("div", { className: "relative", children: [
39967
+ /* @__PURE__ */ jsx149("div", { className: "h-2 bg-zinc-800 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx149(
39968
+ "div",
39969
+ {
39970
+ className: "h-full rounded-full transition-all duration-500 ease-out",
39971
+ style: {
39972
+ width: `${Math.max(pct, 2)}%`,
39973
+ background: "linear-gradient(90deg, #d97706, #f59e0b)"
39974
+ }
39975
+ }
39976
+ ) }),
39977
+ /* @__PURE__ */ jsxs110("span", { className: "absolute right-0 -top-5 text-xs text-zinc-500 font-medium tabular-nums", children: [
39978
+ pct,
39979
+ "%"
39980
+ ] })
39981
+ ] }),
39982
+ /* @__PURE__ */ jsxs110("div", { className: "flex items-center gap-2", children: [
39983
+ /* @__PURE__ */ jsx149("div", { className: "w-2 h-2 rounded-full bg-amber-500 animate-pulse flex-shrink-0" }),
39984
+ /* @__PURE__ */ jsx149("span", { className: "text-xs text-zinc-400", children: step })
39985
+ ] }),
39986
+ phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ jsxs110("div", { className: "pt-1", children: [
39987
+ /* @__PURE__ */ jsxs110("div", { className: "flex items-center justify-between mb-1.5", children: [
39988
+ /* @__PURE__ */ jsx149("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
39989
+ /* @__PURE__ */ jsxs110("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
39990
+ searchesCompleted,
39991
+ "/",
39992
+ searchesTotal
39993
+ ] })
39994
+ ] }),
39995
+ /* @__PURE__ */ jsx149("div", { className: "flex gap-1", children: Array.from({ length: Math.min(searchesTotal, 20) }).map((_, i) => /* @__PURE__ */ jsx149(
39996
+ "div",
39997
+ {
39998
+ className: cn(
39999
+ "flex-1 h-1 rounded-full transition-all duration-300",
40000
+ i < searchesCompleted ? "bg-amber-500" : i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40001
+ )
40002
+ },
40003
+ i
40004
+ )) })
40005
+ ] })
40006
+ ] })
40007
+ ] })
39719
40008
  ] }) });
39720
40009
  }
39721
40010
  if (status === "failed") {
@@ -42784,7 +43073,7 @@ function PlatformMetricsBanner({
42784
43073
  return /* @__PURE__ */ jsxs132(
42785
43074
  "div",
42786
43075
  {
42787
- className: "\r\n grid grid-cols-1 gap-3 rounded-xl py-4 px-4 shadow-sm\r\n md:flex md:overflow-x-auto md:gap-6 md:rounded-l-xl md:py-4 md:px-4 md:items-center md:gap-0 md:px-0 md:ml-8\r\n ",
43076
+ className: "\n grid grid-cols-1 gap-3 rounded-xl py-4 px-4 shadow-sm\n md:flex md:overflow-x-auto md:gap-6 md:rounded-l-xl md:py-4 md:px-4 md:items-center md:gap-0 md:px-0 md:ml-8\n ",
42788
43077
  style: { backgroundColor: bgColor },
42789
43078
  children: [
42790
43079
  /* @__PURE__ */ jsxs132("div", { className: "flex flex-col items-center md:min-w-0", children: [
@@ -45830,6 +46119,7 @@ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
45830
46119
 
45831
46120
  // src/render/PXEngineRenderer.tsx
45832
46121
  import { jsx as jsx187, jsxs as jsxs139 } from "react/jsx-runtime";
46122
+ var MOLECULE_REFS = new Set(Object.values(molecules_exports));
45833
46123
  var CONTEXT_DEPENDENT_COMPONENTS = /* @__PURE__ */ new Set([
45834
46124
  // Form components - require FormField + FormItem context
45835
46125
  "FormLabel",
@@ -46023,8 +46313,11 @@ var normalizeProps = (props) => {
46023
46313
  var PXEngineRenderer = ({
46024
46314
  schema,
46025
46315
  onAction,
46026
- disabled
46316
+ disabled,
46317
+ theme
46027
46318
  }) => {
46319
+ const contextTheme = React117.useContext(WidgetThemeContext);
46320
+ const effectiveTheme = theme ?? contextTheme;
46028
46321
  if (!schema) return null;
46029
46322
  const root = schema.root || schema;
46030
46323
  const renderRecursive = (component, index) => {
@@ -46114,6 +46407,9 @@ var PXEngineRenderer = ({
46114
46407
  "ResizableAtom"
46115
46408
  ]);
46116
46409
  const isAtomWithRenderProp = ATOMS_WITH_RENDER.has(atomName);
46410
+ if (effectiveTheme && finalProps.theme === void 0 && MOLECULE_REFS.has(TargetComponent)) {
46411
+ finalProps.theme = effectiveTheme;
46412
+ }
46117
46413
  const finalStyle = { ...dynamicStyle, ...finalProps.style || {} };
46118
46414
  if (isAtomWithRenderProp) {
46119
46415
  return /* @__PURE__ */ jsx187(
@@ -46140,7 +46436,7 @@ var PXEngineRenderer = ({
46140
46436
  );
46141
46437
  }
46142
46438
  };
46143
- return /* @__PURE__ */ jsx187("div", { className: "px-engine-root relative w-full h-full", children: renderRecursive(root) });
46439
+ return /* @__PURE__ */ jsx187(WidgetThemeContext.Provider, { value: effectiveTheme, children: /* @__PURE__ */ jsx187("div", { className: "px-engine-root relative w-full h-full", children: renderRecursive(root) }) });
46144
46440
  };
46145
46441
  export {
46146
46442
  Accordion,
@@ -46449,6 +46745,7 @@ export {
46449
46745
  TopPostsGrid,
46450
46746
  VideoAtom,
46451
46747
  WebSearchJobCard,
46748
+ WidgetThemeContext,
46452
46749
  cn,
46453
46750
  defaultFetchSelections,
46454
46751
  defaultPersistSelection,
@@ -46460,6 +46757,7 @@ export {
46460
46757
  submitWidgetToAgent,
46461
46758
  th,
46462
46759
  useCreatorWidgetPolling,
46760
+ useWidgetTheme,
46463
46761
  withAlpha
46464
46762
  };
46465
46763
  /*! Bundled license information: