@pipelex/mthds-form 0.11.0 → 0.12.1

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.
@@ -28,10 +28,33 @@ interface StuffFile {
28
28
  /** The file's own name when it states one — otherwise the caller derives it. */
29
29
  filename?: string;
30
30
  mimeType?: string;
31
- /** Where it sat, dotted: `report.attachments.2.scan`. Names a saved file. */
31
+ /**
32
+ * Where it sat, dotted, starting at the root's name:
33
+ * `report.attachments.2.scan`. A saved file with no name of its own is named
34
+ * by the base name and the segments after the first (`report-attachments-2-scan`),
35
+ * since the base name stands for the root, so a hand-built path must start at
36
+ * the root's name too, or its first real segment is lost.
37
+ */
32
38
  path: string;
33
- kind: 'image' | 'document' | 'markup';
39
+ kind: StuffFileKind;
34
40
  }
41
+ /**
42
+ * What a file is: a picture, a document, or a page of markup the stuff carries
43
+ * inline. It is the descriptor's statement (the node's kind, or its concept for
44
+ * `native.Html`), never a reading of the bytes.
45
+ */
46
+ type StuffFileKind = 'image' | 'document' | 'markup';
47
+ /**
48
+ * One file value, read as the file it is declared to be — or `undefined` when
49
+ * the value holds nothing to save (no URL, no markup).
50
+ *
51
+ * The walk below calls this for every file node it reaches, and the result view
52
+ * calls it for the one file a control is drawn beside, so a file's own download
53
+ * button and the whole-result download read the value the same way. `kind` is
54
+ * the caller's statement from the descriptor; this never inspects the value to
55
+ * decide what it is.
56
+ */
57
+ declare function readStuffFile(kind: StuffFileKind, value: unknown, path: string): StuffFile | undefined;
35
58
  /**
36
59
  * Every file inside a stuff, found by walking the DESCRIPTOR — never the value.
37
60
  *
@@ -50,4 +73,4 @@ interface StuffFile {
50
73
  */
51
74
  declare function collectStuffFiles(field: RunField, value: unknown): StuffFile[];
52
75
 
53
- export { type StuffFile, collectStuffFiles };
76
+ export { type StuffFile, type StuffFileKind, collectStuffFiles, readStuffFile };
@@ -1,5 +1,5 @@
1
- export { collectStuffFiles } from '../chunk-4JQAJT7C.js';
2
- import '../chunk-TID7ZN63.js';
1
+ export { collectStuffFiles, readStuffFile } from '../chunk-RRTI7AIR.js';
2
+ import '../chunk-CM4KVG53.js';
3
3
  import '../chunk-V3OV2XQT.js';
4
4
  //# sourceMappingURL=stuff-files.js.map
5
5
  //# sourceMappingURL=stuff-files.js.map
@@ -1,7 +1,8 @@
1
1
  "use client";
2
- import { cn, fieldControlClass, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-E2IVBAW3.js';
3
- import '../chunk-4JQAJT7C.js';
4
- import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-TID7ZN63.js';
2
+ import { cn, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-2D4NEFUH.js';
3
+ import '../chunk-7KQXGG6J.js';
4
+ import '../chunk-RRTI7AIR.js';
5
+ import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-CM4KVG53.js';
5
6
  import '../chunk-FABY3DEY.js';
6
7
  import '../chunk-XCO6GTEC.js';
7
8
  import '../chunk-PM55AHRO.js';
@@ -2292,8 +2293,9 @@ function MthdsResult({ props }) {
2292
2293
  const path = useAbsolutePath(props.path) ?? "";
2293
2294
  const field = scope.result && path ? resultFieldAtPath(scope.result, path) : void 0;
2294
2295
  const value = useStateValue(path);
2295
- if (!field) return /* @__PURE__ */ jsx(Unresolved, { path: props.path, side: "result" });
2296
- return /* @__PURE__ */ jsx(ResultField, { field, value, hideLabel: props.hideLabel ?? false });
2296
+ if (!field || !scope.result) return /* @__PURE__ */ jsx(Unresolved, { path: props.path, side: "result" });
2297
+ const place = [scope.result.name, ...segmentsUnder(RESULT_ROOT, path) ?? []];
2298
+ return /* @__PURE__ */ jsx(ResultRoot, { baseName: scope.result.name, path: place, children: /* @__PURE__ */ jsx(ResultField, { field, value, hideLabel: props.hideLabel ?? false }) });
2297
2299
  }
2298
2300
  function AccessibleSelect({ props, bindings, emit }) {
2299
2301
  const [boundValue, setBoundValue] = useBoundProp(