@pipelex/mthds-ui 0.51.0 → 0.52.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.
@@ -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-DgYaVX6K.js';
4
4
  export { r as PipeOperatorType } from '../../types-DgYaVX6K.js';
5
5
  import { PipeIOContracts, OutputForm, InputForm, SaveFiles } from '@pipelex/mthds-form';
6
- import { ResolveUrl, ResolveRendition, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
6
+ import { ResolveUrl, ResolveRendition, ResolveDocumentPdf, ResolveShareUrl, DownloadDisplay } from '@pipelex/mthds-form/react';
7
7
  import { Edge, Node, ReactFlowInstance } from '@xyflow/react';
8
8
  import 'mthds/errors';
9
9
 
@@ -261,6 +261,22 @@ interface GraphViewerProps {
261
261
  * panel.
262
262
  */
263
263
  resolveRendition?: ResolveRendition;
264
+ /**
265
+ * Answers whether the host has a PDF of a document the browser cannot render,
266
+ * such as a Word, Excel or PowerPoint file, so the result panel can preview
267
+ * that document's pages.
268
+ *
269
+ * Called with the document's own `url` member, as `resolveUrl` is, and what
270
+ * the payload declares about it (`{ filename, mimeType }`); answer
271
+ * `undefined` for a document the host cannot convert, or an ask the panel
272
+ * calls when the reader opens the preview, and again while the host answers
273
+ * `preparing`. Only the preview uses it: the document's name, its copy
274
+ * control and every download keep the original. It goes on the panel's
275
+ * provider beside `resolveUrl`, which replaces an outer provider rather than
276
+ * merging with it, so a `resolveDocumentPdf` set around the graph does not
277
+ * reach the panel.
278
+ */
279
+ resolveDocumentPdf?: ResolveDocumentPdf;
264
280
  /**
265
281
  * Mints a URL that works OUTSIDE this page, for the copy control.
266
282
  *
@@ -481,7 +497,10 @@ declare function PipeCardBase({ data, children }: PipeCardBaseProps): react_jsx_
481
497
  * `public_url` the payload carries. A host that keeps smaller copies of its
482
498
  * pictures passes `resolveRendition` on the same provider, and a gallery's
483
499
  * tiles and a table cell's thumbnails are drawn from those copies while every
484
- * other use of a picture keeps the whole one.
500
+ * other use of a picture keeps the whole one. A host that can make a PDF of a
501
+ * document the browser cannot render, such as a Word, Excel or PowerPoint file,
502
+ * passes `resolveDocumentPdf` there too, and that document's preview shows the
503
+ * PDF's pages.
485
504
  *
486
505
  * ## Saving
487
506
  *
@@ -551,6 +570,15 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
551
570
  * it. Unset, or for a picture it does not answer, the whole picture is drawn.
552
571
  */
553
572
  resolveRendition?: ResolveRendition;
573
+ /**
574
+ * Answers whether the host has a PDF of a document the browser cannot render,
575
+ * such as a Word, Excel or PowerPoint file: `undefined` for one it cannot
576
+ * convert, or an ask the kernel calls when the reader opens the preview. The
577
+ * document's preview then shows the PDF's pages, while its name, its copy
578
+ * control and every download keep the original. Unset, such a document
579
+ * offers no preview.
580
+ */
581
+ resolveDocumentPdf?: ResolveDocumentPdf;
554
582
  /**
555
583
  * Mints a URL that works OUTSIDE this page — what the copy control hands over.
556
584
  * A display URL may sit behind the host's session; a shared one carries its
@@ -568,7 +596,7 @@ interface StuffResultPanelProps extends StuffResultRendererOptions {
568
596
  */
569
597
  downloads?: DownloadDisplay;
570
598
  }
571
- declare function StuffResultPanel({ pipeIoContracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveRendition, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
599
+ declare function StuffResultPanel({ pipeIoContracts, outputForm, inputForm, stuff, producerPipeRef, consumer, resolveUrl, resolveRendition, resolveDocumentPdf, resolveShareUrl, saveFiles, downloads, }: StuffResultPanelProps): react_jsx_runtime.JSX.Element | null;
572
600
 
573
601
  interface DetailPanelProps {
574
602
  isOpen: boolean;
@@ -367,6 +367,7 @@ function StuffResultPanel({
367
367
  consumer,
368
368
  resolveUrl,
369
369
  resolveRendition,
370
+ resolveDocumentPdf,
370
371
  resolveShareUrl,
371
372
  saveFiles,
372
373
  downloads
@@ -380,11 +381,12 @@ function StuffResultPanel({
380
381
  );
381
382
  if (field) {
382
383
  const panel = /* @__PURE__ */ jsx3(StuffViewer, { field, value: stuff.data, name: stuff.name });
383
- return resolveUrl || resolveRendition || resolveShareUrl || saveFiles || downloads ? /* @__PURE__ */ jsx3(
384
+ return resolveUrl || resolveRendition || resolveDocumentPdf || resolveShareUrl || saveFiles || downloads ? /* @__PURE__ */ jsx3(
384
385
  ResultEnvProvider,
385
386
  {
386
387
  resolveUrl,
387
388
  resolveRendition,
389
+ resolveDocumentPdf,
388
390
  resolveShareUrl,
389
391
  saveFiles,
390
392
  downloads,
@@ -2297,12 +2299,19 @@ function ResultView({
2297
2299
  const descriptors = resultDescriptors(artifacts);
2298
2300
  if (!descriptors) return null;
2299
2301
  const concept = stuff.concept && graphspec ? resolveConceptRef(graphspec, stuff.concept) : void 0;
2300
- const { resolveUrl, resolveRendition, resolveShareUrl, saveFiles, downloads } = valueOptions;
2302
+ const {
2303
+ resolveUrl,
2304
+ resolveRendition,
2305
+ resolveDocumentPdf,
2306
+ resolveShareUrl,
2307
+ saveFiles,
2308
+ downloads
2309
+ } = valueOptions;
2301
2310
  return /* @__PURE__ */ jsx22(
2302
2311
  StuffResultPanel,
2303
- __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, descriptors), {
2312
+ __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, descriptors), {
2304
2313
  stuff
2305
- }), concept ? { concept } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveRendition ? { resolveRendition } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
2314
+ }), concept ? { concept } : {}), producerPipeRef ? { producerPipeRef } : {}), consumer ? { consumer } : {}), resolveUrl ? { resolveUrl } : {}), resolveRendition ? { resolveRendition } : {}), resolveDocumentPdf ? { resolveDocumentPdf } : {}), resolveShareUrl ? { resolveShareUrl } : {}), saveFiles ? { saveFiles } : {}), downloads ? { downloads } : {}), {
2306
2315
  theme
2307
2316
  })
2308
2317
  );
@@ -4030,6 +4039,7 @@ function GraphViewerCanvas(props) {
4030
4039
  renderDetailExtra,
4031
4040
  resolveUrl,
4032
4041
  resolveRendition,
4042
+ resolveDocumentPdf,
4033
4043
  resolveShareUrl,
4034
4044
  saveFiles,
4035
4045
  downloads,
@@ -4756,8 +4766,15 @@ function GraphViewerCanvas(props) {
4756
4766
  [projectedData, graphStyle]
4757
4767
  );
4758
4768
  const valueOptions = React13.useMemo(
4759
- () => ({ resolveUrl, resolveRendition, resolveShareUrl, saveFiles, downloads }),
4760
- [resolveUrl, resolveRendition, resolveShareUrl, saveFiles, downloads]
4769
+ () => ({
4770
+ resolveUrl,
4771
+ resolveRendition,
4772
+ resolveDocumentPdf,
4773
+ resolveShareUrl,
4774
+ saveFiles,
4775
+ downloads
4776
+ }),
4777
+ [resolveUrl, resolveRendition, resolveDocumentPdf, resolveShareUrl, saveFiles, downloads]
4761
4778
  );
4762
4779
  const effectiveToolbarPosition = resolveToolbarPosition(
4763
4780
  toolbarPositionProp,