pxengine 0.1.92 → 0.1.94

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
@@ -34679,11 +34679,12 @@ ActionButton.displayName = "ActionButton";
34679
34679
  // src/molecules/generic/FormCard/FormCard.tsx
34680
34680
  var import_react57 = __toESM(require("react"), 1);
34681
34681
  var import_jsx_runtime96 = require("react/jsx-runtime");
34682
+ var humanizeKey = (key) => key.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()).trim();
34682
34683
  var FormCard = import_react57.default.memo(
34683
34684
  ({
34684
34685
  title,
34685
- fields,
34686
- data,
34686
+ fields = [],
34687
+ data = {},
34687
34688
  editingFields: externalEditingFields,
34688
34689
  changedFields = {},
34689
34690
  savingFields = {},
@@ -34720,6 +34721,9 @@ var FormCard = import_react57.default.memo(
34720
34721
  const activeEditingFields = isExternallyControlled ? externalEditingFields || {} : internalEditingFields;
34721
34722
  const resolvedSavingFields = Object.keys(savingFields).length > 0 ? savingFields : internalSavingFields;
34722
34723
  const activeData = internalData;
34724
+ const effectiveFields = Array.isArray(fields) && fields.length > 0 ? fields : Object.keys(activeData || {}).filter(
34725
+ (k) => !k.startsWith("_") && activeData[k] != null && typeof activeData[k] !== "function"
34726
+ ).map((key) => ({ key, label: humanizeKey(key) }));
34723
34727
  const handleFieldEdit = (key) => {
34724
34728
  if (externalOnFieldEdit) {
34725
34729
  externalOnFieldEdit(key);
@@ -34770,7 +34774,7 @@ var FormCard = import_react57.default.memo(
34770
34774
  const text = [
34771
34775
  title,
34772
34776
  "",
34773
- ...fields.map((field) => {
34777
+ ...effectiveFields.map((field) => {
34774
34778
  const value = activeData[field.key];
34775
34779
  return `${field.label}: ${flattenValue(value)}`;
34776
34780
  })
@@ -34817,7 +34821,7 @@ var FormCard = import_react57.default.memo(
34817
34821
  }
34818
34822
  }
34819
34823
  ),
34820
- fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34824
+ effectiveFields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34821
34825
  EditableField,
34822
34826
  {
34823
34827
  label: field.label,
@@ -34836,7 +34840,7 @@ var FormCard = import_react57.default.memo(
34836
34840
  renderEdit: field.renderEdit,
34837
34841
  showIndex: showTimeline,
34838
34842
  index,
34839
- totalFields: fields.length
34843
+ totalFields: effectiveFields.length
34840
34844
  },
34841
34845
  field.key
34842
34846
  ))
@@ -39668,6 +39672,19 @@ var DEFAULT_THEME = {
39668
39672
  secondary: "#a78bfa",
39669
39673
  accent: "#c4b5fd"
39670
39674
  };
39675
+ function readableOn(bg) {
39676
+ if (!bg || typeof bg !== "string") return "#ffffff";
39677
+ const hex = bg.replace("#", "");
39678
+ if (hex.length !== 6) return "#ffffff";
39679
+ const n = parseInt(hex, 16);
39680
+ if (Number.isNaN(n)) return "#ffffff";
39681
+ const ch = [n >> 16 & 255, n >> 8 & 255, n & 255].map((c) => {
39682
+ const x = c / 255;
39683
+ return x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
39684
+ });
39685
+ const lum = 0.2126 * ch[0] + 0.7152 * ch[1] + 0.0722 * ch[2];
39686
+ return lum > 0.5 ? "#1a1a1a" : "#ffffff";
39687
+ }
39671
39688
  var DownloadIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39672
39689
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
39673
39690
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("polyline", { points: "7 10 12 15 17 10" }),
@@ -40090,8 +40107,8 @@ var ResearchReportJobCard = (props) => {
40090
40107
  {
40091
40108
  onClick: handleDownload,
40092
40109
  disabled: !hasHTML,
40093
- className: "flex items-center gap-1.5 px-2.5 h-7 text-white text-xs font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
40094
- style: { backgroundColor: primaryColor },
40110
+ className: "flex items-center gap-1.5 px-2.5 h-7 text-xs font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
40111
+ style: { backgroundColor: primaryColor, color: readableOn(primaryColor) },
40095
40112
  onMouseEnter: (e) => e.currentTarget.style.filter = "brightness(1.15)",
40096
40113
  onMouseLeave: (e) => e.currentTarget.style.filter = "brightness(1)",
40097
40114
  children: [
@@ -40332,7 +40349,7 @@ var WebSearchJobCard = ({
40332
40349
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "w-2 h-2 rounded-full bg-amber-500 animate-pulse flex-shrink-0" }),
40333
40350
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-xs text-zinc-400", children: step })
40334
40351
  ] }),
40335
- phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "pt-1", children: [
40352
+ searchesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "pt-1", children: [
40336
40353
  /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center justify-between mb-1.5", children: [
40337
40354
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
40338
40355
  /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
@@ -40346,7 +40363,7 @@ var WebSearchJobCard = ({
40346
40363
  {
40347
40364
  className: cn(
40348
40365
  "flex-1 h-1 rounded-full transition-all duration-300",
40349
- i < searchesCompleted ? "bg-amber-500" : i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40366
+ i < searchesCompleted ? "bg-amber-500" : phase === "ai_generation" && i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40350
40367
  )
40351
40368
  },
40352
40369
  i