@pipelex/mthds-form 0.6.0 → 0.8.0

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.
@@ -247,6 +247,26 @@ type StuffViewerView = 'rendered' | 'json';
247
247
  interface StuffViewerProps {
248
248
  field: RunField;
249
249
  value: unknown;
250
+ /**
251
+ * The STUFF's name, for the header — `report_pages`, not `output`.
252
+ *
253
+ * A result descriptor's root node is named by the engine that built it, and
254
+ * `build_output_form` calls it `output` for every pipe there has ever been.
255
+ * That is correct in the artifact: the descriptor describes a pipe's output
256
+ * slot, which has no name of its own. It is wrong on screen, where the reader
257
+ * is looking at ONE data item and every other surface — the graph node they
258
+ * clicked, the input panel beside it, the method's own code — calls that item
259
+ * by the name the author gave it.
260
+ *
261
+ * So the name comes from the caller, because only the caller knows it: the
262
+ * graph knows which node was opened, a run page knows which variable it is
263
+ * showing. Absent, the descriptor's own name stands, which keeps a host that
264
+ * has nothing better to say honest rather than blank.
265
+ *
266
+ * It also supplies `downloadBaseName`'s default, so the file a reader saves
267
+ * is named after the thing they were reading rather than `output.json`.
268
+ */
269
+ name?: string;
250
270
  /** Which view opens first. Rendered, unless a host has a reason. */
251
271
  defaultView?: StuffViewerView;
252
272
  /**
@@ -276,7 +296,7 @@ interface StuffViewerProps {
276
296
  declare function JsonView({ value }: {
277
297
  value: unknown;
278
298
  }): react.JSX.Element;
279
- declare function StuffViewer({ field, value, defaultView, downloadBaseName, hideDownload, className, }: StuffViewerProps): react.JSX.Element;
299
+ declare function StuffViewer({ field, value, name, defaultView, downloadBaseName, hideDownload, className, }: StuffViewerProps): react.JSX.Element;
280
300
 
281
301
  /** How a host turns a stored reference into something fetchable. */
282
302
  type ResolveForDownload = (url: string) => string | undefined;
@@ -75,7 +75,7 @@ var Switch = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
75
75
  SwitchPrimitives.Root,
76
76
  {
77
77
  className: cn(
78
- "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
78
+ "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
79
79
  className
80
80
  ),
81
81
  ...props,
@@ -247,9 +247,9 @@ function FieldShell({
247
247
  var fieldControlClass = cn(
248
248
  "w-full rounded-md border border-border bg-input text-sm text-foreground",
249
249
  "placeholder:text-muted-foreground/70 transition-colors",
250
- "focus-visible:outline-none focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/40",
250
+ "focus-visible:outline-hidden focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/40",
251
251
  "disabled:cursor-not-allowed disabled:opacity-50",
252
- "aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30"
252
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/30"
253
253
  );
254
254
  function DateField({ field, value, onChange, id, error, disabled }) {
255
255
  const domId = useFieldDomId(id);
@@ -478,7 +478,7 @@ function FileField({
478
478
  type: "button",
479
479
  disabled: busy,
480
480
  onClick: () => setShowUrl(true),
481
- className: "inline-flex items-center gap-1 font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",
481
+ className: "flex w-fit items-center gap-1 font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",
482
482
  children: [
483
483
  /* @__PURE__ */ jsx(Link2, { className: "h-3 w-3" }),
484
484
  s.pasteUrlInstead
@@ -588,7 +588,7 @@ var SelectTrigger = React2.forwardRef(({ className, children, ...props }, ref) =
588
588
  // Adapted from the registry to DESIGN.md ("Inputs"): the `--input` surface,
589
589
  // a hairline `--border`, and a border-color focus signal instead of the
590
590
  // upstream 2px focus ring ("No focus glow by default").
591
- "flex h-10 w-full items-center justify-between rounded-md border border-border bg-input px-3 py-2 text-sm transition-colors data-[placeholder]:text-muted-foreground focus:border-ring focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive [&>span]:line-clamp-1",
591
+ "flex h-10 w-full items-center justify-between rounded-md border border-border bg-input px-3 py-2 text-sm transition-colors data-placeholder:text-muted-foreground focus:border-ring focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive [&>span]:line-clamp-1",
592
592
  className
593
593
  ),
594
594
  ...props,
@@ -624,7 +624,7 @@ var SelectContent = React2.forwardRef(({ className, children, position = "popper
624
624
  {
625
625
  ref,
626
626
  className: cn(
627
- "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
627
+ "relative z-50 max-h-(--radix-select-content-available-height) min-w-32 overflow-y-auto overflow-x-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",
628
628
  position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
629
629
  className
630
630
  ),
@@ -637,7 +637,7 @@ var SelectContent = React2.forwardRef(({ className, children, position = "popper
637
637
  {
638
638
  className: cn(
639
639
  "p-1",
640
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
640
+ position === "popper" && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"
641
641
  ),
642
642
  children
643
643
  }
@@ -661,7 +661,7 @@ var SelectItem = React2.forwardRef(({ className, children, ...props }, ref) => /
661
661
  {
662
662
  ref,
663
663
  className: cn(
664
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
664
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
665
665
  className
666
666
  ),
667
667
  ...props,
@@ -682,7 +682,7 @@ var SelectSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__
682
682
  ));
683
683
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
684
684
  var toggleVariants = cva(
685
- "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
685
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
686
686
  {
687
687
  variants: {
688
688
  variant: {
@@ -932,7 +932,7 @@ function ProseField({ field, value, onChange, id, error, disabled }) {
932
932
  onChange: (e) => onChange(e.target.value === "" ? void 0 : e.target.value),
933
933
  className: cn(
934
934
  fieldControlClass,
935
- "min-h-[88px] resize-y px-3 py-2.5 leading-relaxed [field-sizing:content]"
935
+ "min-h-[88px] resize-y px-3 py-2.5 leading-relaxed field-sizing-content"
936
936
  )
937
937
  }
938
938
  )
@@ -946,7 +946,7 @@ function OptionalToggle({ count, expanded, onToggle, noun = "field" }) {
946
946
  {
947
947
  type: "button",
948
948
  onClick: onToggle,
949
- className: "inline-flex items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",
949
+ className: "flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",
950
950
  children: [
951
951
  expanded ? /* @__PURE__ */ jsx(Minus, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
952
952
  expanded ? noun === "field" ? s.hideOptionalFields : s.hideOptionalInputs : noun === "field" ? s.optionalFieldsCount(count) : s.optionalInputsCount(count)
@@ -1533,7 +1533,7 @@ function Block({ token }) {
1533
1533
  // for no gain — the lines are prose, and prose wraps. Real code loses
1534
1534
  // its column alignment and keeps every character, which is the better
1535
1535
  // half of that trade at this width.
1536
- /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap break-words rounded-md border border-border bg-card/40 p-2.5 text-[12px]", children: /* @__PURE__ */ jsx("code", { children: code.text }) })
1536
+ /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap wrap-break-word rounded-md border border-border bg-card/40 p-2.5 text-[12px]", children: /* @__PURE__ */ jsx("code", { children: code.text }) })
1537
1537
  );
1538
1538
  }
1539
1539
  case "blockquote":
@@ -1659,7 +1659,7 @@ function Described({ description, children }) {
1659
1659
  "span",
1660
1660
  {
1661
1661
  tabIndex: 0,
1662
- className: "-mx-1 cursor-help rounded px-1 outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",
1662
+ className: "-mx-1 cursor-help rounded px-1 outline-hidden transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",
1663
1663
  children
1664
1664
  }
1665
1665
  ) }),
@@ -1713,7 +1713,7 @@ function stringifyValue(value) {
1713
1713
  function RawValue({ value, compact }) {
1714
1714
  const text = stringifyValue(value);
1715
1715
  if (text === void 0) return /* @__PURE__ */ jsx(Absent, {});
1716
- return compact ? /* @__PURE__ */ jsx("span", { title: text, className: "truncate font-mono text-[12px] text-foreground", children: text }) : /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-border bg-card/40 px-2.5 py-1.5 font-mono text-[12px] leading-relaxed text-foreground", children: text });
1716
+ return compact ? /* @__PURE__ */ jsx("span", { title: text, className: "truncate font-mono text-[12px] text-foreground", children: text }) : /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto whitespace-pre-wrap wrap-break-word rounded-md border border-border bg-card/40 px-2.5 py-1.5 font-mono text-[12px] leading-relaxed text-foreground", children: text });
1717
1717
  }
1718
1718
  function Scalar({ value, compact = false }) {
1719
1719
  if (value === null || value === void 0 || value === "") return /* @__PURE__ */ jsx(Absent, {});
@@ -1780,7 +1780,7 @@ function CopyButton({
1780
1780
  },
1781
1781
  ...title ? { title } : {},
1782
1782
  "aria-label": label,
1783
- className: "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1",
1783
+ className: "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
1784
1784
  children: copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": true, className: "size-3.5" })
1785
1785
  }
1786
1786
  );
@@ -1854,7 +1854,7 @@ function DocumentPreview({ url, name }) {
1854
1854
  title: name,
1855
1855
  loading: "lazy",
1856
1856
  referrerPolicy: "no-referrer",
1857
- className: "h-[28rem] w-full rounded-lg border border-border bg-card/40"
1857
+ className: "h-112 w-full rounded-lg border border-border bg-card/40"
1858
1858
  }
1859
1859
  );
1860
1860
  }
@@ -1888,7 +1888,7 @@ function DocumentValue({ value }) {
1888
1888
  type: "button",
1889
1889
  onClick: () => setOpen((current) => !current),
1890
1890
  "aria-expanded": open,
1891
- className: "flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1",
1891
+ className: "flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
1892
1892
  children: [
1893
1893
  open ? /* @__PURE__ */ jsx(EyeOff, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Eye, { "aria-hidden": true, className: "size-3.5" }),
1894
1894
  s.preview
@@ -1941,7 +1941,7 @@ function ImageValue({
1941
1941
  // times that tall — a generated report image is the RESULT here,
1942
1942
  // not a decoration beside one, and it was unreadable at that size.
1943
1943
  // `object-contain` keeps the aspect ratio when the cap bites.
1944
- !inGallery && !compact && "max-h-[44rem] w-full rounded-lg border border-border object-contain"
1944
+ !inGallery && !compact && "max-h-176 w-full rounded-lg border border-border object-contain"
1945
1945
  )
1946
1946
  }
1947
1947
  )
@@ -2062,14 +2062,22 @@ function LoadingImage({ src, alt, className }) {
2062
2062
  ] });
2063
2063
  }
2064
2064
  function ScalarChips({ field, items }) {
2065
- return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, index) => /* @__PURE__ */ jsx(
2066
- "span",
2067
- {
2068
- className: "rounded-md border border-border bg-card/40 px-2 py-0.5 text-[12.5px] text-foreground",
2069
- children: /* @__PURE__ */ jsx(LeafValue, { field, value: item })
2070
- },
2071
- index
2072
- )) });
2065
+ return (
2066
+ // `data-chips` is the hook the definition grid's value cell reaches through:
2067
+ // `text-right` has no effect on flex children, so a row of tags would keep
2068
+ // starting under its label while every value beside it ended at the right
2069
+ // edge. The attribute keeps that one selector out of this component's own
2070
+ // class list - chips are laid out the same way everywhere, and only the
2071
+ // caller knows which edge they should end on.
2072
+ /* @__PURE__ */ jsx("div", { "data-chips": true, className: "flex flex-wrap gap-1.5", children: items.map((item, index) => /* @__PURE__ */ jsx(
2073
+ "span",
2074
+ {
2075
+ className: "rounded-md border border-border bg-card/40 px-2 py-0.5 text-[12.5px] text-foreground",
2076
+ children: /* @__PURE__ */ jsx(LeafValue, { field, value: item })
2077
+ },
2078
+ index
2079
+ )) })
2080
+ );
2073
2081
  }
2074
2082
  function ItemCount({ count }) {
2075
2083
  const s = useFieldStrings();
@@ -2080,6 +2088,7 @@ function isInlineColumn(field) {
2080
2088
  return TABULAR_KINDS.has(field.kind);
2081
2089
  }
2082
2090
  var CELL_LENGTH_LIMIT = 80;
2091
+ var EXPAND_COLUMN = "2rem";
2083
2092
  function fitsACellWhole(field) {
2084
2093
  switch (field.kind) {
2085
2094
  case "boolean":
@@ -2148,9 +2157,9 @@ function ObjectTable({
2148
2157
  "aria-label": label,
2149
2158
  tabIndex: 0,
2150
2159
  className: "overflow-x-auto rounded-lg border border-border",
2151
- children: /* @__PURE__ */ jsxs("table", { className: "min-w-full border-collapse text-[13px]", children: [
2152
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border bg-card/40 text-left", children: [
2153
- canExpand && /* @__PURE__ */ jsx("th", { scope: "col", className: "w-8 px-1", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: s.rowDetailsColumn }) }),
2160
+ children: /* @__PURE__ */ jsxs("table", { className: "w-full min-w-full border-collapse text-[13px]", children: [
2161
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border bg-muted text-left", children: [
2162
+ canExpand && /* @__PURE__ */ jsx("th", { scope: "col", style: { width: EXPAND_COLUMN }, className: "px-1", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: s.rowDetailsColumn }) }),
2154
2163
  columns.map((column) => /* @__PURE__ */ jsx(
2155
2164
  "th",
2156
2165
  {
@@ -2167,14 +2176,14 @@ function ObjectTable({
2167
2176
  /* @__PURE__ */ jsx("tbody", { children: items.map((item, index) => {
2168
2177
  const isOpen = expanded.has(index);
2169
2178
  return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border/60 last:border-b-0", children: [
2170
- canExpand && /* @__PURE__ */ jsx("td", { className: "px-1 align-top", children: /* @__PURE__ */ jsx(
2179
+ canExpand && /* @__PURE__ */ jsx("td", { className: "px-1 pt-px align-top", children: /* @__PURE__ */ jsx(
2171
2180
  "button",
2172
2181
  {
2173
2182
  type: "button",
2174
2183
  onClick: () => toggle(index),
2175
2184
  "aria-expanded": isOpen,
2176
2185
  "aria-label": s.toggleRowDetails(index + 1),
2177
- className: "mt-0.5 flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1",
2186
+ className: "mt-0.5 flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
2178
2187
  children: isOpen ? /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true, className: "size-3.5" })
2179
2188
  }
2180
2189
  ) }),
@@ -2182,7 +2191,15 @@ function ObjectTable({
2182
2191
  "div",
2183
2192
  {
2184
2193
  className: "sticky left-0 px-3.5 py-3",
2185
- ...viewportWidth ? { style: { width: viewportWidth } } : {},
2194
+ ...viewportWidth ? {
2195
+ style: {
2196
+ // Minus the chevron column: this cell starts
2197
+ // after it, so pinning it to the FULL visible
2198
+ // width pushes its right edge that far past the
2199
+ // scroller. See `EXPAND_COLUMN`.
2200
+ width: canExpand ? `calc(${viewportWidth}px - ${EXPAND_COLUMN})` : viewportWidth
2201
+ }
2202
+ } : {},
2186
2203
  children: /* @__PURE__ */ jsx(ResultField, { field: element, value: item, hideLabel: true })
2187
2204
  }
2188
2205
  ) }) : columns.map((column) => {
@@ -2326,7 +2343,7 @@ function ResultField({ field, value, depth = 0, hideLabel = false }) {
2326
2343
  // longest label left over.
2327
2344
  isInlineColumn(child) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
2328
2345
  /* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(Label2, { field: child, describe: true }) }),
2329
- /* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(LeafValue, { field: child, value: memberValue(child) }) })
2346
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 text-right **:data-chips:justify-end", children: /* @__PURE__ */ jsx(LeafValue, { field: child, value: memberValue(child) }) })
2330
2347
  ] }, child.name) : /* @__PURE__ */ jsx("div", { className: "col-span-2 min-w-0", children: /* @__PURE__ */ jsx(ResultField, { field: child, value: memberValue(child), depth: depth + 1 }) }, child.name)
2331
2348
  )
2332
2349
  )
@@ -2511,7 +2528,7 @@ function JsonView({ value }) {
2511
2528
  });
2512
2529
  },
2513
2530
  "aria-label": s.copyJson,
2514
- className: "absolute right-2 top-2 rounded border border-border bg-card p-1 text-muted-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1",
2531
+ className: "absolute right-2 top-2 rounded border border-border bg-card p-1 text-muted-foreground hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
2515
2532
  children: copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": true, className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": true, className: "size-3.5" })
2516
2533
  }
2517
2534
  ),
@@ -2521,12 +2538,14 @@ function JsonView({ value }) {
2521
2538
  function StuffViewer({
2522
2539
  field,
2523
2540
  value,
2541
+ name,
2524
2542
  defaultView = "rendered",
2525
2543
  downloadBaseName,
2526
2544
  hideDownload = false,
2527
2545
  className
2528
2546
  }) {
2529
2547
  const s = useFieldStrings();
2548
+ const named = name ? { ...field, name } : field;
2530
2549
  const [view, setView] = useState(defaultView);
2531
2550
  const [saving, setSaving] = useState(false);
2532
2551
  const resolveUrl = useResolveUrl();
@@ -2536,20 +2555,20 @@ function StuffViewer({
2536
2555
  await downloadStuff({
2537
2556
  field,
2538
2557
  value,
2539
- baseName: downloadBaseName ?? field.name ?? "result",
2558
+ baseName: downloadBaseName ?? named.name ?? "result",
2540
2559
  resolveUrl
2541
2560
  });
2542
2561
  } finally {
2543
2562
  setSaving(false);
2544
2563
  }
2545
- }, [field, value, downloadBaseName, resolveUrl]);
2564
+ }, [field, named.name, value, downloadBaseName, resolveUrl]);
2546
2565
  const views = [
2547
2566
  { id: "rendered", label: s.viewRendered },
2548
2567
  { id: "json", label: s.viewJson }
2549
2568
  ];
2550
2569
  return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
2551
2570
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-4 gap-y-1", children: [
2552
- /* @__PURE__ */ jsx("div", { className: "min-w-0 space-y-1", children: /* @__PURE__ */ jsx(ResultHeader, { field }) }),
2571
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 space-y-1", children: /* @__PURE__ */ jsx(ResultHeader, { field: named }) }),
2553
2572
  /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
2554
2573
  !hideDownload && /* @__PURE__ */ jsxs(
2555
2574
  "button",
@@ -2558,7 +2577,7 @@ function StuffViewer({
2558
2577
  onClick: () => void handleDownload(),
2559
2578
  disabled: saving,
2560
2579
  "aria-label": s.download,
2561
- className: "inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-60",
2580
+ className: "inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-60",
2562
2581
  children: [
2563
2582
  saving ? /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx(Download, { className: "h-3.5 w-3.5" }),
2564
2583
  saving ? s.downloading : s.download
@@ -2578,7 +2597,7 @@ function StuffViewer({
2578
2597
  onClick: () => setView(id),
2579
2598
  "aria-pressed": view === id,
2580
2599
  className: cn(
2581
- "rounded px-2 py-0.5 text-[12px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1",
2600
+ "rounded px-2 py-0.5 text-[12px] focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",
2582
2601
  view === id ? "bg-card font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
2583
2602
  ),
2584
2603
  children: label