@symbiote-native/device 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 +92 -8
- package/package.json +27 -15
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A wrapper package for [SymbioteNative](../../README.md) that makes
|
|
|
4
4
|
[`expo-device`](https://github.com/expo/expo/tree/main/packages/expo-device)
|
|
5
5
|
— physical device information: brand/model/OS constants, uptime, max-memory,
|
|
6
6
|
root/jailbreak detection, side-loading detection, and platform-feature queries — usable from
|
|
7
|
-
**every** adapter, React, Vue, and Angular, not just React. Like
|
|
7
|
+
**every** adapter, React, Vue, Svelte, Solid, and Angular, not just React. Like
|
|
8
8
|
[`@symbiote-native/local-auth`](../local-auth) and unlike this repo's stateful Expo wrapper
|
|
9
9
|
([`@symbiote-native/sensors`](../sensors), an `EventEmitter` + live-subscription surface), every
|
|
10
10
|
export here is either an eagerly-resolved constant or a one-shot async call with no per-instance
|
|
@@ -56,9 +56,10 @@ src/core/ Eager constants (isDevice, brand, manufacturer, modelId, modelName
|
|
|
56
56
|
src/angular/ @symbiote-native/device/angular — export * from '../core'
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
`./react`, `./vue`, and `./
|
|
60
|
-
physical per-framework file, since there's nothing to subscribe to or clean up.
|
|
61
|
-
a physical file/subpath since Angular ships through a separate `ngc`/AOT build
|
|
59
|
+
`./react`, `./vue`, `./svelte`, and `./solid` are `exports`-map aliases straight onto
|
|
60
|
+
`src/core/` — no physical per-framework file, since there's nothing to subscribe to or clean up.
|
|
61
|
+
`./angular` stays a physical file/subpath since Angular ships through a separate `ngc`/AOT build
|
|
62
|
+
(`build-ngc/`).
|
|
62
63
|
|
|
63
64
|
## Use it
|
|
64
65
|
|
|
@@ -146,6 +147,86 @@ onMounted(() => {
|
|
|
146
147
|
</template>
|
|
147
148
|
```
|
|
148
149
|
|
|
150
|
+
```svelte
|
|
151
|
+
<!-- Svelte -->
|
|
152
|
+
<script lang="ts">
|
|
153
|
+
import { Text, View } from '@symbiote-native/svelte';
|
|
154
|
+
import {
|
|
155
|
+
brand,
|
|
156
|
+
deviceName,
|
|
157
|
+
getMaxMemoryAsync,
|
|
158
|
+
getUptimeAsync,
|
|
159
|
+
isDevice,
|
|
160
|
+
modelName,
|
|
161
|
+
osName,
|
|
162
|
+
osVersion,
|
|
163
|
+
} from '@symbiote-native/device/svelte';
|
|
164
|
+
|
|
165
|
+
let uptime = $state<number | null>(null);
|
|
166
|
+
let maxMemory = $state<number | null>(null);
|
|
167
|
+
|
|
168
|
+
$effect(() => {
|
|
169
|
+
getUptimeAsync().then(value => (uptime = value));
|
|
170
|
+
getMaxMemoryAsync().then(value => (maxMemory = value));
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<View>
|
|
175
|
+
<Text>{isDevice ? 'Real device' : 'Simulator/emulator'}</Text>
|
|
176
|
+
<Text>{`${brand ?? 'unknown'} ${modelName ?? ''}`}</Text>
|
|
177
|
+
<Text>{`${osName ?? 'unknown OS'} ${osVersion ?? ''}`}</Text>
|
|
178
|
+
<Text>{deviceName ?? 'unnamed device'}</Text>
|
|
179
|
+
<Text>{uptime === null ? 'checking uptime…' : `Uptime: ${uptime}ms`}</Text>
|
|
180
|
+
<Text>
|
|
181
|
+
{maxMemory === null ? 'checking memory…' : `Max memory: ${maxMemory} bytes`}
|
|
182
|
+
</Text>
|
|
183
|
+
</View>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
// Solid — a component body runs once, so the two async values need a signal; the eager
|
|
188
|
+
// constants (brand, modelName, ...) are plain reads with nothing to subscribe to.
|
|
189
|
+
import { createSignal, onMount } from 'solid-js';
|
|
190
|
+
import { Text, View } from '@symbiote-native/solid';
|
|
191
|
+
import {
|
|
192
|
+
brand,
|
|
193
|
+
deviceName,
|
|
194
|
+
getMaxMemoryAsync,
|
|
195
|
+
getUptimeAsync,
|
|
196
|
+
isDevice,
|
|
197
|
+
modelName,
|
|
198
|
+
osName,
|
|
199
|
+
osVersion,
|
|
200
|
+
} from '@symbiote-native/device/solid';
|
|
201
|
+
|
|
202
|
+
function DeviceScreen() {
|
|
203
|
+
const [uptime, setUptime] = createSignal<number | null>(null);
|
|
204
|
+
const [maxMemory, setMaxMemory] = createSignal<number | null>(null);
|
|
205
|
+
|
|
206
|
+
onMount(() => {
|
|
207
|
+
void getUptimeAsync().then(setUptime);
|
|
208
|
+
void getMaxMemoryAsync().then(setMaxMemory);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<View>
|
|
213
|
+
<Text>{isDevice ? 'Real device' : 'Simulator/emulator'}</Text>
|
|
214
|
+
<Text>{`${brand ?? 'unknown'} ${modelName ?? ''}`}</Text>
|
|
215
|
+
<Text>{`${osName ?? 'unknown OS'} ${osVersion ?? ''}`}</Text>
|
|
216
|
+
<Text>{deviceName ?? 'unnamed device'}</Text>
|
|
217
|
+
<Text>
|
|
218
|
+
{uptime() === null ? 'checking uptime…' : `Uptime: ${uptime()}ms`}
|
|
219
|
+
</Text>
|
|
220
|
+
<Text>
|
|
221
|
+
{maxMemory() === null
|
|
222
|
+
? 'checking memory…'
|
|
223
|
+
: `Max memory: ${maxMemory()} bytes`}
|
|
224
|
+
</Text>
|
|
225
|
+
</View>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
149
230
|
```ts
|
|
150
231
|
// Angular
|
|
151
232
|
import { Component, signal } from '@angular/core';
|
|
@@ -208,8 +289,8 @@ These snippets mirror the real canary demo screens — `examples/expo-react/scre
|
|
|
208
289
|
## API
|
|
209
290
|
|
|
210
291
|
Eagerly-resolved constants, plus a handful of one-shot async functions — no event stream, no
|
|
211
|
-
per-instance state — so the React/Vue/Angular entry points above are plain
|
|
212
|
-
with nothing adapter-specific to add.
|
|
292
|
+
per-instance state — so the React/Vue/Svelte/Solid/Angular entry points above are plain
|
|
293
|
+
re-exports of `core` with nothing adapter-specific to add.
|
|
213
294
|
|
|
214
295
|
```ts
|
|
215
296
|
// Constants — resolved once, at import time, straight off the native module:
|
|
@@ -250,6 +331,8 @@ import { getDeviceTypeAsync, isDevice } from '@symbiote-native/device';
|
|
|
250
331
|
// or the framework-scoped entry points — identical surface, re-exported verbatim:
|
|
251
332
|
import { getDeviceTypeAsync } from '@symbiote-native/device/react';
|
|
252
333
|
import { getDeviceTypeAsync } from '@symbiote-native/device/vue';
|
|
334
|
+
import { getDeviceTypeAsync } from '@symbiote-native/device/svelte';
|
|
335
|
+
import { getDeviceTypeAsync } from '@symbiote-native/device/solid';
|
|
253
336
|
import { getDeviceTypeAsync } from '@symbiote-native/device/angular';
|
|
254
337
|
```
|
|
255
338
|
|
|
@@ -273,9 +356,10 @@ the real `requireNativeModule` resolution (`src/core/device.test.ts`, `vitest`)
|
|
|
273
356
|
`installFabric()`, no ViewConfig. Native rendering itself is verified on-device (see the parent
|
|
274
357
|
[README](../../README.md) for the project's testing model).
|
|
275
358
|
|
|
276
|
-
Native autolinking wiring for `expo-modules-core` packages is already done in
|
|
359
|
+
Native autolinking wiring for `expo-modules-core` packages is already done in all six Expo
|
|
277
360
|
canary apps (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`,
|
|
278
|
-
`examples/expo-
|
|
361
|
+
`examples/expo-svelte`, `examples/expo-solid`, `examples/expo-angular`) via
|
|
362
|
+
`@symbiote-native/local-auth`/`@symbiote-native/sensors` — this
|
|
279
363
|
package reuses that same wiring with zero further app-side changes, since
|
|
280
364
|
`expo-modules-autolinking` discovers any `expo-modules-core` package already present in
|
|
281
365
|
`node_modules`. A dedicated `DeviceScreen` demo has not been wired into those canaries yet.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/device",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "expo-device wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Device brand/model/OS constants, uptime, max-memory, root/jailbreak detection, side-loading detection, and platform-feature queries.",
|
|
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-device",
|
|
20
|
+
"react",
|
|
21
|
+
"vue",
|
|
22
|
+
"svelte",
|
|
23
|
+
"solid",
|
|
24
|
+
"angular",
|
|
25
|
+
"device-info",
|
|
26
|
+
"root-detection"
|
|
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",
|