@symbiote-native/brightness 1.0.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.
- package/README.md +68 -61
- package/package.json +13 -13
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
|
-
<
|
|
98
|
-
<
|
|
96
|
+
<view>
|
|
97
|
+
<text>
|
|
99
98
|
{brightness === null ? 'checking…' : `${Math.round(brightness * 100)}%`}
|
|
100
|
-
</
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
</
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
</
|
|
108
|
-
</
|
|
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,24 @@ onUnmounted(() => subscription?.remove());
|
|
|
139
137
|
</script>
|
|
140
138
|
|
|
141
139
|
<template>
|
|
142
|
-
<
|
|
143
|
-
<
|
|
140
|
+
<view>
|
|
141
|
+
<text>{{
|
|
144
142
|
brightness === null ? 'checking…' : `${Math.round(brightness * 100)}%`
|
|
145
|
-
}}</
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
</
|
|
149
|
-
<
|
|
150
|
-
<
|
|
151
|
-
<
|
|
152
|
-
</
|
|
153
|
-
</
|
|
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
|
|
|
157
155
|
```svelte
|
|
158
156
|
<!-- Svelte — trimmed from examples/expo-svelte/screens/BrightnessScreen.svelte -->
|
|
159
157
|
<script lang="ts">
|
|
160
|
-
import { Pressable, Text, View } from '@symbiote-native/svelte';
|
|
161
158
|
import {
|
|
162
159
|
addBrightnessListener,
|
|
163
160
|
getBrightnessAsync,
|
|
@@ -173,27 +170,32 @@ onUnmounted(() => subscription?.remove());
|
|
|
173
170
|
|
|
174
171
|
$effect(() => {
|
|
175
172
|
void getBrightnessAsync().then(value => (brightness = value));
|
|
176
|
-
subscription = addBrightnessListener(
|
|
173
|
+
subscription = addBrightnessListener(
|
|
174
|
+
event => (brightness = event.brightness),
|
|
175
|
+
);
|
|
177
176
|
return () => subscription?.remove();
|
|
178
177
|
});
|
|
179
178
|
</script>
|
|
180
179
|
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<
|
|
188
|
-
<
|
|
189
|
-
</
|
|
190
|
-
</
|
|
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>
|
|
191
194
|
```
|
|
192
195
|
|
|
193
196
|
```tsx
|
|
194
197
|
// Solid — trimmed from examples/expo-solid/screens/BrightnessScreen.tsx
|
|
195
198
|
import { createSignal, onCleanup } from 'solid-js';
|
|
196
|
-
import { Pressable, Text, View } from '@symbiote-native/solid';
|
|
197
199
|
import {
|
|
198
200
|
addBrightnessListener,
|
|
199
201
|
getBrightnessAsync,
|
|
@@ -203,25 +205,30 @@ import { createPermissions } from '@symbiote-native/brightness/solid';
|
|
|
203
205
|
|
|
204
206
|
function BrightnessScreen() {
|
|
205
207
|
const [brightness, setBrightness] = createSignal<number | null>(null);
|
|
206
|
-
const { status: permissionStatus, request: requestPermission } =
|
|
208
|
+
const { status: permissionStatus, request: requestPermission } =
|
|
209
|
+
createPermissions();
|
|
207
210
|
|
|
208
211
|
getBrightnessAsync().then(setBrightness);
|
|
209
|
-
const subscription = addBrightnessListener(event =>
|
|
212
|
+
const subscription = addBrightnessListener(event =>
|
|
213
|
+
setBrightness(event.brightness),
|
|
214
|
+
);
|
|
210
215
|
onCleanup(() => subscription.remove());
|
|
211
216
|
|
|
212
217
|
return (
|
|
213
|
-
<
|
|
214
|
-
<
|
|
215
|
-
{brightness() === null
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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>
|
|
225
232
|
);
|
|
226
233
|
}
|
|
227
234
|
```
|
|
@@ -229,7 +236,7 @@ function BrightnessScreen() {
|
|
|
229
236
|
```ts
|
|
230
237
|
// Angular — trimmed from examples/expo-angular/src/screens/BrightnessScreen.ts
|
|
231
238
|
import { Component, inject, signal } from '@angular/core';
|
|
232
|
-
import {
|
|
239
|
+
import { SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
|
|
233
240
|
import {
|
|
234
241
|
PermissionsService,
|
|
235
242
|
addBrightnessListener,
|
|
@@ -240,18 +247,18 @@ import {
|
|
|
240
247
|
@Component({
|
|
241
248
|
selector: 'BrightnessScreen',
|
|
242
249
|
standalone: true,
|
|
243
|
-
imports: [
|
|
250
|
+
imports: [SYMBIOTE_ELEMENTS],
|
|
244
251
|
template: `
|
|
245
|
-
<
|
|
246
|
-
<
|
|
247
|
-
<
|
|
248
|
-
><
|
|
252
|
+
<view>
|
|
253
|
+
<text>{{ brightnessLabel() }}</text>
|
|
254
|
+
<pressable (press)="setBrightnessAsync(0.5)"
|
|
255
|
+
><text>Set to 50%</text></pressable
|
|
249
256
|
>
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
><
|
|
257
|
+
<text>{{ permissionStatus()?.status ?? 'checking…' }}</text>
|
|
258
|
+
<pressable (press)="permissionsService.request()"
|
|
259
|
+
><text>Request permission</text></pressable
|
|
253
260
|
>
|
|
254
|
-
</
|
|
261
|
+
</view>
|
|
255
262
|
`,
|
|
256
263
|
})
|
|
257
264
|
export class BrightnessScreen {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/brightness",
|
|
3
|
-
"version": "
|
|
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": {
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"solid-js": ">=1.9.0",
|
|
81
81
|
"svelte": ">=5.56.0",
|
|
82
82
|
"vue": ">=3.5.0",
|
|
83
|
-
"@symbiote-native/angular": "^
|
|
84
|
-
"@symbiote-native/
|
|
85
|
-
"@symbiote-native/
|
|
86
|
-
"@symbiote-native/
|
|
87
|
-
"@symbiote-native/
|
|
88
|
-
"@symbiote-native/vue": "^
|
|
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"
|
|
89
89
|
},
|
|
90
90
|
"peerDependenciesMeta": {
|
|
91
91
|
"@symbiote-native/angular": {
|
|
@@ -133,13 +133,13 @@
|
|
|
133
133
|
"solid-js": "^1.9.14",
|
|
134
134
|
"svelte": "^5.56.0",
|
|
135
135
|
"typescript": "~6.0.0",
|
|
136
|
-
"@symbiote-native/angular": "
|
|
137
|
-
"@symbiote-native/engine": "0.
|
|
138
|
-
"@symbiote-native/react": "
|
|
139
|
-
"@symbiote-native/solid": "
|
|
140
|
-
"@symbiote-native/svelte": "
|
|
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
141
|
"@symbiote-native/test-utils": "0.3.0",
|
|
142
|
-
"@symbiote-native/vue": "
|
|
142
|
+
"@symbiote-native/vue": "2.0.0"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"typecheck": "tsc --build",
|