diff --git a/package.json b/package.json index 441bebef..ddc34b26 100644 --- a/package.json +++ b/package.json @@ -317,6 +317,7 @@ "riimut": "^0.9.1", "roboto-base64": "^0.1.2", "rtf-stream-parser": "^3.8.1", + "run-pace": "^2.2.0", "safe-license-list": "^0.1.2", "sandybox": "^1.1.2", "sanitize-html": "^2.17.0", @@ -467,7 +468,8 @@ }, "patchedDependencies": { "node-forge@1.4.0": "patches/node-forge@1.4.0.patch", - "esm-potrace-wasm": "patches/esm-potrace-wasm.patch" + "esm-potrace-wasm": "patches/esm-potrace-wasm.patch", + "run-pace": "patches/run-pace.patch" } }, "scarfSettings": { diff --git a/patches/run-pace.patch b/patches/run-pace.patch new file mode 100644 index 00000000..a45477e5 --- /dev/null +++ b/patches/run-pace.patch @@ -0,0 +1,12 @@ +diff --git a/lib/run-pace.js b/lib/run-pace.js +index 2b20a32ff4b5712016dd869a734ff25f730cdb12..9b9b72187e6675db6b295a827f2293950d12a111 100644 +--- a/lib/run-pace.js ++++ b/lib/run-pace.js +@@ -119,7 +119,3 @@ function removeTrailingZeroes(number) { + function removeLeadingZero(number) { + return number.replace(/^0/, ""); + } +- +-function zeroPad(number) { +- return `0${number}`.slice(-2); +-} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cd1579d..a6692544 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ patchedDependencies: node-forge@1.4.0: hash: be4w4shpo4tldv77tcysxrioha path: patches/node-forge@1.4.0.patch + run-pace: + hash: flfgxpnzx6iyo2pksk6djrkobe + path: patches/run-pace.patch importers: @@ -845,6 +848,9 @@ importers: rtf-stream-parser: specifier: ^3.8.1 version: 3.8.1 + run-pace: + specifier: ^2.2.0 + version: 2.2.0(patch_hash=flfgxpnzx6iyo2pksk6djrkobe) safe-license-list: specifier: ^0.1.2 version: 0.1.2 @@ -10146,6 +10152,10 @@ packages: resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} engines: {node: '>=18'} + run-pace@2.2.0: + resolution: {integrity: sha512-IeBogfkMIxyg97mxE+vbf71Iimda/+qAYgfqcn+JTXHJSb8efECyMWazlBE2Jrzgaxu8QHAKZbudPjyX+o+Cew==} + hasBin: true + run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -22190,6 +22200,8 @@ snapshots: run-applescript@7.1.0: {} + run-pace@2.2.0(patch_hash=flfgxpnzx6iyo2pksk6djrkobe): {} + run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 diff --git a/src/tools/running-pace-calculator/index.ts b/src/tools/running-pace-calculator/index.ts new file mode 100644 index 00000000..d3d8d2d1 --- /dev/null +++ b/src/tools/running-pace-calculator/index.ts @@ -0,0 +1,13 @@ +import { Run } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Running Pace Calculator', + path: '/running-pace-calculator', + description: 'Calculate your running pace, estimate your finish times for popular races, break down splits, and find your training zones.', + keywords: ['running', 'pace', 'calculator'], + component: () => import('./running-pace-calculator.vue'), + icon: Run, + createdAt: new Date('2026-06-21'), + category: 'Data', +}); diff --git a/src/tools/running-pace-calculator/run-pace.d.ts b/src/tools/running-pace-calculator/run-pace.d.ts new file mode 100644 index 00000000..f89443ee --- /dev/null +++ b/src/tools/running-pace-calculator/run-pace.d.ts @@ -0,0 +1,26 @@ +declare module 'run-pace' { + export function calculatePace(options: { + time: string; + length: string; + imperial?: boolean; + metric?: boolean; + speed?: boolean; + }): string; + export function calculateLength(options: { + time: string; + pace: string; + imperial?: boolean; + metric?: boolean; + }): string; + export function calculateTime(options: { + length: string; + pace: string; + imperial?: boolean; + metric?: boolean; + }): string; + export function paceToSpeed(options: { + pace: string; + imperial?: boolean; + metric?: boolean; + }): string; +} \ No newline at end of file diff --git a/src/tools/running-pace-calculator/running-pace-calculator.vue b/src/tools/running-pace-calculator/running-pace-calculator.vue new file mode 100644 index 00000000..c03926c4 --- /dev/null +++ b/src/tools/running-pace-calculator/running-pace-calculator.vue @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + km + + + mile + + + + + + + + + + + + Calculate + + + + + {{ error }} + + + + + + +