Normalize sidebar units and record registry updates

This commit is contained in:
Codex
2026-03-07 09:55:04 +00:00
parent 6ae2c38b61
commit 1d4a0bdba9
3 changed files with 102 additions and 13 deletions

View File

@@ -342,6 +342,46 @@ The registry currently contains 296 unique calculator slugs.
| Mach to Knots Convert Mach number to knots. | mach-to-knots | 661.47 |
| Mach to Meters per Second Convert Mach number to meters per second. | mach-to-meters-per-second | 340.29 |
| Mach to Miles per Hour Convert Mach number to miles per hour. | mach-to-miles-per-hour | 761.207 |
| Kilograms to Quarters Convert kilograms into US quarters (1 quarter = 25 pounds). | kilograms-to-quarters | 0.078732 |
| Kilonewtons to Newtons Convert kilonewtons into newtons. | kilonewtons-to-newtons | 1000 |
| Kilopascals to Inches of Mercury Convert pressure from kilopascals to inches of mercury (Hg). | kilopascals-to-inches-of-mercury | 0.2952998 |
| Kilowatt-hours to BTU Convert electrical energy from kilowatt-hours to BTU. | kilowatt-hours-to-btu | 3412.142 |
| Kilowatt-hours to Joules Convert kilowatt-hours to joules. | kilowatt-hours-to-joules | 3600000 |
| Kilowatt-hours to Kilocalories Convert kilowatt-hours to nutritional kilocalories. | kilowatt-hours-to-kilocalories | 860.42065 |
| Kilowatt-hours to Therms Convert kilowatt-hours to therms (US natural gas). | kilowatt-hours-to-therms | 0.034121 |
| Kilowatts to BTU/hour Convert power from kilowatts to BTU per hour. | kilowatts-to-btuhour | 3412.142 |
| Kilowatts to Megawatts Convert kilowatts into megawatts. | kilowatts-to-megawatts | 0.001 |
| Kilowatts to Watts Convert kilowatts into watts. | kilowatts-to-watts | 1000 |
| Kilometers per kWh to Miles per kWh Convert EV efficiency from km per kWh to miles per kWh. | km-per-kwh-to-miles-per-kwh | 0.621371 |
| Kilometers per Second to Speed of Light Express a speed in kilometers per second as a fraction of c (299,792.458 km/s). | kilometers-per-second-to-speed-of-light | 3.33564095198152e-6 |
| Knots to Feet per Second Convert knots into feet per second. | knots-to-feet-per-second | 1.6878098376 |
| Knots to Kilometers per Hour Convert knots into kilometers per hour. | knots-to-kilometers-per-hour | 1.852 |
| Knots to Meters per Second Convert knots into meters per second. | knots-to-meters-per-second | 0.5144444444 |
| kPa to Atmosphere Convert kilopascals to atmospheres. | kpa-to-atmosphere | 0.00986923 |
| kPa to Bar Convert kilopascals to bar. | kpa-to-bar | 0.01 |
| kPa to Pascal Convert kilopascals to pascals. | kpa-to-pascal | 1000 |
| kPa to PSI Convert kilopascals to pounds per square inch. | kpa-to-psi | 0.1450377377 |
| kVA to Kilowatts Convert apparent power to real power assuming unity power factor. | kva-to-kilowatts | 1 |
| Leagues per Hour to Kilometers per Hour Convert leagues per hour into kilometers per hour. | leagues-per-hour-to-kmh | 4.82803 |
| Leagues to Kilometers Convert leagues to kilometers. | leagues-to-kilometers | 4.82803 |
| Leagues to Miles Convert leagues to miles. | leagues-to-miles | 3 |
| Light Years to Kilometers Convert light years to kilometers. | light-years-to-kilometers | 9.4607304725808e12 |
| Light Years to Miles Convert light years to miles. | light-years-to-miles | 5.8786253731808e12 |
| Liters to Imperial gallons Convert liters to imperial gallons. | liters-to-imperial-gallons | 0.219969158 |
| Liters to Milliliters Convert liters to milliliters. | liters-to-milliliters | 1000 |
| Liters to Acre-feet Convert liters to acre-feet. | liters-to-acre-feet | 8.107e-7 |
| Liters to Barrel (US oil) Convert liters to US oil barrels. | liters-to-barrel-us-oil | 0.00628981077 |
| Liters to Bushels Convert liters to US dry bushels. | liters-to-bushels | 0.0284130625 |
| Liters to Centiliters Convert liters to centiliters. | liters-to-centiliters | 100 |
| Long Tons to Kilograms Convert UK long tons to kilograms. | long-tons-to-kilograms | 1016.0469088 |
| Long Tons to Pounds Convert UK long tons to pounds. | long-tons-to-pounds | 2240 |
| Long Tons to Short Tons Convert UK long tons to US short tons. | long-tons-to-short-tons | 1.12 |
| Lux to Foot-candles Convert illuminance from lux to foot-candles. | lux-to-foot-candles | 0.09290304 |
| Mach to Feet per Second Convert Mach number to feet per second (approximate sea-level speed of sound). | mach-to-feet-per-second | 1116.447 |
| Mach to Kilometers per Hour Convert Mach number to kilometers per hour. | mach-to-kilometers-per-hour | 1225.044 |
| Mach to Knots Convert Mach number to knots. | mach-to-knots | 661.47 |
| Mach to Meters per Second Convert Mach number to meters per second. | mach-to-meters-per-second | 340.29 |
| Mach to Miles per Hour Convert Mach number to miles per hour. | mach-to-miles-per-hour | 761.207 |
## Completion Checklist
- [x] Inches to Feet (`inches-to-feet`)
@@ -951,7 +991,7 @@ The registry currently contains 296 unique calculator slugs.
- [ ] AWG to Circular mils
- [ ] AWG to Millimeters (diameter)
- [ ] AWG to Square millimeters (cross-section)
- [ ] Kilograms to Quarters (1 kilogram ≈ 0.078732 US quarters)
- [x] Kilograms to Quarters (1 kilogram ≈ 0.078732 US quarters)
- [x] Banana equivalent dose to Microsievert
- [x] Bar to Atmosphere
- [x] Bar to Inches of Water
@@ -1115,10 +1155,10 @@ The registry currently contains 296 unique calculator slugs.
- [ ] Liters per 100 km to Miles per gallon
- [ ] Liters per minute to Gallons per minute
- [ ] Liters per second to CMS
- [ ] Liters to Acre-feet
- [ ] Liters to Barrel (US oil)
- [ ] Liters to Bushels
- [ ] Liters to Centiliters
- [x] Liters to Acre-feet
- [x] Liters to Barrel (US oil)
- [x] Liters to Bushels
- [x] Liters to Centiliters
- [ ] Liters to Cubic inches
- [ ] Liters to Cubic Meters
- [ ] Liters to Fluid Ounces

View File

@@ -12,26 +12,35 @@
conversions: CalculatorDef[];
};
type UnitBucket = {
label: string;
conversions: CalculatorDef[];
};
$: categoryUnitGroups = Object.entries(categories).map(([key, meta]) => {
const buckets = new Map<string, CalculatorDef[]>();
const buckets = new Map<string, UnitBucket>();
const calcs = getCalculatorsByCategory(key);
calcs.forEach(calc => {
[calc.labels.in1, calc.labels.in2].forEach(unit => {
const existing = buckets.get(unit);
const key = unit.toLowerCase();
const existing = buckets.get(key);
if (existing) {
existing.push(calc);
existing.conversions.push(calc);
} else {
buckets.set(unit, [calc]);
buckets.set(key, {
label: unit,
conversions: [calc],
});
}
});
});
const units = [...buckets.entries()]
.sort(([a], [b]) => a.localeCompare(b))
.map(([label, conversions]) => ({
label,
conversions: conversions.slice().sort((a, b) => a.name.localeCompare(b.name)),
.map(([, bucket]) => ({
label: bucket.label,
conversions: bucket.conversions.slice().sort((a, b) => a.name.localeCompare(b.name)),
}));
return { key, meta, units };

View File

@@ -106,7 +106,7 @@ export const calculators: CalculatorDef[] = [
{"slug": "inches-of-centimeters", "name": "Inches to Centimeters", "category": "length", "type": "standard", "labels": {"in1": "Inches", "in2": "Centimeters"}, "factor": 2.54},
{"slug": "inches-of-millimeters", "name": "Inches to Millimeters", "category": "length", "type": "standard", "labels": {"in1": "Inches", "in2": "Millimeters"}, "factor": 25.4},
{"slug": "centigrams-to-grams", "name": "Centigrams to Grams", "category": "weight", "type": "standard", "labels": {"in1": "Centigrams", "in2": "Grams"}, "factor": 0.01},
{"slug": "centiliters-to-liters", "name": "Centiliters to Liters", "category": "volume", "type": "standard", "labels": {"in1": "Centiliters", "in2": "Liters"}, "factor": 0.01},
{"slug": "centiliters-to-liters", "name": "Centiliters to Liters", "category": "volume", "type": "standard", "labels": {"in1": "Centiliters", "in2": "Liters"}, "factor": 0.01, "hidden": true},
{"slug": "centimeters-to-feet", "name": "Centimeters to Feet", "category": "length", "type": "standard", "labels": {"in1": "Centimeters", "in2": "Feet"}, "factor": 0.032808399},
{"slug": "centimeters-to-meters", "name": "Centimeters to Meters", "category": "length", "type": "standard", "labels": {"in1": "Centimeters", "in2": "Meters"}, "factor": 0.01},
{"slug": "centimeters-to-millimeters", "name": "Centimeters to Millimeters", "category": "length", "type": "standard", "labels": {"in1": "Centimeters", "in2": "Millimeters"}, "factor": 10.0},
@@ -374,6 +374,46 @@ export const calculators: CalculatorDef[] = [
{"slug": "mach-to-knots", "name": "Mach to Knots", "category": "speed", "type": "standard", "teaser": "Convert Mach number to knots.", "labels": {"in1": "Mach", "in2": "Knots"}, "factor": 661.47},
{"slug": "mach-to-meters-per-second", "name": "Mach to Meters per Second", "category": "length", "type": "standard", "teaser": "Convert Mach number to meters per second.", "labels": {"in1": "Mach", "in2": "Meters per Second"}, "factor": 340.29},
{"slug": "mach-to-miles-per-hour", "name": "Mach to Miles per Hour", "category": "length", "type": "standard", "teaser": "Convert Mach number to miles per hour.", "labels": {"in1": "Mach", "in2": "Miles per Hour"}, "factor": 761.207},
{"slug": "kilograms-to-quarters", "name": "Kilograms to Quarters", "category": "weight", "type": "standard", "teaser": "Convert kilograms into US quarters (1 quarter = 25 pounds).", "labels": {"in1": "Kilograms", "in2": "Quarters"}, "factor": 0.078732},
{"slug": "kilonewtons-to-newtons", "name": "Kilonewtons to Newtons", "category": "weight", "type": "standard", "teaser": "Convert kilonewtons into newtons.", "labels": {"in1": "Kilonewtons", "in2": "Newtons"}, "factor": 1000.0},
{"slug": "kilopascals-to-inches-of-mercury", "name": "Kilopascals to Inches of Mercury", "category": "length", "type": "standard", "teaser": "Convert pressure from kilopascals to inches of mercury (Hg).", "labels": {"in1": "Kilopascals", "in2": "Inches of Mercury"}, "factor": 0.2952998},
{"slug": "kilowatt-hours-to-btu", "name": "Kilowatt-hours to BTU", "category": "energy", "type": "standard", "teaser": "Convert electrical energy from kilowatt-hours to BTU.", "labels": {"in1": "Kilowatt-hours", "in2": "BTU"}, "factor": 3412.142},
{"slug": "kilowatt-hours-to-joules", "name": "Kilowatt-hours to Joules", "category": "energy", "type": "standard", "teaser": "Convert kilowatt-hours to joules.", "labels": {"in1": "Kilowatt-hours", "in2": "Joules"}, "factor": 3600000.0},
{"slug": "kilowatt-hours-to-kilocalories", "name": "Kilowatt-hours to Kilocalories", "category": "energy", "type": "standard", "teaser": "Convert kilowatt-hours to nutritional kilocalories.", "labels": {"in1": "Kilowatt-hours", "in2": "Kilocalories"}, "factor": 860.42065},
{"slug": "kilowatt-hours-to-therms", "name": "Kilowatt-hours to Therms", "category": "energy", "type": "standard", "teaser": "Convert kilowatt-hours to therms (US natural gas).", "labels": {"in1": "Kilowatt-hours", "in2": "Therms"}, "factor": 0.034121},
{"slug": "kilowatts-to-btuhour", "name": "Kilowatts to BTU/hour", "category": "energy", "type": "standard", "teaser": "Convert power from kilowatts to BTU per hour.", "labels": {"in1": "Kilowatts", "in2": "BTU/hour"}, "factor": 3412.142},
{"slug": "kilowatts-to-megawatts", "name": "Kilowatts to Megawatts", "category": "power", "type": "standard", "teaser": "Convert kilowatts into megawatts.", "labels": {"in1": "Kilowatts", "in2": "Megawatts"}, "factor": 0.001},
{"slug": "kilowatts-to-watts", "name": "Kilowatts to Watts", "category": "power", "type": "standard", "teaser": "Convert kilowatts into watts.", "labels": {"in1": "Kilowatts", "in2": "Watts"}, "factor": 1000.0},
{"slug": "km-per-kwh-to-miles-per-kwh", "name": "Kilometers per kWh to Miles per kWh", "category": "length", "type": "standard", "teaser": "Convert EV efficiency from km per kWh to miles per kWh.", "labels": {"in1": "Kilometers per kWh", "in2": "Miles per kWh"}, "factor": 0.621371},
{"slug": "kilometers-per-second-to-speed-of-light", "name": "Kilometers per Second to Speed of Light", "category": "length", "type": "standard", "teaser": "Express a speed in kilometers per second as a fraction of c (299,792.458 km/s).", "labels": {"in1": "Kilometers per Second", "in2": "Speed of Light"}, "factor": 3.33564095198152e-06},
{"slug": "knots-to-feet-per-second", "name": "Knots to Feet per Second", "category": "length", "type": "standard", "teaser": "Convert knots into feet per second.", "labels": {"in1": "Knots", "in2": "Feet per Second"}, "factor": 1.6878098376},
{"slug": "knots-to-kilometers-per-hour", "name": "Knots to Kilometers per Hour", "category": "length", "type": "standard", "teaser": "Convert knots into kilometers per hour.", "labels": {"in1": "Knots", "in2": "Kilometers per Hour"}, "factor": 1.852},
{"slug": "knots-to-meters-per-second", "name": "Knots to Meters per Second", "category": "length", "type": "standard", "teaser": "Convert knots into meters per second.", "labels": {"in1": "Knots", "in2": "Meters per Second"}, "factor": 0.5144444444},
{"slug": "kpa-to-atmosphere", "name": "kPa to Atmosphere", "category": "pressure", "type": "standard", "teaser": "Convert kilopascals to atmospheres.", "labels": {"in1": "kPa", "in2": "Atmosphere"}, "factor": 0.00986923},
{"slug": "kpa-to-bar", "name": "kPa to Bar", "category": "pressure", "type": "standard", "teaser": "Convert kilopascals to bar.", "labels": {"in1": "kPa", "in2": "Bar"}, "factor": 0.01},
{"slug": "kpa-to-pascal", "name": "kPa to Pascal", "category": "pressure", "type": "standard", "teaser": "Convert kilopascals to pascals.", "labels": {"in1": "kPa", "in2": "Pascal"}, "factor": 1000.0},
{"slug": "kpa-to-psi", "name": "kPa to PSI", "category": "pressure", "type": "standard", "teaser": "Convert kilopascals to pounds per square inch.", "labels": {"in1": "kPa", "in2": "PSI"}, "factor": 0.1450377377},
{"slug": "kva-to-kilowatts", "name": "kVA to Kilowatts", "category": "power", "type": "standard", "teaser": "Convert apparent power to real power assuming unity power factor.", "labels": {"in1": "kVA", "in2": "Kilowatts"}},
{"slug": "leagues-per-hour-to-kmh", "name": "Leagues per Hour to Kilometers per Hour", "category": "length", "type": "standard", "teaser": "Convert leagues per hour into kilometers per hour.", "labels": {"in1": "Leagues per Hour", "in2": "Kilometers per Hour"}, "factor": 4.82803},
{"slug": "leagues-to-kilometers", "name": "Leagues to Kilometers", "category": "length", "type": "standard", "teaser": "Convert leagues to kilometers.", "labels": {"in1": "Leagues", "in2": "Kilometers"}, "factor": 4.82803},
{"slug": "leagues-to-miles", "name": "Leagues to Miles", "category": "length", "type": "standard", "teaser": "Convert leagues to miles.", "labels": {"in1": "Leagues", "in2": "Miles"}, "factor": 3.0},
{"slug": "light-years-to-kilometers", "name": "Light Years to Kilometers", "category": "length", "type": "standard", "teaser": "Convert light years to kilometers.", "labels": {"in1": "Light Years", "in2": "Kilometers"}, "factor": 9460730472580.8},
{"slug": "light-years-to-miles", "name": "Light Years to Miles", "category": "length", "type": "standard", "teaser": "Convert light years to miles.", "labels": {"in1": "Light Years", "in2": "Miles"}, "factor": 5878625373180.8},
{"slug": "liters-to-imperial-gallons", "name": "Liters to Imperial gallons", "category": "volume", "type": "standard", "teaser": "Convert liters to imperial gallons.", "labels": {"in1": "Liters", "in2": "Imperial gallons"}, "factor": 0.219969158, "hidden": true},
{"slug": "liters-to-milliliters", "name": "Liters to Milliliters", "category": "volume", "type": "standard", "teaser": "Convert liters to milliliters.", "labels": {"in1": "Liters", "in2": "Milliliters"}, "factor": 1000.0},
{"slug": "liters-to-acre-feet", "name": "Liters to Acre-feet", "category": "length", "type": "standard", "teaser": "Convert liters to acre-feet.", "labels": {"in1": "Liters", "in2": "Acre-feet"}, "factor": 8.107e-07},
{"slug": "liters-to-barrel-us-oil", "name": "Liters to Barrel (US oil)", "category": "volume", "type": "standard", "teaser": "Convert liters to US oil barrels.", "labels": {"in1": "Liters", "in2": "Barrel (US oil)"}, "factor": 0.00628981077},
{"slug": "liters-to-bushels", "name": "Liters to Bushels", "category": "volume", "type": "standard", "teaser": "Convert liters to US dry bushels.", "labels": {"in1": "Liters", "in2": "Bushels"}, "factor": 0.0284130625},
{"slug": "liters-to-centiliters", "name": "Liters to Centiliters", "category": "volume", "type": "standard", "teaser": "Convert liters to centiliters.", "labels": {"in1": "Liters", "in2": "Centiliters"}, "factor": 100.0},
{"slug": "long-tons-to-kilograms", "name": "Long Tons to Kilograms", "category": "weight", "type": "standard", "teaser": "Convert UK long tons to kilograms.", "labels": {"in1": "Long Tons", "in2": "Kilograms"}, "factor": 1016.0469088},
{"slug": "long-tons-to-pounds", "name": "Long Tons to Pounds", "category": "weight", "type": "standard", "teaser": "Convert UK long tons to pounds.", "labels": {"in1": "Long Tons", "in2": "Pounds"}, "factor": 2240.0},
{"slug": "long-tons-to-short-tons", "name": "Long Tons to Short Tons", "category": "weight", "type": "standard", "teaser": "Convert UK long tons to US short tons.", "labels": {"in1": "Long Tons", "in2": "Short Tons"}, "factor": 1.12},
{"slug": "lux-to-foot-candles", "name": "Lux to Foot-candles", "category": "light", "type": "standard", "teaser": "Convert illuminance from lux to foot-candles.", "labels": {"in1": "Lux", "in2": "Foot-candles"}, "factor": 0.09290304, "hidden": true},
{"slug": "mach-to-feet-per-second", "name": "Mach to Feet per Second", "category": "length", "type": "standard", "teaser": "Convert Mach number to feet per second (approximate sea-level speed of sound).", "labels": {"in1": "Mach", "in2": "Feet per Second"}, "factor": 1116.447},
{"slug": "mach-to-kilometers-per-hour", "name": "Mach to Kilometers per Hour", "category": "length", "type": "standard", "teaser": "Convert Mach number to kilometers per hour.", "labels": {"in1": "Mach", "in2": "Kilometers per Hour"}, "factor": 1225.044},
{"slug": "mach-to-knots", "name": "Mach to Knots", "category": "speed", "type": "standard", "teaser": "Convert Mach number to knots.", "labels": {"in1": "Mach", "in2": "Knots"}, "factor": 661.47},
{"slug": "mach-to-meters-per-second", "name": "Mach to Meters per Second", "category": "length", "type": "standard", "teaser": "Convert Mach number to meters per second.", "labels": {"in1": "Mach", "in2": "Meters per Second"}, "factor": 340.29},
{"slug": "mach-to-miles-per-hour", "name": "Mach to Miles per Hour", "category": "length", "type": "standard", "teaser": "Convert Mach number to miles per hour.", "labels": {"in1": "Mach", "in2": "Miles per Hour"}, "factor": 761.207},
];