@pipelex/mthds-ui 0.42.0 → 0.44.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.
@@ -60,7 +60,7 @@ import {
60
60
  sortParentsFirst,
61
61
  textWidthPx,
62
62
  validateGraphSpec
63
- } from "../chunk-HPARBH6K.js";
63
+ } from "../chunk-5E3UJI2I.js";
64
64
  import {
65
65
  GRAPH_STYLES,
66
66
  GRAPH_STYLE_IDS,
@@ -3,7 +3,7 @@ import React__default from 'react';
3
3
  import { d as GraphSpec, e as GraphNodeData, f as GraphEdge, g as GraphNode, h as GraphConfig, i as GraphDirection, F as FoldMode, G as GraphThemeMode, T as ToolbarPosition, j as GraphStyleId, a as GraphTheme, k as PipeStatus, l as GraphSpecNodeIoItem, m as ValidationState, V as ValidationIssue, L as LabelDescriptor, n as PipeControllerType, o as FoldToggleOptions, N as NodeValidationSummary, p as PipeCardPayload, C as ConceptInfo, q as GraphSpecNode } from '../../types-DLAnYNoi.js';
4
4
  export { r as PipeOperatorType } from '../../types-DLAnYNoi.js';
5
5
  import { PipeIOContracts, OutputForm, InputForm, SaveFiles } from '@pipelex/mthds-form';
6
- import { ResolveUrl, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
6
+ import { ResolveUrl, ResolveRendition, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
7
7
  import { Edge, Node, ReactFlowInstance } from '@xyflow/react';
8
8
  import 'mthds/errors';
9
9
 
@@ -247,6 +247,20 @@ interface GraphViewerProps {
247
247
  * durable, so supply one if your storage has an authenticated read path.
248
248
  */
249
249
  resolveUrl?: ResolveUrl;
250
+ /**
251
+ * Answers a smaller copy of a picture, so the result panel's gallery tiles
252
+ * and table thumbnails stop loading whole files.
253
+ *
254
+ * Called with the picture's own `url` member, as `resolveUrl` is, and the
255
+ * width the kernel asks for; answer the URL of a copy at least that wide, or
256
+ * `undefined` to have the whole picture drawn. Only those small pictures use
257
+ * it: the viewer a picture opens, "Open the original", the copy control and
258
+ * every download keep the whole picture. It goes on the panel's provider
259
+ * beside `resolveUrl`, which replaces an outer provider rather than merging
260
+ * with it, so a `resolveRendition` set around the graph does not reach the
261
+ * panel.
262
+ */
263
+ resolveRendition?: ResolveRendition;
250
264
  /**
251
265
  * Mints a URL that works OUTSIDE this page, for the copy control.
252
266
  *
@@ -464,7 +478,10 @@ declare function PipeCardBase({ data, children }: PipeCardBaseProps): react_jsx_
464
478
  * It does not resolve `pipelex-storage://` URIs itself. A host that can passes
465
479
  * `resolveUrl`, which is installed as the kernel's `ResultEnvProvider` so the
466
480
  * kernel's own file arms paint the file; without one, the panel paints whatever
467
- * `public_url` the payload carries.
481
+ * `public_url` the payload carries. A host that keeps smaller copies of its
482
+ * pictures passes `resolveRendition` on the same provider, and a gallery's
483
+ * tiles and a table cell's thumbnails are drawn from those copies while every
484
+ * other use of a picture keeps the whole one.
468
485
  *
469
486
  * ## Saving
470
487
  *
@@ -526,6 +543,14 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
526
543
  * problem rather than an expiry. A resolver is what makes a result durable.
527
544
  */
528
545
  resolveUrl?: ResolveUrl;
546
+ /**
547
+ * Answers a smaller copy of a picture, at the width the kernel asks for, so a
548
+ * gallery's tiles and a table cell's thumbnails stop loading the whole file.
549
+ * The viewer a picture opens, "Open the original", the copy control and every
550
+ * download keep the whole picture, and a copy that fails to load gives way to
551
+ * it. Unset, or for a picture it does not answer, the whole picture is drawn.
552
+ */
553
+ resolveRendition?: ResolveRendition;
529
554
  /**
530
555
  * Mints a URL that works OUTSIDE this page — what the copy control hands over.
531
556
  * A display URL may sit behind the host's session; a shared one carries its
@@ -543,7 +568,7 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
543
568
  */
544
569
  downloads?: DownloadDisplay;
545
570
  }
546
- declare function StuffResultPanel({ pipeIoContracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
571
+ declare function StuffResultPanel({ pipeIoContracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveRendition, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
547
572
 
548
573
  interface DetailPanelProps {
549
574
  isOpen: boolean;
@@ -555,7 +580,11 @@ interface DetailPanelProps {
555
580
  isDragging?: boolean;
556
581
  /** Mouse-down handler for the resize handle. When provided, the handle is rendered. */
557
582
  onResizeHandleMouseDown?: (e: React__default.MouseEvent) => void;
558
- /** Close panel on Escape key. Defaults to true. */
583
+ /**
584
+ * Close panel on Escape key. Defaults to true. An Escape pressed while a
585
+ * dialog is open above the panel, such as the picture viewer a result opens,
586
+ * closes that dialog alone and leaves the panel open.
587
+ */
559
588
  closeOnEscape?: boolean;
560
589
  }
561
590
  declare function DetailPanel({ isOpen, onClose, children, width, isDragging, onResizeHandleMouseDown, closeOnEscape, }: DetailPanelProps): react_jsx_runtime.JSX.Element;
@@ -27,7 +27,7 @@ import {
27
27
  roundedPolylinePath,
28
28
  routeLabelCenter,
29
29
  validateGraphSpec
30
- } from "../../chunk-HPARBH6K.js";
30
+ } from "../../chunk-5E3UJI2I.js";
31
31
  import {
32
32
  GRAPH_STYLES,
33
33
  resolveGraphStyle,
@@ -114,6 +114,7 @@ function StuffResultPanel({
114
114
  producerPipeRef,
115
115
  consumer,
116
116
  resolveUrl,
117
+ resolveRendition,
117
118
  resolveShareUrl,
118
119
  saveFiles,
119
120
  downloads
@@ -127,10 +128,11 @@ function StuffResultPanel({
127
128
  );
128
129
  if (field) {
129
130
  const panel = /* @__PURE__ */ jsx(StuffViewer, { field, value: stuff.data, name: stuff.name });
130
- return resolveUrl || resolveShareUrl || saveFiles || downloads ? /* @__PURE__ */ jsx(
131
+ return resolveUrl || resolveRendition || resolveShareUrl || saveFiles || downloads ? /* @__PURE__ */ jsx(
131
132
  ResultEnvProvider,
132
133
  {
133
134
  resolveUrl,
135
+ resolveRendition,
134
136
  resolveShareUrl,
135
137
  saveFiles,
136
138
  downloads,
@@ -194,6 +196,14 @@ function resultDescriptors(graph) {
194
196
  // src/graph/react/detail/DetailPanel.tsx
195
197
  import React2 from "react";
196
198
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
199
+ var DIALOG_LAYER_SELECTOR = 'dialog, [role="dialog"], [role="alertdialog"]';
200
+ function escapeBelongsAbove(event, panel) {
201
+ if (event.defaultPrevented) return true;
202
+ const target = event.target;
203
+ if (!(target instanceof Element)) return false;
204
+ const layer = target.closest(DIALOG_LAYER_SELECTOR);
205
+ return layer !== null && !(panel !== null && layer.contains(panel));
206
+ }
197
207
  function DetailPanel({
198
208
  isOpen,
199
209
  onClose,
@@ -203,10 +213,11 @@ function DetailPanel({
203
213
  onResizeHandleMouseDown,
204
214
  closeOnEscape = true
205
215
  }) {
216
+ const panelRef = React2.useRef(null);
206
217
  React2.useEffect(() => {
207
218
  if (!isOpen || !closeOnEscape) return;
208
219
  const onKeyDown = (e) => {
209
- if (e.key === "Escape") onClose();
220
+ if (e.key === "Escape" && !escapeBelongsAbove(e, panelRef.current)) onClose();
210
221
  };
211
222
  document.addEventListener("keydown", onKeyDown);
212
223
  return () => document.removeEventListener("keydown", onKeyDown);
@@ -216,7 +227,7 @@ function DetailPanel({
216
227
  !isOpen && "detail-panel--closed",
217
228
  isDragging && "detail-panel--dragging"
218
229
  ].filter(Boolean).join(" ");
219
- return /* @__PURE__ */ jsxs2("div", { className, style: width ? { width: `${width}px` } : void 0, children: [
230
+ return /* @__PURE__ */ jsxs2("div", { ref: panelRef, className, style: width ? { width: `${width}px` } : void 0, children: [
220
231
  onResizeHandleMouseDown && /* @__PURE__ */ jsx2(
221
232
  "div",
222
233
  {
@@ -3229,6 +3240,7 @@ function StuffNodeDetail({
3229
3240
  artifacts,
3230
3241
  theme,
3231
3242
  resolveUrl,
3243
+ resolveRendition,
3232
3244
  resolveShareUrl,
3233
3245
  saveFiles,
3234
3246
  downloads
@@ -3239,9 +3251,9 @@ function StuffNodeDetail({
3239
3251
  const descriptors = resultDescriptors(artifacts);
3240
3252
  const renderData = descriptors ? () => /* @__PURE__ */ jsx30(
3241
3253
  StuffResultPanel,
3242
- __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, descriptors), {
3254
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, descriptors), {
3243
3255
  stuff: stuffData
3244
- }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
3256
+ }), conceptInfo ? { concept: conceptInfo } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveRendition ? { resolveRendition } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
3245
3257
  theme
3246
3258
  })
3247
3259
  ) : void 0;
@@ -3386,6 +3398,7 @@ function GraphViewerCanvas(props) {
3386
3398
  onPaneClick,
3387
3399
  renderDetailExtra,
3388
3400
  resolveUrl,
3401
+ resolveRendition,
3389
3402
  resolveShareUrl,
3390
3403
  saveFiles,
3391
3404
  downloads,
@@ -4196,6 +4209,7 @@ function GraphViewerCanvas(props) {
4196
4209
  theme: resolvedTheme,
4197
4210
  artifacts: graph,
4198
4211
  resolveUrl,
4212
+ resolveRendition,
4199
4213
  resolveShareUrl,
4200
4214
  saveFiles,
4201
4215
  downloads