diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 78ecc7a..1b6a4a5 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -100,7 +100,7 @@ function sidebarGuide() { collapsible: true, items: [ { text: 'Config Reference', link: '/config/index' }, - { text: 'Methods', link: '/config/methods' }, + { text: 'Calculation Methods', link: '/config/methods' }, ], }, { diff --git a/docs/api.md b/docs/api.md index 57fef08..a2abefd 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,3 +1,115 @@ # API Reference -WIP +## Table of Contents + +- [StaticCalculator](#StaticCalculator) + - [Constructor](#StaticCalculator-Constructor) + - [Methods](#StaticCalculator-Methods) +- [ReactiveCalculator](#ReactiveCalculator) + - [Constructor](#ReactiveCalculator-Constructor) + - [Methods](#ReactiveCalculator-Methods) +- [Helper Functions](#Helper-Functions) + - [calculateQibla](#calculateQibla) +- [Types](#Types) + - [CoordinatesObject](#CoordinatesObject) + - [TimeObject](#TimeObject) + +--- + +## StaticCalculator + +### Constructor + +#### `new StaticCalculator(config: CalculationsConfig)` + +Initializes a new `StaticCalculator` instance. + +**Parameters:** + +- `config`: [CalculationsConfig](#CalculationsConfig) + +**Example:** + +```ts +const calculator = new StaticCalculator({ + /* config options */ +}) +``` + +### Methods + +#### `getQiblaDirection(coordinates?: CoordinatesObject): number` + +Calculates the Qibla direction. + +**Parameters:** + +- `coordinates`: Optional. [CoordinatesObject](#CoordinatesObject) + +**Example:** + +```ts +const direction = calculator.getQiblaDirection() +``` + +--- + +## ReactiveCalculator + +### Constructor + +#### `new ReactiveCalculator(config: CalculationsConfig)` + +Initializes a new `ReactiveCalculator` instance. + +### Methods + +#### `cleanup(): void` + +Cleans up all subscriptions. + +**Example:** + +```ts +reactiveCalculator.cleanup() +``` + +--- + +## Helper Functions + +### calculateQibla + +#### `calculateQibla(coordinates: CoordinatesObject): number` + +Calculates the Qibla direction based on the given coordinates. + +**Example:** + +```ts +const direction = calculateQibla({ latitude: 40.7128, longitude: -74.006 }) +``` + +--- + +## Types + +### CoordinatesObject + +```ts +{ + latitude: number + longitude: number +} +``` + +### TimeObject + +```ts +{ + name: string + time: Date +} +``` + +--- diff --git a/docs/recipes/testing.md b/docs/recipes/testing.md index 7040ac8..b109d75 100644 --- a/docs/recipes/testing.md +++ b/docs/recipes/testing.md @@ -1,7 +1,13 @@ # Testing -::: tip -This is a work in progress. If you have any questions or suggestions, please [open an issue]() or [start a discussion](). +::: warning Work in progress +We're currently evaluating the inclusion of testing utilities. While they may not be available in version 1, we're considering adding them in future releases. Your input is valuable to us. Feel free to open an [issue]() for questions or suggestions. ::: Testing reactive code can be tricky. That's why `prayer-call` provides some helpers that allows you to test your reactive code in a synchronous manner. + + diff --git a/docs/roadmap.md b/docs/roadmap.md index e51aa79..e2768ba 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,5 +1,7 @@ -- Offer open source tools to make comparing and making methods easier. +- Offer open source tools to make comparing and building calculation methods easier. - Re-write the library from scratch making it reactive from the ground up (using vue 3 reactive core api) +- improve the docs to have examples imported from actual ts files +- translated the docs to Arabic - Add altitude to the calculation formula - Support `Temporal` instead of `Date` - Offer testing utilities for reactive code