@pipelex/mthds-ui 0.37.0 → 0.38.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.
package/README.md CHANGED
@@ -86,6 +86,10 @@ Without `pipeIoContracts` and `outputForm` the panel shows each concept's struct
86
86
 
87
87
  A failed node carries the MTHDS Protocol's problem document in its `error` (the `Problem` type of `mthds/errors`). Its detail panel shows the problem's title, code and detail, the pipe it failed in with the path down to it, and its next step, reading only the standard's core members, so a problem from any conforming runtime renders. The graph rings the pipe the run failed in: the node whose own problem's `location` names its pipe, not the controllers that failed because of it. See [docs/run-problem.md](docs/run-problem.md).
88
88
 
89
+ ### When a spec cannot be drawn
90
+
91
+ `GraphViewer` never throws a spec it cannot draw out of render. A spec `validateGraphSpec` refuses, from a runtime newer or older than this package for instance, is drawn as an alert in place of the graph, naming the location refused and what was found there, and so is a spec the build or its first layout fails on. Your page stays up, and the next spec you pass is drawn afresh. A layout that fails after the reader changes the direction, the folds or the style is drawn as an alert over the dimmed graph instead, with the toolbar kept so they can change the view back. See [docs/error-state.md](docs/error-state.md).
92
+
89
93
  ### GraphViewer props
90
94
 
91
95
  | Prop | Type | Default | Description |
@@ -304,6 +308,7 @@ See `graphConfig.ts` for the full default palette.
304
308
  | `@pipelex/mthds-ui` | Pure-TS graph logic — types, builders, layout, controllers, config |
305
309
  | `@pipelex/mthds-ui/graph/react` | React components — `GraphViewer`, label helpers, type converters |
306
310
  | `@pipelex/mthds-ui/form` | The form kernel's React-free surface, re-exported |
311
+ | `@pipelex/mthds-ui/form/brand` | The kernel's brand entry: seed colours into readable colour roles |
307
312
  | `@pipelex/mthds-ui/form/react` | `RunPanel` — a pipe's input form — and the kernel's controls |
308
313
  | `@pipelex/mthds-ui/timeline` | A run's progress snapshot: types, path grammar, rows and time axis |
309
314
  | `@pipelex/mthds-ui/timeline/react` | `RunTimeline` — a running run's invocations as growing bars |
@@ -391,7 +396,9 @@ Tailwind 3 hosts and Tailwind 4 hosts that configure a prefix are not supported:
391
396
 
392
397
  Either way, the shadcn token values are yours to supply, and each must be a **complete colour** — `hsl(240 10% 3.9%)`, `#0a0711`, `oklch(…)` — never a bare HSL triplet. Since kernel `0.8.0` the sheet emits `background-color: var(--background)` rather than `hsl(var(--background))`, so a triplet computes to something that is not a colour and the browser discards the declaration instead of overriding with it: green build, token inspectable, style silently absent.
393
398
 
394
- Full contract, why this package stopped loading the kernel's stylesheet itself, the `.dark` bridge and the `mthds-run-panel` token hook: [docs/run-form-panel.md](./docs/run-form-panel.md).
399
+ To brand the controls with a team's own colours, `@pipelex/mthds-ui/form/brand` derives `--primary` and the three optional tokens the controls read for brand-coloured text and its pale fill, `--brand`, `--brand-muted` and `--brand-muted-foreground`, from up to three colours a person picked, every text colour readable on the theme's page. A page that defines none of the three renders exactly as it did.
400
+
401
+ Full contract, why this package stopped loading the kernel's stylesheet itself, the `.dark` bridge, the `mthds-run-panel` token hook and the brand tokens: [docs/run-form-panel.md](./docs/run-form-panel.md).
395
402
 
396
403
  ## Run timeline
397
404
 
@@ -0,0 +1 @@
1
+ export * from '@pipelex/mthds-form/brand';
@@ -0,0 +1,3 @@
1
+ // src/form/brand/index.ts
2
+ export * from "@pipelex/mthds-form/brand";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/form/brand/index.ts"],"sourcesContent":["/**\n * The `./form/brand` entry — the form kernel's `./brand` entry, re-exported.\n *\n * A host that brands its pages reaches the kernel's colour derivation here:\n * `deriveBrandRoles` turns up to three seed colours a person picked into the\n * roles a page paints with, every text role readable at WCAG AA, and\n * `resolveDarkSeeds`, `isActionFaint`, `isAccentAdjusted`, `readableTextOn` and\n * `PIPELEX_GREEN` are the rules around it. The same entry carries the rest of\n * the kernel's brand surface: the theme contract, the token file's validator,\n * and the manifest, provenance and compiler a full brand goes through.\n *\n * It is its own entry rather than part of `./form` because the kernel keeps it\n * apart from its `.` entry, and for the same reason: it is isomorphic and\n * network-free, with no React and no DOM, so a settings screen, a server action\n * and a build script all import it. Re-exported wholesale, it follows the\n * kernel from release to release with nothing to edit here.\n *\n * The rule `./form` states holds here too: a host imports the kernel through\n * this package, never directly, so its tree holds one copy of it.\n *\n * Mapping the roles onto the tokens the kernel's controls read — `--primary`,\n * `--primary-foreground`, `--brand`, `--brand-muted` and\n * `--brand-muted-foreground` — is described in `docs/run-form-panel.md`.\n */\n\nexport * from \"@pipelex/mthds-form/brand\";\n"],"mappings":";AAyBA,cAAc;","names":[]}
@@ -1 +1,2 @@
1
1
  export * from '@pipelex/mthds-form';
2
+ import '@pipelex/mthds-form/brand';
@@ -118,6 +118,86 @@
118
118
  background: transparent;
119
119
  pointer-events: none;
120
120
  }
121
+ /* The error state (`GraphErrorState`), drawn in place of the graph when the
122
+ viewer cannot draw the spec it was given. It fills the canvas's area, centred,
123
+ and scrolls when its message does not fit. In the still presentation it flows
124
+ at the height of its message, and takes the pointer, so its text can be
125
+ selected and copied. Colours come from the tokens alone, so the theme and a
126
+ host's `paletteColors` reach it. */
127
+ .react-flow-container--failed {
128
+ /* Centred by the message's auto margins rather than by alignment, which would
129
+ push the top of a message taller than the area out of reach of the scroll. */
130
+ display: flex;
131
+ box-sizing: border-box;
132
+ padding: 16px;
133
+ overflow: auto;
134
+ font-family: var(--font-sans);
135
+ }
136
+ .react-flow-container--failed.react-flow-container--still {
137
+ pointer-events: auto;
138
+ }
139
+ .graph-error-state {
140
+ box-sizing: border-box;
141
+ width: 100%;
142
+ max-width: 560px;
143
+ margin: auto;
144
+ padding: 12px 14px;
145
+ border: 1px solid var(--color-error-border);
146
+ border-left: 3px solid var(--color-error);
147
+ border-radius: 6px;
148
+ background: var(--color-error-bg);
149
+ color: var(--text-default);
150
+ font-size: 13px;
151
+ line-height: 1.5;
152
+ }
153
+ .graph-error-state-title {
154
+ margin: 0 0 4px;
155
+ font-weight: 600;
156
+ color: var(--text-primary);
157
+ }
158
+ .graph-error-state-detail {
159
+ margin: 0;
160
+ font-family: var(--font-mono);
161
+ font-size: 12px;
162
+ color: var(--text-secondary);
163
+ white-space: pre-wrap;
164
+ overflow-wrap: anywhere;
165
+ }
166
+ .graph-error-state-hint {
167
+ margin: 8px 0 0;
168
+ color: var(--text-secondary);
169
+ }
170
+ /* A relayout's failure (`GraphRelayoutFailure`): a spec already drawn that a
171
+ change of direction, folds or style failed to redraw. The alert floats over
172
+ the flow, inside it and beneath the toolbar's panel (z-index 11), so the
173
+ toolbar stays on top and usable. The layer lets the pointer through to the
174
+ drawing beneath, which is dimmed: it is the view the reader changed from,
175
+ not the one they asked for. */
176
+ .react-flow-container--relayout-failed .react-flow__renderer {
177
+ opacity: 0.35;
178
+ }
179
+ .graph-relayout-failure {
180
+ position: absolute;
181
+ inset: 0;
182
+ z-index: 6;
183
+ display: flex;
184
+ box-sizing: border-box;
185
+ padding: 16px;
186
+ overflow: hidden;
187
+ pointer-events: none;
188
+ font-family: var(--font-sans);
189
+ }
190
+ .graph-error-state--floating {
191
+ max-height: 100%;
192
+ overflow: auto;
193
+ pointer-events: auto;
194
+ /* The error tint laid over the opaque panel surface, so the drawing beneath
195
+ never shows through the text. */
196
+ background:
197
+ linear-gradient(var(--color-error-bg), var(--color-error-bg)),
198
+ var(--surface-panel);
199
+ box-shadow: var(--shadow-md);
200
+ }
121
201
  .react-flow__node {
122
202
  font-family: var(--font-sans);
123
203
  cursor: pointer;
@@ -110,6 +110,11 @@ interface GraphViewerProps {
110
110
  * all four from ONE source: a run's results, or a method's validate report
111
111
  * beside the dry or static graph of that same method. `null` draws nothing.
112
112
  *
113
+ * A spec `validateGraphSpec` refuses, or one the viewer otherwise fails to
114
+ * draw, draws an error state in place of the graph, naming what was refused,
115
+ * and is never thrown out of render: the host's page stays up. The next spec
116
+ * the host passes is drawn afresh.
117
+ *
113
118
  * One object rather than a spec prop and three descriptor props, because the
114
119
  * detail panel looks a data node's descriptor up by the `pipe_ref` of the pipe
115
120
  * that produced it IN THIS GRAPH. A graph paired with another source's
@@ -292,6 +297,16 @@ interface GraphViewerProps {
292
297
  }
293
298
  /** Apply Layer 2 execution state overrides to rendered nodes. */
294
299
  declare function applyStatusOverrides(nodes: AppNode[], statusMap: Record<string, PipeStatus> | undefined): AppNode[];
300
+ /**
301
+ * The viewer. A spec `validateGraphSpec` refuses is drawn as an error state by
302
+ * the canvas itself, which reads the spec as a value (`readGraphSpec`); anything
303
+ * else the canvas throws or reports is caught by the boundary around it, which
304
+ * draws the same error state, so no failure of the graph unmounts the host's
305
+ * tree. A new spec clears either. A layout that fails to redraw a spec already
306
+ * drawn, after a change of direction, folds or style, reaches neither: the
307
+ * canvas draws it over the flow and keeps the toolbar, so the reader can change
308
+ * the view back (`routeLayoutFailure`).
309
+ */
295
310
  declare function GraphViewer(props: GraphViewerProps): react_jsx_runtime.JSX.Element;
296
311
 
297
312
  declare function renderLabel(desc: LabelDescriptor): React.ReactNode;