import type { BaselineCorrectionZone } from '@zakodium/nmr-types'; import type { Spectrum, ViewState } from '@zakodium/nmrium-core'; import type { Source } from 'file-collection'; import { FileCollection } from 'file-collection'; import type { CorrelationData } from 'nmr-correlation'; import type { Reducer } from 'react'; import type { StateMoleculeExtended } from '../../data/molecules/Molecule.js'; import type { UsedColors } from '../../types/UsedColors.js'; import type { Insets } from '../1d/inset/SpectraInsets.js'; import type { Action } from '../context/DispatchContext.js'; import type { Tool } from '../toolbar/ToolTypes.js'; import type { ZoomHistory } from './helper/ZoomHistoryManager.js'; export type DisplayerMode = '1D' | '2D'; interface Pivot { value: number; index: number; } export interface Margin { top: number; right: number; bottom: number; left: number; } export type Domains = Record; export type SpectraDirection = 'RTL' | 'LTR'; export type TraceDirection = 'vertical' | 'horizontal'; export interface SpectrumTrace { id: string; x: number; y: number; } export interface PhaseCorrectionTraceData { spectra: SpectrumTrace[]; ph0: number; ph1: number; pivot: Pivot | null; scaleRatio: number; } export interface TwoDimensionPhaseCorrection { traces: Record; activeTraceDirection: TraceDirection; addTracesToBothDirections: boolean; } export declare const getDefaultTwoDimensionsPhaseCorrectionTraceOptions: () => TwoDimensionPhaseCorrection["traces"]; export declare function getDefaultViewState(): ViewState; export declare const getInitialState: () => State; export declare const initialState: State; export type VerticalAlignment = 'bottom' | 'center' | 'stack'; export interface State { /** * Last action type * base on the action type we can decide to trigger or not the callback function (onDataChange) */ actionType: Action['type']; /** * web source of data * Record key is an identifier of the source (stored in spectra) * * Is needed until we remove the support of the old nmrium format */ sources: Record; /** * Aggregation of file collections used to load the data * - external data sources (web-source, import jdx from url, ...) * - multiples files open / drag and drop * * Each of them is separated in an uuid folder */ aggregator: FileCollection; /** * spectra list (1d and 2d) */ data: Spectrum[]; /** * snapshot of the spectra data once phase correction activated * */ tempData: any; /** * X axis domain * value change when zooming in/out * @default [] */ xDomain: number[]; /** * Y axis domain * value change when vertical scale change for all spectra * @default [] */ yDomain: number[]; /** * Y axis domain per spectrum * value change when vertical scale change for the selected spectrum * @default {} */ yDomains: Domains; /** * X axis domain per spectrum * value change when zooming in/out for the selected spectrum * @default {} */ xDomains: Domains; /** * Domain for X and Y axis once it calculated and it change in one case when we load new spectra * @default {} */ originDomain: { xDomain: number[]; yDomain: number[]; xDomains: Domains; yDomains: Domains; shareYDomain: boolean; }; /** * plot chart area width * @default 0 */ width: number; /** * plot chart area height * @default 0 */ height: number; /** * The margin Around the plot chart area * @default {top: 10,right: 20,bottom: 70,left: 0} */ margin: Margin; /** * Scale direction * @default 'RTL' */ mode: SpectraDirection; /** * molecules * @default [] */ molecules: StateMoleculeExtended[]; /** * View related information * @default { floatingMolecules: [], ranges: [], zones: [] }; */ view: ViewState; /** * @todo for undo /redo features */ history: Partial<{ past: any[]; present: any; future: any[]; hasUndo: boolean; hasRedo: boolean; }>; /** * hide/show main loading indicator * @default false */ isLoading: boolean; /** * temporary snapshot of state once the user press on number from 1-9 */ keysPreferences: any; /** * displayer mode '1D' or '2D' * @default '1D' */ displayerMode: DisplayerMode; /** * unique key identifier per Displayer instance */ displayerKey: string; /** * Correlation data */ correlations: CorrelationData; /** * Zoom Manager for vertical scale for spectra, integral, And undo zoom in per tab (nucleus) * @default {history: {},spectra: {},integral: {}} */ zoom: { history: ZoomHistory; }; /** * Basic options for the tools */ toolOptions: { /** * The current selected tool * @default `options.zoom.id` */ selectedTool: Tool; /** * The current active options panel * Part of tools has an options panel for more control over the tool, once the user select the tool then the options panel will be shown in the header * @default null */ selectedOptionPanel: string | null; /** * extra data for tools */ data: { /** * list of zones for Baseline correction filter */ baselineCorrection: { zones: BaselineCorrectionZone[]; options: any; livePreview: boolean; }; /** * pivot point for manual phase correction * @default {value:0,index:0} */ pivot: Pivot; /** * Noise factor for auto zones detection * @default 1 */ twoDimensionPhaseCorrection: TwoDimensionPhaseCorrection; zonesNoiseFactor: number; zonesMinMaxRatio: number; /** * The current active Filter * @default null */ activeFilterID: string | null; /** * prediction Index * @default 0 */ predictionIndex: number; }; }; usedColors: UsedColors; errorAction?: any; insets: Insets; } export declare function initState(state: State): State; export declare const spectrumReducer: Reducer; export {}; //# sourceMappingURL=Reducer.d.ts.map