@ramcna/capacitor-ephemeris 0.0.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.
Files changed (56) hide show
  1. package/Package.swift +28 -0
  2. package/README.md +127 -0
  3. package/RamcnaCapacitorEphemeris.podspec +17 -0
  4. package/android/build.gradle +77 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/cpp/CMakeLists.txt +41 -0
  7. package/android/src/main/cpp/cJSON/cJSON.c +3191 -0
  8. package/android/src/main/cpp/cJSON/cJSON.h +306 -0
  9. package/android/src/main/cpp/swe-bridge.cpp +151 -0
  10. package/android/src/main/cpp/swejni/LICENSE +52 -0
  11. package/android/src/main/cpp/swejni/LICENSE.TXT +52 -0
  12. package/android/src/main/cpp/swejni/ephemeris_jni.c +177 -0
  13. package/android/src/main/cpp/swejni/sefstars.txt +1602 -0
  14. package/android/src/main/cpp/swejni/seleapsec.txt +6 -0
  15. package/android/src/main/cpp/swejni/seorbel.txt +97 -0
  16. package/android/src/main/cpp/swejni/swecl.c +6428 -0
  17. package/android/src/main/cpp/swejni/swedate.c +588 -0
  18. package/android/src/main/cpp/swejni/swedate.h +81 -0
  19. package/android/src/main/cpp/swejni/swehel.c +3511 -0
  20. package/android/src/main/cpp/swejni/swehouse.c +3143 -0
  21. package/android/src/main/cpp/swejni/swehouse.h +98 -0
  22. package/android/src/main/cpp/swejni/swejni.c +2057 -0
  23. package/android/src/main/cpp/swejni/swejni.h +757 -0
  24. package/android/src/main/cpp/swejni/swejpl.c +958 -0
  25. package/android/src/main/cpp/swejni/swejpl.h +103 -0
  26. package/android/src/main/cpp/swejni/swemmoon.c +1930 -0
  27. package/android/src/main/cpp/swejni/swemplan.c +967 -0
  28. package/android/src/main/cpp/swejni/swemptab.h +10640 -0
  29. package/android/src/main/cpp/swejni/swenut2000a.h +2819 -0
  30. package/android/src/main/cpp/swejni/sweodef.h +326 -0
  31. package/android/src/main/cpp/swejni/sweph.c +8614 -0
  32. package/android/src/main/cpp/swejni/sweph.h +849 -0
  33. package/android/src/main/cpp/swejni/swephexp.h +1020 -0
  34. package/android/src/main/cpp/swejni/swephlib.c +4634 -0
  35. package/android/src/main/cpp/swejni/swephlib.h +189 -0
  36. package/android/src/main/java/com/vedichoroo/ephemeris/CapacitorEphemerisPlugin.java +182 -0
  37. package/android/src/main/res/.gitkeep +0 -0
  38. package/dist/docs.json +147 -0
  39. package/dist/esm/definitions.d.ts +42 -0
  40. package/dist/esm/definitions.js +2 -0
  41. package/dist/esm/definitions.js.map +1 -0
  42. package/dist/esm/index.d.ts +4 -0
  43. package/dist/esm/index.js +7 -0
  44. package/dist/esm/index.js.map +1 -0
  45. package/dist/esm/web.d.ts +31 -0
  46. package/dist/esm/web.js +28 -0
  47. package/dist/esm/web.js.map +1 -0
  48. package/dist/plugin.cjs.js +42 -0
  49. package/dist/plugin.cjs.js.map +1 -0
  50. package/dist/plugin.js +45 -0
  51. package/dist/plugin.js.map +1 -0
  52. package/ios/Sources/CapacitorEphemerisPluginPlugin/CapacitorEphemerisPlugin.swift +8 -0
  53. package/ios/Sources/CapacitorEphemerisPluginPlugin/CapacitorEphemerisPluginImplementation.swift +52 -0
  54. package/ios/Sources/CapacitorEphemerisPluginPlugin/CapacitorEphemerisPluginPlugin.swift +82 -0
  55. package/ios/Tests/CapacitorEphemerisPluginPluginTests/CapacitorEphemerisPluginTests.swift +15 -0
  56. package/package.json +81 -0
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "RamcnaCapacitorEphemeris",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "RamcnaCapacitorEphemeris",
10
+ targets: ["CapacitorEphemerisPluginPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "CapacitorEphemerisPluginPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/CapacitorEphemerisPluginPlugin"),
23
+ .testTarget(
24
+ name: "CapacitorEphemerisPluginPluginTests",
25
+ dependencies: ["CapacitorEphemerisPluginPlugin"],
26
+ path: "ios/Tests/CapacitorEphemerisPluginPluginTests")
27
+ ]
28
+ )
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # @ramcna/capacitor-ephemeris
2
+
3
+ Capacitor plugin that integrates Swiss Ephemeris (JNI) to calculate accurate planetary positions using SEPLM, SEPL_18, and SE1 ephemeris data files.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @ramcna/capacitor-ephemeris
9
+ npx cap sync
10
+ ```
11
+
12
+ ## API
13
+
14
+ <docgen-index>
15
+
16
+ * [`initialize(...)`](#initialize)
17
+ * [`calculateHoroscope(...)`](#calculatehoroscope)
18
+ * [`calculateAstroDetails(...)`](#calculateastrodetails)
19
+ * [`getAscendant(...)`](#getascendant)
20
+ * [`getCusps(...)`](#getcusps)
21
+ * [`getSMLSubPositions(...)`](#getsmlsubpositions)
22
+ * [Interfaces](#interfaces)
23
+
24
+ </docgen-index>
25
+
26
+ <docgen-api>
27
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
28
+
29
+ ### initialize(...)
30
+
31
+ ```typescript
32
+ initialize(options: InitializeOptions) => Promise<void>
33
+ ```
34
+
35
+ | Param | Type |
36
+ | ------------- | --------------------------------------------------------------- |
37
+ | **`options`** | <code><a href="#initializeoptions">InitializeOptions</a></code> |
38
+
39
+ --------------------
40
+
41
+
42
+ ### calculateHoroscope(...)
43
+
44
+ ```typescript
45
+ calculateHoroscope(options: { context: string; }) => Promise<{ result: string; }>
46
+ ```
47
+
48
+ | Param | Type |
49
+ | ------------- | --------------------------------- |
50
+ | **`options`** | <code>{ context: string; }</code> |
51
+
52
+ **Returns:** <code>Promise&lt;{ result: string; }&gt;</code>
53
+
54
+ --------------------
55
+
56
+
57
+ ### calculateAstroDetails(...)
58
+
59
+ ```typescript
60
+ calculateAstroDetails(options: { jdUtc: number; context: string; }) => Promise<{ result: string; }>
61
+ ```
62
+
63
+ | Param | Type |
64
+ | ------------- | ------------------------------------------------ |
65
+ | **`options`** | <code>{ jdUtc: number; context: string; }</code> |
66
+
67
+ **Returns:** <code>Promise&lt;{ result: string; }&gt;</code>
68
+
69
+ --------------------
70
+
71
+
72
+ ### getAscendant(...)
73
+
74
+ ```typescript
75
+ getAscendant(options: { context: string; }) => Promise<{ ascendant: number; }>
76
+ ```
77
+
78
+ | Param | Type |
79
+ | ------------- | --------------------------------- |
80
+ | **`options`** | <code>{ context: string; }</code> |
81
+
82
+ **Returns:** <code>Promise&lt;{ ascendant: number; }&gt;</code>
83
+
84
+ --------------------
85
+
86
+
87
+ ### getCusps(...)
88
+
89
+ ```typescript
90
+ getCusps(options: { context: string; }) => Promise<{ cusps: number[]; }>
91
+ ```
92
+
93
+ | Param | Type |
94
+ | ------------- | --------------------------------- |
95
+ | **`options`** | <code>{ context: string; }</code> |
96
+
97
+ **Returns:** <code>Promise&lt;{ cusps: number[]; }&gt;</code>
98
+
99
+ --------------------
100
+
101
+
102
+ ### getSMLSubPositions(...)
103
+
104
+ ```typescript
105
+ getSMLSubPositions(options: { context: string; }) => Promise<{ result: string; }>
106
+ ```
107
+
108
+ | Param | Type |
109
+ | ------------- | --------------------------------- |
110
+ | **`options`** | <code>{ context: string; }</code> |
111
+
112
+ **Returns:** <code>Promise&lt;{ result: string; }&gt;</code>
113
+
114
+ --------------------
115
+
116
+
117
+ ### Interfaces
118
+
119
+
120
+ #### InitializeOptions
121
+
122
+ | Prop | Type | Description |
123
+ | ------------------ | ------------------- | -------------------------------------------------------------------------------------- |
124
+ | **`ephPath`** | <code>string</code> | Local path to ephemeris files on device |
125
+ | **`ephemerisUrl`** | <code>string</code> | Remote URL where ephemeris files are hosted Plugin will download files to device cache |
126
+
127
+ </docgen-api>
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'RamcnaCapacitorEphemeris'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '15.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
@@ -0,0 +1,77 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.13.0'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace = "com.vedichoroo.ephemeris"
22
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
23
+ ndkVersion = "28.2.13676358"
24
+
25
+ lintOptions {
26
+ abortOnError false
27
+ disable 'All'
28
+ }
29
+
30
+ defaultConfig {
31
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
32
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
33
+ versionCode 1
34
+ versionName "1.0"
35
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
36
+ externalNativeBuild {
37
+ cmake {
38
+ cppFlags "-std=c++17"
39
+ abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
40
+ arguments "-DANDROID_STL=c++_shared"
41
+ }
42
+ }
43
+ }
44
+
45
+ buildTypes {
46
+ release {
47
+ minifyEnabled false
48
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
49
+ }
50
+ }
51
+
52
+ compileOptions {
53
+ sourceCompatibility JavaVersion.VERSION_21
54
+ targetCompatibility JavaVersion.VERSION_21
55
+ }
56
+
57
+ externalNativeBuild {
58
+ cmake {
59
+ path "CMakeLists.txt"
60
+ version "3.22.1"
61
+ }
62
+ }
63
+ }
64
+
65
+ repositories {
66
+ google()
67
+ mavenCentral()
68
+ }
69
+
70
+ dependencies {
71
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
72
+ implementation project(':capacitor-android')
73
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
74
+ testImplementation "junit:junit:$junitVersion"
75
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
76
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
77
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,41 @@
1
+ cmake_minimum_required(VERSION 3.22.1)
2
+
3
+ project("swejni")
4
+
5
+ set(CMAKE_C_STANDARD 11)
6
+ set(CMAKE_CXX_STANDARD 11)
7
+
8
+ # Include JNI headers from Android NDK
9
+ include_directories(${ANDROID_NDK}/sysroot/usr/include)
10
+ include_directories(${ANDROID_NDK}/sysroot/usr/include/${ANDROID_ABI})
11
+
12
+ # Include SWE headers
13
+ include_directories(swejni)
14
+
15
+ # Include cJSON headers
16
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/cJSON)
17
+
18
+ # List all SWE source files
19
+ set(SWEJNI_SOURCES
20
+ swejni/swecl.c
21
+ swejni/swedate.c
22
+ swejni/swehel.c
23
+ swejni/swehouse.c
24
+ swejni/swejni.c
25
+ swejni/swejpl.c
26
+ swejni/swemmoon.c
27
+ swejni/swemplan.c
28
+ swejni/sweph.c
29
+ swejni/swephlib.c
30
+ swejni/ephemeris_jni.c # <-- add your JNI C file here
31
+ cJSON/cJSON.c # <-- add cJSON implementation
32
+ )
33
+
34
+ # Build shared library
35
+ add_library(swejni SHARED ${SWEJNI_SOURCES})
36
+
37
+ # Link Android libraries
38
+ target_link_libraries(swejni
39
+ android
40
+ log
41
+ )