@morscherlab/mint-sdk 1.0.13 → 1.0.15

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 (46) hide show
  1. package/dist/__tests__/composables/useCommandHistory.test.d.ts +1 -0
  2. package/dist/__tests__/composables/useFileImport.test.d.ts +1 -0
  3. package/dist/__tests__/composables/useOptimisticMutation.test.d.ts +1 -0
  4. package/dist/__tests__/composables/useResourceCrud.test.d.ts +1 -0
  5. package/dist/__tests__/composables/useWellPainting.test.d.ts +1 -0
  6. package/dist/__tests__/composables/useWellPlateAdapter.test.d.ts +1 -0
  7. package/dist/__tests__/composables/useWellPlateValidation.test.d.ts +1 -0
  8. package/dist/components/index.js +1 -1
  9. package/dist/{components-CzFtQExv.js → components-Cyk8QEyL.js} +81 -75
  10. package/dist/components-Cyk8QEyL.js.map +1 -0
  11. package/dist/composables/index.d.ts +7 -0
  12. package/dist/composables/index.js +2 -2
  13. package/dist/composables/useCommandHistory.d.ts +29 -0
  14. package/dist/composables/useFileImport.d.ts +35 -0
  15. package/dist/composables/useOptimisticMutation.d.ts +28 -0
  16. package/dist/composables/useResourceCrud.d.ts +40 -0
  17. package/dist/composables/useWellPainting.d.ts +35 -0
  18. package/dist/composables/useWellPlateAdapter.d.ts +36 -0
  19. package/dist/composables/useWellPlateValidation.d.ts +27 -0
  20. package/dist/{composables-BuG5yAb7.js → composables-D9mexHSW.js} +666 -3
  21. package/dist/composables-D9mexHSW.js.map +1 -0
  22. package/dist/index.js +3 -3
  23. package/dist/install.js +1 -1
  24. package/package.json +1 -1
  25. package/src/__tests__/components/SampleSelector.test.ts +6 -3
  26. package/src/__tests__/components/SampleSelectorSampleRow.test.ts +5 -2
  27. package/src/__tests__/composables/useCommandHistory.test.ts +43 -0
  28. package/src/__tests__/composables/useFileImport.test.ts +44 -0
  29. package/src/__tests__/composables/useOptimisticMutation.test.ts +40 -0
  30. package/src/__tests__/composables/useResourceCrud.test.ts +56 -0
  31. package/src/__tests__/composables/useWellPainting.test.ts +52 -0
  32. package/src/__tests__/composables/useWellPlateAdapter.test.ts +50 -0
  33. package/src/__tests__/composables/useWellPlateValidation.test.ts +42 -0
  34. package/src/components/PluginWorkspaceView.vue +3 -3
  35. package/src/components/SampleSelector.vue +2 -0
  36. package/src/components/SampleSelectorSampleRow.vue +2 -0
  37. package/src/composables/index.ts +67 -0
  38. package/src/composables/useCommandHistory.ts +113 -0
  39. package/src/composables/useFileImport.ts +231 -0
  40. package/src/composables/useOptimisticMutation.ts +107 -0
  41. package/src/composables/useResourceCrud.ts +245 -0
  42. package/src/composables/useWellPainting.ts +187 -0
  43. package/src/composables/useWellPlateAdapter.ts +147 -0
  44. package/src/composables/useWellPlateValidation.ts +85 -0
  45. package/dist/components-CzFtQExv.js.map +0 -1
  46. package/dist/composables-BuG5yAb7.js.map +0 -1
@@ -31,6 +31,10 @@ export { useAppExperiment, APP_EXPERIMENT_KEY, type AppExperimentRecord, type Ap
31
31
  export { useExperimentSave, type UseExperimentSaveOptions, type UseExperimentSaveReturn, } from './useExperimentSave';
32
32
  export { useTemplateCollection, type TemplateCollectionInput, type UseTemplateCollectionOptions, type UseTemplateCollectionReturn, } from './useTemplateCollection';
33
33
  export { useRequestSyncState, type RequestSyncRunOptions, type RequestSyncSuccessKind, type UseRequestSyncStateReturn, } from './useRequestSyncState';
34
+ export { useCommandHistory, type CommandHistoryCommand, type CommandHistoryExecuteOptions, type CommandHistoryResult, type UseCommandHistoryOptions, type UseCommandHistoryReturn, } from './useCommandHistory';
35
+ export { useOptimisticMutation, type OptimisticMutationContext, type UseOptimisticMutationOptions, type UseOptimisticMutationReturn, } from './useOptimisticMutation';
36
+ export { createPluginResourceClient, useResourceCrud, type PluginResourceClientOptions, type ResourceCrudAdapter, type ResourceKey, type UseResourceCrudOptions, type UseResourceCrudReturn, } from './useResourceCrud';
37
+ export { detectDelimiter, parseDelimitedText, readFileAsText, useFileImport, validateImportFile, type DelimitedTable, type FileImportOptions, type FileImportValidationOptions, type ParseDelimitedTextOptions, type UseFileImportReturn, } from './useFileImport';
34
38
  export { useSelectionLimit, type SelectionLimitSource, type UseSelectionLimitOptions, type UseSelectionLimitReturn, } from './useSelectionLimit';
35
39
  export { useListSelection, type ListSelectionSource, type ListSelectionValue, type UseListSelectionOptions, type UseListSelectionReturn, type WidenListSelectionValue, } from './useListSelection';
36
40
  export { useGroupAssignment, type GroupAssignmentSource, type GroupAssignmentState, type GroupAssignmentZone, type UseGroupAssignmentOptions, type UseGroupAssignmentReturn, } from './useGroupAssignment';
@@ -38,6 +42,9 @@ export { useSampleGroups, type DisplaySampleSubGroup, type SampleGroupSource, ty
38
42
  export { useExpansionSet, type ExpansionSetSource, type UseExpansionSetOptions, type UseExpansionSetReturn, } from './useExpansionSet';
39
43
  export { compareSortValues, useSortedItems, type CompareSortValuesOptions, type SortComparator, type SortComparatorContext, type SortDescriptor, type SortedItemsSource, type SortOrder, type UseSortedItemsOptions, type UseSortedItemsReturn, } from './useSortedItems';
40
44
  export { candidateMatchesSearch, normalizeSearchQuery, useTextSearch, type TextSearchCandidate, type TextSearchSource, type UseTextSearchOptions, type UseTextSearchReturn, } from './useTextSearch';
45
+ export { coordinateToWellId, useWellPainting, wellIdToCoordinate, wellIdsInRectangle, type UseWellPaintingOptions, type UseWellPaintingReturn, type WellCoordinate, type WellPaintResult, type WellPlateSource, } from './useWellPainting';
46
+ export { createColumnConditions, createRowConditions, createWellPlateWells, useWellPlateAdapter, type AxisConditionEntry, type UseWellPlateAdapterReturn, type WellPlateAdapterOptions, type WellPlateAdapterSource, type WellPlateEntry, } from './useWellPlateAdapter';
47
+ export { runWellPlateValidation, useWellPlateValidation, type UseWellPlateValidationOptions, type UseWellPlateValidationReturn, type WellPlateValidationRule, type WellPlateValidationSeverity, type WellPlateValidationSource, type WellPlateValidationWarning, } from './useWellPlateValidation';
41
48
  export { controlsToFormSchema, controlsToSectionFormSchema, controlsToSectionFormSchemas, controlsToSidebarPanels, controlsToSettingsSchema, controlsToTopBarSettingsConfig, controlsToViewIds, controlsToViewItems, controlValuesToComponentBindings, controlValuesToComponentBindingsById, controlValuesToComponentProps, defineControlComponentBindings, defineControlModel, defineDoseDesignControlModel, defineDoseCalculatorControlProps, defineControls, defineWellPlateControlProps, defineWellPlateDoseComponentBindings, defineWellPlateDoseControlProps, getDefaultControlView, getControlDefaults, useControlSchema, useControlWorkspace, type ControlDefinition, type ControlComponentBinding, type ControlComponentBindingConfig, type ControlComponentBindingRecordConfig, type ControlComponentBindingsById, type ControlComponentBindingsConfig, type ControlComponentPropSource, type ControlComponentPropsByIdMap, type ControlComponentPropsMap, type DoseDesignControlModelOptions, type DoseCalculatorControlPropsOptions, type ControlFormSchema, type ControlInput, type ControlModel, type ControlModelBinding, type ControlModelSectionConfig, type ControlModelViewConfig, type ControlOption, type ControlOptionValue, type ControlPrimitive, type ControlSchema, type ControlSchemaOptions, type ControlShorthand, type ControlWorkspaceOptions, type ControlFormBinding, type ControlSettingsBinding, type ControlSidebarBinding, type ControlSectionConfig, type ControlSidebarConfig, type ControlTopBarSettingsBinding, type ControlViewConfig, type ControlValues, type UseControlSchemaReturn, type ControlWorkspaceAppTopBarPillBinding, type ControlWorkspaceComponentBindings, type ControlWorkspaceFormBinding, type ControlWorkspacePillNavBinding, type ControlWorkspaceSidebarBinding, type ControlWorkspaceTopBarBinding, type ControlWorkspaceTopBarSettingsBinding, type UseControlWorkspaceReturn, type WellPlateControlPropsOptions, type WellPlateDoseControlPropsOptions, } from './useControlSchema';
42
49
  export { getBioTemplateControlSchema, requireBioTemplateControlSchema, useBioTemplateControls, type BioTemplateControlSchema, type BioTemplateControlTarget, } from './useBioTemplateControls';
43
50
  export { getBioTemplateComponentProps, getBioTemplateComponentBindings, toBioTemplateComponentBindings, toBioTemplateComponentBindingsById, toBioTemplateComponentProps, toBioTemplateComponentPropsByComponent, toBioTemplateComponentPropsById, useBioTemplateComponents, type BioTemplateComponentBinding, type BioTemplateComponentBindingsById, type BioTemplateComponentPropsByComponent, type BioTemplateComponentPropsBinding, type BioTemplateComponentPropsById, type BioTemplateComponentPropsLookupOptions, type BioTemplateResolvedComponentBinding, type BioTemplateComponentTarget, type UseBioTemplateComponentsReturn, } from './useBioTemplateComponents';
@@ -6,5 +6,5 @@ import { i as usePlatformContext, n as evaluateCondition, r as useForm, t as use
6
6
  import { a as SORT_OPTIONS, c as formatExperimentStatus, i as EXPERIMENT_STATUS_VARIANT_MAP, l as getExperimentStatusVariant, n as EXPERIMENT_STATUS_LABELS, o as datePresetToISO, r as EXPERIMENT_STATUS_OPTIONS, s as formatExperimentDate, t as DATE_PRESET_OPTIONS, u as resolveExperimentCode } from "../experiment-utils-D11yT3AR.js";
7
7
  import { i as useApi, n as useDebouncedWatch, r as useRequestSyncState, t as useExperimentSelector } from "../useExperimentSelector-BBaz0w51.js";
8
8
  import { B as toBioTemplateComponentProps, H as toBioTemplateComponentPropsById, L as toBioTemplateComponentBindings, P as getBioTemplateComponentBindings, R as toBioTemplateComponentBindingsById, l as requireBioTemplateControlSchema, o as getBioTemplateControlSchema } from "../templates-Do43ZIMb.js";
9
- import { a as pluginFormDataFromPayload, c as usePluginClient, d as resolvePluginBaseUrl, f as usePluginConfig, g as useAuth, h as usePasskey, i as getPluginPageSelectorItems, l as usePluginSettings, m as useAsyncBatch, n as downloadBlob, o as uploadPluginEndpoint, p as useAsync, r as downloadPluginEndpoint, s as useCurrentExperiment, t as createPluginClient, u as buildPluginEndpointUrl } from "../composables-BuG5yAb7.js";
10
- export { APP_EXPERIMENT_KEY, ATOMIC_WEIGHTS, DATE_PRESET_OPTIONS, DEFAULT_COLORS, DEFAULT_PRESETS, DEFAULT_UNITS, EXPERIMENT_STATUS_LABELS, EXPERIMENT_STATUS_OPTIONS, EXPERIMENT_STATUS_VARIANT_MAP, SORT_OPTIONS, addMinutes, buildPluginEndpointUrl, candidateMatchesSearch, compareSortValues, compareTime, controlValuesToComponentBindings, controlValuesToComponentBindingsById, controlValuesToComponentProps, controlsToFormSchema, controlsToSectionFormSchema, controlsToSectionFormSchemas, controlsToSettingsSchema, controlsToSidebarPanels, controlsToTopBarSettingsConfig, controlsToViewIds, controlsToViewItems, createPluginClient, datePresetToISO, defineControlComponentBindings, defineControlModel, defineControls, defineDoseCalculatorControlProps, defineDoseDesignControlModel, defineWellPlateControlProps, defineWellPlateDoseComponentBindings, defineWellPlateDoseControlProps, downloadBlob, downloadPluginEndpoint, durationMinutes, evaluateCondition, extractSampleNamesFromDesignData, extractSampleOptionsFromDesignData, extractSamplesFromDesignData, findAvailableSlots, findNearestTimeSlotIndex, formatDuration, formatExperimentDate, formatExperimentStatus, formatTime, formatTimeSlot, fromMinutes, generateDilutionSeries, generateTimeSlots, getBioTemplateComponentBindings, getBioTemplateComponentProps, getBioTemplateControlSchema, getControlDefaults, getDefaultControlView, getExperimentStatusVariant, getFieldRegistryEntry, getPluginPageSelectorItems, getTypeDefault, isTimeInRange, normalizeSearchQuery, parseTime, pluginFormDataFromPayload, rangesOverlap, requireBioTemplateControlSchema, resolveExperimentCode, resolvePluginBaseUrl, snapToSlot, toBioTemplateComponentBindings, toBioTemplateComponentBindingsById, toBioTemplateComponentProps, toBioTemplateComponentPropsByComponent, toBioTemplateComponentPropsById, toMinutes, unwrapExperimentDesignData, uploadPluginEndpoint, useApi, useAppExperiment, useAsync, useAsyncBatch, useAuth, useAutoGroup, useBioTemplateComponents, useBioTemplateControls, useBioTemplatePackWorkspace, useBioTemplatePresetWorkspace, useBioTemplateWorkspace, useChemicalFormula, useConcentrationUnits, useControlSchema, useControlWorkspace, useCurrentExperiment, useDebouncedWatch, useDoseCalculator, useEventListener, useExpansionSet, useExperimentData, useExperimentSamples, useExperimentSave, useExperimentSelector, useForm, useFormBuilder, useGroupAssignment, useListSelection, usePasskey, usePlatformContext, usePluginClient, usePluginConfig, usePluginSettings, useProtocolTemplates, useRackEditor, useReagentSeries, useRequestSyncState, useSampleGroups, useScheduleDrag, useSelectionLimit, useSequenceUtils, useSortedItems, useTemplateCollection, useTextSearch, useTheme, useTimeUtils, useToast, useWellPlateEditor };
9
+ import { A as useCommandHistory, C as parseDelimitedText, D as createPluginResourceClient, E as validateImportFile, F as useAuth, M as useAsync, N as useAsyncBatch, O as useResourceCrud, P as usePasskey, S as detectDelimiter, T as useFileImport, _ as useWellPlateAdapter, a as pluginFormDataFromPayload, b as wellIdToCoordinate, c as usePluginClient, d as resolvePluginBaseUrl, f as runWellPlateValidation, g as createWellPlateWells, h as createRowConditions, i as getPluginPageSelectorItems, j as usePluginConfig, k as useOptimisticMutation, l as usePluginSettings, m as createColumnConditions, n as downloadBlob, o as uploadPluginEndpoint, p as useWellPlateValidation, r as downloadPluginEndpoint, s as useCurrentExperiment, t as createPluginClient, u as buildPluginEndpointUrl, v as coordinateToWellId, w as readFileAsText, x as wellIdsInRectangle, y as useWellPainting } from "../composables-D9mexHSW.js";
10
+ export { APP_EXPERIMENT_KEY, ATOMIC_WEIGHTS, DATE_PRESET_OPTIONS, DEFAULT_COLORS, DEFAULT_PRESETS, DEFAULT_UNITS, EXPERIMENT_STATUS_LABELS, EXPERIMENT_STATUS_OPTIONS, EXPERIMENT_STATUS_VARIANT_MAP, SORT_OPTIONS, addMinutes, buildPluginEndpointUrl, candidateMatchesSearch, compareSortValues, compareTime, controlValuesToComponentBindings, controlValuesToComponentBindingsById, controlValuesToComponentProps, controlsToFormSchema, controlsToSectionFormSchema, controlsToSectionFormSchemas, controlsToSettingsSchema, controlsToSidebarPanels, controlsToTopBarSettingsConfig, controlsToViewIds, controlsToViewItems, coordinateToWellId, createColumnConditions, createPluginClient, createPluginResourceClient, createRowConditions, createWellPlateWells, datePresetToISO, defineControlComponentBindings, defineControlModel, defineControls, defineDoseCalculatorControlProps, defineDoseDesignControlModel, defineWellPlateControlProps, defineWellPlateDoseComponentBindings, defineWellPlateDoseControlProps, detectDelimiter, downloadBlob, downloadPluginEndpoint, durationMinutes, evaluateCondition, extractSampleNamesFromDesignData, extractSampleOptionsFromDesignData, extractSamplesFromDesignData, findAvailableSlots, findNearestTimeSlotIndex, formatDuration, formatExperimentDate, formatExperimentStatus, formatTime, formatTimeSlot, fromMinutes, generateDilutionSeries, generateTimeSlots, getBioTemplateComponentBindings, getBioTemplateComponentProps, getBioTemplateControlSchema, getControlDefaults, getDefaultControlView, getExperimentStatusVariant, getFieldRegistryEntry, getPluginPageSelectorItems, getTypeDefault, isTimeInRange, normalizeSearchQuery, parseDelimitedText, parseTime, pluginFormDataFromPayload, rangesOverlap, readFileAsText, requireBioTemplateControlSchema, resolveExperimentCode, resolvePluginBaseUrl, runWellPlateValidation, snapToSlot, toBioTemplateComponentBindings, toBioTemplateComponentBindingsById, toBioTemplateComponentProps, toBioTemplateComponentPropsByComponent, toBioTemplateComponentPropsById, toMinutes, unwrapExperimentDesignData, uploadPluginEndpoint, useApi, useAppExperiment, useAsync, useAsyncBatch, useAuth, useAutoGroup, useBioTemplateComponents, useBioTemplateControls, useBioTemplatePackWorkspace, useBioTemplatePresetWorkspace, useBioTemplateWorkspace, useChemicalFormula, useCommandHistory, useConcentrationUnits, useControlSchema, useControlWorkspace, useCurrentExperiment, useDebouncedWatch, useDoseCalculator, useEventListener, useExpansionSet, useExperimentData, useExperimentSamples, useExperimentSave, useExperimentSelector, useFileImport, useForm, useFormBuilder, useGroupAssignment, useListSelection, useOptimisticMutation, usePasskey, usePlatformContext, usePluginClient, usePluginConfig, usePluginSettings, useProtocolTemplates, useRackEditor, useReagentSeries, useRequestSyncState, useResourceCrud, useSampleGroups, useScheduleDrag, useSelectionLimit, useSequenceUtils, useSortedItems, useTemplateCollection, useTextSearch, useTheme, useTimeUtils, useToast, useWellPainting, useWellPlateAdapter, useWellPlateEditor, useWellPlateValidation, validateImportFile, wellIdToCoordinate, wellIdsInRectangle };
@@ -0,0 +1,29 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ export type CommandHistoryResult = void | Promise<void>;
3
+ export interface CommandHistoryCommand {
4
+ execute: () => CommandHistoryResult;
5
+ undo: () => CommandHistoryResult;
6
+ redo?: () => CommandHistoryResult;
7
+ description?: string;
8
+ }
9
+ export interface CommandHistoryExecuteOptions {
10
+ skipExecute?: boolean;
11
+ }
12
+ export interface UseCommandHistoryOptions {
13
+ maxDepth?: number;
14
+ }
15
+ export interface UseCommandHistoryReturn<TCommand extends CommandHistoryCommand = CommandHistoryCommand> {
16
+ undoStack: Ref<TCommand[]>;
17
+ redoStack: Ref<TCommand[]>;
18
+ canUndo: ComputedRef<boolean>;
19
+ canRedo: ComputedRef<boolean>;
20
+ undoDescription: ComputedRef<string>;
21
+ redoDescription: ComputedRef<string>;
22
+ execute: (command: TCommand, options?: CommandHistoryExecuteOptions) => CommandHistoryResult;
23
+ push: (command: TCommand) => void;
24
+ undo: () => CommandHistoryResult;
25
+ redo: () => CommandHistoryResult;
26
+ clear: () => void;
27
+ }
28
+ /** Generic command-stack state for plugin editors with undo/redo controls. */
29
+ export declare function useCommandHistory<TCommand extends CommandHistoryCommand = CommandHistoryCommand>(options?: UseCommandHistoryOptions): UseCommandHistoryReturn<TCommand>;
@@ -0,0 +1,35 @@
1
+ import { Ref, ShallowRef } from 'vue';
2
+ export interface DelimitedTable {
3
+ columns: string[];
4
+ rows: Record<string, string>[];
5
+ rawRows: string[][];
6
+ delimiter: string;
7
+ }
8
+ export interface ParseDelimitedTextOptions {
9
+ delimiter?: string;
10
+ headers?: readonly string[];
11
+ hasHeaderRow?: boolean;
12
+ trim?: boolean;
13
+ }
14
+ export interface FileImportValidationOptions {
15
+ accept?: string | readonly string[];
16
+ maxSizeBytes?: number;
17
+ }
18
+ export interface FileImportOptions<TResult = string> extends FileImportValidationOptions {
19
+ encoding?: string;
20
+ parse?: (text: string, file: File) => TResult | Promise<TResult>;
21
+ }
22
+ export interface UseFileImportReturn<TResult> {
23
+ loading: ShallowRef<boolean>;
24
+ error: Ref<string | null>;
25
+ fileName: Ref<string>;
26
+ result: Ref<TResult | null>;
27
+ importFile: (file: File) => Promise<TResult>;
28
+ clear: () => void;
29
+ }
30
+ /** Stateful file reader for plugin import flows with shared validation and error handling. */
31
+ export declare function useFileImport<TResult = string>(options?: FileImportOptions<TResult>): UseFileImportReturn<TResult>;
32
+ export declare function validateImportFile(file: File, options?: FileImportValidationOptions): void;
33
+ export declare function readFileAsText(file: File, encoding?: string): Promise<string>;
34
+ export declare function parseDelimitedText(text: string, options?: ParseDelimitedTextOptions): DelimitedTable;
35
+ export declare function detectDelimiter(text: string): string;
@@ -0,0 +1,28 @@
1
+ import { ComputedRef, Ref, ShallowRef } from 'vue';
2
+ export interface OptimisticMutationContext<TVariables, TSnapshot> {
3
+ variables: TVariables;
4
+ snapshot: TSnapshot | undefined;
5
+ }
6
+ export interface UseOptimisticMutationOptions<TVariables, TData, TSnapshot = unknown> {
7
+ mutation: (variables: TVariables) => Promise<TData>;
8
+ snapshot?: (variables: TVariables) => TSnapshot;
9
+ apply?: (variables: TVariables, snapshot: TSnapshot | undefined) => void;
10
+ commit?: (data: TData, context: OptimisticMutationContext<TVariables, TSnapshot>) => void;
11
+ rollback?: (snapshot: TSnapshot | undefined, variables: TVariables, error: unknown) => void;
12
+ onSuccess?: (data: TData, context: OptimisticMutationContext<TVariables, TSnapshot>) => void;
13
+ onError?: (error: unknown, context: OptimisticMutationContext<TVariables, TSnapshot>) => void;
14
+ onSettled?: (context: OptimisticMutationContext<TVariables, TSnapshot>) => void;
15
+ readErrorMessage?: (error: unknown) => string;
16
+ }
17
+ export interface UseOptimisticMutationReturn<TVariables, TData, TSnapshot = unknown> {
18
+ loading: ShallowRef<boolean>;
19
+ error: Ref<string | null>;
20
+ data: Ref<TData | null>;
21
+ lastSnapshot: Ref<TSnapshot | undefined>;
22
+ isIdle: ComputedRef<boolean>;
23
+ run: (variables: TVariables) => Promise<TData>;
24
+ clearError: () => void;
25
+ reset: () => void;
26
+ }
27
+ /** Run async mutations with optional optimistic local updates and rollback. */
28
+ export declare function useOptimisticMutation<TVariables, TData, TSnapshot = unknown>(options: UseOptimisticMutationOptions<TVariables, TData, TSnapshot>): UseOptimisticMutationReturn<TVariables, TData, TSnapshot>;
@@ -0,0 +1,40 @@
1
+ import { ComputedRef, Ref, ShallowRef } from 'vue';
2
+ export type ResourceKey = string | number;
3
+ export interface ResourceCrudAdapter<TItem, TCreate = Partial<TItem>, TUpdate = Partial<TItem>, TKey extends ResourceKey = ResourceKey> {
4
+ list: () => Promise<TItem[]>;
5
+ create?: (payload: TCreate) => Promise<TItem>;
6
+ update?: (key: TKey, payload: TUpdate) => Promise<TItem>;
7
+ remove?: (key: TKey) => Promise<void>;
8
+ }
9
+ export interface UseResourceCrudOptions<TItem, TCreate = Partial<TItem>, TUpdate = Partial<TItem>, TKey extends ResourceKey = ResourceKey> {
10
+ adapter: ResourceCrudAdapter<TItem, TCreate, TUpdate, TKey>;
11
+ initialItems?: readonly TItem[];
12
+ getKey?: (item: TItem) => TKey;
13
+ readErrorMessage?: (error: unknown) => string;
14
+ }
15
+ export interface UseResourceCrudReturn<TItem, TCreate, TUpdate, TKey extends ResourceKey> {
16
+ items: Ref<TItem[]>;
17
+ loading: ShallowRef<boolean>;
18
+ saving: ShallowRef<boolean>;
19
+ deleting: ShallowRef<boolean>;
20
+ error: Ref<string | null>;
21
+ isBusy: ComputedRef<boolean>;
22
+ load: () => Promise<TItem[]>;
23
+ createItem: (payload: TCreate) => Promise<TItem>;
24
+ updateItem: (key: TKey, payload: TUpdate) => Promise<TItem>;
25
+ deleteItem: (keyOrItem: TKey | TItem) => Promise<void>;
26
+ setItems: (items: readonly TItem[]) => void;
27
+ upsertLocal: (item: TItem) => void;
28
+ removeLocal: (keyOrItem: TKey | TItem) => void;
29
+ clearError: () => void;
30
+ }
31
+ /** Common list/create/update/delete state wrapper for generated plugin clients. */
32
+ export declare function useResourceCrud<TItem, TCreate = Partial<TItem>, TUpdate = Partial<TItem>, TKey extends ResourceKey = ResourceKey>(options: UseResourceCrudOptions<TItem, TCreate, TUpdate, TKey>): UseResourceCrudReturn<TItem, TCreate, TUpdate, TKey>;
33
+ export interface PluginResourceClientOptions<TClient, TItem, TCreate = Partial<TItem>, TUpdate = Partial<TItem>, TKey extends ResourceKey = ResourceKey> {
34
+ client: TClient;
35
+ list: (client: TClient) => Promise<TItem[]>;
36
+ create?: (client: TClient, payload: TCreate) => Promise<TItem>;
37
+ update?: (client: TClient, key: TKey, payload: TUpdate) => Promise<TItem>;
38
+ remove?: (client: TClient, key: TKey) => Promise<void>;
39
+ }
40
+ export declare function createPluginResourceClient<TClient, TItem, TCreate = Partial<TItem>, TUpdate = Partial<TItem>, TKey extends ResourceKey = ResourceKey>(options: PluginResourceClientOptions<TClient, TItem, TCreate, TUpdate, TKey>): ResourceCrudAdapter<TItem, TCreate, TUpdate, TKey>;
@@ -0,0 +1,35 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { WellPlateFormat } from '../types';
3
+ export type WellPlateSource<T> = T | Ref<T> | ComputedRef<T> | (() => T);
4
+ export interface WellCoordinate {
5
+ row: number;
6
+ col: number;
7
+ }
8
+ export interface WellPaintResult<TMode extends string = string, TPayload = unknown> {
9
+ wellIds: string[];
10
+ mode: TMode;
11
+ payload?: TPayload;
12
+ }
13
+ export interface UseWellPaintingOptions<TMode extends string = string, TPayload = unknown> {
14
+ format: WellPlateSource<WellPlateFormat>;
15
+ initialMode?: TMode;
16
+ initialPayload?: TPayload;
17
+ onComplete?: (result: WellPaintResult<TMode, TPayload>) => void;
18
+ }
19
+ export interface UseWellPaintingReturn<TMode extends string = string, TPayload = unknown> {
20
+ activeMode: Ref<TMode>;
21
+ activePayload: Ref<TPayload | undefined>;
22
+ isDragging: Ref<boolean>;
23
+ previewWellIds: ComputedRef<string[]>;
24
+ setMode: (mode: TMode, payload?: TPayload) => void;
25
+ setPayload: (payload: TPayload | undefined) => void;
26
+ onWellMouseDown: (wellId: string) => void;
27
+ onWellMouseMove: (wellId: string) => void;
28
+ onWellMouseUp: () => void;
29
+ cancel: () => void;
30
+ }
31
+ /** Pointer painting/rectangle selection state for WellPlate-based editors. */
32
+ export declare function useWellPainting<TMode extends string = string, TPayload = unknown>(options: UseWellPaintingOptions<TMode, TPayload>): UseWellPaintingReturn<TMode, TPayload>;
33
+ export declare function wellIdToCoordinate(wellId: string): WellCoordinate | null;
34
+ export declare function coordinateToWellId(coord: WellCoordinate): string;
35
+ export declare function wellIdsInRectangle(start: WellCoordinate, end: WellCoordinate, format: WellPlateFormat): string[];
@@ -0,0 +1,36 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { ColumnCondition, RowCondition, Well } from '../types';
3
+ export type WellPlateAdapterSource<T> = T | Ref<T> | ComputedRef<T> | (() => T);
4
+ export interface WellPlateEntry {
5
+ wellId: string;
6
+ state?: Well['state'];
7
+ sampleType?: string;
8
+ value?: number;
9
+ metadata?: Record<string, unknown>;
10
+ }
11
+ export interface WellPlateAdapterOptions<TEntry> {
12
+ entries: WellPlateAdapterSource<readonly TEntry[]>;
13
+ getWellId: (entry: TEntry) => string;
14
+ getState?: (entry: TEntry) => Well['state'] | undefined;
15
+ getSampleType?: (entry: TEntry) => string | undefined;
16
+ getValue?: (entry: TEntry) => number | undefined;
17
+ getMetadata?: (entry: TEntry) => Record<string, unknown> | undefined;
18
+ }
19
+ export interface UseWellPlateAdapterReturn {
20
+ wells: ComputedRef<Record<string, Partial<Well>>>;
21
+ }
22
+ /** Convert domain rows into WellPlate's wells prop without hand-written adapters. */
23
+ export declare function useWellPlateAdapter<TEntry>(options: WellPlateAdapterOptions<TEntry>): UseWellPlateAdapterReturn;
24
+ export declare function createWellPlateWells<TEntry>(entries: readonly TEntry[], options: Omit<WellPlateAdapterOptions<TEntry>, 'entries'>): Record<string, Partial<Well>>;
25
+ export interface AxisConditionEntry {
26
+ label: string;
27
+ color: string;
28
+ start: string | number;
29
+ concentrations: readonly {
30
+ value: number;
31
+ replicates?: number;
32
+ }[];
33
+ unit?: string;
34
+ }
35
+ export declare function createColumnConditions(entries: readonly AxisConditionEntry[]): ColumnCondition[];
36
+ export declare function createRowConditions(entries: readonly AxisConditionEntry[]): RowCondition[];
@@ -0,0 +1,27 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ export type WellPlateValidationSeverity = 'error' | 'warning' | 'info';
3
+ export interface WellPlateValidationWarning<TType extends string = string> {
4
+ type: TType;
5
+ severity: WellPlateValidationSeverity;
6
+ message: string;
7
+ affectedWells?: string[];
8
+ }
9
+ export interface WellPlateValidationRule<TContext, TType extends string = string> {
10
+ type: TType;
11
+ severity: WellPlateValidationSeverity;
12
+ validate: (context: TContext) => false | string | Omit<WellPlateValidationWarning<TType>, 'type' | 'severity'>;
13
+ }
14
+ export type WellPlateValidationSource<T> = T | Ref<T> | ComputedRef<T> | (() => T);
15
+ export interface UseWellPlateValidationOptions<TContext, TType extends string = string> {
16
+ context: WellPlateValidationSource<TContext>;
17
+ rules: WellPlateValidationSource<readonly WellPlateValidationRule<TContext, TType>[]>;
18
+ }
19
+ export interface UseWellPlateValidationReturn<TType extends string = string> {
20
+ warnings: ComputedRef<WellPlateValidationWarning<TType>[]>;
21
+ hasBlockingIssues: ComputedRef<boolean>;
22
+ warningCount: ComputedRef<number>;
23
+ errorCount: ComputedRef<number>;
24
+ }
25
+ /** Rule-driven validation state for WellPlate layout/design screens. */
26
+ export declare function useWellPlateValidation<TContext, TType extends string = string>(options: UseWellPlateValidationOptions<TContext, TType>): UseWellPlateValidationReturn<TType>;
27
+ export declare function runWellPlateValidation<TContext, TType extends string = string>(context: TContext, rules: readonly WellPlateValidationRule<TContext, TType>[]): WellPlateValidationWarning<TType>[];