@pipelex/mthds-ui 0.27.0 → 0.29.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.
@@ -1,11 +1,83 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
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
- export { q as PipeOperatorType } from '../../types-DgqW3Jg4.js';
3
+ import { b as GraphSpec, c as GraphNodeData, d as GraphEdge, e as GraphNode, 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 NodePipeType, o as GraphSpecMode, C as ConceptInfo, p as GraphSpecNode } from '../../types-BaFWy56P.js';
4
+ export { q as PipeOperatorType } from '../../types-BaFWy56P.js';
5
5
  import { PipeIOContracts, OutputForm, InputForm, SaveFiles } from '@pipelex/mthds-form';
6
6
  import { ResolveUrl, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
7
7
  import { Edge, Node, ReactFlowInstance } from '@xyflow/react';
8
8
 
9
+ /**
10
+ * A graph and the artifacts that describe its pipes, taken from ONE source.
11
+ *
12
+ * `GraphViewer` takes this as its single `graph` prop rather than a spec and
13
+ * three descriptor props side by side, because the descriptors are keyed by the
14
+ * graph's own `pipe_ref`s: the detail panel walks from a data node back to the
15
+ * pipe that produced it and looks that pipe up in `outputForm` and
16
+ * `pipeIoContracts`. A spec paired with another source's descriptors (a past
17
+ * run's graph beside the current method's validate report, after the method's
18
+ * pipes were renamed) misses every lookup, and the panel can only say that no
19
+ * descriptor describes the value. Carrying all four in one object is what keeps
20
+ * them from one run, or from one validate call.
21
+ *
22
+ * Where each source lives:
23
+ *
24
+ * - **A run**: its results carry `graph_spec`, `pipe_io_contracts`,
25
+ * `output_form` and `input_form` together; `graphArtifactsFrom(results)`
26
+ * reads them in one call.
27
+ * - **A method that has not run** (a dry run, or a static graph built from its
28
+ * sources): the descriptors come from the same method's validate report, the
29
+ * one the dry graph or the static build describes.
30
+ *
31
+ * The descriptors are optional, and nullable as the wire carries them. Without
32
+ * `pipeIoContracts` and `outputForm` together, the panel shows a data node's
33
+ * structure table and no data tab, which is the honest floor for a graph whose
34
+ * artifacts were not produced. `inputForm` is optional even beside the other
35
+ * two: it is what lets a method's own inputs, which no pipe produced, show their
36
+ * value through the consuming pipe's slot.
37
+ */
38
+ interface GraphArtifacts {
39
+ /** The graph to draw: a run's `graph_spec`, a dry run's, or a static build. */
40
+ graphSpec: GraphSpec;
41
+ /** `pipe_io_contracts` for the pipes of THIS graph. */
42
+ pipeIoContracts?: PipeIOContracts | null;
43
+ /** `output_form` for the pipes of THIS graph, from the same source. */
44
+ outputForm?: OutputForm | null;
45
+ /** `input_form` for the pipes of THIS graph, from the same source. */
46
+ inputForm?: InputForm | null;
47
+ }
48
+ /**
49
+ * The four artifacts as a run's results, or a validate report, spell them on
50
+ * the wire. `graph_spec` is `unknown` because transport layers type it that way;
51
+ * `GraphViewer` validates it at its boundary.
52
+ */
53
+ interface GraphArtifactsSource {
54
+ graph_spec?: unknown;
55
+ pipe_io_contracts?: PipeIOContracts | null;
56
+ output_form?: OutputForm | null;
57
+ input_form?: InputForm | null;
58
+ }
59
+ /**
60
+ * Read the graph and its descriptors out of one run's results (or one report
61
+ * that carries all four), so a host never assembles the bundle by hand from two
62
+ * places. Returns `null` when the source carries no graph.
63
+ */
64
+ declare function graphArtifactsFrom(source: GraphArtifactsSource): GraphArtifacts | null;
65
+ /** The descriptors the detail panel renders a value from, once they are usable. */
66
+ interface ResultDescriptors {
67
+ pipeIoContracts: PipeIOContracts;
68
+ outputForm: OutputForm;
69
+ inputForm?: InputForm;
70
+ }
71
+ /**
72
+ * The descriptors a graph's detail panel can render from, or `null`.
73
+ *
74
+ * Both `pipeIoContracts` and `outputForm`, or neither: the contract names the
75
+ * payload's shape and the descriptor says what the result IS, so a panel given
76
+ * one of the two would be guessing the other. `inputForm` rides along when the
77
+ * other two are there.
78
+ */
79
+ declare function resultDescriptors(graph: GraphArtifacts | null): ResultDescriptors | null;
80
+
9
81
  /** ReactFlow node parameterized with our domain data. */
10
82
  type AppNode = Node<GraphNodeData>;
11
83
  /** ReactFlow edge with standard fields (domain-only fields are dropped at the boundary). */
@@ -30,7 +102,21 @@ declare function toAppNodes(nodes: GraphNode[]): AppNode[];
30
102
  declare function toAppEdges(edges: GraphEdge[]): AppEdge[];
31
103
 
32
104
  interface GraphViewerProps {
33
- graphspec: GraphSpec | null;
105
+ /**
106
+ * The graph to draw, together with the artifacts that describe its pipes —
107
+ * all four from ONE source: a run's results, or a method's validate report
108
+ * beside the dry or static graph of that same method. `null` draws nothing.
109
+ *
110
+ * One object rather than a spec prop and three descriptor props, because the
111
+ * detail panel looks a data node's descriptor up by the `pipe_ref` of the pipe
112
+ * that produced it IN THIS GRAPH. A graph paired with another source's
113
+ * descriptors misses every lookup. See `GraphArtifacts`.
114
+ *
115
+ * Without `pipeIoContracts` and `outputForm`, the panel still works: it shows
116
+ * the concept's structure table and no data tab, which is the honest floor
117
+ * for a graph whose artifacts the host does not hold.
118
+ */
119
+ graph: GraphArtifacts | null;
34
120
  config?: GraphConfig;
35
121
  /** Initial layout direction. Users can toggle this via the built-in toolbar. */
36
122
  initialDirection?: GraphDirection;
@@ -94,7 +180,10 @@ interface GraphViewerProps {
94
180
  onNavigateToPipe?: (pipeCode: string, status?: PipeStatus) => void;
95
181
  onStuffNodeClick?: (stuff: GraphSpecNodeIoItem) => void;
96
182
  onReactFlowInit?: (instance: AppRFInstance) => void;
97
- /** Layer 2 execution state: pipe_code → current status. Updates node status dots in real-time. */
183
+ /**
184
+ * Layer 2 execution state: pipe_code → current status. Updates node status dots in real-time.
185
+ * A binding card is never matched: its `pipeCode` is the path it binds, not a pipe's code.
186
+ */
98
187
  statusMap?: Record<string, PipeStatus>;
99
188
  /** Called when any node is clicked with full node data. Use for detail/inspector panels. */
100
189
  onNodeSelect?: (nodeId: string, nodeData: GraphNodeData, event: React.MouseEvent) => void;
@@ -102,35 +191,6 @@ interface GraphViewerProps {
102
191
  onPaneClick?: () => void;
103
192
  /** Render extra content below the built-in detail panel content for the selected node. */
104
193
  renderDetailExtra?: (nodeId: string, nodeData: GraphNodeData) => React.ReactNode;
105
- /**
106
- * `pipe_io_contracts` for the method this spec is a run of — one half of what
107
- * the detail panel needs to render a data node's VALUE.
108
- *
109
- * The graph renders results itself now. It used to take a render prop instead,
110
- * because the form kernel was an optional peer and `./graph/react` had to keep
111
- * resolving without it — an arrangement that made sense while the kernel only
112
- * powered an optional run form, and stopped making sense the moment the
113
- * standard's `output_form` became how this viewer shows a result at all. A
114
- * viewer whose detail panel cannot show data is not a viewer, so the kernel is
115
- * a dependency of this package and the seam is gone.
116
- *
117
- * Omit these and the panel still works: it shows the concept's structure table
118
- * and no data tab, which is the honest floor for a spec whose artifacts the
119
- * host does not hold (a static graph, a spec restored without its validate
120
- * report).
121
- */
122
- contracts?: PipeIOContracts;
123
- /**
124
- * `output_form` from the SAME `/validate` call — the other half. The contract
125
- * names the payload's shape; the descriptor says what the result IS.
126
- */
127
- outputForm?: OutputForm;
128
- /**
129
- * `input_form`, optional even here. It is what lets a method's own INPUTS show
130
- * their value: no pipe produced them, so no output descriptor describes them,
131
- * and the CONSUMING pipe's descriptor for their slot is what names them.
132
- */
133
- inputForm?: InputForm;
134
194
  /**
135
195
  * Turns the runtime's own `pipelex-storage://…` reference into a URL a
136
196
  * browser can fetch, so files in a result actually paint.
@@ -272,8 +332,9 @@ declare const controllerNodeTypes: {
272
332
 
273
333
  type PipeCardDirection = "LR" | "TB";
274
334
  interface PipeCardData {
335
+ /** The pipe code, or the `from` path of a binding step's card. */
275
336
  pipeCode: string;
276
- pipeType: PipeType;
337
+ pipeType: NodePipeType;
277
338
  description?: string;
278
339
  status: PipeStatus;
279
340
  graphMode?: GraphSpecMode;
@@ -336,10 +397,12 @@ declare function PipeCardBase({ data, children }: PipeCardBaseProps): react_jsx_
336
397
  *
337
398
  * ## What it needs from the host, and why
338
399
  *
339
- * The artifacts every `/validate` call returns beside the graph spec, keyed by
340
- * `pipe_ref`. The join is the producing pipe: the graph hands over
341
- * `producerPipeRef` (see `stuffLookup.ts`), and `output_form` plus the output
342
- * half of the contract are looked up by it.
400
+ * The artifacts a run's results (or a `/validate` call) return beside the graph
401
+ * spec, keyed by `pipe_ref`. The join is the producing pipe: the graph hands
402
+ * over `producerPipeRef` (see `stuffLookup.ts`), and `output_form` plus the
403
+ * output half of the contract are looked up by it. That join only holds when
404
+ * the artifacts and the graph come from the same source, which is why
405
+ * `GraphViewer` takes them as one `graph` object (`GraphArtifacts`).
343
406
  *
344
407
  * ## The method's own inputs, which no pipe produced
345
408
  *
@@ -380,9 +443,14 @@ declare function PipeCardBase({ data, children }: PipeCardBaseProps): react_jsx_
380
443
  * never reach a panel that installs its own.
381
444
  */
382
445
  interface StuffResultRendererOptions {
383
- /** `pipe_io_contracts` for the method being displayed. */
384
- contracts: PipeIOContracts;
385
- /** `output_form` for the same method — the SAME `/validate` call. */
446
+ /**
447
+ * `pipe_io_contracts` from the same source as the `producerPipeRef` and
448
+ * `consumer` below: the run, or the validate report, whose graph they were
449
+ * read from. Inside `GraphViewer` that pairing is guaranteed by its single
450
+ * `graph` prop; a host using this panel on its own owns it.
451
+ */
452
+ pipeIoContracts: PipeIOContracts;
453
+ /** `output_form` from that SAME source. */
386
454
  outputForm: OutputForm;
387
455
  /**
388
456
  * `input_form`, optional. Supplying it is what lets a method's own INPUTS
@@ -440,7 +508,7 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
440
508
  */
441
509
  downloads?: DownloadDisplay;
442
510
  }
443
- declare function StuffResultPanel({ contracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
511
+ declare function StuffResultPanel({ pipeIoContracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
444
512
 
445
513
  interface DetailPanelProps {
446
514
  isOpen: boolean;
@@ -472,8 +540,8 @@ interface ConceptDetailPanelProps {
472
540
  isDryRun?: boolean;
473
541
  /**
474
542
  * Renders the data half. `GraphViewer` supplies it as a `StuffResultPanel`,
475
- * the form kernel's descriptor-driven result view, when the host passed the
476
- * `contracts` and `outputForm` artifacts; see `docs/stuff-result-panel.md`.
543
+ * the form kernel's descriptor-driven result view, when the host's `graph`
544
+ * carries `pipeIoContracts` and `outputForm`; see `docs/stuff-result-panel.md`.
477
545
  *
478
546
  * Without it — or when it returns nothing for this item — the panel shows the
479
547
  * structure table alone and no tabs, which is what a viewer that has not been
@@ -511,4 +579,4 @@ interface UseResizableResult {
511
579
  }
512
580
  declare function useResizable({ defaultWidth, minWidth, maxWidth, containerRef, }: UseResizableOptions): UseResizableResult;
513
581
 
514
- export { type AppEdge, type AppNode, type AppRFInstance, ConceptDetailPanel, type ConceptDetailPanelProps, ControllerGroupNode, DetailPanel, type DetailPanelProps, GraphViewer, type GraphViewerProps, PipeCardBase, type PipeCardBaseProps, type PipeCardData, PipeCardNode, PipeDetailPanel, type PipeDetailPanelProps, PipeStatus, StuffResultPanel, type StuffResultPanelProps, type StuffResultRendererOptions, type UseResizableOptions, type UseResizableResult, ValidationPanel, type ValidationPanelPlacement, type ValidationPanelProps, applyStatusOverrides, controllerNodeTypes, detectSystemTheme, hydrateLabels, renderLabel, toAppEdges, toAppNodes, useResizable, useSystemTheme, validationLabel, validationPanelPlacement };
582
+ export { type AppEdge, type AppNode, type AppRFInstance, ConceptDetailPanel, type ConceptDetailPanelProps, ControllerGroupNode, DetailPanel, type DetailPanelProps, type GraphArtifacts, type GraphArtifactsSource, GraphViewer, type GraphViewerProps, PipeCardBase, type PipeCardBaseProps, type PipeCardData, PipeCardNode, PipeDetailPanel, type PipeDetailPanelProps, PipeStatus, type ResultDescriptors, StuffResultPanel, type StuffResultPanelProps, type StuffResultRendererOptions, type UseResizableOptions, type UseResizableResult, ValidationPanel, type ValidationPanelPlacement, type ValidationPanelProps, applyStatusOverrides, controllerNodeTypes, detectSystemTheme, graphArtifactsFrom, hydrateLabels, renderLabel, resultDescriptors, toAppEdges, toAppNodes, useResizable, useSystemTheme, validationLabel, validationPanelPlacement };