import type { Point2D, Vec2 } from '../math'; import type { LineStyle } from '../plot'; import type { Sides } from '../plot/core/layout'; import type { TooltipConfig, TooltipProp } from '../tooltip'; export type TempUnit = `K` | `°C` | `°F`; export type CompUnit = `at%` | `wt%` | `mol%` | `fraction`; export interface PhaseRegion { id: string; name: string; vertices: Vec2[]; color?: string; label_position?: Vec2; } export type BoundaryType = `liquidus` | `solidus` | `solvus` | `eutectic` | `peritectic` | `tie-line` | `custom`; export interface PhaseBoundary { id: string; type: BoundaryType; points: Vec2[]; style?: LineStyle; label?: string; } export type SpecialPointType = `eutectic` | `peritectic` | `eutectoid` | `peritectoid` | `congruent` | `melting_point` | `custom`; export interface SpecialPoint { id: string; type: SpecialPointType; position: Vec2; label?: string; } export interface PseudoBinaryMetadata { parent_system?: string[]; section_description?: string; use_subscripts?: boolean; } export interface PhaseDiagramData { components: [string, string]; temperature_range: Vec2; temperature_unit?: TempUnit; composition_unit?: CompUnit; regions: PhaseRegion[]; boundaries: PhaseBoundary[]; special_points?: SpecialPoint[]; title?: string; pseudo_binary?: PseudoBinaryMetadata; x_axis_label?: string; y_axis_label?: string; } export interface TieLineConfig { stroke_width?: number; endpoint_radius?: number; cursor_radius?: number; } export interface PhaseDiagramConfig { margin?: Sides; font_size?: number; special_point_radius?: number; tie_line?: TieLineConfig; colors?: { background?: string; grid?: string; axis?: string; text?: string; boundary?: string; special_point?: string; }; } export interface LeverRuleResult { left_phase: string; right_phase: string; left_composition: number; right_composition: number; fraction_left: number; fraction_right: number; } export interface VerticalLeverRuleResult { bottom_phase: string; top_phase: string; bottom_temperature: number; top_temperature: number; fraction_bottom: number; fraction_top: number; } export type LeverRuleMode = `horizontal` | `vertical`; export interface PhaseHoverInfo { region: PhaseRegion; composition: number; temperature: number; position: Point2D; lever_rule?: LeverRuleResult; vertical_lever_rule?: VerticalLeverRuleResult; special_point?: SpecialPoint; } export type PhaseDiagramTooltipConfig = TooltipConfig; export type PhaseDiagramTooltipProp = TooltipProp;