@oxyhq/bloom 1.8.0 → 1.9.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/docs/getting-started.mdx +29 -15
- package/docs/media-flight.mdx +14 -9
- package/lib/commonjs/connection-status/index.js +7 -0
- package/lib/commonjs/connection-status/index.js.map +1 -1
- package/lib/commonjs/connection-status/index.web.js +7 -0
- package/lib/commonjs/connection-status/index.web.js.map +1 -1
- package/lib/commonjs/connection-status/netinfo.js +34 -0
- package/lib/commonjs/connection-status/netinfo.js.map +1 -1
- package/lib/commonjs/theme/adaptive-colors.js +30 -4
- package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
- package/lib/module/connection-status/index.js +3 -0
- package/lib/module/connection-status/index.js.map +1 -1
- package/lib/module/connection-status/index.web.js +3 -0
- package/lib/module/connection-status/index.web.js.map +1 -1
- package/lib/module/connection-status/netinfo.js +33 -0
- package/lib/module/connection-status/netinfo.js.map +1 -1
- package/lib/module/theme/adaptive-colors.js +30 -4
- package/lib/module/theme/adaptive-colors.js.map +1 -1
- package/lib/typescript/commonjs/connection-status/index.d.ts +1 -0
- package/lib/typescript/commonjs/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/connection-status/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts +25 -0
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/index.d.ts +1 -0
- package/lib/typescript/module/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/index.web.d.ts +1 -0
- package/lib/typescript/module/connection-status/index.web.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/netinfo.d.ts +25 -0
- package/lib/typescript/module/connection-status/netinfo.d.ts.map +1 -1
- package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connection-status/index.ts +3 -0
- package/src/connection-status/index.web.ts +3 -0
- package/src/connection-status/netinfo.ts +33 -0
- package/src/theme/adaptive-colors.ts +37 -4
package/docs/getting-started.mdx
CHANGED
|
@@ -67,32 +67,46 @@ export function Hello() {
|
|
|
67
67
|
## If you build with Vite (or any ESM web bundler)
|
|
68
68
|
|
|
69
69
|
Bloom reaches its **optional** peers through a `require()` that Metro marks
|
|
70
|
-
optional.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
is why this only appears off Metro.
|
|
70
|
+
optional. Off Metro that load does not deliver the package **even when it is
|
|
71
|
+
installed** — and the reason depends on your bundler, which is why this defect
|
|
72
|
+
keeps being diagnosed wrongly:
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
| bundler | `typeof require` | what happens |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| Rollup / Vite | `"undefined"` | the guard sees no `require` and degrades |
|
|
77
|
+
| esbuild | `"function"` | a shim that THROWS, so the guard passes and the call fails inside the `try` |
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
Same symptom, different causes — so `typeof require` is **not** a reliable check
|
|
80
|
+
for whether you are affected. Metro is unaffected.
|
|
81
|
+
|
|
82
|
+
**What you actually lose on web is the connection toasts**, and only those:
|
|
83
|
+
`ConnectionStatusToasts` calls `loadNetInfo()` with no platform guard, so a web
|
|
84
|
+
app with `@react-native-community/netinfo` installed gets no outage toast.
|
|
85
|
+
|
|
86
|
+
**The other optional peers are NOT affected on web**, because their callers
|
|
87
|
+
return before the `require` is ever reached:
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
| peer | why web never reaches it |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `expo-router` (adaptive colours) | `getAdaptiveColors` returns `null` unless `Platform.OS` is `android`/`ios` (`theme/adaptive-colors.ts:143-145`) |
|
|
92
|
+
| `nativewind` (scoped presets) | both callers `return` on web (`theme/color-scope/style-builder.ts:159, :192`) |
|
|
93
|
+
| `expo-haptics` | `useHaptics` returns on web (`hooks/use-haptics.tsx:47`) |
|
|
94
|
+
|
|
95
|
+
If scoped NativeWind presets are wrong in your web app, this is not the cause —
|
|
96
|
+
look at the CSS-variable pipeline instead.
|
|
97
|
+
|
|
98
|
+
Two peers can be handed over explicitly, which works on any bundler:
|
|
82
99
|
|
|
83
100
|
```ts
|
|
84
101
|
import * as ExpoVideo from 'expo-video';
|
|
102
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
85
103
|
import { provideExpoVideo } from '@oxyhq/bloom/media-flight';
|
|
104
|
+
import { provideNetInfo } from '@oxyhq/bloom/connection-status';
|
|
86
105
|
|
|
87
106
|
provideExpoVideo(ExpoVideo); // otherwise video silently shows only its poster
|
|
107
|
+
provideNetInfo(NetInfo); // otherwise the outage toast never appears
|
|
88
108
|
```
|
|
89
109
|
|
|
90
|
-
The others have no equivalent yet, so on an ESM bundle you currently lose
|
|
91
|
-
scoped NativeWind presets (`BloomColorScope`), adaptive colours, haptics and the
|
|
92
|
-
connection toasts. Most of them say so in the dev console — the warning ends
|
|
93
|
-
`Reason: this bundle has no CommonJS require` — with the exception noted in
|
|
94
|
-
`theme/adaptive-colors.ts`, which degrades silently.
|
|
95
|
-
|
|
96
110
|
## Recommended layout
|
|
97
111
|
|
|
98
112
|
If your app supports both light and dark themes:
|
package/docs/media-flight.mdx
CHANGED
|
@@ -583,13 +583,19 @@ flies video without it gets the poster plus a single dev warning naming the
|
|
|
583
583
|
package.
|
|
584
584
|
|
|
585
585
|
<Callout variant="warning" title="On Vite (or any ESM web bundler) you must hand expo-video over">
|
|
586
|
-
Bloom loads optional peers through a `require()` that Metro marks optional.
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
poster **even when `expo-video` is installed**. Metro has a real `require` and
|
|
590
|
-
is unaffected, which is why this only shows up off Metro.
|
|
586
|
+
Bloom loads optional peers through a `require()` that Metro marks optional. Off
|
|
587
|
+
Metro that load does not deliver the package **even when `expo-video` is
|
|
588
|
+
installed**, and video degrades to its poster.
|
|
591
589
|
|
|
592
|
-
|
|
590
|
+
**Do not test for this with `typeof require`.** The cause depends on the
|
|
591
|
+
bundler and the symptom does not:
|
|
592
|
+
|
|
593
|
+
| bundler | `typeof require` | what happens |
|
|
594
|
+
| --- | --- | --- |
|
|
595
|
+
| Rollup / Vite | `"undefined"` | the guard sees no `require` and degrades |
|
|
596
|
+
| esbuild | `"function"` | a shim that THROWS, so the guard passes and the call fails inside the `try` |
|
|
597
|
+
|
|
598
|
+
One line at startup fixes it, on any bundler:
|
|
593
599
|
|
|
594
600
|
```ts
|
|
595
601
|
import * as ExpoVideo from 'expo-video';
|
|
@@ -598,9 +604,8 @@ import { provideExpoVideo } from '@oxyhq/bloom/media-flight';
|
|
|
598
604
|
provideExpoVideo(ExpoVideo);
|
|
599
605
|
```
|
|
600
606
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
so directly — the warning ends `Reason: this bundle has no CommonJS require`.
|
|
607
|
+
The dev console says so too, and the `Reason:` it prints is the bundler's own
|
|
608
|
+
message rather than a fixed string.
|
|
604
609
|
</Callout>
|
|
605
610
|
|
|
606
611
|
## What a jest run can and cannot see
|
|
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "ConnectionStatusToasts", {
|
|
|
9
9
|
return _ConnectionStatusToasts.ConnectionStatusToasts;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "provideNetInfo", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _netinfo.provideNetInfo;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _netinfo = require("./netinfo.js");
|
|
12
19
|
var _ConnectionStatusToasts = require("./ConnectionStatusToasts");
|
|
13
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_netinfo","require","_ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "ConnectionStatusToasts", {
|
|
|
9
9
|
return _ConnectionStatusToastsWeb.ConnectionStatusToasts;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "provideNetInfo", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _netinfo.provideNetInfo;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _netinfo = require("./netinfo.js");
|
|
12
19
|
var _ConnectionStatusToastsWeb = require("./ConnectionStatusToasts.web.js");
|
|
13
20
|
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_netinfo","require","_ConnectionStatusToastsWeb"],"sourceRoot":"../../../src","sources":["connection-status/index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.loadNetInfo = loadNetInfo;
|
|
7
|
+
exports.provideNetInfo = provideNetInfo;
|
|
7
8
|
exports.warnNetInfoUnavailable = warnNetInfoUnavailable;
|
|
8
9
|
/**
|
|
9
10
|
* The optional-peer boundary for `@react-native-community/netinfo`.
|
|
@@ -68,12 +69,45 @@ exports.warnNetInfoUnavailable = warnNetInfoUnavailable;
|
|
|
68
69
|
|
|
69
70
|
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
70
71
|
let netInfoModule;
|
|
72
|
+
/** Handed in by a consumer, which is the only thing that works in an ESM bundle. */
|
|
73
|
+
let providedModule = null;
|
|
71
74
|
/** Why the load failed, quoted verbatim in the dev warning. */
|
|
72
75
|
let unavailableReason = '';
|
|
73
76
|
let hasWarned = false;
|
|
74
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
80
|
+
*
|
|
81
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
82
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
83
|
+
* bundler resolved, hands the module in.
|
|
84
|
+
*
|
|
85
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
86
|
+
* knowing because the symptom is identical while the cause is not:
|
|
87
|
+
*
|
|
88
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
89
|
+
* and the boundary degrades.
|
|
90
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
91
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
92
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
93
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
94
|
+
*
|
|
95
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
96
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
97
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
98
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
99
|
+
*
|
|
100
|
+
* Metro is unaffected either way and needs no binding.
|
|
101
|
+
*/
|
|
102
|
+
function provideNetInfo(module) {
|
|
103
|
+
providedModule = module;
|
|
104
|
+
netInfoModule = undefined;
|
|
105
|
+
hasWarned = false;
|
|
106
|
+
}
|
|
107
|
+
|
|
75
108
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
76
109
|
function loadNetInfo() {
|
|
110
|
+
if (providedModule !== null) return providedModule;
|
|
77
111
|
if (netInfoModule !== undefined) return netInfoModule;
|
|
78
112
|
netInfoModule = null;
|
|
79
113
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["netInfoModule","unavailableReason","hasWarned","
|
|
1
|
+
{"version":3,"names":["netInfoModule","providedModule","unavailableReason","hasWarned","provideNetInfo","module","undefined","loadNetInfo","require","loaded","resolved","addEventListener","default","error","Error","message","String","warnNetInfoUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["connection-status/netinfo.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAGA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,IAAIA,aAA6C;AACjD;AACA,IAAIC,cAAkC,GAAG,IAAI;AAC7C;AACA,IAAIC,iBAAiB,GAAG,EAAE;AAC1B,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,MAA0B,EAAQ;EAC/DJ,cAAc,GAAGI,MAAM;EACvBL,aAAa,GAAGM,SAAS;EACzBH,SAAS,GAAG,KAAK;AACnB;;AAEA;AACO,SAASI,WAAWA,CAAA,EAAuB;EAChD,IAAIN,cAAc,KAAK,IAAI,EAAE,OAAOA,cAAc;EAClD,IAAID,aAAa,KAAKM,SAAS,EAAE,OAAON,aAAa;EACrDA,aAAa,GAAG,IAAI;;EAEpB;EACA;EACA;EACA;EACA,IAAI,OAAOQ,OAAO,KAAK,WAAW,EAAE;IAClCN,iBAAiB,GAAG,uCAAuC;IAC3D,OAAOF,aAAa;EACtB;EAEA,IAAI;IACF;IACA;IACA;IACA,MAAMS,MAAM,GAAGD,OAAO,CAAC,iCAAiC,CAG3C;IACb,MAAME,QAAQ,GAAG,OAAOD,MAAM,EAAEE,gBAAgB,KAAK,UAAU,GAAGF,MAAM,GAAGA,MAAM,EAAEG,OAAO;IAE1F,IAAI,OAAOF,QAAQ,EAAEC,gBAAgB,KAAK,UAAU,EAAE;MACpDX,aAAa,GAAGU,QAAuB;IACzC,CAAC,MAAM;MACLR,iBAAiB,GAAG,0DAA0D;IAChF;EACF,CAAC,CAAC,OAAOW,KAAK,EAAE;IACdX,iBAAiB,GAAGW,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC;EAC5E;EAEA,OAAOb,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiB,sBAAsBA,CAAA,EAAS;EAC7C,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIjB,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACA;EACA;EACAkB,OAAO,CAACC,IAAI,CACV,6DAA6D,GAC3D,+EAA+E,GAC/E,8EAA8E,GAC9E,6EAA6E,GAC7E,oDAAoDpB,iBAAiB,EACzE,CAAC;AACH","ignoreList":[]}
|
|
@@ -41,9 +41,30 @@ var _reactNative = require("react-native");
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
const c = v => v;
|
|
44
|
+
let hasWarned = false;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* SAY SO. This boundary degraded in complete silence, which is the worst of the
|
|
48
|
+
* six: an app simply gets the preset palette instead of the platform's, and
|
|
49
|
+
* nothing anywhere says the platform read failed.
|
|
50
|
+
*
|
|
51
|
+
* It is only reachable on Android and iOS — `getAdaptiveColors` returns `null`
|
|
52
|
+
* on web before touching `require` — so an ESM bundle never gets here. That is
|
|
53
|
+
* an argument for warning, not against it: a failure that cannot happen in the
|
|
54
|
+
* environment you test in is exactly the one that goes unnoticed when it does.
|
|
55
|
+
*/
|
|
56
|
+
function warnAdaptiveColorsUnavailable(reason) {
|
|
57
|
+
if (process.env.NODE_ENV === 'production' || hasWarned) return;
|
|
58
|
+
hasWarned = true;
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.warn('[Bloom] The adaptive palette fell back to the preset one: `expo-router`’s ' + '`Color` proxy could not be read, so platform colours (Material You, iOS ' + 'dynamic) are not in use. Install the optional peer ' + '(`npx expo install expo-router`) if you want them. ' + `Reason: ${reason}`);
|
|
61
|
+
}
|
|
44
62
|
function getAndroidColors() {
|
|
45
63
|
try {
|
|
46
|
-
if (typeof require === 'undefined')
|
|
64
|
+
if (typeof require === 'undefined') {
|
|
65
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
47
68
|
const {
|
|
48
69
|
Color
|
|
49
70
|
} = require('expo-router');
|
|
@@ -83,13 +104,17 @@ function getAndroidColors() {
|
|
|
83
104
|
shadow: 'rgba(0, 0, 0, 0.2)',
|
|
84
105
|
overlay: 'rgba(0, 0, 0, 0.5)'
|
|
85
106
|
};
|
|
86
|
-
} catch {
|
|
107
|
+
} catch (error) {
|
|
108
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
87
109
|
return null;
|
|
88
110
|
}
|
|
89
111
|
}
|
|
90
112
|
function getIOSColors() {
|
|
91
113
|
try {
|
|
92
|
-
if (typeof require === 'undefined')
|
|
114
|
+
if (typeof require === 'undefined') {
|
|
115
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
93
118
|
const {
|
|
94
119
|
Color
|
|
95
120
|
} = require('expo-router');
|
|
@@ -129,7 +154,8 @@ function getIOSColors() {
|
|
|
129
154
|
shadow: 'rgba(0, 0, 0, 0.15)',
|
|
130
155
|
overlay: 'rgba(0, 0, 0, 0.5)'
|
|
131
156
|
};
|
|
132
|
-
} catch {
|
|
157
|
+
} catch (error) {
|
|
158
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
133
159
|
return null;
|
|
134
160
|
}
|
|
135
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","c","v","getAndroidColors","Color","d","android","dynamic","background","surface","backgroundSecondary","surfaceContainerLow","backgroundTertiary","surfaceContainer","text","onSurface","textSecondary","onSurfaceVariant","textTertiary","outline","border","outlineVariant","borderLight","primary","primaryForeground","onPrimary","primaryLight","primaryContainer","primaryDark","onPrimaryContainer","secondary","secondaryForeground","onSecondary","tertiary","tertiaryForeground","onTertiary","tint","icon","iconActive","success","error","warning","info","primarySubtle","primarySubtleForeground","negative","negativeForeground","negativeSubtle","errorContainer","negativeSubtleForeground","onErrorContainer","contrast50","card","shadow","overlay","getIOSColors","i","ios","systemBackground","secondarySystemBackground","tertiarySystemBackground","label","secondaryLabel","tertiaryLabel","separator","opaqueSeparator","systemBlue","systemGray6","systemPurple","systemTeal","systemGreen","systemRed","systemOrange","getAdaptiveColors","Platform","OS"],"sourceRoot":"../../../src","sources":["theme/adaptive-colors.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,MAAMC,CAAC,GAAIC,CAAU,IAAaA,CAAW;AAE7C,SAASC,gBAAgBA,CAAA,EAA0B;EACjD,IAAI;IACF,IAAI,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","c","v","hasWarned","warnAdaptiveColorsUnavailable","reason","process","env","NODE_ENV","console","warn","getAndroidColors","Color","d","android","dynamic","background","surface","backgroundSecondary","surfaceContainerLow","backgroundTertiary","surfaceContainer","text","onSurface","textSecondary","onSurfaceVariant","textTertiary","outline","border","outlineVariant","borderLight","primary","primaryForeground","onPrimary","primaryLight","primaryContainer","primaryDark","onPrimaryContainer","secondary","secondaryForeground","onSecondary","tertiary","tertiaryForeground","onTertiary","tint","icon","iconActive","success","error","warning","info","primarySubtle","primarySubtleForeground","negative","negativeForeground","negativeSubtle","errorContainer","negativeSubtleForeground","onErrorContainer","contrast50","card","shadow","overlay","Error","message","String","getIOSColors","i","ios","systemBackground","secondarySystemBackground","tertiarySystemBackground","label","secondaryLabel","tertiaryLabel","separator","opaqueSeparator","systemBlue","systemGray6","systemPurple","systemTeal","systemGreen","systemRed","systemOrange","getAdaptiveColors","Platform","OS"],"sourceRoot":"../../../src","sources":["theme/adaptive-colors.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,MAAMC,CAAC,GAAIC,CAAU,IAAaA,CAAW;AAE7C,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,MAAc,EAAQ;EAC3D,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIL,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACAM,OAAO,CAACC,IAAI,CACV,4EAA4E,GAC1E,0EAA0E,GAC1E,qDAAqD,GACrD,qDAAqD,GACrD,WAAWL,MAAM,EACrB,CAAC;AACH;AAEA,SAASM,gBAAgBA,CAAA,EAA0B;EACjD,IAAI;IACF,IAAI,OAAOX,OAAO,KAAK,WAAW,EAAE;MAClCI,6BAA6B,CAAC,uCAAuC,CAAC;MACtE,OAAO,IAAI;I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uB,EAAEnD,CAAC,CAACkE,CAAC,CAACU,UAAU,CAAC;MACxCxB,QAAQ,EAAEpD,CAAC,CAACkE,CAAC,CAACe,SAAS,CAAC;MACxB5B,kBAAkB,EAAE,SAAS;MAC7BC,cAAc,EAAEtD,CAAC,CAACkE,CAAC,CAACW,WAAW,CAAC;MAChCrB,wBAAwB,EAAExD,CAAC,CAACkE,CAAC,CAACe,SAAS,CAAC;MACxCvB,UAAU,EAAE1D,CAAC,CAACkE,CAAC,CAACW,WAAW,CAAC;MAC5BlB,IAAI,EAAE3D,CAAC,CAACkE,CAAC,CAACG,yBAAyB,CAAC;MACpCT,MAAM,EAAE,qBAAqB;MAC7BC,OAAO,EAAE;IACX,CAAC;EACH,CAAC,CAAC,OAAOd,KAAK,EAAE;IACd5C,6BAA6B,CAAC4C,KAAK,YAAYe,KAAK,GAAGf,KAAK,CAACgB,OAAO,GAAGC,MAAM,CAACjB,KAAK,CAAC,CAAC;IACrF,OAAO,IAAI;EACb;AACF;AAEO,SAASoC,iBAAiBA,CAAA,EAA0B;EACzD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE,OAAO3E,gBAAgB,CAAC,CAAC;EACxD,IAAI0E,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE,OAAOpB,YAAY,CAAC,CAAC;EAChD,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
4
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
5
|
+
export { provideNetInfo } from "./netinfo.js";
|
|
3
6
|
export { ConnectionStatusToasts } from './ConnectionStatusToasts';
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.ts"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"names":["provideNetInfo","ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.ts"],"mappings":";;AACA;AACA;AACA,SAASA,cAAc,QAA0B,cAAW;AAC5D,SACEC,sBAAsB,QACjB,0BAA0B","ignoreList":[]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
4
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
5
|
+
export { provideNetInfo } from "./netinfo.js";
|
|
3
6
|
export { ConnectionStatusToasts } from "./ConnectionStatusToasts.web.js";
|
|
4
7
|
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.web.ts"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"names":["provideNetInfo","ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.web.ts"],"mappings":";;AACA;AACA;AACA,SAASA,cAAc,QAA0B,cAAW;AAC5D,SACEC,sBAAsB,QACjB,iCAA8B","ignoreList":[]}
|
|
@@ -63,12 +63,45 @@
|
|
|
63
63
|
|
|
64
64
|
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
65
65
|
let netInfoModule;
|
|
66
|
+
/** Handed in by a consumer, which is the only thing that works in an ESM bundle. */
|
|
67
|
+
let providedModule = null;
|
|
66
68
|
/** Why the load failed, quoted verbatim in the dev warning. */
|
|
67
69
|
let unavailableReason = '';
|
|
68
70
|
let hasWarned = false;
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
74
|
+
*
|
|
75
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
76
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
77
|
+
* bundler resolved, hands the module in.
|
|
78
|
+
*
|
|
79
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
80
|
+
* knowing because the symptom is identical while the cause is not:
|
|
81
|
+
*
|
|
82
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
83
|
+
* and the boundary degrades.
|
|
84
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
85
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
86
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
87
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
88
|
+
*
|
|
89
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
90
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
91
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
92
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
93
|
+
*
|
|
94
|
+
* Metro is unaffected either way and needs no binding.
|
|
95
|
+
*/
|
|
96
|
+
export function provideNetInfo(module) {
|
|
97
|
+
providedModule = module;
|
|
98
|
+
netInfoModule = undefined;
|
|
99
|
+
hasWarned = false;
|
|
100
|
+
}
|
|
101
|
+
|
|
70
102
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
71
103
|
export function loadNetInfo() {
|
|
104
|
+
if (providedModule !== null) return providedModule;
|
|
72
105
|
if (netInfoModule !== undefined) return netInfoModule;
|
|
73
106
|
netInfoModule = null;
|
|
74
107
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["netInfoModule","unavailableReason","hasWarned","
|
|
1
|
+
{"version":3,"names":["netInfoModule","providedModule","unavailableReason","hasWarned","provideNetInfo","module","undefined","loadNetInfo","require","loaded","resolved","addEventListener","default","error","Error","message","String","warnNetInfoUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["connection-status/netinfo.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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OW,KAAK,EAAE;IACdX,iBAAiB,GAAGW,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC;EAC5E;EAEA,OAAOb,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiB,sBAAsBA,CAAA,EAAS;EAC7C,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIjB,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACA;EACA;EACAkB,OAAO,CAACC,IAAI,CACV,6DAA6D,GAC3D,+EAA+E,GAC/E,8EAA8E,GAC9E,6EAA6E,GAC7E,oDAAoDpB,iBAAiB,EACzE,CAAC;AACH","ignoreList":[]}
|
|
@@ -38,9 +38,30 @@ import { Platform } from 'react-native';
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
const c = v => v;
|
|
41
|
+
let hasWarned = false;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* SAY SO. This boundary degraded in complete silence, which is the worst of the
|
|
45
|
+
* six: an app simply gets the preset palette instead of the platform's, and
|
|
46
|
+
* nothing anywhere says the platform read failed.
|
|
47
|
+
*
|
|
48
|
+
* It is only reachable on Android and iOS — `getAdaptiveColors` returns `null`
|
|
49
|
+
* on web before touching `require` — so an ESM bundle never gets here. That is
|
|
50
|
+
* an argument for warning, not against it: a failure that cannot happen in the
|
|
51
|
+
* environment you test in is exactly the one that goes unnoticed when it does.
|
|
52
|
+
*/
|
|
53
|
+
function warnAdaptiveColorsUnavailable(reason) {
|
|
54
|
+
if (process.env.NODE_ENV === 'production' || hasWarned) return;
|
|
55
|
+
hasWarned = true;
|
|
56
|
+
// eslint-disable-next-line no-console
|
|
57
|
+
console.warn('[Bloom] The adaptive palette fell back to the preset one: `expo-router`’s ' + '`Color` proxy could not be read, so platform colours (Material You, iOS ' + 'dynamic) are not in use. Install the optional peer ' + '(`npx expo install expo-router`) if you want them. ' + `Reason: ${reason}`);
|
|
58
|
+
}
|
|
41
59
|
function getAndroidColors() {
|
|
42
60
|
try {
|
|
43
|
-
if (typeof require === 'undefined')
|
|
61
|
+
if (typeof require === 'undefined') {
|
|
62
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
44
65
|
const {
|
|
45
66
|
Color
|
|
46
67
|
} = require('expo-router');
|
|
@@ -80,13 +101,17 @@ function getAndroidColors() {
|
|
|
80
101
|
shadow: 'rgba(0, 0, 0, 0.2)',
|
|
81
102
|
overlay: 'rgba(0, 0, 0, 0.5)'
|
|
82
103
|
};
|
|
83
|
-
} catch {
|
|
104
|
+
} catch (error) {
|
|
105
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
84
106
|
return null;
|
|
85
107
|
}
|
|
86
108
|
}
|
|
87
109
|
function getIOSColors() {
|
|
88
110
|
try {
|
|
89
|
-
if (typeof require === 'undefined')
|
|
111
|
+
if (typeof require === 'undefined') {
|
|
112
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
90
115
|
const {
|
|
91
116
|
Color
|
|
92
117
|
} = require('expo-router');
|
|
@@ -126,7 +151,8 @@ function getIOSColors() {
|
|
|
126
151
|
shadow: 'rgba(0, 0, 0, 0.15)',
|
|
127
152
|
overlay: 'rgba(0, 0, 0, 0.5)'
|
|
128
153
|
};
|
|
129
|
-
} catch {
|
|
154
|
+
} catch (error) {
|
|
155
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
130
156
|
return null;
|
|
131
157
|
}
|
|
132
158
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","c","v","getAndroidColors","require","Color","d","android","dynamic","background","surface","backgroundSecondary","surfaceContainerLow","backgroundTertiary","surfaceContainer","text","onSurface","textSecondary","onSurfaceVariant","textTertiary","outline","border","outlineVariant","borderLight","primary","primaryForeground","onPrimary","primaryLight","primaryContainer","primaryDark","onPrimaryContainer","secondary","secondaryForeground","onSecondary","tertiary","tertiaryForeground","onTertiary","tint","icon","iconActive","success","error","warning","info","primarySubtle","primarySubtleForeground","negative","negativeForeground","negativeSubtle","errorContainer","negativeSubtleForeground","onErrorContainer","contrast50","card","shadow","overlay","getIOSColors","i","ios","systemBackground","secondarySystemBackground","tertiarySystemBackground","label","secondaryLabel","tertiaryLabel","separator","opaqueSeparator","systemBlue","systemGray6","systemPurple","systemTeal","systemGreen","systemRed","systemOrange","getAdaptiveColors","OS"],"sourceRoot":"../../../src","sources":["theme/adaptive-colors.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAGvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,MAAMC,CAAC,GAAIC,CAAU,IAAaA,CAAW;AAE7C,SAASC,gBAAgBA,CAAA,EAA0B;EACjD,IAAI;IACF,IAAI,OAAOC,OAAO,KAAK,WAAW,EAAE,OAAO,IAAI;
|
|
1
|
+
{"version":3,"names":["Platform","c","v","hasWarned","warnAdaptiveColorsUnavailable","reason","process","env","NODE_ENV","console","warn","getAndroidColors","require","Color","d","android","dynamic","background","surface","backgroundSecondary","surfaceContainerLow","backgroundTertiary","surfaceContainer","text","onSurface","textSecondary","onSurfaceVariant","textTertiary","outline","border","outlineVariant","borderLight","primary","primaryForeground","onPrimary","primaryLight","primaryContainer","primaryDark","onPrimaryContainer","secondary","secondaryForeground","onSecondary","tertiary","tertiaryForeground","onTertiary","tint","icon","iconActive","success","error","warning","info","primarySubtle","primarySubtleForeground","negative","negativeForeground","negativeSubtle","errorContainer","negativeSubtleForeground","onErrorContainer","contrast50","card","shadow","overlay","Error","message","String","getIOSColors","i","ios","systemBackground","secondarySystemBackground","tertiarySystemBackground","label","secondaryLabel","tertiaryLabel","separator","opaqueSeparator","systemBlue","systemGray6","systemPurple","systemTeal","systemGreen","systemRed","systemOrange","getAdaptiveColors","OS"],"sourceRoot":"../../../src","sources":["theme/adaptive-colors.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAGvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,MAAMC,CAAC,GAAIC,CAAU,IAAaA,CAAW;AAE7C,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,MAAc,EAAQ;EAC3D,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIL,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACAM,OAAO,CAACC,IAAI,CACV,4EAA4E,GAC1E,0EAA0E,GAC1E,qDAAqD,GACrD,qDAAqD,GACrD,WAAWL,MAAM,EACrB,CAAC;AACH;AAEA,SAASM,gBAAgBA,CAAA,EAA0B;EACjD,IAAI;IACF,IAAI,OAAOC,OAAO,KAAK,WAAW,EAAE;MAClCR,6BAA6B,CAAC,uCAAuC,CAAC;MACtE,OAAO,IAAI;IACb;IACA,MAAM;MAAES;IAAM,CAAC,GAAGD,OAAO,CAAC,aAAa,CAAC;IACxC,MAAME,CAAC,GAAGD,KAAK,CAACE,OAAO,CAACC,OAAO;IAC/B,OAAO;MACLC,UAAU,EAAEhB,CAAC,CAACa,CAAC,CAACI,OAAO,CAAC;MACxBC,mBAAmB,EAAElB,CAAC,CAACa,CAAC,CAACM,mBAAmB,CAAC;MAC7CC,kBAAkB,EAAEpB,CAAC,CAACa,CAAC,CAACQ,gBAAgB,CAAC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AC;MAC5BlB,IAAI,EAAE5D,CAAC,CAACmE,CAAC,CAACG,yBAAyB,CAAC;MACpCT,MAAM,EAAE,qBAAqB;MAC7BC,OAAO,EAAE;IACX,CAAC;EACH,CAAC,CAAC,OAAOd,KAAK,EAAE;IACd7C,6BAA6B,CAAC6C,KAAK,YAAYe,KAAK,GAAGf,KAAK,CAACgB,OAAO,GAAGC,MAAM,CAACjB,KAAK,CAAC,CAAC;IACrF,OAAO,IAAI;EACb;AACF;AAEA,OAAO,SAASoC,iBAAiBA,CAAA,EAA0B;EACzD,IAAIrF,QAAQ,CAACsF,EAAE,KAAK,SAAS,EAAE,OAAO3E,gBAAgB,CAAC,CAAC;EACxD,IAAIX,QAAQ,CAACsF,EAAE,KAAK,KAAK,EAAE,OAAOnB,YAAY,CAAC,CAAC;EAChD,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.web.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.web.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,sBAAsB,GACvB,MAAM,8BAA8B,CAAC"}
|
|
@@ -57,6 +57,31 @@ export interface NetInfoStateLike {
|
|
|
57
57
|
export interface NetInfoLike {
|
|
58
58
|
addEventListener: (listener: (state: NetInfoStateLike) => void) => () => void;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
62
|
+
*
|
|
63
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
64
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
65
|
+
* bundler resolved, hands the module in.
|
|
66
|
+
*
|
|
67
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
68
|
+
* knowing because the symptom is identical while the cause is not:
|
|
69
|
+
*
|
|
70
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
71
|
+
* and the boundary degrades.
|
|
72
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
73
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
74
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
75
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
76
|
+
*
|
|
77
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
78
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
79
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
80
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
81
|
+
*
|
|
82
|
+
* Metro is unaffected either way and needs no binding.
|
|
83
|
+
*/
|
|
84
|
+
export declare function provideNetInfo(module: NetInfoLike | null): void;
|
|
60
85
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
61
86
|
export declare function loadNetInfo(): NetInfoLike | null;
|
|
62
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netinfo.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/netinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AASH,yDAAyD;AACzD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,mBAAmB,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CAC/E;
|
|
1
|
+
{"version":3,"file":"netinfo.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/netinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AASH,yDAAyD;AACzD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,mBAAmB,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CAC/E;AAUD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAI/D;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,WAAW,GAAG,IAAI,CAkChD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAa7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;AA+HF,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAIzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,sBAAsB,GACvB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.web.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.web.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,sBAAsB,GACvB,MAAM,8BAA8B,CAAC"}
|
|
@@ -57,6 +57,31 @@ export interface NetInfoStateLike {
|
|
|
57
57
|
export interface NetInfoLike {
|
|
58
58
|
addEventListener: (listener: (state: NetInfoStateLike) => void) => () => void;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
62
|
+
*
|
|
63
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
64
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
65
|
+
* bundler resolved, hands the module in.
|
|
66
|
+
*
|
|
67
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
68
|
+
* knowing because the symptom is identical while the cause is not:
|
|
69
|
+
*
|
|
70
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
71
|
+
* and the boundary degrades.
|
|
72
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
73
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
74
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
75
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
76
|
+
*
|
|
77
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
78
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
79
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
80
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
81
|
+
*
|
|
82
|
+
* Metro is unaffected either way and needs no binding.
|
|
83
|
+
*/
|
|
84
|
+
export declare function provideNetInfo(module: NetInfoLike | null): void;
|
|
60
85
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
61
86
|
export declare function loadNetInfo(): NetInfoLike | null;
|
|
62
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netinfo.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/netinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AASH,yDAAyD;AACzD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,mBAAmB,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CAC/E;
|
|
1
|
+
{"version":3,"file":"netinfo.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/netinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AASH,yDAAyD;AACzD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,mBAAmB,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CAC/E;AAUD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAI/D;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,WAAW,GAAG,IAAI,CAkChD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAa7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;AA+HF,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAIzD"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type { ConnectionStatusToastsProps } from './shared';
|
|
2
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
3
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
4
|
+
export { provideNetInfo, type NetInfoLike } from './netinfo';
|
|
2
5
|
export {
|
|
3
6
|
ConnectionStatusToasts,
|
|
4
7
|
} from './ConnectionStatusToasts';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type { ConnectionStatusToastsProps } from './shared';
|
|
2
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
3
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
4
|
+
export { provideNetInfo, type NetInfoLike } from './netinfo';
|
|
2
5
|
export {
|
|
3
6
|
ConnectionStatusToasts,
|
|
4
7
|
} from './ConnectionStatusToasts.web';
|
|
@@ -69,12 +69,45 @@ export interface NetInfoLike {
|
|
|
69
69
|
|
|
70
70
|
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
71
71
|
let netInfoModule: NetInfoLike | null | undefined;
|
|
72
|
+
/** Handed in by a consumer, which is the only thing that works in an ESM bundle. */
|
|
73
|
+
let providedModule: NetInfoLike | null = null;
|
|
72
74
|
/** Why the load failed, quoted verbatim in the dev warning. */
|
|
73
75
|
let unavailableReason = '';
|
|
74
76
|
let hasWarned = false;
|
|
75
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
80
|
+
*
|
|
81
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
82
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
83
|
+
* bundler resolved, hands the module in.
|
|
84
|
+
*
|
|
85
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
86
|
+
* knowing because the symptom is identical while the cause is not:
|
|
87
|
+
*
|
|
88
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
89
|
+
* and the boundary degrades.
|
|
90
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
91
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
92
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
93
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
94
|
+
*
|
|
95
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
96
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
97
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
98
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
99
|
+
*
|
|
100
|
+
* Metro is unaffected either way and needs no binding.
|
|
101
|
+
*/
|
|
102
|
+
export function provideNetInfo(module: NetInfoLike | null): void {
|
|
103
|
+
providedModule = module;
|
|
104
|
+
netInfoModule = undefined;
|
|
105
|
+
hasWarned = false;
|
|
106
|
+
}
|
|
107
|
+
|
|
76
108
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
77
109
|
export function loadNetInfo(): NetInfoLike | null {
|
|
110
|
+
if (providedModule !== null) return providedModule;
|
|
78
111
|
if (netInfoModule !== undefined) return netInfoModule;
|
|
79
112
|
netInfoModule = null;
|
|
80
113
|
|
|
@@ -49,9 +49,37 @@ export type AdaptiveColors = Omit<
|
|
|
49
49
|
|
|
50
50
|
const c = (v: unknown): string => v as string;
|
|
51
51
|
|
|
52
|
+
let hasWarned = false;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* SAY SO. This boundary degraded in complete silence, which is the worst of the
|
|
56
|
+
* six: an app simply gets the preset palette instead of the platform's, and
|
|
57
|
+
* nothing anywhere says the platform read failed.
|
|
58
|
+
*
|
|
59
|
+
* It is only reachable on Android and iOS — `getAdaptiveColors` returns `null`
|
|
60
|
+
* on web before touching `require` — so an ESM bundle never gets here. That is
|
|
61
|
+
* an argument for warning, not against it: a failure that cannot happen in the
|
|
62
|
+
* environment you test in is exactly the one that goes unnoticed when it does.
|
|
63
|
+
*/
|
|
64
|
+
function warnAdaptiveColorsUnavailable(reason: string): void {
|
|
65
|
+
if (process.env.NODE_ENV === 'production' || hasWarned) return;
|
|
66
|
+
hasWarned = true;
|
|
67
|
+
// eslint-disable-next-line no-console
|
|
68
|
+
console.warn(
|
|
69
|
+
'[Bloom] The adaptive palette fell back to the preset one: `expo-router`’s ' +
|
|
70
|
+
'`Color` proxy could not be read, so platform colours (Material You, iOS ' +
|
|
71
|
+
'dynamic) are not in use. Install the optional peer ' +
|
|
72
|
+
'(`npx expo install expo-router`) if you want them. ' +
|
|
73
|
+
`Reason: ${reason}`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
52
77
|
function getAndroidColors(): AdaptiveColors | null {
|
|
53
78
|
try {
|
|
54
|
-
if (typeof require === 'undefined')
|
|
79
|
+
if (typeof require === 'undefined') {
|
|
80
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
55
83
|
const { Color } = require('expo-router');
|
|
56
84
|
const d = Color.android.dynamic;
|
|
57
85
|
return {
|
|
@@ -89,14 +117,18 @@ function getAndroidColors(): AdaptiveColors | null {
|
|
|
89
117
|
shadow: 'rgba(0, 0, 0, 0.2)',
|
|
90
118
|
overlay: 'rgba(0, 0, 0, 0.5)',
|
|
91
119
|
};
|
|
92
|
-
} catch {
|
|
120
|
+
} catch (error) {
|
|
121
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
93
122
|
return null;
|
|
94
123
|
}
|
|
95
124
|
}
|
|
96
125
|
|
|
97
126
|
function getIOSColors(): AdaptiveColors | null {
|
|
98
127
|
try {
|
|
99
|
-
if (typeof require === 'undefined')
|
|
128
|
+
if (typeof require === 'undefined') {
|
|
129
|
+
warnAdaptiveColorsUnavailable('this bundle has no CommonJS `require`');
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
100
132
|
const { Color } = require('expo-router');
|
|
101
133
|
const i = Color.ios;
|
|
102
134
|
return {
|
|
@@ -134,7 +166,8 @@ function getIOSColors(): AdaptiveColors | null {
|
|
|
134
166
|
shadow: 'rgba(0, 0, 0, 0.15)',
|
|
135
167
|
overlay: 'rgba(0, 0, 0, 0.5)',
|
|
136
168
|
};
|
|
137
|
-
} catch {
|
|
169
|
+
} catch (error) {
|
|
170
|
+
warnAdaptiveColorsUnavailable(error instanceof Error ? error.message : String(error));
|
|
138
171
|
return null;
|
|
139
172
|
}
|
|
140
173
|
}
|