@symbiote-native/brightness 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.
- package/README.md +79 -5
- package/package.json +27 -15
package/README.md
CHANGED
|
@@ -154,6 +154,78 @@ onUnmounted(() => subscription?.remove());
|
|
|
154
154
|
</template>
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
```svelte
|
|
158
|
+
<!-- Svelte — trimmed from examples/expo-svelte/screens/BrightnessScreen.svelte -->
|
|
159
|
+
<script lang="ts">
|
|
160
|
+
import { Pressable, Text, View } from '@symbiote-native/svelte';
|
|
161
|
+
import {
|
|
162
|
+
addBrightnessListener,
|
|
163
|
+
getBrightnessAsync,
|
|
164
|
+
setBrightnessAsync,
|
|
165
|
+
usePermissions,
|
|
166
|
+
type EventSubscription,
|
|
167
|
+
} from '@symbiote-native/brightness/svelte';
|
|
168
|
+
|
|
169
|
+
let brightness = $state<number | null>(null);
|
|
170
|
+
const permissions = usePermissions(); // boxed getter: permissions.status / .request()
|
|
171
|
+
|
|
172
|
+
let subscription: EventSubscription | undefined;
|
|
173
|
+
|
|
174
|
+
$effect(() => {
|
|
175
|
+
void getBrightnessAsync().then(value => (brightness = value));
|
|
176
|
+
subscription = addBrightnessListener(event => (brightness = event.brightness));
|
|
177
|
+
return () => subscription?.remove();
|
|
178
|
+
});
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<View>
|
|
182
|
+
<Text>{brightness === null ? 'checking…' : `${Math.round(brightness * 100)}%`}</Text>
|
|
183
|
+
<Pressable onPress={() => setBrightnessAsync(0.5)}>
|
|
184
|
+
<Text>Set to 50%</Text>
|
|
185
|
+
</Pressable>
|
|
186
|
+
<Text>{permissions.status?.status ?? 'checking…'}</Text>
|
|
187
|
+
<Pressable onPress={() => permissions.request()}>
|
|
188
|
+
<Text>Request permission</Text>
|
|
189
|
+
</Pressable>
|
|
190
|
+
</View>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
// Solid — trimmed from examples/expo-solid/screens/BrightnessScreen.tsx
|
|
195
|
+
import { createSignal, onCleanup } from 'solid-js';
|
|
196
|
+
import { Pressable, Text, View } from '@symbiote-native/solid';
|
|
197
|
+
import {
|
|
198
|
+
addBrightnessListener,
|
|
199
|
+
getBrightnessAsync,
|
|
200
|
+
setBrightnessAsync,
|
|
201
|
+
} from '@symbiote-native/brightness';
|
|
202
|
+
import { createPermissions } from '@symbiote-native/brightness/solid';
|
|
203
|
+
|
|
204
|
+
function BrightnessScreen() {
|
|
205
|
+
const [brightness, setBrightness] = createSignal<number | null>(null);
|
|
206
|
+
const { status: permissionStatus, request: requestPermission } = createPermissions();
|
|
207
|
+
|
|
208
|
+
getBrightnessAsync().then(setBrightness);
|
|
209
|
+
const subscription = addBrightnessListener(event => setBrightness(event.brightness));
|
|
210
|
+
onCleanup(() => subscription.remove());
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<View>
|
|
214
|
+
<Text>
|
|
215
|
+
{brightness() === null ? 'checking…' : `${Math.round(brightness()! * 100)}%`}
|
|
216
|
+
</Text>
|
|
217
|
+
<Pressable onPress={() => setBrightnessAsync(0.5)}>
|
|
218
|
+
<Text>Set to 50%</Text>
|
|
219
|
+
</Pressable>
|
|
220
|
+
<Text>{permissionStatus()?.status ?? 'checking…'}</Text>
|
|
221
|
+
<Pressable onPress={() => requestPermission()}>
|
|
222
|
+
<Text>Request permission</Text>
|
|
223
|
+
</Pressable>
|
|
224
|
+
</View>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
157
229
|
```ts
|
|
158
230
|
// Angular — trimmed from examples/expo-angular/src/screens/BrightnessScreen.ts
|
|
159
231
|
import { Component, inject, signal } from '@angular/core';
|
|
@@ -205,8 +277,9 @@ export class BrightnessScreen {
|
|
|
205
277
|
}
|
|
206
278
|
```
|
|
207
279
|
|
|
208
|
-
The real demo screens (`examples/expo-react/screens/BrightnessScreen.tsx` and its Vue/
|
|
209
|
-
twins in `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-
|
|
280
|
+
The real demo screens (`examples/expo-react/screens/BrightnessScreen.tsx` and its Vue/Svelte/
|
|
281
|
+
Solid/Angular twins in `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
|
|
282
|
+
`examples/expo-solid`, `examples/expo-angular`) additionally
|
|
210
283
|
gate an Android-only system-brightness-mode card behind `Platform.OS === 'android'` — see
|
|
211
284
|
[API](#api) below for that surface's full signatures.
|
|
212
285
|
|
|
@@ -315,8 +388,9 @@ ViewConfig. Native rendering itself is verified on-device (see the parent
|
|
|
315
388
|
## Known gaps
|
|
316
389
|
|
|
317
390
|
- Not yet wired into the public, non-Expo `examples/react` canary — only in `examples/expo-react`
|
|
318
|
-
(and its Vue/Angular Expo twins, `examples/expo-vue-sfc`/`examples/expo-vue-tsx`/
|
|
319
|
-
`examples/expo-angular`, all of which already have
|
|
320
|
-
`MainApplication.kt` registration + `WRITE_SETTINGS`,
|
|
391
|
+
(and its Vue/Svelte/Solid/Angular Expo twins, `examples/expo-vue-sfc`/`examples/expo-vue-tsx`/
|
|
392
|
+
`examples/expo-svelte`/`examples/expo-solid`/`examples/expo-angular`, all of which already have
|
|
393
|
+
full three-layer native wiring: Android `MainApplication.kt` registration + `WRITE_SETTINGS`,
|
|
394
|
+
plus the iOS Podfile/pod install).
|
|
321
395
|
- Tests exercise the JS layer only (fake native module, `vitest`) — no on-device/simulator
|
|
322
396
|
automated smoke test yet, only manual verification.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/brightness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "expo-brightness wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Screen brightness get/set, Android-only system-brightness-mode control, an iOS-only brightness-change listener, and permission get/request.",
|
|
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-brightness",
|
|
20
|
+
"react",
|
|
21
|
+
"vue",
|
|
22
|
+
"svelte",
|
|
23
|
+
"solid",
|
|
24
|
+
"angular",
|
|
25
|
+
"screen-brightness",
|
|
26
|
+
"brightness-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.
|
|
125
|
-
"@symbiote-native/engine": "0.
|
|
126
|
-
"@symbiote-native/react": "0.
|
|
127
|
-
"@symbiote-native/solid": "
|
|
128
|
-
"@symbiote-native/svelte": "0.
|
|
129
|
-
"@symbiote-native/test-utils": "0.
|
|
130
|
-
"@symbiote-native/vue": "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",
|