@symbiote-native/network 1.0.0 → 3.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 +23 -20
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -17,6 +17,10 @@ depended on directly and never the `expo` meta-package, why the upstream JS is h
|
|
|
17
17
|
npm install @symbiote-native/network
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Scaffolding or extending a SymbioteNative app? `npx @symbiote-native/cli new --network` (or
|
|
21
|
+
`add --network` in an existing app) installs and wires this for you — see
|
|
22
|
+
[`@symbiote-native/cli`](../cli).
|
|
23
|
+
|
|
20
24
|
Depends on `expo-network` and `expo-modules-core` directly (regular dependencies, pinned to exact
|
|
21
25
|
versions — never a caret range, since this package's `core/` is hand-ported against one specific
|
|
22
26
|
native API shape and a newer resolve could silently drift the two apart). Never install
|
|
@@ -95,13 +99,13 @@ function NetworkScreen() {
|
|
|
95
99
|
|
|
96
100
|
return (
|
|
97
101
|
<>
|
|
98
|
-
<
|
|
102
|
+
<text>
|
|
99
103
|
{networkState.isConnected
|
|
100
104
|
? `Connected via ${networkState.type}`
|
|
101
105
|
: 'Offline'}
|
|
102
|
-
</
|
|
103
|
-
<
|
|
104
|
-
<
|
|
106
|
+
</text>
|
|
107
|
+
<text>{ipAddress ?? 'checking…'}</text>
|
|
108
|
+
<text>{isAirplaneMode ? 'Airplane mode: On' : 'Airplane mode: Off'}</text>
|
|
105
109
|
</>
|
|
106
110
|
);
|
|
107
111
|
}
|
|
@@ -111,7 +115,6 @@ function NetworkScreen() {
|
|
|
111
115
|
<!-- Vue — examples/expo-vue-sfc/screens/NetworkScreen.vue -->
|
|
112
116
|
<script setup lang="ts">
|
|
113
117
|
import { ref, watch } from 'vue';
|
|
114
|
-
import { Text } from '@symbiote-native/vue';
|
|
115
118
|
import {
|
|
116
119
|
getIpAddressAsync,
|
|
117
120
|
isAirplaneModeEnabledAsync,
|
|
@@ -136,10 +139,10 @@ watch(
|
|
|
136
139
|
);
|
|
137
140
|
</script>
|
|
138
141
|
<template>
|
|
139
|
-
<
|
|
142
|
+
<text>{{
|
|
140
143
|
networkState.isConnected ? `Connected via ${networkState.type}` : 'Offline'
|
|
141
|
-
}}</
|
|
142
|
-
<
|
|
144
|
+
}}</text>
|
|
145
|
+
<text>{{ ipAddress ?? 'checking…' }}</text>
|
|
143
146
|
</template>
|
|
144
147
|
```
|
|
145
148
|
|
|
@@ -166,18 +169,19 @@ watch(
|
|
|
166
169
|
);
|
|
167
170
|
});
|
|
168
171
|
</script>
|
|
169
|
-
|
|
172
|
+
|
|
173
|
+
<text>
|
|
170
174
|
{networkState.current.isConnected
|
|
171
175
|
? `Connected via ${networkState.current.type}`
|
|
172
176
|
: 'Offline'}
|
|
173
|
-
</
|
|
174
|
-
<
|
|
177
|
+
</text>
|
|
178
|
+
<text>{ipAddress ?? 'checking…'}</text>
|
|
175
179
|
```
|
|
176
180
|
|
|
177
181
|
```ts
|
|
178
182
|
// Angular — examples/expo-angular/src/screens/NetworkScreen.ts
|
|
179
183
|
import { Component, effect, inject, signal } from '@angular/core';
|
|
180
|
-
import {
|
|
184
|
+
import { SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
|
|
181
185
|
import {
|
|
182
186
|
NetworkStateService,
|
|
183
187
|
getIpAddressAsync,
|
|
@@ -186,8 +190,8 @@ import {
|
|
|
186
190
|
|
|
187
191
|
@Component({
|
|
188
192
|
standalone: true,
|
|
189
|
-
imports: [
|
|
190
|
-
template: `<
|
|
193
|
+
imports: [SYMBIOTE_ELEMENTS],
|
|
194
|
+
template: `<text>{{ ipAddress() }}</text>`,
|
|
191
195
|
})
|
|
192
196
|
export class NetworkScreen {
|
|
193
197
|
readonly networkState = inject(NetworkStateService).connect(); // Signal<NetworkState>
|
|
@@ -209,7 +213,6 @@ export class NetworkScreen {
|
|
|
209
213
|
```tsx
|
|
210
214
|
// Solid — the accessor is CALLED; a Solid component body runs once, so a snapshot would freeze.
|
|
211
215
|
import { createSignal, onMount } from 'solid-js';
|
|
212
|
-
import { Text } from '@symbiote-native/solid';
|
|
213
216
|
import {
|
|
214
217
|
getIpAddressAsync,
|
|
215
218
|
isAirplaneModeEnabledAsync,
|
|
@@ -234,15 +237,15 @@ function NetworkScreen() {
|
|
|
234
237
|
|
|
235
238
|
return (
|
|
236
239
|
<>
|
|
237
|
-
<
|
|
240
|
+
<text>
|
|
238
241
|
{networkState().isConnected
|
|
239
242
|
? `Connected via ${networkState().type}`
|
|
240
243
|
: 'Offline'}
|
|
241
|
-
</
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
+
</text>
|
|
245
|
+
<text>{ipAddress() ?? 'checking…'}</text>
|
|
246
|
+
<text>
|
|
244
247
|
{isAirplaneMode() ? 'Airplane mode: On' : 'Airplane mode: Off'}
|
|
245
|
-
</
|
|
248
|
+
</text>
|
|
246
249
|
</>
|
|
247
250
|
);
|
|
248
251
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/network",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "expo-network wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Network state (type/connected/internet-reachable) with a change listener, device IP address, and airplane-mode detection.",
|
|
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/engine": "^0.
|
|
85
|
-
"@symbiote-native/react": "^
|
|
86
|
-
"@symbiote-native/solid": "^
|
|
87
|
-
"@symbiote-native/svelte": "^
|
|
88
|
-
"@symbiote-native/vue": "^
|
|
83
|
+
"@symbiote-native/angular": "^3.0.0",
|
|
84
|
+
"@symbiote-native/engine": "^1.0.0",
|
|
85
|
+
"@symbiote-native/react": "^3.0.0",
|
|
86
|
+
"@symbiote-native/solid": "^3.0.0",
|
|
87
|
+
"@symbiote-native/svelte": "^3.0.0",
|
|
88
|
+
"@symbiote-native/vue": "^3.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": "
|
|
141
|
-
"@symbiote-native/test-utils": "0.3.
|
|
142
|
-
"@symbiote-native/vue": "
|
|
136
|
+
"@symbiote-native/angular": "3.0.0",
|
|
137
|
+
"@symbiote-native/engine": "1.0.0",
|
|
138
|
+
"@symbiote-native/react": "3.0.0",
|
|
139
|
+
"@symbiote-native/solid": "3.0.0",
|
|
140
|
+
"@symbiote-native/svelte": "3.0.0",
|
|
141
|
+
"@symbiote-native/test-utils": "0.3.1",
|
|
142
|
+
"@symbiote-native/vue": "3.0.0"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"typecheck": "tsc --build",
|