@symbiote-native/battery 0.3.0 → 1.0.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 (2) hide show
  1. package/README.md +35 -4
  2. package/package.json +27 -15
package/README.md CHANGED
@@ -125,6 +125,36 @@ const batteryLevelText = computed(() =>
125
125
  </template>
126
126
  ```
127
127
 
128
+ ```svelte
129
+ <!-- Svelte — examples/expo-svelte/screens/BatteryScreen.svelte. Each rune returns a boxed
130
+ getter object, read as `.current`, since a bare `$state` doesn't survive being handed out
131
+ of a plain function. -->
132
+ <script lang="ts">
133
+ import {
134
+ useBatteryLevel,
135
+ useBatteryState,
136
+ useLowPowerMode,
137
+ } from '@symbiote-native/battery/svelte';
138
+ import { BatteryState } from '@symbiote-native/battery';
139
+
140
+ const batteryLevel = useBatteryLevel(); // { current: number }, -1 until the first reading
141
+ const batteryState = useBatteryState(); // { current: BatteryState }
142
+ const lowPowerMode = useLowPowerMode(); // { current: boolean }
143
+
144
+ const batteryLevelLabel = $derived(
145
+ batteryLevel.current < 0
146
+ ? 'unknown'
147
+ : `${Math.round(batteryLevel.current * 100)}%`,
148
+ );
149
+ </script>
150
+
151
+ <Text>{batteryLevelLabel}</Text>
152
+ <Text>
153
+ {batteryState.current === BatteryState.CHARGING ? 'Charging' : 'Not charging'}
154
+ </Text>
155
+ <Text>{lowPowerMode.current ? 'On' : 'Off'}</Text>
156
+ ```
157
+
128
158
  ```tsx
129
159
  // Solid — an accessor per value; call it to read, so a component body that runs once still
130
160
  // re-renders the leaf that reads it.
@@ -178,7 +208,7 @@ export class BatteryScreen {
178
208
  }
179
209
  ```
180
210
 
181
- Each of the three demo screens above also renders a one-shot capabilities card
211
+ Each of the demo screens above also renders a one-shot capabilities card
182
212
  (`isAvailableAsync()`, and Android-only `isBatteryOptimizationEnabledAsync()`) resolved directly
183
213
  from `@symbiote-native/battery`'s core entry point — see the linked files for the full version.
184
214
  The iOS Simulator reports the battery API as unavailable (`isAvailableAsync()` resolves `false`)
@@ -257,6 +287,7 @@ surface, never a view. Tests inject a fake native-module object in place of the
257
287
  ViewConfig. Native rendering itself is verified on-device — see the parent
258
288
  [README](../../README.md).
259
289
 
260
- The Android/iOS native wiring is done across all four `examples/expo-*` canary apps
261
- (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-angular`);
262
- this package isn't yet in the public, non-Expo `examples/react` canary.
290
+ The Android/iOS native wiring is done across all six `examples/expo-*` canary apps
291
+ (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
292
+ `examples/expo-solid`, `examples/expo-angular`); this package isn't yet in the public, non-Expo
293
+ `examples/react` canary.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/battery",
3
- "version": "0.3.0",
3
+ "version": "1.0.0",
4
4
  "description": "expo-battery wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Battery level and state (charging/full/unplugged/unknown), low-power-mode detection, plus event listeners for level and state changes.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,18 @@
13
13
  "url": "https://github.com/OneEyed1366/symbiote-native/issues"
14
14
  },
15
15
  "author": "Andrey Prokopenko <psevdoproger@gmail.com>",
16
+ "keywords": [
17
+ "react-native",
18
+ "symbiote-native",
19
+ "expo-battery",
20
+ "react",
21
+ "vue",
22
+ "svelte",
23
+ "solid",
24
+ "angular",
25
+ "battery-status",
26
+ "low-power-mode"
27
+ ],
16
28
  "type": "module",
17
29
  "main": "./build/core/index.js",
18
30
  "module": "./build/core/index.js",
@@ -61,19 +73,19 @@
61
73
  "expo-modules-core": "57.0.5"
62
74
  },
63
75
  "peerDependencies": {
64
- "@symbiote-native/angular": ">=0.6.2",
65
- "@symbiote-native/engine": ">=0.1.7",
66
- "@symbiote-native/react": ">=0.2.8",
67
- "@symbiote-native/solid": ">=0.0.1",
68
- "@symbiote-native/svelte": ">=0.1.0",
69
- "@symbiote-native/vue": ">=0.3.8",
70
76
  "@angular/core": ">=20",
71
77
  "@vue/runtime-core": "^3.5.13",
72
78
  "react": ">=19.0.0",
73
79
  "react-native": ">=0.86",
74
80
  "solid-js": ">=1.9.0",
75
81
  "svelte": ">=5.56.0",
76
- "vue": ">=3.5.0"
82
+ "vue": ">=3.5.0",
83
+ "@symbiote-native/angular": "^1.0.0",
84
+ "@symbiote-native/engine": "^0.4.0",
85
+ "@symbiote-native/react": "^1.0.0",
86
+ "@symbiote-native/solid": "^1.0.0",
87
+ "@symbiote-native/svelte": "^1.0.0",
88
+ "@symbiote-native/vue": "^1.0.0"
77
89
  },
78
90
  "peerDependenciesMeta": {
79
91
  "@symbiote-native/angular": {
@@ -121,13 +133,13 @@
121
133
  "solid-js": "^1.9.14",
122
134
  "svelte": "^5.56.0",
123
135
  "typescript": "~6.0.0",
124
- "@symbiote-native/angular": "0.8.0",
125
- "@symbiote-native/engine": "0.3.0",
126
- "@symbiote-native/react": "0.4.0",
127
- "@symbiote-native/solid": "0.1.0",
128
- "@symbiote-native/svelte": "0.3.0",
129
- "@symbiote-native/test-utils": "0.2.0",
130
- "@symbiote-native/vue": "0.5.0"
136
+ "@symbiote-native/angular": "1.0.0",
137
+ "@symbiote-native/engine": "0.4.0",
138
+ "@symbiote-native/react": "1.0.0",
139
+ "@symbiote-native/solid": "1.0.0",
140
+ "@symbiote-native/svelte": "1.0.0",
141
+ "@symbiote-native/test-utils": "0.3.0",
142
+ "@symbiote-native/vue": "1.0.0"
131
143
  },
132
144
  "scripts": {
133
145
  "typecheck": "tsc --build",