@symbiote-native/battery 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.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/package.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A. Prokopenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @symbiote-native/battery
|
|
2
|
+
|
|
3
|
+
**Status: skeleton only — not implemented, published early to reserve the npm name.**
|
|
4
|
+
This package currently ships nothing but `package.json` and this README. No `src/`, no
|
|
5
|
+
dependencies, no build. See the `symbiote-new-package-skeleton` project skill for what a
|
|
6
|
+
tier-1 skeleton package is and isn't.
|
|
7
|
+
|
|
8
|
+
Planned: a port of [`expo-battery`](https://docs.expo.dev/versions/latest/sdk/battery/) for
|
|
9
|
+
[SymbioteNative](../../README.md) — battery level and state, low-power-mode detection, reachable
|
|
10
|
+
from every adapter (React, Vue, Angular), not just React.
|
|
11
|
+
|
|
12
|
+
## Planned API
|
|
13
|
+
|
|
14
|
+
Forward-looking reference only, transcribed from upstream's actual
|
|
15
|
+
`.vendors/expo/packages/expo-battery/src/Battery.ts` — signatures here are what will be ported,
|
|
16
|
+
not yet implemented.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
isAvailableAsync(): Promise<boolean> // battery API availability on this device
|
|
20
|
+
getBatteryLevelAsync(): Promise<number> // 0..1, or -1 if unsupported
|
|
21
|
+
getBatteryStateAsync(): Promise<BatteryState> // UNKNOWN/UNPLUGGED/CHARGING/FULL/NOT_CHARGING
|
|
22
|
+
isLowPowerModeEnabledAsync(): Promise<boolean> // Low Power Mode (iOS) / Power Saver (Android)
|
|
23
|
+
isBatteryOptimizationEnabledAsync(): Promise<boolean> // Android only
|
|
24
|
+
getPowerStateAsync(): Promise<PowerState> // combined level + state + lowPowerMode
|
|
25
|
+
addBatteryLevelListener(listener): Subscription // fires on battery level change
|
|
26
|
+
addBatteryStateListener(listener): Subscription // fires on battery state change
|
|
27
|
+
addLowPowerModeListener(listener): Subscription // fires when low-power mode toggles
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Plus `BatteryState` (enum), `PowerState`, `BatteryLevelEvent`, `BatteryStateEvent`,
|
|
31
|
+
`PowerModeEvent` — ported from upstream's `Battery.types.ts`. Upstream also exposes
|
|
32
|
+
`useBatteryLevel` / `useBatteryState` / `useLowPowerMode` / `usePowerState` React hooks; per this
|
|
33
|
+
repo's core/adapter split, those become adapter-owned lifecycle wrappers (React hooks, Vue
|
|
34
|
+
composables, …) over the same shared core, not core exports themselves.
|
|
35
|
+
|
|
36
|
+
## Reference
|
|
37
|
+
|
|
38
|
+
- [`../local-auth`](../local-auth) — nearest already-implemented sibling package: an
|
|
39
|
+
`expo-modules-core`-based wrapper with the same shape this package will follow (framework-agnostic
|
|
40
|
+
`core/`, thin per-adapter re-export entries).
|
|
41
|
+
- [`symbiote-expo-native-module`](../../.claude/skills/symbiote-expo-native-module/SKILL.md) — the
|
|
42
|
+
real wrapping mechanics (depend on `expo-modules-core` only, never the `expo` meta-package; port
|
|
43
|
+
upstream JS into `core/` rather than importing it; autolinking) that will apply once this moves
|
|
44
|
+
past skeleton.
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@symbiote-native/battery",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "expo-battery wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Battery level and state (charging/full/unplugged/unknown), low-power-mode detection, plus event listeners for level and state changes.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/OneEyed1366/symbiote-native.git",
|
|
9
|
+
"directory": "packages/battery"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/OneEyed1366/symbiote-native/tree/master/packages/battery#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/OneEyed1366/symbiote-native/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "Andrey Prokopenko <psevdoproger@gmail.com>",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
}
|
|
19
|
+
}
|