@pipelex/mthds-form 0.17.1 → 0.19.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,5 +1,5 @@
1
1
  "use client";
2
- import { cn, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-Y4MTDG2R.js';
2
+ import { cn, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-QCGIH3WY.js';
3
3
  import '../chunk-ICUEHNEH.js';
4
4
  export { seedInputs } from '../chunk-VH5CDQDR.js';
5
5
  import '../chunk-RRTI7AIR.js';
@@ -812,6 +812,27 @@ interface DownloadDisplay {
812
812
  * `docs/result-view.md`.
813
813
  */
814
814
  type TableLayout = 'scroll' | 'stack';
815
+ /** An HTML page handed to a host's own PDF maker. */
816
+ interface PdfPage {
817
+ /**
818
+ * The page as one standalone document: the frame document the preview shows,
819
+ * under the same policy (no scripts, the same `img-src` and `font-src`), with
820
+ * the stored pictures it names already resolved. A host that prints it
821
+ * elsewhere, on a server, can fetch only what those resolvers answered as a
822
+ * real URL or inline data: a `blob:` URL belongs to the reader's tab.
823
+ */
824
+ html: string;
825
+ /** The PDF's document title, when the reader's file name gives one. */
826
+ title?: string;
827
+ }
828
+ /**
829
+ * How a host makes the PDF of an HTML page itself, typically on a server with
830
+ * a print engine, which keeps the text as text: selectable, searchable and
831
+ * editable. Resolve to the PDF's bytes; reject and the control shows its
832
+ * failure. Unset, the PDF is made in the browser (`renderHtmlPdf`), whose pages
833
+ * are pictures.
834
+ */
835
+ type RenderPdf = (page: PdfPage) => Promise<Blob>;
815
836
  interface ResultEnv {
816
837
  resolveUrl?: ResolveUrl;
817
838
  /**
@@ -878,8 +899,13 @@ interface ResultEnv {
878
899
  * See {@link TableLayout}.
879
900
  */
880
901
  tableLayout?: TableLayout;
902
+ /**
903
+ * The host's own PDF maker, which "Download PDF" calls instead of making the
904
+ * PDF in the browser. See {@link RenderPdf}.
905
+ */
906
+ renderPdf?: RenderPdf;
881
907
  }
882
- declare function ResultEnvProvider({ resolveUrl, resolveUrls, resolveShareUrl, proseImages, tableColumns, tableLayout, saveFiles, downloads, children, }: ResultEnv & {
908
+ declare function ResultEnvProvider({ resolveUrl, resolveUrls, resolveShareUrl, proseImages, tableColumns, tableLayout, saveFiles, downloads, renderPdf, children, }: ResultEnv & {
883
909
  children: ReactNode;
884
910
  }): react.JSX.Element;
885
911
  /**
@@ -1226,8 +1252,9 @@ interface PdfDownloadButtonProps {
1226
1252
  }
1227
1253
  /**
1228
1254
  * "Download PDF" for an HTML page: one click, and the browser saves
1229
- * `<fileName>.pdf`. The PDF is made in the browser (`renderHtmlPdf`) from a
1230
- * script-free copy of the page laid out with its print rules, and handed to the
1255
+ * `<fileName>.pdf`. The PDF is made by the host's `renderPdf` when the result
1256
+ * environment supplies one, and otherwise in the browser (`renderHtmlPdf`) from
1257
+ * a script-free copy of the page laid out with its print rules; it is handed to the
1231
1258
  * result environment's `saveFiles` like every other download, so a host that
1232
1259
  * delivers files its own way delivers this one too. The stored pictures the
1233
1260
  * page names are resolved through the environment's resolvers first, as its
@@ -1364,4 +1391,4 @@ declare function FieldDomIdProvider({ prefix, children, }: {
1364
1391
  */
1365
1392
  declare function useFieldDomId(path: string): string;
1366
1393
 
1367
- export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, type DownloadDisplay, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, type HtmlPdf, type HtmlPdfOptions, HtmlPreview, type HtmlPreviewProps, ImageField, JsonView, ListField, Markdown, type MarkdownProps, type MarkupResolvers, MethodForm, type MethodFormController, type MethodFormProps, type MethodFormState, type MethodFormUploadContext, type MethodFormValues, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, type PdfDownloadButtonProps, ProseField, type ProseImages, type ResolveShareUrl, type ResolveUrl, type ResolveUrls, ResultEnvProvider, ResultField, type ResultFieldProps, SUPPORTED_LOCALES, StuffViewer, type StuffViewerProps, type StuffViewerView, type TableLayout, TextField, UnknownField, type UploadedFile, type UseMethodFormOptions, fieldControlClass, fieldStringsFor, humanizeFieldName, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
1394
+ export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, type DownloadDisplay, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, type HtmlPdf, type HtmlPdfOptions, HtmlPreview, type HtmlPreviewProps, ImageField, JsonView, ListField, Markdown, type MarkdownProps, type MarkupResolvers, MethodForm, type MethodFormController, type MethodFormProps, type MethodFormState, type MethodFormUploadContext, type MethodFormValues, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, type PdfDownloadButtonProps, type PdfPage, ProseField, type ProseImages, type RenderPdf, type ResolveShareUrl, type ResolveUrl, type ResolveUrls, ResultEnvProvider, ResultField, type ResultFieldProps, SUPPORTED_LOCALES, StuffViewer, type StuffViewerProps, type StuffViewerView, type TableLayout, TextField, UnknownField, type UploadedFile, type UseMethodFormOptions, fieldControlClass, fieldStringsFor, humanizeFieldName, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, HtmlPreview, ImageField, JsonView, ListField, Markdown, MethodForm, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, ProseField, ResultEnvProvider, ResultField, SUPPORTED_LOCALES, StuffViewer, TextField, UnknownField, fieldControlClass, fieldStringsFor, humanizeFieldName, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl } from '../chunk-Y4MTDG2R.js';
2
+ export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, HtmlPreview, ImageField, JsonView, ListField, Markdown, MethodForm, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, ProseField, ResultEnvProvider, ResultField, SUPPORTED_LOCALES, StuffViewer, TextField, UnknownField, fieldControlClass, fieldStringsFor, humanizeFieldName, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl } from '../chunk-QCGIH3WY.js';
3
3
  import '../chunk-ICUEHNEH.js';
4
4
  import '../chunk-VH5CDQDR.js';
5
5
  import '../chunk-RRTI7AIR.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelex/mthds-form",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "Headless form kernel and control set for MTHDS method inputs",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -76,7 +76,7 @@
76
76
  "lucide-react": "^0.462.0",
77
77
  "marked": "^18.0.11",
78
78
  "modern-screenshot": "^4.7.0",
79
- "mthds": "^0.30.1",
79
+ "mthds": "^0.32.1",
80
80
  "react-dropzone": "^14.3.8",
81
81
  "tailwind-merge": "^3.6.0",
82
82
  "zod": "^4.5.4"