tauqeet-js 1.0.2 → 1.1.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.
Files changed (91) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +143 -101
  3. package/dist/index.cjs +2035 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +612 -12
  6. package/dist/index.d.ts +612 -12
  7. package/dist/index.js +1993 -1
  8. package/dist/index.js.map +1 -1
  9. package/package.json +64 -41
  10. package/dist/astronomy/index.cjs +0 -2
  11. package/dist/astronomy/index.cjs.map +0 -1
  12. package/dist/astronomy/index.d.cts +0 -40
  13. package/dist/astronomy/index.d.ts +0 -40
  14. package/dist/astronomy/index.js +0 -2
  15. package/dist/astronomy/index.js.map +0 -1
  16. package/dist/chunk-4GEHU4EV.js +0 -2
  17. package/dist/chunk-4GEHU4EV.js.map +0 -1
  18. package/dist/chunk-4JQOEJI5.cjs +0 -2
  19. package/dist/chunk-4JQOEJI5.cjs.map +0 -1
  20. package/dist/chunk-BJ45B342.cjs +0 -2
  21. package/dist/chunk-BJ45B342.cjs.map +0 -1
  22. package/dist/chunk-CSU6AEKX.js +0 -2
  23. package/dist/chunk-CSU6AEKX.js.map +0 -1
  24. package/dist/chunk-DJ357A47.js +0 -2
  25. package/dist/chunk-DJ357A47.js.map +0 -1
  26. package/dist/chunk-E4M4MYZR.cjs +0 -2
  27. package/dist/chunk-E4M4MYZR.cjs.map +0 -1
  28. package/dist/chunk-FQ6RGT3F.cjs +0 -2
  29. package/dist/chunk-FQ6RGT3F.cjs.map +0 -1
  30. package/dist/chunk-FTWK5BZJ.js +0 -2
  31. package/dist/chunk-FTWK5BZJ.js.map +0 -1
  32. package/dist/chunk-GIWGJKCS.js +0 -2
  33. package/dist/chunk-GIWGJKCS.js.map +0 -1
  34. package/dist/chunk-H2JLMZ5E.cjs +0 -2
  35. package/dist/chunk-H2JLMZ5E.cjs.map +0 -1
  36. package/dist/chunk-H33IJIM5.cjs +0 -2
  37. package/dist/chunk-H33IJIM5.cjs.map +0 -1
  38. package/dist/chunk-IAQLPBAC.js +0 -2
  39. package/dist/chunk-IAQLPBAC.js.map +0 -1
  40. package/dist/chunk-II6TW43P.cjs +0 -2
  41. package/dist/chunk-II6TW43P.cjs.map +0 -1
  42. package/dist/chunk-IPNHW5FC.js +0 -2
  43. package/dist/chunk-IPNHW5FC.js.map +0 -1
  44. package/dist/chunk-JA4E3Q7A.js +0 -2
  45. package/dist/chunk-JA4E3Q7A.js.map +0 -1
  46. package/dist/chunk-LTEJ7X6W.js +0 -2
  47. package/dist/chunk-LTEJ7X6W.js.map +0 -1
  48. package/dist/chunk-QMMOAGSC.js +0 -2
  49. package/dist/chunk-QMMOAGSC.js.map +0 -1
  50. package/dist/chunk-WFHQSUXS.cjs +0 -2
  51. package/dist/chunk-WFHQSUXS.cjs.map +0 -1
  52. package/dist/chunk-WXX4UNDC.js +0 -2
  53. package/dist/chunk-WXX4UNDC.js.map +0 -1
  54. package/dist/chunk-XL5IKB2X.js +0 -2
  55. package/dist/chunk-XL5IKB2X.js.map +0 -1
  56. package/dist/chunk-YDSVFKVM.cjs +0 -2
  57. package/dist/chunk-YDSVFKVM.cjs.map +0 -1
  58. package/dist/chunk-YMPRSR53.cjs +0 -2
  59. package/dist/chunk-YMPRSR53.cjs.map +0 -1
  60. package/dist/chunk-YSOESZ35.cjs +0 -2
  61. package/dist/chunk-YSOESZ35.cjs.map +0 -1
  62. package/dist/chunk-YZUP33VG.cjs +0 -2
  63. package/dist/chunk-YZUP33VG.cjs.map +0 -1
  64. package/dist/index-tSYKxCru.d.cts +0 -64
  65. package/dist/index-tSYKxCru.d.ts +0 -64
  66. package/dist/moon/index.cjs +0 -2
  67. package/dist/moon/index.cjs.map +0 -1
  68. package/dist/moon/index.d.cts +0 -20
  69. package/dist/moon/index.d.ts +0 -20
  70. package/dist/moon/index.js +0 -2
  71. package/dist/moon/index.js.map +0 -1
  72. package/dist/prayer/index.cjs +0 -2
  73. package/dist/prayer/index.cjs.map +0 -1
  74. package/dist/prayer/index.d.cts +0 -17
  75. package/dist/prayer/index.d.ts +0 -17
  76. package/dist/prayer/index.js +0 -2
  77. package/dist/prayer/index.js.map +0 -1
  78. package/dist/qibla/index.cjs +0 -2
  79. package/dist/qibla/index.cjs.map +0 -1
  80. package/dist/qibla/index.d.cts +0 -22
  81. package/dist/qibla/index.d.ts +0 -22
  82. package/dist/qibla/index.js +0 -2
  83. package/dist/qibla/index.js.map +0 -1
  84. package/dist/ramadan-BpmCzDzM.d.ts +0 -77
  85. package/dist/ramadan-Cr6YrTTX.d.cts +0 -77
  86. package/dist/ui/index.cjs +0 -105
  87. package/dist/ui/index.cjs.map +0 -1
  88. package/dist/ui/index.d.cts +0 -43
  89. package/dist/ui/index.d.ts +0 -43
  90. package/dist/ui/index.js +0 -105
  91. package/dist/ui/index.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026
3
+ Copyright (c) 2026 Ghulam Hasnain
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,101 +1,143 @@
1
- # TauqeetJS
2
-
3
- **TauqeetJS** is a high-performance, modular, and headless-first TypeScript library for calculating Islamic prayer times and astronomical data. Designed for professional engineers, it prioritizes precision, type safety, and minimal bundle size.
4
-
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- ![Bundle Size](https://img.shields.io/bundlephobia/minzip/tauqeetjs)
7
-
8
- ---
9
-
10
- ## Key Features
11
-
12
- - **Headless-First**: Import only the logic you need. No forced UI dependencies.
13
- - **Type-Safe**: Written in TypeScript with exhaustive definitions.
14
- - **Robust Error Handling**: Uses the `Result<T, E>` pattern—no silent failures or unexpected exceptions.
15
- - **Environmentally Aware**: High-precision atmospheric refraction adjustments (elevation, temperature, pressure).
16
- - **Small Footprint**: Zero external dependencies in the core engine.
17
-
18
- ---
19
-
20
- ## Quick Start
21
-
22
- Install via your preferred package manager:
23
-
24
- ```bash
25
- npm install tauqeet-js
26
- # or
27
- yarn add tauqeet-js
28
- ```
29
-
30
- ### Basic Usage (Low-Code)
31
-
32
- Get prayer times for a specific location using smart defaults (Karachi method, Hanafi madhab).
33
-
34
- ```typescript
35
- import { getPrayerTimes } from 'tauqeet-js';
36
-
37
- const result = getPrayerTimes({
38
- location: { latitude: 24.8607, longitude: 67.0011 }
39
- });
40
-
41
- if (result.success) {
42
- const { fajr, dhuhr, asr, maghrib, isha } = result.data;
43
- console.log(`Fajr: ${fajr.toLocaleTimeString()}`);
44
- } else {
45
- console.error(`Calculation failed: ${result.error}`);
46
- }
47
- ```
48
-
49
- ---
50
-
51
- ## Core Concepts
52
-
53
- ### Headless-First Architecture
54
-
55
- To keep your production bundle small, TauqeetJS is designed to be imported modularly. If you only need the prayer calculation engine without Qibla or Moon logic:
56
-
57
- ```typescript
58
- import { getPrayerTimes } from 'tauqeetjs/prayer';
59
- ```
60
-
61
- ### The Result Pattern
62
-
63
- Unlike libraries that throw errors or return `null`, TauqeetJS returns a `Result<T, E>` object. This ensures your application remains stable even with invalid inputs.
64
-
65
- ```typescript
66
- const result = getPrayerTimes(config);
67
-
68
- if (!result.success) {
69
- // result.error contains a descriptive string
70
- handleError(result.error);
71
- } else {
72
- // result.data is fully typed
73
- renderUI(result.data);
74
- }
75
- ```
76
-
77
- ---
78
-
79
- ## Advanced Configuration
80
-
81
- Fine-tune calculations for specific environmental conditions or local preferences.
82
-
83
- ```typescript
84
- const config = {
85
- location: { latitude: 24.86, longitude: 67.01, elevation: 20 },
86
- method: 'MWL',
87
- madhab: 'Hanafi',
88
- temperature: 25, // Celsius
89
- pressure: 1010, // hPa/mbar
90
- adjustments: {
91
- fajr: 2, // Add 2 minutes
92
- maghrib: 1 // Add 1 minute (safety margin)
93
- }
94
- };
95
- ```
96
-
97
- ---
98
-
99
- ## Documentation
100
-
101
- For a full breakdown of the API, configuration options, and astronomical parameters, see [API.md](./API.md).
1
+ # tauqeet-js
2
+
3
+ **A high-precision TypeScript library for Islamic astronomical calculations.**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5%2B-blue)](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. 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