pxengine 0.1.89 → 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
@@ -39784,6 +39822,7 @@ var WebSearchJobCard = ({
39784
39822
  summary: initialSummary,
39785
39823
  results: initialResults,
39786
39824
  error: initialError,
39825
+ progress: initialProgress,
39787
39826
  pollUrl,
39788
39827
  authToken,
39789
39828
  className,
@@ -39798,6 +39837,7 @@ var WebSearchJobCard = ({
39798
39837
  const [summary, setSummary] = useState12(initialSummary || "");
39799
39838
  const [results, setResults] = useState12(initialResults || []);
39800
39839
  const [error, setError] = useState12(initialError);
39840
+ const [progress, setProgress] = useState12(initialProgress);
39801
39841
  const intervalRef = useRef7(null);
39802
39842
  const onCompleteRef = useRef7(onComplete);
39803
39843
  const onFailedRef = useRef7(onFailed);
@@ -39828,6 +39868,11 @@ var WebSearchJobCard = ({
39828
39868
  useEffect8(() => {
39829
39869
  if (initialError) setError(initialError);
39830
39870
  }, [initialError]);
39871
+ const progressPct = initialProgress?.percentage;
39872
+ const progressStep = initialProgress?.current_step;
39873
+ useEffect8(() => {
39874
+ if (initialProgress) setProgress(initialProgress);
39875
+ }, [progressPct, progressStep]);
39831
39876
  const isTerminal = status === "complete" || status === "failed";
39832
39877
  useEffect8(() => {
39833
39878
  if (isTerminal || !pollUrl) return;
@@ -39840,6 +39885,9 @@ var WebSearchJobCard = ({
39840
39885
  const data = await res.json();
39841
39886
  const newStatus = data.status;
39842
39887
  setStatus(newStatus);
39888
+ if (data.progress) {
39889
+ setProgress(data.progress);
39890
+ }
39843
39891
  if (newStatus === "complete" && data.output) {
39844
39892
  const output = data.output;
39845
39893
  setQuery(output.query || "");
@@ -39876,31 +39924,87 @@ var WebSearchJobCard = ({
39876
39924
  }
39877
39925
  }, [isTerminal]);
39878
39926
  if (status === "pending" || status === "running") {
39879
- 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: [
39880
- /* @__PURE__ */ jsxs110("div", { className: "p-5 space-y-3", children: [
39881
- /* @__PURE__ */ jsxs110("div", { className: "flex items-center gap-3", children: [
39882
- /* @__PURE__ */ jsx149("div", { className: "w-10 h-10 rounded-xl bg-zinc-300 dark:bg-zinc-700 animate-pulse flex-shrink-0" }),
39883
- /* @__PURE__ */ jsxs110("div", { className: "flex-1 space-y-2", children: [
39884
- /* @__PURE__ */ jsx149("div", { className: "h-[13px] w-[60%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse" }),
39885
- /* @__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" })
39886
39963
  ] })
39887
39964
  ] }),
39888
- /* @__PURE__ */ jsx149("div", { className: "h-[9px] w-[85%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "120ms" } }),
39889
- /* @__PURE__ */ jsx149("div", { className: "h-[9px] w-[70%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: "160ms" } }),
39890
- /* @__PURE__ */ jsx149("div", { className: "space-y-2 pt-1", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs110(
39891
- "div",
39892
- {
39893
- className: "rounded-xl border border-zinc-200 dark:border-zinc-800 p-3 space-y-1.5",
39894
- children: [
39895
- /* @__PURE__ */ jsx149("div", { className: "h-[10px] w-[65%] rounded bg-zinc-300 dark:bg-zinc-700 animate-pulse", style: { animationDelay: `${200 + i * 80}ms` } }),
39896
- /* @__PURE__ */ jsx149("div", { className: "h-[8px] w-[18%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${240 + i * 80}ms` } }),
39897
- /* @__PURE__ */ jsx149("div", { className: "h-[8px] w-[90%] rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse", style: { animationDelay: `${280 + i * 80}ms` } })
39898
- ]
39899
- },
39900
- i
39901
- )) })
39902
- ] }),
39903
- /* @__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
+ ] })
39904
40008
  ] }) });
39905
40009
  }
39906
40010
  if (status === "failed") {
@@ -42969,7 +43073,7 @@ function PlatformMetricsBanner({
42969
43073
  return /* @__PURE__ */ jsxs132(
42970
43074
  "div",
42971
43075
  {
42972
- 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 ",
42973
43077
  style: { backgroundColor: bgColor },
42974
43078
  children: [
42975
43079
  /* @__PURE__ */ jsxs132("div", { className: "flex flex-col items-center md:min-w-0", children: [
@@ -46015,6 +46119,7 @@ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
46015
46119
 
46016
46120
  // src/render/PXEngineRenderer.tsx
46017
46121
  import { jsx as jsx187, jsxs as jsxs139 } from "react/jsx-runtime";
46122
+ var MOLECULE_REFS = new Set(Object.values(molecules_exports));
46018
46123
  var CONTEXT_DEPENDENT_COMPONENTS = /* @__PURE__ */ new Set([
46019
46124
  // Form components - require FormField + FormItem context
46020
46125
  "FormLabel",
@@ -46208,8 +46313,11 @@ var normalizeProps = (props) => {
46208
46313
  var PXEngineRenderer = ({
46209
46314
  schema,
46210
46315
  onAction,
46211
- disabled
46316
+ disabled,
46317
+ theme
46212
46318
  }) => {
46319
+ const contextTheme = React117.useContext(WidgetThemeContext);
46320
+ const effectiveTheme = theme ?? contextTheme;
46213
46321
  if (!schema) return null;
46214
46322
  const root = schema.root || schema;
46215
46323
  const renderRecursive = (component, index) => {
@@ -46299,6 +46407,9 @@ var PXEngineRenderer = ({
46299
46407
  "ResizableAtom"
46300
46408
  ]);
46301
46409
  const isAtomWithRenderProp = ATOMS_WITH_RENDER.has(atomName);
46410
+ if (effectiveTheme && finalProps.theme === void 0 && MOLECULE_REFS.has(TargetComponent)) {
46411
+ finalProps.theme = effectiveTheme;
46412
+ }
46302
46413
  const finalStyle = { ...dynamicStyle, ...finalProps.style || {} };
46303
46414
  if (isAtomWithRenderProp) {
46304
46415
  return /* @__PURE__ */ jsx187(
@@ -46325,7 +46436,7 @@ var PXEngineRenderer = ({
46325
46436
  );
46326
46437
  }
46327
46438
  };
46328
- 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) }) });
46329
46440
  };
46330
46441
  export {
46331
46442
  Accordion,
@@ -46634,6 +46745,7 @@ export {
46634
46745
  TopPostsGrid,
46635
46746
  VideoAtom,
46636
46747
  WebSearchJobCard,
46748
+ WidgetThemeContext,
46637
46749
  cn,
46638
46750
  defaultFetchSelections,
46639
46751
  defaultPersistSelection,
@@ -46645,6 +46757,7 @@ export {
46645
46757
  submitWidgetToAgent,
46646
46758
  th,
46647
46759
  useCreatorWidgetPolling,
46760
+ useWidgetTheme,
46648
46761
  withAlpha
46649
46762
  };
46650
46763
  /*! Bundled license information: