@jjlmoya/utils-motor 1.3.0 → 1.5.0
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.
- package/package.json +2 -2
- package/src/category/index.ts +3 -1
- package/src/entries.ts +5 -1
- package/src/index.ts +10 -0
- package/src/tests/locale_completeness.test.ts +1 -1
- package/src/tests/tool_validation.test.ts +1 -1
- package/src/tool/evChargingTimeCostPlanner/bibliography.astro +6 -0
- package/src/tool/evChargingTimeCostPlanner/bibliography.ts +16 -0
- package/src/tool/evChargingTimeCostPlanner/component.astro +147 -0
- package/src/tool/evChargingTimeCostPlanner/controller.ts +214 -0
- package/src/tool/evChargingTimeCostPlanner/dom-views.ts +124 -0
- package/src/tool/evChargingTimeCostPlanner/entry.ts +30 -0
- package/src/tool/evChargingTimeCostPlanner/ev-charging-time-cost-planner.css +598 -0
- package/src/tool/evChargingTimeCostPlanner/evaluator.ts +10 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/de.ts +22 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/en.ts +161 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/es.ts +16 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/factory.ts +113 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/fr.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/id.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/it.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/ja.ts +13 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/ko.ts +13 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/nl.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/pl.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/pt.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/ru.ts +13 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/sv.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/tr.ts +9 -0
- package/src/tool/evChargingTimeCostPlanner/i18n/zh.ts +13 -0
- package/src/tool/evChargingTimeCostPlanner/index.ts +10 -0
- package/src/tool/evChargingTimeCostPlanner/logic.test.ts +71 -0
- package/src/tool/evChargingTimeCostPlanner/logic.ts +174 -0
- package/src/tool/evChargingTimeCostPlanner/seo.astro +15 -0
- package/src/tool/evChargingTimeCostPlanner/storage.ts +27 -0
- package/src/tool/evChargingTimeCostPlanner/ui.ts +50 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/bibliography.astro +6 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/bibliography.ts +12 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/component.astro +166 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/controller.ts +207 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/dom-views.ts +101 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/entry.ts +30 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/evaluator.ts +7 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/de.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/en.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/es.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/fr.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/id.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/it.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/ja.ts +201 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/ko.ts +201 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/nl.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/pl.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/pt.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/ru.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/sv.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/tr.ts +185 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/i18n/zh.ts +201 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/index.ts +10 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/logic.test.ts +229 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/logic.ts +179 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/motorcycle-skid-mark-speed-estimator.css +523 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/seo.astro +15 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/storage.ts +49 -0
- package/src/tool/motorcycleSkidMarkSpeedEstimator/ui.ts +46 -0
- package/src/tools.ts +5 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isBrakeUse,
|
|
3
|
+
isSurfaceId,
|
|
4
|
+
isUnitSystem,
|
|
5
|
+
type BrakeUse,
|
|
6
|
+
type SurfaceId,
|
|
7
|
+
type UnitSystem,
|
|
8
|
+
} from './logic';
|
|
9
|
+
|
|
10
|
+
export interface SavedSkidState {
|
|
11
|
+
lengthMeters: number;
|
|
12
|
+
unit: UnitSystem;
|
|
13
|
+
surface: SurfaceId;
|
|
14
|
+
friction: number;
|
|
15
|
+
gradePercent: number;
|
|
16
|
+
brakeUse: BrakeUse;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const STORAGE_KEY = 'jjlmoya:motorcycle-skid-mark-speed-estimator';
|
|
20
|
+
|
|
21
|
+
function isSavedSkidState(value: unknown): value is SavedSkidState {
|
|
22
|
+
if (!value || typeof value !== 'object') return false;
|
|
23
|
+
const state = value as SavedSkidState;
|
|
24
|
+
return (
|
|
25
|
+
typeof state.lengthMeters === 'number' &&
|
|
26
|
+
isUnitSystem(state.unit) &&
|
|
27
|
+
isSurfaceId(state.surface) &&
|
|
28
|
+
typeof state.friction === 'number' &&
|
|
29
|
+
typeof state.gradePercent === 'number' &&
|
|
30
|
+
isBrakeUse(state.brakeUse)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function loadSkidState(): SavedSkidState | null {
|
|
35
|
+
try {
|
|
36
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
37
|
+
if (!raw) return null;
|
|
38
|
+
const parsed: unknown = JSON.parse(raw);
|
|
39
|
+
return isSavedSkidState(parsed) ? parsed : null;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function saveSkidState(state: SavedSkidState): void {
|
|
46
|
+
try {
|
|
47
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface MotorcycleSkidMarkSpeedEstimatorUI extends Record<string, string> {
|
|
2
|
+
unitMetric: string;
|
|
3
|
+
unitImperial: string;
|
|
4
|
+
disclaimer: string;
|
|
5
|
+
lengthLabel: string;
|
|
6
|
+
lengthHint: string;
|
|
7
|
+
gradeLabel: string;
|
|
8
|
+
gradeHint: string;
|
|
9
|
+
surfaceLabel: string;
|
|
10
|
+
frictionLabel: string;
|
|
11
|
+
frictionHint: string;
|
|
12
|
+
brakeLabel: string;
|
|
13
|
+
brakeBoth: string;
|
|
14
|
+
brakeFront: string;
|
|
15
|
+
brakeRear: string;
|
|
16
|
+
brakeUnknown: string;
|
|
17
|
+
speedLabel: string;
|
|
18
|
+
rangeLabel: string;
|
|
19
|
+
dragHint: string;
|
|
20
|
+
emptyMessage: string;
|
|
21
|
+
invalidMessage: string;
|
|
22
|
+
readyMessage: string;
|
|
23
|
+
educationalBadge: string;
|
|
24
|
+
surfaceDryAsphalt: string;
|
|
25
|
+
surfaceWetAsphalt: string;
|
|
26
|
+
surfaceDryConcrete: string;
|
|
27
|
+
surfaceGravel: string;
|
|
28
|
+
surfaceGrass: string;
|
|
29
|
+
surfaceIce: string;
|
|
30
|
+
surfaceCustom: string;
|
|
31
|
+
sensitivityLabel: string;
|
|
32
|
+
lowAssumption: string;
|
|
33
|
+
highAssumption: string;
|
|
34
|
+
gradeUphill: string;
|
|
35
|
+
gradeDownhill: string;
|
|
36
|
+
gradeLevel: string;
|
|
37
|
+
measureHint: string;
|
|
38
|
+
stencilUnitKmh: string;
|
|
39
|
+
stencilUnitMph: string;
|
|
40
|
+
lengthUnitM: string;
|
|
41
|
+
lengthUnitFt: string;
|
|
42
|
+
percentSuffix: string;
|
|
43
|
+
dragLowLabel: string;
|
|
44
|
+
dragMidLabel: string;
|
|
45
|
+
dragHighLabel: string;
|
|
46
|
+
}
|
package/src/tools.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { ALL_ENTRIES } from './entries';
|
|
2
2
|
import { BRAKING_DISTANCE_CALCULATOR_TOOL } from './tool/brakingDistanceCalculator';
|
|
3
3
|
import { CAR_MOTORCYCLE_GEAR_RATIO_CALCULATOR_TOOL } from './tool/carMotorcycleGearRatioCalculator';
|
|
4
|
+
import { MOTORCYCLE_SKID_MARK_SPEED_ESTIMATOR_TOOL } from './tool/motorcycleSkidMarkSpeedEstimator';
|
|
4
5
|
import { REAL_FUEL_CONSUMPTION_CALCULATOR_TOOL } from './tool/realFuelConsumptionCalculator';
|
|
5
6
|
import { TIRE_PRESSURE_CONVERTER_TOOL } from './tool/tirePressureConverter';
|
|
7
|
+
import { EV_CHARGING_TIME_COST_PLANNER_TOOL } from './tool/evChargingTimeCostPlanner';
|
|
6
8
|
|
|
7
|
-
export const ALL_TOOLS = [BRAKING_DISTANCE_CALCULATOR_TOOL, REAL_FUEL_CONSUMPTION_CALCULATOR_TOOL, CAR_MOTORCYCLE_GEAR_RATIO_CALCULATOR_TOOL, TIRE_PRESSURE_CONVERTER_TOOL];
|
|
9
|
+
export const ALL_TOOLS = [BRAKING_DISTANCE_CALCULATOR_TOOL, REAL_FUEL_CONSUMPTION_CALCULATOR_TOOL, CAR_MOTORCYCLE_GEAR_RATIO_CALCULATOR_TOOL, TIRE_PRESSURE_CONVERTER_TOOL, MOTORCYCLE_SKID_MARK_SPEED_ESTIMATOR_TOOL, EV_CHARGING_TIME_COST_PLANNER_TOOL];
|
|
10
|
+
export { evChargingTimeCostPlanner } from './tool/evChargingTimeCostPlanner/entry';
|
|
11
|
+
export type { EVChargingTimeCostPlannerLocaleContent } from './tool/evChargingTimeCostPlanner/entry';
|