@symbiote-native/brightness 0.3.0 → 2.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 +120 -39
  2. package/package.json +27 -15
package/README.md CHANGED
@@ -72,7 +72,6 @@ verbatim by every adapter.
72
72
  ```tsx
73
73
  // React — trimmed from examples/expo-react/screens/BrightnessScreen.tsx
74
74
  import { useEffect, useState } from 'react';
75
- import { Pressable, Text, View } from '@symbiote-native/react';
76
75
  import {
77
76
  addBrightnessListener,
78
77
  getBrightnessAsync,
@@ -94,18 +93,18 @@ function BrightnessScreen() {
94
93
  }, []);
95
94
 
96
95
  return (
97
- <View>
98
- <Text>
96
+ <view>
97
+ <text>
99
98
  {brightness === null ? 'checking…' : `${Math.round(brightness * 100)}%`}
100
- </Text>
101
- <Pressable onPress={() => setBrightnessAsync(0.5)}>
102
- <Text>Set to 50%</Text>
103
- </Pressable>
104
- <Text>{permissionStatus?.status ?? 'checking…'}</Text>
105
- <Pressable onPress={() => requestPermission()}>
106
- <Text>Request permission</Text>
107
- </Pressable>
108
- </View>
99
+ </text>
100
+ <pressable onPress={() => setBrightnessAsync(0.5)}>
101
+ <text>Set to 50%</text>
102
+ </pressable>
103
+ <text>{permissionStatus?.status ?? 'checking…'}</text>
104
+ <pressable onPress={() => requestPermission()}>
105
+ <text>Request permission</text>
106
+ </pressable>
107
+ </view>
109
108
  );
110
109
  }
111
110
  ```
@@ -114,7 +113,6 @@ function BrightnessScreen() {
114
113
  <!-- Vue — trimmed from examples/expo-vue-sfc/screens/BrightnessScreen.vue -->
115
114
  <script setup lang="ts">
116
115
  import { onMounted, onUnmounted, ref } from 'vue';
117
- import { Pressable, Text, View } from '@symbiote-native/vue';
118
116
  import {
119
117
  addBrightnessListener,
120
118
  getBrightnessAsync,
@@ -139,25 +137,106 @@ onUnmounted(() => subscription?.remove());
139
137
  </script>
140
138
 
141
139
  <template>
142
- <View>
143
- <Text>{{
140
+ <view>
141
+ <text>{{
144
142
  brightness === null ? 'checking…' : `${Math.round(brightness * 100)}%`
145
- }}</Text>
146
- <Pressable @press="setBrightnessAsync(0.5)">
147
- <Text>Set to 50%</Text>
148
- </Pressable>
149
- <Text>{{ permissionStatus?.status ?? 'checking…' }}</Text>
150
- <Pressable @press="requestPermission()">
151
- <Text>Request permission</Text>
152
- </Pressable>
153
- </View>
143
+ }}</text>
144
+ <pressable @press="setBrightnessAsync(0.5)">
145
+ <text>Set to 50%</text>
146
+ </pressable>
147
+ <text>{{ permissionStatus?.status ?? 'checking…' }}</text>
148
+ <pressable @press="requestPermission()">
149
+ <text>Request permission</text>
150
+ </pressable>
151
+ </view>
154
152
  </template>
155
153
  ```
156
154
 
155
+ ```svelte
156
+ <!-- Svelte — trimmed from examples/expo-svelte/screens/BrightnessScreen.svelte -->
157
+ <script lang="ts">
158
+ import {
159
+ addBrightnessListener,
160
+ getBrightnessAsync,
161
+ setBrightnessAsync,
162
+ usePermissions,
163
+ type EventSubscription,
164
+ } from '@symbiote-native/brightness/svelte';
165
+
166
+ let brightness = $state<number | null>(null);
167
+ const permissions = usePermissions(); // boxed getter: permissions.status / .request()
168
+
169
+ let subscription: EventSubscription | undefined;
170
+
171
+ $effect(() => {
172
+ void getBrightnessAsync().then(value => (brightness = value));
173
+ subscription = addBrightnessListener(
174
+ event => (brightness = event.brightness),
175
+ );
176
+ return () => subscription?.remove();
177
+ });
178
+ </script>
179
+
180
+ <view>
181
+ <text
182
+ >{brightness === null
183
+ ? 'checking…'
184
+ : `${Math.round(brightness * 100)}%`}</text
185
+ >
186
+ <pressable onPress={() => setBrightnessAsync(0.5)}>
187
+ <text>Set to 50%</text>
188
+ </pressable>
189
+ <text>{permissions.status?.status ?? 'checking…'}</text>
190
+ <pressable onPress={() => permissions.request()}>
191
+ <text>Request permission</text>
192
+ </pressable>
193
+ </view>
194
+ ```
195
+
196
+ ```tsx
197
+ // Solid — trimmed from examples/expo-solid/screens/BrightnessScreen.tsx
198
+ import { createSignal, onCleanup } from 'solid-js';
199
+ import {
200
+ addBrightnessListener,
201
+ getBrightnessAsync,
202
+ setBrightnessAsync,
203
+ } from '@symbiote-native/brightness';
204
+ import { createPermissions } from '@symbiote-native/brightness/solid';
205
+
206
+ function BrightnessScreen() {
207
+ const [brightness, setBrightness] = createSignal<number | null>(null);
208
+ const { status: permissionStatus, request: requestPermission } =
209
+ createPermissions();
210
+
211
+ getBrightnessAsync().then(setBrightness);
212
+ const subscription = addBrightnessListener(event =>
213
+ setBrightness(event.brightness),
214
+ );
215
+ onCleanup(() => subscription.remove());
216
+
217
+ return (
218
+ <view>
219
+ <text>
220
+ {brightness() === null
221
+ ? 'checking…'
222
+ : `${Math.round(brightness()! * 100)}%`}
223
+ </text>
224
+ <pressable onPress={() => setBrightnessAsync(0.5)}>
225
+ <text>Set to 50%</text>
226
+ </pressable>
227
+ <text>{permissionStatus()?.status ?? 'checking…'}</text>
228
+ <pressable onPress={() => requestPermission()}>
229
+ <text>Request permission</text>
230
+ </pressable>
231
+ </view>
232
+ );
233
+ }
234
+ ```
235
+
157
236
  ```ts
158
237
  // Angular — trimmed from examples/expo-angular/src/screens/BrightnessScreen.ts
159
238
  import { Component, inject, signal } from '@angular/core';
160
- import { Pressable, Text, View } from '@symbiote-native/angular';
239
+ import { SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
161
240
  import {
162
241
  PermissionsService,
163
242
  addBrightnessListener,
@@ -168,18 +247,18 @@ import {
168
247
  @Component({
169
248
  selector: 'BrightnessScreen',
170
249
  standalone: true,
171
- imports: [Pressable, Text, View],
250
+ imports: [SYMBIOTE_ELEMENTS],
172
251
  template: `
173
- <View>
174
- <Text>{{ brightnessLabel() }}</Text>
175
- <Pressable (press)="setBrightnessAsync(0.5)"
176
- ><Text>Set to 50%</Text></Pressable
252
+ <view>
253
+ <text>{{ brightnessLabel() }}</text>
254
+ <pressable (press)="setBrightnessAsync(0.5)"
255
+ ><text>Set to 50%</text></pressable
177
256
  >
178
- <Text>{{ permissionStatus()?.status ?? 'checking…' }}</Text>
179
- <Pressable (press)="permissionsService.request()"
180
- ><Text>Request permission</Text></Pressable
257
+ <text>{{ permissionStatus()?.status ?? 'checking…' }}</text>
258
+ <pressable (press)="permissionsService.request()"
259
+ ><text>Request permission</text></pressable
181
260
  >
182
- </View>
261
+ </view>
183
262
  `,
184
263
  })
185
264
  export class BrightnessScreen {
@@ -205,8 +284,9 @@ export class BrightnessScreen {
205
284
  }
206
285
  ```
207
286
 
208
- The real demo screens (`examples/expo-react/screens/BrightnessScreen.tsx` and its Vue/Angular
209
- twins in `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-angular`) additionally
287
+ The real demo screens (`examples/expo-react/screens/BrightnessScreen.tsx` and its Vue/Svelte/
288
+ Solid/Angular twins in `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
289
+ `examples/expo-solid`, `examples/expo-angular`) additionally
210
290
  gate an Android-only system-brightness-mode card behind `Platform.OS === 'android'` — see
211
291
  [API](#api) below for that surface's full signatures.
212
292
 
@@ -315,8 +395,9 @@ ViewConfig. Native rendering itself is verified on-device (see the parent
315
395
  ## Known gaps
316
396
 
317
397
  - 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 full three-layer native wiring: Android
320
- `MainApplication.kt` registration + `WRITE_SETTINGS`, plus the iOS Podfile/pod install).
398
+ (and its Vue/Svelte/Solid/Angular Expo twins, `examples/expo-vue-sfc`/`examples/expo-vue-tsx`/
399
+ `examples/expo-svelte`/`examples/expo-solid`/`examples/expo-angular`, all of which already have
400
+ full three-layer native wiring: Android `MainApplication.kt` registration + `WRITE_SETTINGS`,
401
+ plus the iOS Podfile/pod install).
321
402
  - Tests exercise the JS layer only (fake native module, `vitest`) — no on-device/simulator
322
403
  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.0",
3
+ "version": "2.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": "^2.0.0",
84
+ "@symbiote-native/react": "^2.0.0",
85
+ "@symbiote-native/engine": "^0.5.0",
86
+ "@symbiote-native/svelte": "^2.0.0",
87
+ "@symbiote-native/solid": "^2.0.0",
88
+ "@symbiote-native/vue": "^2.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": "2.0.0",
137
+ "@symbiote-native/engine": "0.5.0",
138
+ "@symbiote-native/react": "2.0.0",
139
+ "@symbiote-native/solid": "2.0.0",
140
+ "@symbiote-native/svelte": "2.0.0",
141
+ "@symbiote-native/test-utils": "0.3.0",
142
+ "@symbiote-native/vue": "2.0.0"
131
143
  },
132
144
  "scripts": {
133
145
  "typecheck": "tsc --build",