@pipelex/mthds-ui 0.26.0 → 0.27.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.
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { c as GraphNodeData, d as GraphEdge, e as GraphNode, b as GraphSpec, f as GraphConfig, g as GraphDirection, F as FoldMode, h as GraphThemeMode, T as ToolbarPosition, G as GraphTheme, i as PipeStatus, j as GraphSpecNodeIoItem, k as ValidationState, V as ValidationIssue, L as LabelDescriptor, l as PipeControllerType, m as FoldToggleOptions, N as NodeValidationSummary, n as PipeType, o as GraphSpecMode, C as ConceptInfo, p as GraphSpecNode } from '../../types-DgqW3Jg4.js';
4
4
  export { q as PipeOperatorType } from '../../types-DgqW3Jg4.js';
5
- import { PipeIOContracts, OutputForm, InputForm } from '@pipelex/mthds-form';
6
- import { ResolveUrl, ResolveShareUrl } from '@pipelex/mthds-form/react';
5
+ import { PipeIOContracts, OutputForm, InputForm, SaveFiles } from '@pipelex/mthds-form';
6
+ import { ResolveUrl, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
7
7
  import { Edge, Node, ReactFlowInstance } from '@xyflow/react';
8
8
 
9
9
  /** ReactFlow node parameterized with our domain data. */
@@ -153,6 +153,24 @@ interface GraphViewerProps {
153
153
  * since it starts expiring the moment it exists.
154
154
  */
155
155
  resolveShareUrl?: ResolveShareUrl;
156
+ /**
157
+ * Delivers the files the result panel's downloads hand over: its Download
158
+ * control and each file's own button.
159
+ *
160
+ * Without it the kernel saves them in the browser tab, through an object URL
161
+ * and a clicked link. A host whose view runs in a sandboxed frame is refused
162
+ * both, so its downloads fail without a word unless it supplies this, handing
163
+ * the planned files to its own bridge. It goes on the panel's provider beside
164
+ * `resolveUrl`, which replaces an outer provider rather than merging with it,
165
+ * so a `saveFiles` set around the graph does not reach the panel.
166
+ */
167
+ saveFiles?: SaveFiles;
168
+ /**
169
+ * Which of the result panel's download controls are drawn: the whole-result
170
+ * Download (`result`) and each file's own button (`files`, which also takes
171
+ * the kinds that carry one). Both are drawn by default.
172
+ */
173
+ downloads?: DownloadDisplay;
156
174
  /**
157
175
  * State of the toolbar's validation widget. The widget renders only when this
158
176
  * is set — `undefined` (the default) disables the feature entirely. Reactive:
@@ -349,6 +367,17 @@ declare function PipeCardBase({ data, children }: PipeCardBaseProps): react_jsx_
349
367
  * `resolveUrl`, which is installed as the kernel's `ResultEnvProvider` so the
350
368
  * kernel's own file arms paint the file; without one, the panel paints whatever
351
369
  * `public_url` the payload carries.
370
+ *
371
+ * ## Saving
372
+ *
373
+ * The kernel's Download control and its per-file download buttons save through
374
+ * the browser tab unless a host says otherwise. A host whose view runs in a
375
+ * sandboxed frame, where the tab's object URL, clicked link and popup are all
376
+ * refused, passes `saveFiles` to deliver the files through its own bridge, and
377
+ * `downloads` to choose which of those controls are drawn. Both go on the same
378
+ * provider as `resolveUrl`, because the kernel's provider replaces an outer
379
+ * one rather than merging with it: set around the graph instead, they would
380
+ * never reach a panel that installs its own.
352
381
  */
353
382
  interface StuffResultRendererOptions {
354
383
  /** `pipe_io_contracts` for the method being displayed. */
@@ -400,8 +429,18 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
400
429
  * own credential.
401
430
  */
402
431
  resolveShareUrl?: ResolveShareUrl;
432
+ /**
433
+ * Delivers the files a download hands over, for a host that cannot save
434
+ * through the browser tab. Without one, the kernel saves in the tab.
435
+ */
436
+ saveFiles?: SaveFiles;
437
+ /**
438
+ * Which download controls are drawn: the whole-result Download and each
439
+ * file's own button, set independently. Both are drawn by default.
440
+ */
441
+ downloads?: DownloadDisplay;
403
442
  }
404
- declare function StuffResultPanel({ contracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveShareUrl, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
443
+ declare function StuffResultPanel({ contracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
405
444
 
406
445
  interface DetailPanelProps {
407
446
  isOpen: boolean;
@@ -128,7 +128,9 @@ function StuffResultPanel({
128
128
  producerPipeRef,
129
129
  consumer,
130
130
  resolveUrl,
131
- resolveShareUrl
131
+ resolveShareUrl,
132
+ saveFiles,
133
+ downloads
132
134
  }) {
133
135
  const field = React2.useMemo(
134
136
  () => {
@@ -139,7 +141,16 @@ function StuffResultPanel({
139
141
  );
140
142
  if (field) {
141
143
  const panel = /* @__PURE__ */ jsx(StuffViewer, { field, value: stuff.data, name: stuff.name });
142
- return resolveUrl || resolveShareUrl ? /* @__PURE__ */ jsx(ResultEnvProvider, { resolveUrl, resolveShareUrl, children: panel }) : panel;
144
+ return resolveUrl || resolveShareUrl || saveFiles || downloads ? /* @__PURE__ */ jsx(
145
+ ResultEnvProvider,
146
+ {
147
+ resolveUrl,
148
+ resolveShareUrl,
149
+ saveFiles,
150
+ downloads,
151
+ children: panel
152
+ }
153
+ ) : panel;
143
154
  }
144
155
  return stuff.data === void 0 || stuff.data === null ? null : /* @__PURE__ */ jsx(UndescribedValue, { value: stuff.data });
145
156
  }
@@ -2515,19 +2526,21 @@ function StuffNodeDetail({
2515
2526
  outputForm,
2516
2527
  inputForm,
2517
2528
  resolveUrl,
2518
- resolveShareUrl
2529
+ resolveShareUrl,
2530
+ saveFiles,
2531
+ downloads
2519
2532
  }) {
2520
2533
  var _a;
2521
2534
  const conceptInfo = stuffData.concept && graphspec ? resolveConceptRef(graphspec, stuffData.concept) : void 0;
2522
2535
  const isDryRun = graphSpecMode(graphspec) === GRAPH_SPEC_MODE.DRY;
2523
2536
  const renderData = contracts && outputForm ? () => /* @__PURE__ */ jsx24(
2524
2537
  StuffResultPanel,
2525
- __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
2538
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
2526
2539
  contracts,
2527
2540
  outputForm
2528
2541
  }, inputForm ? { inputForm } : {}), {
2529
2542
  stuff: stuffData
2530
- }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveShareUrl ? { resolveShareUrl } : {}), {
2543
+ }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
2531
2544
  theme
2532
2545
  })
2533
2546
  ) : void 0;
@@ -2616,6 +2629,8 @@ function GraphViewer(props) {
2616
2629
  inputForm,
2617
2630
  resolveUrl,
2618
2631
  resolveShareUrl,
2632
+ saveFiles,
2633
+ downloads,
2619
2634
  validationState,
2620
2635
  validationIssues,
2621
2636
  onValidationIssueClick
@@ -3293,7 +3308,9 @@ function GraphViewer(props) {
3293
3308
  outputForm,
3294
3309
  inputForm,
3295
3310
  resolveUrl,
3296
- resolveShareUrl
3311
+ resolveShareUrl,
3312
+ saveFiles,
3313
+ downloads
3297
3314
  }
3298
3315
  ) : null,
3299
3316
  renderDetailExtra && detailSelection && !conceptOverride && renderDetailExtra(detailSelection.nodeId, detailSelection.nodeData)