@pipelex/mthds-ui 0.26.0 → 0.28.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.
@@ -14,14 +14,14 @@ import {
14
14
  resolveConceptRef,
15
15
  resolveIssueTargetNodeId,
16
16
  validateGraphSpec
17
- } from "../../chunk-K3BWHQVX.js";
17
+ } from "../../chunk-I7Z5TTQI.js";
18
18
  import {
19
19
  parsePipeRef
20
20
  } from "../../chunk-2N65P32H.js";
21
21
  import {
22
22
  DEFAULT_GRAPH_CONFIG,
23
23
  getPaletteForTheme
24
- } from "../../chunk-XBHDA3PQ.js";
24
+ } from "../../chunk-7WJYQHYF.js";
25
25
  import {
26
26
  EDGE_TYPE,
27
27
  FOLD_MODE,
@@ -39,7 +39,7 @@ import {
39
39
  stuffDigestFromId,
40
40
  toolbarOrientation,
41
41
  toolbarSide
42
- } from "../../chunk-VCO4GZDZ.js";
42
+ } from "../../chunk-AE7AA5XC.js";
43
43
  import {
44
44
  __spreadProps,
45
45
  __spreadValues
@@ -121,25 +121,36 @@ import {
121
121
  } from "@pipelex/mthds-form/react";
122
122
  import { jsx, jsxs } from "react/jsx-runtime";
123
123
  function StuffResultPanel({
124
- contracts,
124
+ pipeIoContracts,
125
125
  outputForm,
126
126
  inputForm,
127
127
  stuff,
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
  () => {
135
137
  var _a;
136
- return (_a = fromProducer(contracts, outputForm, producerPipeRef)) != null ? _a : fromConsumer(contracts, inputForm, consumer);
138
+ return (_a = fromProducer(pipeIoContracts, outputForm, producerPipeRef)) != null ? _a : fromConsumer(pipeIoContracts, inputForm, consumer);
137
139
  },
138
- [contracts, outputForm, inputForm, producerPipeRef, consumer]
140
+ [pipeIoContracts, outputForm, inputForm, producerPipeRef, consumer]
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
  }
@@ -175,6 +186,25 @@ function fromConsumer(contracts, inputForm, consumer) {
175
186
  return buildResultField({ field: node }, slot.json_schema);
176
187
  }
177
188
 
189
+ // src/graph/react/viewer/graphArtifacts.ts
190
+ function graphArtifactsFrom(source) {
191
+ var _a, _b, _c;
192
+ if (source.graph_spec === void 0 || source.graph_spec === null) return null;
193
+ return {
194
+ graphSpec: source.graph_spec,
195
+ pipeIoContracts: (_a = source.pipe_io_contracts) != null ? _a : null,
196
+ outputForm: (_b = source.output_form) != null ? _b : null,
197
+ inputForm: (_c = source.input_form) != null ? _c : null
198
+ };
199
+ }
200
+ function resultDescriptors(graph) {
201
+ const pipeIoContracts = graph == null ? void 0 : graph.pipeIoContracts;
202
+ const outputForm = graph == null ? void 0 : graph.outputForm;
203
+ if (!pipeIoContracts || !outputForm) return null;
204
+ const inputForm = graph == null ? void 0 : graph.inputForm;
205
+ return inputForm ? { pipeIoContracts, outputForm, inputForm } : { pipeIoContracts, outputForm };
206
+ }
207
+
178
208
  // src/graph/react/detail/DetailPanel.tsx
179
209
  import React3 from "react";
180
210
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -2510,24 +2540,22 @@ function StuffNodeDetail({
2510
2540
  producerPipeRef,
2511
2541
  consumer,
2512
2542
  graphspec,
2543
+ artifacts,
2513
2544
  theme,
2514
- contracts,
2515
- outputForm,
2516
- inputForm,
2517
2545
  resolveUrl,
2518
- resolveShareUrl
2546
+ resolveShareUrl,
2547
+ saveFiles,
2548
+ downloads
2519
2549
  }) {
2520
2550
  var _a;
2521
2551
  const conceptInfo = stuffData.concept && graphspec ? resolveConceptRef(graphspec, stuffData.concept) : void 0;
2522
2552
  const isDryRun = graphSpecMode(graphspec) === GRAPH_SPEC_MODE.DRY;
2523
- const renderData = contracts && outputForm ? () => /* @__PURE__ */ jsx24(
2553
+ const descriptors = resultDescriptors(artifacts);
2554
+ const renderData = descriptors ? () => /* @__PURE__ */ jsx24(
2524
2555
  StuffResultPanel,
2525
- __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
2526
- contracts,
2527
- outputForm
2528
- }, inputForm ? { inputForm } : {}), {
2556
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, descriptors), {
2529
2557
  stuff: stuffData
2530
- }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveShareUrl ? { resolveShareUrl } : {}), {
2558
+ }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
2531
2559
  theme
2532
2560
  })
2533
2561
  ) : void 0;
@@ -2591,9 +2619,9 @@ function applyStatusOverrides(nodes, statusMap) {
2591
2619
  });
2592
2620
  }
2593
2621
  function GraphViewer(props) {
2594
- var _a, _b, _c;
2622
+ var _a, _b, _c, _d;
2595
2623
  const {
2596
- graphspec: graphspecProp,
2624
+ graph,
2597
2625
  config = DEFAULT_GRAPH_CONFIG,
2598
2626
  initialDirection,
2599
2627
  initialShowControllers,
@@ -2611,15 +2639,15 @@ function GraphViewer(props) {
2611
2639
  onNodeSelect,
2612
2640
  onPaneClick,
2613
2641
  renderDetailExtra,
2614
- contracts,
2615
- outputForm,
2616
- inputForm,
2617
2642
  resolveUrl,
2618
2643
  resolveShareUrl,
2644
+ saveFiles,
2645
+ downloads,
2619
2646
  validationState,
2620
2647
  validationIssues,
2621
2648
  onValidationIssueClick
2622
2649
  } = props;
2650
+ const graphspecProp = (_a = graph == null ? void 0 : graph.graphSpec) != null ? _a : null;
2623
2651
  const graphspec = React10.useMemo(
2624
2652
  () => graphspecProp === null ? null : validateGraphSpec(graphspecProp),
2625
2653
  [graphspecProp]
@@ -2655,7 +2683,7 @@ function GraphViewer(props) {
2655
2683
  (_a2 = onThemeChangeRef.current) == null ? void 0 : _a2.call(onThemeChangeRef, mode, resolvedTheme);
2656
2684
  }
2657
2685
  }, [mode, resolvedTheme]);
2658
- const effectiveFoldMode = (_b = (_a = initialFoldMode != null ? initialFoldMode : config.foldMode) != null ? _a : DEFAULT_GRAPH_CONFIG.foldMode) != null ? _b : FOLD_MODE.EXPANDED;
2686
+ const effectiveFoldMode = (_c = (_b = initialFoldMode != null ? initialFoldMode : config.foldMode) != null ? _b : DEFAULT_GRAPH_CONFIG.foldMode) != null ? _c : FOLD_MODE.EXPANDED;
2659
2687
  const [showControllers, setShowControllers] = React10.useState(() => {
2660
2688
  var _a2, _b2;
2661
2689
  if (effectiveFoldMode === FOLD_MODE.FOLDED) return true;
@@ -3175,7 +3203,7 @@ function GraphViewer(props) {
3175
3203
  toolbarPositionProp,
3176
3204
  config.toolbarPosition
3177
3205
  );
3178
- const rawAnalysis = (_c = rawGraphDataRef.current) == null ? void 0 : _c.analysis;
3206
+ const rawAnalysis = (_d = rawGraphDataRef.current) == null ? void 0 : _d.analysis;
3179
3207
  const allControllerIds = rawAnalysis == null ? void 0 : rawAnalysis.controllerNodeIds;
3180
3208
  const foldAllProps = React10.useMemo(() => {
3181
3209
  if (!showControllers || !allControllerIds || allControllerIds.size === 0) {
@@ -3289,11 +3317,11 @@ function GraphViewer(props) {
3289
3317
  consumer: detailSelection.consumer,
3290
3318
  graphspec,
3291
3319
  theme: resolvedTheme,
3292
- contracts,
3293
- outputForm,
3294
- inputForm,
3320
+ artifacts: graph,
3295
3321
  resolveUrl,
3296
- resolveShareUrl
3322
+ resolveShareUrl,
3323
+ saveFiles,
3324
+ downloads
3297
3325
  }
3298
3326
  ) : null,
3299
3327
  renderDetailExtra && detailSelection && !conceptOverride && renderDetailExtra(detailSelection.nodeId, detailSelection.nodeData)
@@ -3317,8 +3345,10 @@ export {
3317
3345
  applyStatusOverrides,
3318
3346
  controllerNodeTypes,
3319
3347
  detectSystemTheme,
3348
+ graphArtifactsFrom,
3320
3349
  hydrateLabels,
3321
3350
  renderLabel,
3351
+ resultDescriptors,
3322
3352
  toAppEdges,
3323
3353
  toAppNodes,
3324
3354
  useResizable,