-
-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathtypes.ts
More file actions
68 lines (62 loc) · 1.7 KB
/
types.ts
File metadata and controls
68 lines (62 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// categories.json structure
export interface CategoryMap {
categoryToBaseUnit: {
[categoryName: string]: string // category → SI unit (e.g., "speed" → "m/s")
}
coreCategories: string[]
}
// Conversion formula
export interface ConversionFormula {
formula: string // e.g., "value * 1.94384"
inverseFormula: string // e.g., "value * 0.514444"
symbol: string // e.g., "kn"
longName?: string // e.g., "knots"
key?: string // ASCII-safe key for special characters
}
// standard-units-definitions.json structure
export interface UnitDefinitions {
[siUnit: string]: {
longName?: string
conversions: {
[targetUnit: string]: ConversionFormula
}
}
}
// Preset file structure
export interface Preset {
version: string
name: string
description?: string
date?: string
categories: {
[categoryName: string]: {
baseUnit: string
targetUnit: string
displayFormat?: string
}
}
}
// Config file structure
export interface UnitPreferencesConfig {
activePreset: string // e.g., "imperial-us" or "my-boat"
userPresets?: { [username: string]: string } // per-user preset overrides
version?: string
}
// What gets stored in path metadata (baseDeltas.json)
export interface DisplayUnitsMetadata {
category: string
targetUnit?: string // Only if path override
formula?: string // Only if custom category
inverseFormula?: string // Only if custom category
symbol?: string // Only if custom category
displayFormat?: string // Only if path override
}
// What server returns in GET /meta response
export interface EnhancedDisplayUnits {
category: string
targetUnit: string
formula: string
inverseFormula: string
symbol: string
displayFormat?: string
}