@symbiote-native/network 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 +52 -21
  2. package/package.json +27 -15
package/README.md CHANGED
@@ -95,13 +95,13 @@ function NetworkScreen() {
95
95
 
96
96
  return (
97
97
  <>
98
- <Text>
98
+ <text>
99
99
  {networkState.isConnected
100
100
  ? `Connected via ${networkState.type}`
101
101
  : 'Offline'}
102
- </Text>
103
- <Text>{ipAddress ?? 'checking…'}</Text>
104
- <Text>{isAirplaneMode ? 'Airplane mode: On' : 'Airplane mode: Off'}</Text>
102
+ </text>
103
+ <text>{ipAddress ?? 'checking…'}</text>
104
+ <text>{isAirplaneMode ? 'Airplane mode: On' : 'Airplane mode: Off'}</text>
105
105
  </>
106
106
  );
107
107
  }
@@ -111,7 +111,6 @@ function NetworkScreen() {
111
111
  <!-- Vue — examples/expo-vue-sfc/screens/NetworkScreen.vue -->
112
112
  <script setup lang="ts">
113
113
  import { ref, watch } from 'vue';
114
- import { Text } from '@symbiote-native/vue';
115
114
  import {
116
115
  getIpAddressAsync,
117
116
  isAirplaneModeEnabledAsync,
@@ -136,17 +135,49 @@ watch(
136
135
  );
137
136
  </script>
138
137
  <template>
139
- <Text>{{
138
+ <text>{{
140
139
  networkState.isConnected ? `Connected via ${networkState.type}` : 'Offline'
141
- }}</Text>
142
- <Text>{{ ipAddress ?? 'checking…' }}</Text>
140
+ }}</text>
141
+ <text>{{ ipAddress ?? 'checking…' }}</text>
143
142
  </template>
144
143
  ```
145
144
 
145
+ ```svelte
146
+ <!-- Svelte -->
147
+ <script lang="ts">
148
+ import {
149
+ getIpAddressAsync,
150
+ isAirplaneModeEnabledAsync,
151
+ } from '@symbiote-native/network';
152
+ import { useNetworkState } from '@symbiote-native/network/svelte';
153
+
154
+ const networkState = useNetworkState(); // { readonly current: NetworkState }
155
+ let ipAddress = $state<string | null>(null);
156
+ let isAirplaneMode = $state<boolean | null>(null);
157
+
158
+ $effect(() => {
159
+ networkState.current; // establishes the dependency, so this re-runs on network change
160
+ void Promise.all([getIpAddressAsync(), isAirplaneModeEnabledAsync()]).then(
161
+ ([ip, airplaneMode]) => {
162
+ ipAddress = ip;
163
+ isAirplaneMode = airplaneMode;
164
+ },
165
+ );
166
+ });
167
+ </script>
168
+
169
+ <text>
170
+ {networkState.current.isConnected
171
+ ? `Connected via ${networkState.current.type}`
172
+ : 'Offline'}
173
+ </text>
174
+ <text>{ipAddress ?? 'checking…'}</text>
175
+ ```
176
+
146
177
  ```ts
147
178
  // Angular — examples/expo-angular/src/screens/NetworkScreen.ts
148
179
  import { Component, effect, inject, signal } from '@angular/core';
149
- import { Text } from '@symbiote-native/angular';
180
+ import { SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
150
181
  import {
151
182
  NetworkStateService,
152
183
  getIpAddressAsync,
@@ -155,8 +186,8 @@ import {
155
186
 
156
187
  @Component({
157
188
  standalone: true,
158
- imports: [Text],
159
- template: `<Text>{{ ipAddress() }}</Text>`,
189
+ imports: [SYMBIOTE_ELEMENTS],
190
+ template: `<text>{{ ipAddress() }}</text>`,
160
191
  })
161
192
  export class NetworkScreen {
162
193
  readonly networkState = inject(NetworkStateService).connect(); // Signal<NetworkState>
@@ -178,7 +209,6 @@ export class NetworkScreen {
178
209
  ```tsx
179
210
  // Solid — the accessor is CALLED; a Solid component body runs once, so a snapshot would freeze.
180
211
  import { createSignal, onMount } from 'solid-js';
181
- import { Text } from '@symbiote-native/solid';
182
212
  import {
183
213
  getIpAddressAsync,
184
214
  isAirplaneModeEnabledAsync,
@@ -203,15 +233,15 @@ function NetworkScreen() {
203
233
 
204
234
  return (
205
235
  <>
206
- <Text>
236
+ <text>
207
237
  {networkState().isConnected
208
238
  ? `Connected via ${networkState().type}`
209
239
  : 'Offline'}
210
- </Text>
211
- <Text>{ipAddress() ?? 'checking…'}</Text>
212
- <Text>
240
+ </text>
241
+ <text>{ipAddress() ?? 'checking…'}</text>
242
+ <text>
213
243
  {isAirplaneMode() ? 'Airplane mode: On' : 'Airplane mode: Off'}
214
- </Text>
244
+ </text>
215
245
  </>
216
246
  );
217
247
  }
@@ -263,11 +293,12 @@ between the seed and the subscription.
263
293
  No Fabric/Descriptor angle at all — network is a pure async-function + `EventEmitter` listener
264
294
  surface, never a view. Tests inject a fake native-module object in place of the real
265
295
  `requireNativeModule` resolution (`src/core/network.test.ts`,
266
- `src/{react,vue,angular}/**/*.test.{ts,tsx}`, `vitest`), the same pattern
296
+ `src/{react,vue,svelte,solid,angular}/**/*.test.{ts,tsx}`, `vitest`), the same pattern
267
297
  `@symbiote-native/battery`/`@symbiote-native/sensors`/`@symbiote-native/local-auth` use — no
268
298
  `installFabric()`, no ViewConfig. Native rendering itself is verified on-device — see the parent
269
299
  [README](../../README.md).
270
300
 
271
- The Android/iOS native wiring is done across all four `examples/expo-*` canary apps
272
- (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-angular`);
273
- this package isn't yet in the public, non-Expo `examples/react` canary.
301
+ The Android/iOS native wiring is done across all six `examples/expo-*` canary apps
302
+ (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
303
+ `examples/expo-solid`, `examples/expo-angular`); this package isn't yet in the public, non-Expo
304
+ `examples/react` canary.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/network",
3
- "version": "0.3.0",
3
+ "version": "2.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": {
@@ -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-network",
20
+ "react",
21
+ "vue",
22
+ "svelte",
23
+ "solid",
24
+ "angular",
25
+ "connectivity",
26
+ "network-state"
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/engine": "^0.5.0",
85
+ "@symbiote-native/react": "^2.0.0",
86
+ "@symbiote-native/solid": "^2.0.0",
87
+ "@symbiote-native/svelte": "^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",