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.mjs CHANGED
@@ -34352,11 +34352,12 @@ ActionButton.displayName = "ActionButton";
34352
34352
  // src/molecules/generic/FormCard/FormCard.tsx
34353
34353
  import React87, { useState as useState7 } from "react";
34354
34354
  import { jsx as jsx96, jsxs as jsxs58 } from "react/jsx-runtime";
34355
+ var humanizeKey = (key) => key.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()).trim();
34355
34356
  var FormCard = React87.memo(
34356
34357
  ({
34357
34358
  title,
34358
- fields,
34359
- data,
34359
+ fields = [],
34360
+ data = {},
34360
34361
  editingFields: externalEditingFields,
34361
34362
  changedFields = {},
34362
34363
  savingFields = {},
@@ -34393,6 +34394,9 @@ var FormCard = React87.memo(
34393
34394
  const activeEditingFields = isExternallyControlled ? externalEditingFields || {} : internalEditingFields;
34394
34395
  const resolvedSavingFields = Object.keys(savingFields).length > 0 ? savingFields : internalSavingFields;
34395
34396
  const activeData = internalData;
34397
+ const effectiveFields = Array.isArray(fields) && fields.length > 0 ? fields : Object.keys(activeData || {}).filter(
34398
+ (k) => !k.startsWith("_") && activeData[k] != null && typeof activeData[k] !== "function"
34399
+ ).map((key) => ({ key, label: humanizeKey(key) }));
34396
34400
  const handleFieldEdit = (key) => {
34397
34401
  if (externalOnFieldEdit) {
34398
34402
  externalOnFieldEdit(key);
@@ -34443,7 +34447,7 @@ var FormCard = React87.memo(
34443
34447
  const text = [
34444
34448
  title,
34445
34449
  "",
34446
- ...fields.map((field) => {
34450
+ ...effectiveFields.map((field) => {
34447
34451
  const value = activeData[field.key];
34448
34452
  return `${field.label}: ${flattenValue(value)}`;
34449
34453
  })
@@ -34490,7 +34494,7 @@ var FormCard = React87.memo(
34490
34494
  }
34491
34495
  }
34492
34496
  ),
34493
- fields.map((field, index) => /* @__PURE__ */ jsx96(
34497
+ effectiveFields.map((field, index) => /* @__PURE__ */ jsx96(
34494
34498
  EditableField,
34495
34499
  {
34496
34500
  label: field.label,
@@ -34509,7 +34513,7 @@ var FormCard = React87.memo(
34509
34513
  renderEdit: field.renderEdit,
34510
34514
  showIndex: showTimeline,
34511
34515
  index,
34512
- totalFields: fields.length
34516
+ totalFields: effectiveFields.length
34513
34517
  },
34514
34518
  field.key
34515
34519
  ))
@@ -39341,6 +39345,19 @@ var DEFAULT_THEME = {
39341
39345
  secondary: "#a78bfa",
39342
39346
  accent: "#c4b5fd"
39343
39347
  };
39348
+ function readableOn(bg) {
39349
+ if (!bg || typeof bg !== "string") return "#ffffff";
39350
+ const hex = bg.replace("#", "");
39351
+ if (hex.length !== 6) return "#ffffff";
39352
+ const n = parseInt(hex, 16);
39353
+ if (Number.isNaN(n)) return "#ffffff";
39354
+ const ch = [n >> 16 & 255, n >> 8 & 255, n & 255].map((c) => {
39355
+ const x = c / 255;
39356
+ return x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
39357
+ });
39358
+ const lum = 0.2126 * ch[0] + 0.7152 * ch[1] + 0.0722 * ch[2];
39359
+ return lum > 0.5 ? "#1a1a1a" : "#ffffff";
39360
+ }
39344
39361
  var DownloadIcon2 = () => /* @__PURE__ */ jsxs109("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39345
39362
  /* @__PURE__ */ jsx148("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
39346
39363
  /* @__PURE__ */ jsx148("polyline", { points: "7 10 12 15 17 10" }),
@@ -39763,8 +39780,8 @@ var ResearchReportJobCard = (props) => {
39763
39780
  {
39764
39781
  onClick: handleDownload,
39765
39782
  disabled: !hasHTML,
39766
- 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",
39767
- style: { backgroundColor: primaryColor },
39783
+ 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",
39784
+ style: { backgroundColor: primaryColor, color: readableOn(primaryColor) },
39768
39785
  onMouseEnter: (e) => e.currentTarget.style.filter = "brightness(1.15)",
39769
39786
  onMouseLeave: (e) => e.currentTarget.style.filter = "brightness(1)",
39770
39787
  children: [
@@ -40005,7 +40022,7 @@ var WebSearchJobCard = ({
40005
40022
  /* @__PURE__ */ jsx149("div", { className: "w-2 h-2 rounded-full bg-amber-500 animate-pulse flex-shrink-0" }),
40006
40023
  /* @__PURE__ */ jsx149("span", { className: "text-xs text-zinc-400", children: step })
40007
40024
  ] }),
40008
- phase === "ai_generation" && searchesTotal > 0 && /* @__PURE__ */ jsxs110("div", { className: "pt-1", children: [
40025
+ searchesTotal > 0 && /* @__PURE__ */ jsxs110("div", { className: "pt-1", children: [
40009
40026
  /* @__PURE__ */ jsxs110("div", { className: "flex items-center justify-between mb-1.5", children: [
40010
40027
  /* @__PURE__ */ jsx149("span", { className: "text-xs text-zinc-500", children: "Web searches" }),
40011
40028
  /* @__PURE__ */ jsxs110("span", { className: "text-xs text-zinc-500 tabular-nums", children: [
@@ -40019,7 +40036,7 @@ var WebSearchJobCard = ({
40019
40036
  {
40020
40037
  className: cn(
40021
40038
  "flex-1 h-1 rounded-full transition-all duration-300",
40022
- i < searchesCompleted ? "bg-amber-500" : i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40039
+ i < searchesCompleted ? "bg-amber-500" : phase === "ai_generation" && i === searchesCompleted ? "bg-amber-500/50 animate-pulse" : "bg-zinc-700"
40023
40040
  )
40024
40041
  },
40025
40042
  i