@morscherlab/mint-sdk 1.2.0-beta.12 → 1.2.0-beta.13

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.
Files changed (69) hide show
  1. package/dist/__tests__/components/FileBrowserModal.test.d.ts +1 -0
  2. package/dist/__tests__/components/FilePicker.state.test.d.ts +1 -0
  3. package/dist/__tests__/components/FilePicker.test.d.ts +1 -0
  4. package/dist/__tests__/composables/useFileBrowser.test.d.ts +1 -0
  5. package/dist/__tests__/composables/usePlatformFilePickerAdapter.test.d.ts +1 -0
  6. package/dist/components/FileBrowserModal.vue.d.ts +99 -0
  7. package/dist/components/FilePicker.vue.d.ts +32 -0
  8. package/dist/components/fileBrowserPresentation.d.ts +10 -0
  9. package/dist/components/index.d.ts +3 -0
  10. package/dist/components/index.js +2 -2
  11. package/dist/components/internal/FileBrowserDialogInternal.vue.d.ts +34 -0
  12. package/dist/components/internal/FileBrowserListingInternal.vue.d.ts +25 -0
  13. package/dist/components/internal/FileBrowserToolbarInternal.vue.d.ts +26 -0
  14. package/dist/components/internal/FilePickerPreviewInternal.vue.d.ts +18 -0
  15. package/dist/components/internal/FilePickerTreeInternal.vue.d.ts +31 -0
  16. package/dist/{components-DnZzoTN4.js → components-DuQRC810.js} +3725 -1519
  17. package/dist/components-DuQRC810.js.map +1 -0
  18. package/dist/composables/filePicker/localFiles.d.ts +3 -0
  19. package/dist/composables/filePicker/usePickerNavigation.d.ts +95 -0
  20. package/dist/composables/filePicker/usePickerSelection.d.ts +31 -0
  21. package/dist/composables/filePicker/validation.d.ts +5 -0
  22. package/dist/composables/index.d.ts +2 -0
  23. package/dist/composables/index.js +3 -3
  24. package/dist/composables/useFileBrowser.d.ts +55 -0
  25. package/dist/composables/useFilePicker.d.ts +190 -0
  26. package/dist/composables/usePlatformFilePickerAdapter.d.ts +11 -0
  27. package/dist/{composables-B_pia3hO.js → composables-hY2Q2xPI.js} +289 -3
  28. package/dist/composables-hY2Q2xPI.js.map +1 -0
  29. package/dist/index.js +4 -4
  30. package/dist/install.js +1 -1
  31. package/dist/styles.css +2232 -1259
  32. package/dist/types/fileBrowserTypes.d.ts +77 -0
  33. package/dist/types/filePicker.d.ts +69 -0
  34. package/dist/types/index.d.ts +2 -0
  35. package/dist/{useProtocolTemplates-BmX_iVBR.js → validation-nBbSn1TI.js} +46 -2
  36. package/dist/validation-nBbSn1TI.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/__tests__/components/FileBrowserModal.test.ts +460 -0
  39. package/src/__tests__/components/FilePicker.state.test.ts +160 -0
  40. package/src/__tests__/components/FilePicker.test.ts +328 -0
  41. package/src/__tests__/composables/useFileBrowser.test.ts +305 -0
  42. package/src/__tests__/composables/usePlatformFilePickerAdapter.test.ts +67 -0
  43. package/src/components/FileBrowserModal.story.vue +203 -0
  44. package/src/components/FileBrowserModal.vue +384 -0
  45. package/src/components/FilePicker.vue +301 -0
  46. package/src/components/fileBrowserPresentation.ts +39 -0
  47. package/src/components/index.ts +4 -0
  48. package/src/components/internal/FileBrowserDialogInternal.vue +75 -0
  49. package/src/components/internal/FileBrowserListingInternal.vue +197 -0
  50. package/src/components/internal/FileBrowserToolbarInternal.vue +136 -0
  51. package/src/components/internal/FilePickerPreviewInternal.vue +100 -0
  52. package/src/components/internal/FilePickerTreeInternal.vue +238 -0
  53. package/src/composables/filePicker/localFiles.ts +55 -0
  54. package/src/composables/filePicker/usePickerNavigation.ts +199 -0
  55. package/src/composables/filePicker/usePickerSelection.ts +242 -0
  56. package/src/composables/filePicker/validation.ts +40 -0
  57. package/src/composables/index.ts +7 -0
  58. package/src/composables/useFileBrowser.ts +314 -0
  59. package/src/composables/useFilePicker.ts +347 -0
  60. package/src/composables/usePlatformFilePickerAdapter.ts +104 -0
  61. package/src/styles/components/file-browser-modal.css +489 -0
  62. package/src/styles/components/file-picker.css +501 -0
  63. package/src/styles/index.css +3 -0
  64. package/src/types/fileBrowserTypes.ts +85 -0
  65. package/src/types/filePicker.ts +65 -0
  66. package/src/types/index.ts +14 -0
  67. package/dist/components-DnZzoTN4.js.map +0 -1
  68. package/dist/composables-B_pia3hO.js.map +0 -1
  69. package/dist/useProtocolTemplates-BmX_iVBR.js.map +0 -1
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Types for browsing read-only server mounts.
3
+ *
4
+ * These mirror the `mint_sdk.filesystem` wire models. MINT records the path of
5
+ * data that already sits on a mount; it never copies it.
6
+ */
7
+ /** What a listing row is. */
8
+ export type FileEntryKind = 'file' | 'directory';
9
+ /** Field a listing is ordered by, after directories are grouped first. */
10
+ export type FileBrowserSortKey = 'name' | 'size' | 'modified';
11
+ /** One read-only directory tree exposed by the server. */
12
+ export interface ServerMount {
13
+ id: string;
14
+ label: string;
15
+ read_only?: boolean;
16
+ /** False when the mount is configured but currently unreachable. */
17
+ available?: boolean;
18
+ /** Child mounts, used to render the sidebar tree. */
19
+ children?: ServerMount[];
20
+ /** Item count shown beside the mount; free-form so callers can send "1.2k". */
21
+ count?: string | number;
22
+ }
23
+ /** One step of the trail from a mount root to the current directory. */
24
+ export interface FilePathCrumb {
25
+ label: string;
26
+ path: string;
27
+ }
28
+ /** A single file or directory inside a mount. */
29
+ export interface FileEntry {
30
+ name: string;
31
+ /** Mount-relative POSIX path. */
32
+ path: string;
33
+ kind: FileEntryKind;
34
+ /** Null for directories. */
35
+ size_bytes?: number | null;
36
+ modified_at?: string | null;
37
+ extension?: string;
38
+ /**
39
+ * False when the entry fails the active type rules. Non-matching entries are
40
+ * still listed — they dim rather than vanish.
41
+ */
42
+ matches_type_rules?: boolean;
43
+ /** Directories only. */
44
+ child_count?: number | null;
45
+ }
46
+ /** The contents of one directory inside a mount. */
47
+ export interface FileDirectoryListing {
48
+ mount_id: string;
49
+ path: string;
50
+ /** Null at the mount root. */
51
+ parent?: string | null;
52
+ breadcrumbs?: FilePathCrumb[];
53
+ entries?: FileEntry[];
54
+ /** Directory size before any search filter. */
55
+ total_count?: number;
56
+ /** How many entries satisfy the type rules. */
57
+ match_count?: number;
58
+ /** How many entries this response carries, after search and any cap. */
59
+ shown_count?: number;
60
+ /** True when the directory held more entries than the server will return. */
61
+ truncated?: boolean;
62
+ }
63
+ /** One item the user has picked. */
64
+ export interface FileSelection {
65
+ mount_id: string;
66
+ path: string;
67
+ name: string;
68
+ kind: FileEntryKind;
69
+ /** For a directory pick, how many files it contains. */
70
+ child_count?: number | null;
71
+ size_bytes?: number | null;
72
+ }
73
+ /** Where the user is standing in the browser. */
74
+ export interface FileBrowserLocation {
75
+ mount_id: string;
76
+ path: string;
77
+ }
@@ -0,0 +1,69 @@
1
+ /** Sources are supplied by the host; the SDK never infers a host filesystem path. */
2
+ export type PickerSource = 'server' | 'localFile';
3
+ export type PickerSelectionMode = 'single-file' | 'multi-file' | 'folder' | 'folder+files';
4
+ interface PickerNodeBase {
5
+ path: string;
6
+ name: string;
7
+ parentPath?: string | null;
8
+ parentName?: string;
9
+ bytes?: number | null;
10
+ /** An explicit adapter failure makes a row inert, including its disclosure. */
11
+ unavailableReason?: string;
12
+ }
13
+ export interface PickerFolder extends PickerNodeBase {
14
+ kind: 'folder';
15
+ fileCount?: number | null;
16
+ formats?: Record<string, number>;
17
+ hasChildren?: boolean;
18
+ }
19
+ export interface PickerFile extends PickerNodeBase {
20
+ kind: 'file';
21
+ format: string;
22
+ /** Present only for browser-selected files. The picker does not read its bytes. */
23
+ file?: File;
24
+ }
25
+ export type PickerNode = PickerFolder | PickerFile;
26
+ export interface PickerRequest {
27
+ signal?: AbortSignal;
28
+ source?: PickerSource;
29
+ }
30
+ export interface PickerAdapter {
31
+ listRoot(request?: PickerRequest): Promise<PickerNode[]>;
32
+ listChildren(path: string, request?: PickerRequest): Promise<PickerNode[]>;
33
+ search(query: string, scope: {
34
+ path: string;
35
+ recursive: boolean;
36
+ }, request?: PickerRequest): Promise<PickerNode[]>;
37
+ }
38
+ export interface PickerCapability {
39
+ /** Case-insensitive suffixes, including compound extensions such as mzML.gz. */
40
+ formats: string[];
41
+ maxBytes?: number;
42
+ /** Optional host-owned blank classification; no filename heuristics in the SDK. */
43
+ isBlank?: (node: PickerNode) => boolean;
44
+ }
45
+ export type PickerCapabilities = Partial<Record<PickerSource, PickerCapability>>;
46
+ export type PickerExclusionReason = 'deselected' | 'unsupported' | 'tooLarge' | 'blank' | 'unreadable';
47
+ export interface PickerExcluded {
48
+ /** Opaque identity prevents collisions between equal filenames in different folders. */
49
+ path: string;
50
+ name: string;
51
+ reason: PickerExclusionReason;
52
+ }
53
+ export type PickerSelection = {
54
+ source: 'server';
55
+ folders: string[];
56
+ files: PickerFile[];
57
+ excluded: PickerExcluded[];
58
+ } | {
59
+ source: 'localFile';
60
+ files: File[];
61
+ };
62
+ export interface PickerTreeRow {
63
+ node: PickerNode;
64
+ depth: number;
65
+ expanded: boolean;
66
+ loading: boolean;
67
+ error?: string;
68
+ }
69
+ export {};
@@ -2,6 +2,7 @@ export type { ContainerDirection, ButtonVariant, ButtonSize, ActionMenuItem, Inp
2
2
  export type * from './generated-ui';
3
3
  export type { AnalysisArtifactStatus, AnalysisArtifactStatusFilter, AnalysisArtifactSummary, AnalysisArtifactDetail, AnalysisArtifactListResponse, AnalysisArtifactTarget, AnalysisArtifactMetadataUpdate, ArtifactSaveMode, ArtifactFileSource, JsonArtifactSavePayload, FileArtifactCreatePayload, FileArtifactUpdatePayload, HandlerFileArtifactCreatePayload, HandlerFileArtifactUpdatePayload, ArtifactSavePayload, HandlerArtifactSavePayload, ArtifactSaveDialogPayload, ArtifactSaveResult, ArtifactSaveHandler, HandlerArtifactSaveHandler, ArtifactSaveDialogHandler, } from './analysisArtifactTypes';
4
4
  export { ANALYSIS_FILE_ARTIFACT_SCHEMA } from './analysisArtifactTypes';
5
+ export type { FileBrowserLocation, FileBrowserSortKey, FileDirectoryListing, FileEntry, FileEntryKind, FilePathCrumb, FileSelection, ServerMount, } from './fileBrowserTypes';
5
6
  export type { JobListPayload, JobProgress, JobSnapshotPayload, JobState, JobStateInput, JobStatus, JobStreamData, } from './jobs';
6
7
  export type { InstrumentAlert, InstrumentAlertBody, InstrumentAlertLevel, InstrumentState, InstrumentStatus, SampleInfo, SampleInfo as InstrumentSampleInfo, SequenceProgress, } from './instrument';
7
8
  export type { LcmsContainerType, LcmsPolarity, LcmsSequenceItem, LcmsSequenceTableColumn, } from '../lcms';
@@ -10,3 +11,4 @@ export type { FormFieldType, FieldCondition, FieldValidation, FormFieldSchema, F
10
11
  export type { OutlierAction, InputMode, OutlierInfo, ColumnInfo, MetadataRow, AutoGroupResult, ParsedCsvData, } from './auto-group';
11
12
  export type { AuthConfig, UserInfo, LoginResponse, TokenVerifyResponse, RegisterRequest, UpdateProfileRequest, CredentialInfo, } from './auth';
12
13
  export type { PluginInfo, PluginNavItem, PluginSettings, PluginSettingField, PlatformContext, PlatformContextOptions, PlatformEventType, PlatformEvent, ThemeMode, ColorPalette, TableDensity, UserSummary, } from './platform';
14
+ export type * from './filePicker';
@@ -5607,6 +5607,50 @@ function useProtocolTemplates() {
5607
5607
  };
5608
5608
  }
5609
5609
  //#endregion
5610
- export { usePresenceHeartbeat as $, useAutoGroup as A, useReorderAnnouncer as B, getSampleGroupParentPath as C, useFileImport as D, readFileAsText as E, DEFAULT_COLORS as F, usePluginWorkspace as G, combinePluginJobSources as H, useWellPlateEditor as I, APP_EXPERIMENT_KEY as J, DEFAULT_MOBILE_VIEWPORT_QUERY as K, REORDER_ANNOUNCER_STYLE as L, extractSampleNamesFromDesignData as M, extractSampleOptionsFromDesignData as N, validateImportFile as O, unwrapExperimentDesignData as P, getPresenceClientId as Q, reorderList as R, getSampleGroupMajorPrefix as S, parseDelimitedText as T, useJobsStatusTray as U, useDoseCalculator as V, usePluginJobCenter as W, getInjectedFrontendRevision as X, useAppExperiment as Y, useRuntimeAlignment as Z, useScheduleDrag as _, useReagentSeries as a, compareSortValues as at, useExpansionSet as b, useBioTemplatePresetWorkspace as c, useRovingFocus as ct, getBioTemplateComponentProps as d, useTheme as et, toBioTemplateComponentPropsByComponent as f, useExperimentSave as g, useTemplateCollection as h, generateDilutionSeries as i, useTextSearch as it, parseCSV as j, extractSamplesFromDesignData as k, useBioTemplatePackWorkspace as l, useBioTemplateControls as m, DEFAULT_PRESETS as n, candidateMatchesSearch as nt, useGroupAssignment as o, useSortedItems as ot, useBioTemplateComponents as p, useMobileSupportGate as q, DEFAULT_UNITS as r, normalizeSearchQuery as rt, useRackEditor as s, useMenuKeyboard as st, useProtocolTemplates as t, useToast as tt, useBioTemplateWorkspace as u, useExperimentSamples as v, detectDelimiter as w, useSampleGroups as x, useExperimentData as y, useListReorder as z };
5610
+ //#region src/composables/filePicker/validation.ts
5611
+ function normalizePickerFormat(format) {
5612
+ return format.trim().replace(/^\./, "").toLowerCase();
5613
+ }
5614
+ function pickerExclusion(node, capability, skipBlanks = false) {
5615
+ const base = {
5616
+ path: node.path,
5617
+ name: node.name
5618
+ };
5619
+ if (node.unavailableReason) return {
5620
+ ...base,
5621
+ reason: "unreadable"
5622
+ };
5623
+ if (skipBlanks && capability?.isBlank?.(node)) return {
5624
+ ...base,
5625
+ reason: "blank"
5626
+ };
5627
+ if (node.kind === "folder") return null;
5628
+ const formats = capability?.formats.map(normalizePickerFormat) ?? [];
5629
+ if (formats.length && !formats.some((format) => node.name.toLowerCase().endsWith(`.${format}`))) return {
5630
+ ...base,
5631
+ reason: "unsupported"
5632
+ };
5633
+ if (capability?.maxBytes != null && node.bytes != null && node.bytes > capability.maxBytes) return {
5634
+ ...base,
5635
+ reason: "tooLarge"
5636
+ };
5637
+ return null;
5638
+ }
5639
+ function pickerReason(excluded, node) {
5640
+ if (!excluded) return "";
5641
+ return {
5642
+ unsupported: "This format is not supported by this source.",
5643
+ tooLarge: "This file exceeds the size limit for this source.",
5644
+ blank: "Skipped by the blank-file rule.",
5645
+ unreadable: node?.unavailableReason || "This item cannot be read.",
5646
+ deselected: "Removed from the selection."
5647
+ }[excluded.reason];
5648
+ }
5649
+ function pickerFormat(name) {
5650
+ const compound = /\.(mzml|mzxml)\.gz$/i.exec(name);
5651
+ return compound ? `${compound[1]}.gz` : name.includes(".") ? name.split(".").pop() : "";
5652
+ }
5653
+ //#endregion
5654
+ export { getInjectedFrontendRevision as $, useFileImport as A, REORDER_ANNOUNCER_STYLE as B, useExpansionSet as C, detectDelimiter as D, getSampleGroupParentPath as E, extractSampleNamesFromDesignData as F, combinePluginJobSources as G, useListReorder as H, extractSampleOptionsFromDesignData as I, usePluginWorkspace as J, useJobsStatusTray as K, unwrapExperimentDesignData as L, extractSamplesFromDesignData as M, useAutoGroup as N, parseDelimitedText as O, parseCSV as P, useAppExperiment as Q, DEFAULT_COLORS as R, useExperimentData as S, getSampleGroupMajorPrefix as T, useReorderAnnouncer as U, reorderList as V, useDoseCalculator as W, useMobileSupportGate as X, DEFAULT_MOBILE_VIEWPORT_QUERY as Y, APP_EXPERIMENT_KEY as Z, useBioTemplateControls as _, DEFAULT_PRESETS as a, candidateMatchesSearch as at, useScheduleDrag as b, useReagentSeries as c, compareSortValues as ct, useBioTemplatePresetWorkspace as d, useRovingFocus as dt, useRuntimeAlignment as et, useBioTemplatePackWorkspace as f, useBioTemplateComponents as g, toBioTemplateComponentPropsByComponent as h, useProtocolTemplates as i, useToast as it, validateImportFile as j, readFileAsText as k, useGroupAssignment as l, useSortedItems as lt, getBioTemplateComponentProps as m, pickerFormat as n, usePresenceHeartbeat as nt, DEFAULT_UNITS as o, normalizeSearchQuery as ot, useBioTemplateWorkspace as p, usePluginJobCenter as q, pickerReason as r, useTheme as rt, generateDilutionSeries as s, useTextSearch as st, pickerExclusion as t, getPresenceClientId as tt, useRackEditor as u, useMenuKeyboard as ut, useTemplateCollection as v, useSampleGroups as w, useExperimentSamples as x, useExperimentSave as y, useWellPlateEditor as z };
5611
5655
 
5612
- //# sourceMappingURL=useProtocolTemplates-BmX_iVBR.js.map
5656
+ //# sourceMappingURL=validation-nBbSn1TI.js.map