tauqeet-js 1.0.2 → 1.1.1
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/CHANGELOG.md +83 -0
- package/LICENSE +1 -1
- package/README.md +143 -101
- package/dist/hijri/index.cjs +2779 -0
- package/dist/hijri/index.cjs.map +1 -0
- package/dist/hijri/index.d.cts +218 -0
- package/dist/hijri/index.d.ts +218 -0
- package/dist/hijri/index.js +2765 -0
- package/dist/hijri/index.js.map +1 -0
- package/dist/index.cjs +4261 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -17
- package/dist/index.d.ts +5 -17
- package/dist/index.js +4219 -1
- package/dist/index.js.map +1 -1
- package/dist/moon/index.cjs +2632 -1
- package/dist/moon/index.cjs.map +1 -1
- package/dist/moon/index.d.cts +153 -15
- package/dist/moon/index.d.ts +153 -15
- package/dist/moon/index.js +2617 -1
- package/dist/moon/index.js.map +1 -1
- package/dist/prayers/index.cjs +2562 -0
- package/dist/prayers/index.cjs.map +1 -0
- package/dist/prayers/index.d.cts +165 -0
- package/dist/prayers/index.d.ts +165 -0
- package/dist/prayers/index.js +2551 -0
- package/dist/prayers/index.js.map +1 -0
- package/dist/qibla/index.cjs +97 -1
- package/dist/qibla/index.cjs.map +1 -1
- package/dist/qibla/index.d.cts +43 -15
- package/dist/qibla/index.d.ts +43 -15
- package/dist/qibla/index.js +93 -1
- package/dist/qibla/index.js.map +1 -1
- package/dist/solar-alignment/index.cjs +1491 -0
- package/dist/solar-alignment/index.cjs.map +1 -0
- package/dist/solar-alignment/index.d.cts +38 -0
- package/dist/solar-alignment/index.d.ts +38 -0
- package/dist/solar-alignment/index.js +1489 -0
- package/dist/solar-alignment/index.js.map +1 -0
- package/package.json +95 -20
- package/dist/astronomy/index.cjs +0 -2
- package/dist/astronomy/index.cjs.map +0 -1
- package/dist/astronomy/index.d.cts +0 -40
- package/dist/astronomy/index.d.ts +0 -40
- package/dist/astronomy/index.js +0 -2
- package/dist/astronomy/index.js.map +0 -1
- package/dist/chunk-4GEHU4EV.js +0 -2
- package/dist/chunk-4GEHU4EV.js.map +0 -1
- package/dist/chunk-4JQOEJI5.cjs +0 -2
- package/dist/chunk-4JQOEJI5.cjs.map +0 -1
- package/dist/chunk-BJ45B342.cjs +0 -2
- package/dist/chunk-BJ45B342.cjs.map +0 -1
- package/dist/chunk-CSU6AEKX.js +0 -2
- package/dist/chunk-CSU6AEKX.js.map +0 -1
- package/dist/chunk-DJ357A47.js +0 -2
- package/dist/chunk-DJ357A47.js.map +0 -1
- package/dist/chunk-E4M4MYZR.cjs +0 -2
- package/dist/chunk-E4M4MYZR.cjs.map +0 -1
- package/dist/chunk-FQ6RGT3F.cjs +0 -2
- package/dist/chunk-FQ6RGT3F.cjs.map +0 -1
- package/dist/chunk-FTWK5BZJ.js +0 -2
- package/dist/chunk-FTWK5BZJ.js.map +0 -1
- package/dist/chunk-GIWGJKCS.js +0 -2
- package/dist/chunk-GIWGJKCS.js.map +0 -1
- package/dist/chunk-H2JLMZ5E.cjs +0 -2
- package/dist/chunk-H2JLMZ5E.cjs.map +0 -1
- package/dist/chunk-H33IJIM5.cjs +0 -2
- package/dist/chunk-H33IJIM5.cjs.map +0 -1
- package/dist/chunk-IAQLPBAC.js +0 -2
- package/dist/chunk-IAQLPBAC.js.map +0 -1
- package/dist/chunk-II6TW43P.cjs +0 -2
- package/dist/chunk-II6TW43P.cjs.map +0 -1
- package/dist/chunk-IPNHW5FC.js +0 -2
- package/dist/chunk-IPNHW5FC.js.map +0 -1
- package/dist/chunk-JA4E3Q7A.js +0 -2
- package/dist/chunk-JA4E3Q7A.js.map +0 -1
- package/dist/chunk-LTEJ7X6W.js +0 -2
- package/dist/chunk-LTEJ7X6W.js.map +0 -1
- package/dist/chunk-QMMOAGSC.js +0 -2
- package/dist/chunk-QMMOAGSC.js.map +0 -1
- package/dist/chunk-WFHQSUXS.cjs +0 -2
- package/dist/chunk-WFHQSUXS.cjs.map +0 -1
- package/dist/chunk-WXX4UNDC.js +0 -2
- package/dist/chunk-WXX4UNDC.js.map +0 -1
- package/dist/chunk-XL5IKB2X.js +0 -2
- package/dist/chunk-XL5IKB2X.js.map +0 -1
- package/dist/chunk-YDSVFKVM.cjs +0 -2
- package/dist/chunk-YDSVFKVM.cjs.map +0 -1
- package/dist/chunk-YMPRSR53.cjs +0 -2
- package/dist/chunk-YMPRSR53.cjs.map +0 -1
- package/dist/chunk-YSOESZ35.cjs +0 -2
- package/dist/chunk-YSOESZ35.cjs.map +0 -1
- package/dist/chunk-YZUP33VG.cjs +0 -2
- package/dist/chunk-YZUP33VG.cjs.map +0 -1
- package/dist/index-tSYKxCru.d.cts +0 -64
- package/dist/index-tSYKxCru.d.ts +0 -64
- package/dist/prayer/index.cjs +0 -2
- package/dist/prayer/index.cjs.map +0 -1
- package/dist/prayer/index.d.cts +0 -17
- package/dist/prayer/index.d.ts +0 -17
- package/dist/prayer/index.js +0 -2
- package/dist/prayer/index.js.map +0 -1
- package/dist/ramadan-BpmCzDzM.d.ts +0 -77
- package/dist/ramadan-Cr6YrTTX.d.cts +0 -77
- package/dist/ui/index.cjs +0 -105
- package/dist/ui/index.cjs.map +0 -1
- package/dist/ui/index.d.cts +0 -43
- package/dist/ui/index.d.ts +0 -43
- package/dist/ui/index.js +0 -105
- package/dist/ui/index.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `tauqeet-js` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Sub-path exports (`/prayers`, `/qibla`, `/moon`, `/hijri`, `/solar-alignment`) for true per-module tree-shaking.
|
|
13
|
+
- ESLint + Prettier configuration for consistent code quality enforcement.
|
|
14
|
+
- GitHub Actions CI workflow (`.github/workflows/ci.yml`) running tests and build on Node 20 and 22.
|
|
15
|
+
- `CHANGELOG.md` (this file).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- `tsconfig.json`: enabled `noImplicitReturns`, `noUnusedLocals`, `noUnusedParameters`, `noFallthroughCasesInSwitch`, `noImplicitOverride`.
|
|
19
|
+
- `tsconfig.json`: removed unused `"jsx": "react-jsx"` option (library has no JSX).
|
|
20
|
+
- `vitest.config.ts`: broadened `include` from an allowlist to `tests/**/*.test.ts`.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Stale test files (`engine.test.ts`, `moon.test.ts`, `high-latitude.test.ts`, `extended/*.test.ts`) rewritten to use the current API.
|
|
24
|
+
- Removed leftover `methods.ts` from the project root.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [1.1.0] — 2026-06-14
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Hijri Calendar module** (`src/hijri/`): Gregorian ↔ Hijri conversion via four strategies — Civil (tabular), Conjunction (astronomical), Visibility (location-based), and Umm al-Qura.
|
|
32
|
+
- `HijriEngine` class with pluggable calendar methods.
|
|
33
|
+
- Convenience converters `toHijri()` and `toGregorian()`.
|
|
34
|
+
- `HIJRI_MONTH_NAMES` constant array.
|
|
35
|
+
- **Solar Alignment module** (`src/solar-alignment/`): computes times when the sun aligns with the Qibla direction, useful for compass calibration.
|
|
36
|
+
- `EphemerisService` singleton with LRU cache (10-day window) and Lagrange 3-point interpolation for solar ephemeris, reducing per-prayer computation cost.
|
|
37
|
+
- `withMetadata` option on `calculatePrayerTimes` / `getPrayerTimes` to expose DEC, EOT, HP, SD, and solver iteration counts per prayer.
|
|
38
|
+
- `dhahwaKubra` (Ḍuḥā Kubrā) time to prayer results — the midpoint between Fajr and Sunset.
|
|
39
|
+
- Atmospheric corrections (`temperatureC`, `pressureMbar`) for refraction-accurate Sunrise/Maghrib.
|
|
40
|
+
- `resolveTimezoneAsync` hook on `PrayerConfig` for async timezone resolution.
|
|
41
|
+
- `highLatitudeStrategy` option: `'AngleBased'`, `'MiddleOfNight'`, `'SeventhOfNight'`, `'NearestLatitude'`.
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
- **Architecture consolidation**: merged `internal` and `_internal` utility folders into a single `src/internal/` directory.
|
|
45
|
+
- Iterative refinement for Solar Declination and Equation of Time inside the solar alignment solver.
|
|
46
|
+
- Validator (`validatePrayerConfig`) now supports DMS string and object coordinate formats.
|
|
47
|
+
- `timeZone` falls back to `Intl.DateTimeFormat().resolvedOptions().timeZone` when omitted.
|
|
48
|
+
- Default madhab changed to `Hanafi`; default method per madhab derived from `isDefault` flag in registry.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
- Sub-second inaccuracies in astronomical event times resolved by iterative ephemeris refinement.
|
|
52
|
+
- Pressure validation now enforces integer check (`Number.isInteger`).
|
|
53
|
+
- Timezone offset widening (`string | number`) corrected throughout all modules.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## [1.0.0] — 2026-05-29
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
- **Prayer Times module** (`src/prayers/`): Fajr, Sunrise, Ḍuḥā, Dhuhr, Asr, Maghrib, Isha.
|
|
61
|
+
- 8 built-in calculation methods scoped per Madhab (Hanafi, Shafi, Maliki, Hanbali, Jaafari).
|
|
62
|
+
- High-latitude handling: Polar Day, Polar Night, Continuous Twilight with Astronomical Midnight fallback.
|
|
63
|
+
- Per-prayer minute adjustments via `adjustments` config.
|
|
64
|
+
- Elevation-based horizon dip correction.
|
|
65
|
+
- **Qibla module** (`src/qibla/`): great-circle bearing, rhumb-line bearing, and Haversine distance to the Kaaba.
|
|
66
|
+
- **Moon module** (`src/moon/`):
|
|
67
|
+
- Moon phase, elongation, illuminated fraction.
|
|
68
|
+
- Moon age (days since last New Moon).
|
|
69
|
+
- Lunar events: Next/Previous New Moon and Full Moon.
|
|
70
|
+
- Crescent visibility via Odeh, Yallop, and HMNAO criteria.
|
|
71
|
+
- **Astronomy engine** (`src/astronomy/`): VSOP87-derived solar ephemeris, lunar position theory, ΔT correction (ELP2000-style).
|
|
72
|
+
- Dual-module output (ESM + CJS) via `tsup`.
|
|
73
|
+
- TypeScript declaration files (`.d.ts` / `.d.cts`).
|
|
74
|
+
- Source maps.
|
|
75
|
+
- `sideEffects: false` for bundler tree-shaking.
|
|
76
|
+
- `prepublishOnly` script to gate `npm publish` behind a full build + test run.
|
|
77
|
+
- Comprehensive test suite with `vitest`.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
[Unreleased]: https://github.com/h-ghulam-hasnain/tauqeet-js/compare/v1.1.0...HEAD
|
|
82
|
+
[1.1.0]: https://github.com/h-ghulam-hasnain/tauqeet-js/compare/v1.0.0...v1.1.0
|
|
83
|
+
[1.0.0]: https://github.com/h-ghulam-hasnain/tauqeet-js/releases/tag/v1.0.0
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,101 +1,143 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
[](LICENSE)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
> 📖 **Interactive documentation & live API explorer:** [https://tauqeet-js.web.app](https://tauqeet-js.web.app)
|
|
9
|
+
|
|
10
|
+
`tauqeet-js` (تَوقِيت — Arabic for "timing") provides high-fidelity Islamic astronomical computation powered by a full VSOP87-derived solar ephemeris, lunar theory, and ΔT correction. It is modular by design — import only the feature you need.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Features](#features)
|
|
17
|
+
- [Prerequisites](#prerequisites)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Quick Start](#quick-start)
|
|
20
|
+
- [Documentation](#documentation)
|
|
21
|
+
- [Modules Overview](#modules-overview)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
- [Author](#author)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
| Module | Capability |
|
|
30
|
+
|---|---|
|
|
31
|
+
| **Prayers** | Fajr, Sunrise, Ḍuḥā, Dhuhr, Asr, Maghrib, Isha with 8 built-in calculation methods |
|
|
32
|
+
| **Qibla** | Great-circle bearing, rhumb-line bearing, and distance to the Kaaba |
|
|
33
|
+
| **Moon** | Phase, illumination, age, lunar events, crescent visibility (Odeh / Yallop / HMNAO) |
|
|
34
|
+
| **Hijri** | Gregorian ↔ Hijri conversion via Civil, Conjunction, Visibility, or Umm al-Qura methods |
|
|
35
|
+
| **Solar Alignment** | Times when the sun aligns with the Qibla direction (useful for compass calibration) |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
- **Node.js** ≥ 18
|
|
42
|
+
- **TypeScript** ≥ 5 (for source usage)
|
|
43
|
+
- ESM-first; CJS bundle also provided.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install tauqeet-js
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> **Note:** The package is currently in active development for v1.2.0. See [CONTRIBUTING.md](CONTRIBUTING.md) for building from source.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
### Prayer Times
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { calculatePrayerTimes, BUILT_IN_METHODS } from 'tauqeet-js';
|
|
63
|
+
|
|
64
|
+
// London, UK – today
|
|
65
|
+
const result = calculatePrayerTimes({
|
|
66
|
+
lat: 51.5074,
|
|
67
|
+
long: -0.1278,
|
|
68
|
+
timeZone: 'Europe/London',
|
|
69
|
+
method: 'MWL', // Muslim World League
|
|
70
|
+
madhab: 'Shafi',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
console.log(result.fajr.local); // e.g. "03:41 AM"
|
|
74
|
+
console.log(result.dhuhr.local); // e.g. "01:05 PM"
|
|
75
|
+
console.log(result.isha.local); // e.g. "10:52 PM"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Qibla Direction
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { getQiblaDirection } from 'tauqeet-js';
|
|
82
|
+
|
|
83
|
+
const qibla = getQiblaDirection({ latitude: 51.5074, longitude: -0.1278 });
|
|
84
|
+
console.log(`Bearing to Kaaba: ${qibla.bearing?.toFixed(2)}°`);
|
|
85
|
+
console.log(`Distance: ${qibla.distanceKm.toFixed(0)} km`);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Moon Phase
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { getMoonPhase, getMoonAge } from 'tauqeet-js';
|
|
92
|
+
|
|
93
|
+
const phase = getMoonPhase(new Date());
|
|
94
|
+
console.log(`Phase: ${phase.phaseName}`); // e.g. "Waxing Crescent"
|
|
95
|
+
console.log(`Illumination: ${(phase.illuminatedFraction * 100).toFixed(1)}%`);
|
|
96
|
+
|
|
97
|
+
const age = getMoonAge(new Date());
|
|
98
|
+
console.log(`Moon age: ${age.ageDays.toFixed(1)} days`);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Hijri Date Conversion
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { toHijri, HijriMethod, HIJRI_MONTH_NAMES } from 'tauqeet-js';
|
|
105
|
+
|
|
106
|
+
const hijri = toHijri(new Date(), HijriMethod.CIVIL);
|
|
107
|
+
console.log(`${hijri.day} ${HIJRI_MONTH_NAMES[hijri.month - 1]} ${hijri.year} AH`);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Documentation
|
|
113
|
+
|
|
114
|
+
| File | Description |
|
|
115
|
+
|---|---|
|
|
116
|
+
| [API.md](API.md) | Complete API reference for all exported functions, types, and classes |
|
|
117
|
+
| [USAGE.md](USAGE.md) | Practical code guides with real-world examples |
|
|
118
|
+
| [MODULES.md](MODULES.md) | Architecture overview and module import guide |
|
|
119
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | Build, test, and contribution guidelines |
|
|
120
|
+
|
|
121
|
+
For the most up-to-date, interactive reference visit **[https://tauqeet-js.web.app](https://tauqeet-js.web.app)**.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Modules Overview
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
tauqeet-js
|
|
129
|
+
├── prayers/ Prayer time engine (8 methods, high-latitude strategies)
|
|
130
|
+
├── qibla/ Qibla bearing & distance to Mecca
|
|
131
|
+
├── moon/ Moon phase, age, events, crescent visibility
|
|
132
|
+
├── hijri/ Gregorian ↔ Hijri calendar conversion
|
|
133
|
+
├── solar-alignment/ Sun-at-Qibla times
|
|
134
|
+
└── astronomy/ Internal ephemeris (VSOP87, lunar theory, ΔT) — private
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See [MODULES.md](MODULES.md) for a detailed dependency graph and tree-shaking guide.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
[MIT](LICENSE) © Ghulam Hasnain
|