@oxyhq/bloom 0.67.0 → 0.69.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/lib/commonjs/animated-check/AnimatedCheck.js +22 -93
- package/lib/commonjs/animated-check/AnimatedCheck.js.map +1 -1
- package/lib/commonjs/avatar/Avatar.js +6 -24
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/avatar/AvatarRing.js +14 -30
- package/lib/commonjs/avatar/AvatarRing.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.js +9 -4
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/connection-status/index.js +16 -7
- package/lib/commonjs/connection-status/index.js.map +1 -1
- package/lib/commonjs/connection-status/netinfo.js +119 -0
- package/lib/commonjs/connection-status/netinfo.js.map +1 -0
- package/lib/commonjs/hooks/haptics-module.js +109 -0
- package/lib/commonjs/hooks/haptics-module.js.map +1 -0
- package/lib/commonjs/hooks/useHaptics.js +6 -8
- package/lib/commonjs/hooks/useHaptics.js.map +1 -1
- package/lib/commonjs/loading/SpinnerIcon.js +22 -55
- package/lib/commonjs/loading/SpinnerIcon.js.map +1 -1
- package/lib/commonjs/theme/adaptive-colors.js +20 -4
- package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
- package/lib/commonjs/theme/color-scope/style-builder.js +107 -6
- package/lib/commonjs/theme/color-scope/style-builder.js.map +1 -1
- package/lib/commonjs/theme/init-css-interop.js +13 -11
- package/lib/commonjs/theme/init-css-interop.js.map +1 -1
- package/lib/commonjs/toast/Toaster.js +5 -0
- package/lib/commonjs/toast/Toaster.js.map +1 -1
- package/lib/commonjs/toast/use-single-outlet-guard.js +72 -0
- package/lib/commonjs/toast/use-single-outlet-guard.js.map +1 -0
- package/lib/module/animated-check/AnimatedCheck.js +22 -91
- package/lib/module/animated-check/AnimatedCheck.js.map +1 -1
- package/lib/module/avatar/Avatar.js +1 -19
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/avatar/AvatarRing.js +7 -23
- package/lib/module/avatar/AvatarRing.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +9 -4
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/connection-status/index.js +16 -6
- package/lib/module/connection-status/index.js.map +1 -1
- package/lib/module/connection-status/netinfo.js +114 -0
- package/lib/module/connection-status/netinfo.js.map +1 -0
- package/lib/module/hooks/haptics-module.js +104 -0
- package/lib/module/hooks/haptics-module.js.map +1 -0
- package/lib/module/hooks/useHaptics.js +7 -11
- package/lib/module/hooks/useHaptics.js.map +1 -1
- package/lib/module/loading/SpinnerIcon.js +13 -46
- package/lib/module/loading/SpinnerIcon.js.map +1 -1
- package/lib/module/loading/index.web.js +2 -2
- package/lib/module/theme/adaptive-colors.js +20 -4
- package/lib/module/theme/adaptive-colors.js.map +1 -1
- package/lib/module/theme/color-scope/style-builder.js +107 -6
- package/lib/module/theme/color-scope/style-builder.js.map +1 -1
- package/lib/module/theme/init-css-interop.js +13 -11
- package/lib/module/theme/init-css-interop.js.map +1 -1
- package/lib/module/toast/Toaster.js +5 -0
- package/lib/module/toast/Toaster.js.map +1 -1
- package/lib/module/toast/use-single-outlet-guard.js +65 -0
- package/lib/module/toast/use-single-outlet-guard.js.map +1 -0
- package/lib/typescript/commonjs/animated-check/AnimatedCheck.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/AvatarRing.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts +69 -0
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/haptics-module.d.ts +58 -0
- package/lib/typescript/commonjs/hooks/haptics-module.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useHaptics.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts +9 -2
- package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/init-css-interop.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/Toaster.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/use-single-outlet-guard.d.ts +9 -0
- package/lib/typescript/commonjs/toast/use-single-outlet-guard.d.ts.map +1 -0
- package/lib/typescript/module/animated-check/AnimatedCheck.d.ts.map +1 -1
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/avatar/AvatarRing.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/netinfo.d.ts +69 -0
- package/lib/typescript/module/connection-status/netinfo.d.ts.map +1 -0
- package/lib/typescript/module/hooks/haptics-module.d.ts +58 -0
- package/lib/typescript/module/hooks/haptics-module.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useHaptics.d.ts.map +1 -1
- package/lib/typescript/module/loading/SpinnerIcon.d.ts +9 -2
- package/lib/typescript/module/loading/SpinnerIcon.d.ts.map +1 -1
- package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/style-builder.d.ts.map +1 -1
- package/lib/typescript/module/theme/init-css-interop.d.ts.map +1 -1
- package/lib/typescript/module/toast/Toaster.d.ts.map +1 -1
- package/lib/typescript/module/toast/use-single-outlet-guard.d.ts +9 -0
- package/lib/typescript/module/toast/use-single-outlet-guard.d.ts.map +1 -0
- package/package.json +348 -88
- package/src/__tests__/color-scope-nativewind.test.ts +135 -0
- package/src/__tests__/connection-status-netinfo.test.tsx +203 -0
- package/src/__tests__/exports-map-contract.test.ts +112 -0
- package/src/__tests__/optional-peer-imports.test.ts +406 -0
- package/src/__tests__/svg-required-peer.test.tsx +75 -0
- package/src/__tests__/toast-single-outlet-guard.test.tsx +176 -0
- package/src/__tests__/useHaptics.test.tsx +203 -16
- package/src/animated-check/AnimatedCheck.tsx +19 -86
- package/src/avatar/Avatar.tsx +1 -11
- package/src/avatar/AvatarRing.tsx +7 -15
- package/src/bottom-sheet/index.tsx +9 -4
- package/src/connection-status/index.tsx +16 -6
- package/src/connection-status/netinfo.ts +131 -0
- package/src/hooks/haptics-module.ts +118 -0
- package/src/hooks/useHaptics.tsx +6 -9
- package/src/loading/SpinnerIcon.tsx +13 -52
- package/src/loading/index.web.ts +2 -2
- package/src/theme/adaptive-colors.ts +20 -4
- package/src/theme/color-scope/style-builder.ts +118 -6
- package/src/theme/init-css-interop.ts +13 -11
- package/src/toast/Toaster.tsx +6 -0
- package/src/toast/use-single-outlet-guard.ts +72 -0
- package/lib/commonjs/avatar/svg-module.js +0 -15
- package/lib/commonjs/avatar/svg-module.js.map +0 -1
- package/lib/commonjs/utils/lazy-require.js +0 -37
- package/lib/commonjs/utils/lazy-require.js.map +0 -1
- package/lib/module/avatar/svg-module.js +0 -11
- package/lib/module/avatar/svg-module.js.map +0 -1
- package/lib/module/utils/lazy-require.js +0 -33
- package/lib/module/utils/lazy-require.js.map +0 -1
- package/lib/typescript/commonjs/avatar/svg-module.d.ts +0 -8
- package/lib/typescript/commonjs/avatar/svg-module.d.ts.map +0 -1
- package/lib/typescript/commonjs/utils/lazy-require.d.ts +0 -15
- package/lib/typescript/commonjs/utils/lazy-require.d.ts.map +0 -1
- package/lib/typescript/module/avatar/svg-module.d.ts +0 -8
- package/lib/typescript/module/avatar/svg-module.d.ts.map +0 -1
- package/lib/typescript/module/utils/lazy-require.d.ts +0 -15
- package/lib/typescript/module/utils/lazy-require.d.ts.map +0 -1
- package/src/avatar/svg-module.ts +0 -11
- package/src/utils/lazy-require.ts +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","
|
|
1
|
+
{"version":3,"names":["React","useEffect","Animated","Easing","useAnimatedStyle","useSharedValue","withRepeat","withTiming","Svg","Rect","jsx","_jsx","jsxs","_jsxs","SpinnerIcon","color","size","className","style","rotation","value","duration","easing","linear","animatedStyle","transform","rotate","View","width","height","alignItems","justifyContent","children","viewBox","fill","opacity","rx","ry","x","y","displayName"],"sourceRoot":"../../../src","sources":["loading/SpinnerIcon.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,OAAOC,QAAQ,IACbC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,OAAOC,GAAG,IAAIC,IAAI,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAuC,GAAGA,CAAC;EACtDC,KAAK,GAAG,cAAc;EACtBC,IAAI,GAAG,EAAE;EACTC,SAAS;EACTC;AACF,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGd,cAAc,CAAC,CAAC,CAAC;EAElCJ,SAAS,CAAC,MAAM;IACdkB,QAAQ,CAACC,KAAK,GAAGd,UAAU,CACzBC,UAAU,CAAC,GAAG,EAAE;MAAEc,QAAQ,EAAE,GAAG;MAAEC,MAAM,EAAEnB,MAAM,CAACoB;IAAO,CAAC,CAAC,EACzD,CAAC,CAAC,EACF,KACF,CAAC;IACD;IACA;IACA;EACF,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA;EACA;EACA,MAAMC,aAAa,GAAGpB,gBAAgB,CAAC,OAAO;IAC5CqB,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE,GAAGP,QAAQ,CAACC,KAAK;IAAM,CAAC;EAChD,CAAC,CAAC,EAAE,CAACD,Q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AAC,EAAC,IAAI;QAACC,CAAC,EAAC;MAAI,CAAE,CAAC;IAAA,CACnH;EAAC,CACO,CAAC;AAEpB,CAAC;AAEDzB,WAAW,CAAC0B,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Web variant of the `./loading` barrel.
|
|
4
4
|
//
|
|
5
5
|
// The default barrel (`./index.ts`) re-exports from `./Loading` and
|
|
6
|
-
// `./SpinnerIcon`, which statically import `react-native-reanimated`
|
|
7
|
-
// `react-native-svg
|
|
6
|
+
// `./SpinnerIcon`, which statically import `react-native-reanimated` and
|
|
7
|
+
// `react-native-svg`. Reanimated has no web build — its worklets Babel plugin
|
|
8
8
|
// is native-only and importing it statically breaks every web bundler (Vite,
|
|
9
9
|
// webpack, Metro-web). The web forks (`./Loading.web`, `./SpinnerIcon.web`)
|
|
10
10
|
// render the same components with CSS keyframes/transitions and no native deps.
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
+
/**
|
|
5
|
+
* `expo-router`'s `Color` proxy is read through a `require()` of a STRING
|
|
6
|
+
* LITERAL as a direct statement of a `try` block — the shape Metro collects as
|
|
7
|
+
* an optional dependency, resolving the real module when installed and writing
|
|
8
|
+
* `null` into the dependency map when it is not, so an app without the optional
|
|
9
|
+
* `expo-router` peer loses the adaptive palette and nothing else.
|
|
10
|
+
*
|
|
11
|
+
* The specifier was previously bound to a local `const` first. That still
|
|
12
|
+
* worked — Metro evaluates the constant — but the literal is what the rule can
|
|
13
|
+
* be stated and checked as, and it does not rest on a constant-folding pass
|
|
14
|
+
* every bundler happens to share. What must never come back is a specifier
|
|
15
|
+
* Metro CANNOT evaluate (a function parameter, a computed value): it collects no
|
|
16
|
+
* dependency and rewrites the call into a thrower, so it resolves nothing on any
|
|
17
|
+
* device.
|
|
18
|
+
*
|
|
19
|
+
* @see connection-status/netinfo.ts — the same boundary, with the full rule.
|
|
20
|
+
*/
|
|
21
|
+
|
|
4
22
|
const c = v => v;
|
|
5
23
|
function getAndroidColors() {
|
|
6
24
|
try {
|
|
7
25
|
if (typeof require === 'undefined') return null;
|
|
8
|
-
const moduleName = 'expo-router';
|
|
9
26
|
const {
|
|
10
27
|
Color
|
|
11
|
-
} = require(
|
|
28
|
+
} = require('expo-router');
|
|
12
29
|
const d = Color.android.dynamic;
|
|
13
30
|
return {
|
|
14
31
|
background: c(d.surface),
|
|
@@ -52,10 +69,9 @@ function getAndroidColors() {
|
|
|
52
69
|
function getIOSColors() {
|
|
53
70
|
try {
|
|
54
71
|
if (typeof require === 'undefined') return null;
|
|
55
|
-
const moduleName = 'expo-router';
|
|
56
72
|
const {
|
|
57
73
|
Color
|
|
58
|
-
} = require(
|
|
74
|
+
} = require('expo-router');
|
|
59
75
|
const i = Color.ios;
|
|
60
76
|
return {
|
|
61
77
|
background: c(i.systemBackground),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","c","v","getAndroidColors","require","
|
|
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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CAAC;MACrBvB,aAAa,EAAE3C,CAAC,CAACwD,CAAC,CAACW,WAAW,CAAC;MAC/BvB,uBAAuB,EAAE5C,CAAC,CAACwD,CAAC,CAACU,UAAU,CAAC;MACxCrB,QAAQ,EAAE7C,CAAC,CAACwD,CAAC,CAACe,SAAS,CAAC;MACxBzB,kBAAkB,EAAE,SAAS;MAC7BC,cAAc,EAAE/C,CAAC,CAACwD,CAAC,CAACW,WAAW,CAAC;MAChClB,wBAAwB,EAAEjD,CAAC,CAACwD,CAAC,CAACe,SAAS,CAAC;MACxCpB,UAAU,EAAEnD,CAAC,CAACwD,CAAC,CAACW,WAAW,CAAC;MAC5Bf,IAAI,EAAEpD,CAAC,CAACwD,CAAC,CAACG,yBAAyB,CAAC;MACpCN,MAAM,EAAE,qBAAqB;MAC7BC,OAAO,EAAE;IACX,CAAC;EACH,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,OAAO,SAASmB,iBAAiBA,CAAA,EAAuB;EACtD,IAAI1E,QAAQ,CAAC2E,EAAE,KAAK,SAAS,EAAE,OAAOxE,gBAAgB,CAAC,CAAC;EACxD,IAAIH,QAAQ,CAAC2E,EAAE,KAAK,KAAK,EAAE,OAAOnB,YAAY,CAAC,CAAC;EAChD,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
4
|
import { CANONICAL_TOKENS, getResolvedTokens } from "../token-registry.js";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The optional-peer boundary for `nativewind`.
|
|
8
|
+
*
|
|
9
|
+
* The consumer's OWN nativewind has to be the one that answers: its version
|
|
10
|
+
* decides which var mechanism exists (`VariableContextProvider` under
|
|
11
|
+
* NativeWind 5 / react-native-css@3, `vars()` before it), and a scope built
|
|
12
|
+
* against a second copy would publish into a context nothing reads. That rules
|
|
13
|
+
* out reaching for Bloom's own `react-native-css` dependency, and an optional
|
|
14
|
+
* peer rules out a static import — Metro resolves those eagerly, so an app
|
|
15
|
+
* without nativewind would fail to BUILD rather than degrade.
|
|
16
|
+
*
|
|
17
|
+
* What is left is the one dynamic shape Metro understands: `require()` of a
|
|
18
|
+
* STRING LITERAL as a DIRECT statement of a `try` block, collected as an
|
|
19
|
+
* optional dependency. Both halves matter, and both were verified against metro
|
|
20
|
+
* 0.83.5's own `collectDependencies`:
|
|
21
|
+
*
|
|
22
|
+
* - The shape this replaced — the deleted `utils/lazy-require.ts`, which took
|
|
23
|
+
* the specifier as a function PARAMETER — is not statically evaluable, so
|
|
24
|
+
* Metro collected no dependency at all and rewrote the call into a thrower
|
|
25
|
+
* ("Dynamic require defined at line N; not supported by Metro"). It resolved
|
|
26
|
+
* NOTHING from a consumer's `node_modules` whether or not nativewind was
|
|
27
|
+
* installed, and `BloomColorScope` could never scope NativeWind classes on a
|
|
28
|
+
* device.
|
|
29
|
+
* - `isOptionalDependency` returns at the first BlockStatement above the call,
|
|
30
|
+
* so one `if`/`else` of nesting inside the try loses the optional marking and
|
|
31
|
+
* an absent nativewind fails the BUILD. Hence the `typeof require` guard
|
|
32
|
+
* below sits outside the try.
|
|
33
|
+
*
|
|
34
|
+
* `require` may not exist at all (this file also backs the `import` condition,
|
|
35
|
+
* i.e. an ESM build under Node), hence that guard. Both callers below return
|
|
36
|
+
* before loading on web, where the vars are written to `document.documentElement`
|
|
37
|
+
* instead.
|
|
38
|
+
*
|
|
39
|
+
* @see connection-status/netinfo.ts — the same boundary for netinfo.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Declared locally rather than taken from the ambient `NodeRequire`, which
|
|
44
|
+
* returns `any`: `unknown` forces the module handle to be narrowed below instead
|
|
45
|
+
* of leaking an untyped value into the caller.
|
|
46
|
+
*/
|
|
6
47
|
|
|
7
48
|
/**
|
|
8
49
|
* Component that provides inline CSS variables to a subtree via NativeWind's
|
|
@@ -11,7 +52,57 @@ import { lazyRequire } from "../../utils/lazy-require.js";
|
|
|
11
52
|
* record produced by `buildScopeVars`.
|
|
12
53
|
*/
|
|
13
54
|
|
|
14
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The slice of nativewind's surface Bloom uses. Hand-written so no nativewind
|
|
57
|
+
* type reaches Bloom's emitted declarations — a consumer that skips the optional
|
|
58
|
+
* peer must not inherit a TS7016 from Bloom's own `.d.ts`.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
62
|
+
let nativeWindModule;
|
|
63
|
+
/** Why the scope cannot be applied, quoted verbatim in the dev warning. */
|
|
64
|
+
let unavailableReason = '';
|
|
65
|
+
let hasWarned = false;
|
|
66
|
+
|
|
67
|
+
/** The nativewind module, or `null` when the optional peer is not installed. */
|
|
68
|
+
function loadNativeWindVars() {
|
|
69
|
+
if (nativeWindModule !== undefined) return nativeWindModule;
|
|
70
|
+
nativeWindModule = null;
|
|
71
|
+
|
|
72
|
+
// The `typeof require` guard sits OUTSIDE the try on purpose — see the second
|
|
73
|
+
// constraint above. Nested one `if`/`else` deeper, the require stops counting
|
|
74
|
+
// as optional and an app without nativewind fails to BUILD.
|
|
75
|
+
if (typeof require === 'undefined') {
|
|
76
|
+
unavailableReason = 'this bundle has no CommonJS `require`';
|
|
77
|
+
return nativeWindModule;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const loaded = require('nativewind');
|
|
81
|
+
if (typeof loaded?.vars === 'function') {
|
|
82
|
+
nativeWindModule = loaded;
|
|
83
|
+
} else {
|
|
84
|
+
unavailableReason = 'the module resolved without a `vars` export';
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
unavailableReason = error instanceof Error ? error.message : String(error);
|
|
88
|
+
}
|
|
89
|
+
return nativeWindModule;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* One warning per module lifetime, and none in production — the same mechanism
|
|
94
|
+
* as `connection-status/netinfo.ts`. A scope that does not scope is invisible:
|
|
95
|
+
* the subtree keeps rendering, just in the app-wide palette instead of the
|
|
96
|
+
* requested one.
|
|
97
|
+
*/
|
|
98
|
+
function warnScopeInert(detail) {
|
|
99
|
+
if (process.env.NODE_ENV === 'production' || hasWarned) return;
|
|
100
|
+
hasWarned = true;
|
|
101
|
+
// Internal Bloom diagnostic: only the consumer's package.json can fix this,
|
|
102
|
+
// so it names the package and the install command.
|
|
103
|
+
// eslint-disable-next-line no-console
|
|
104
|
+
console.warn(`[Bloom] BloomColorScope cannot scope NativeWind classes on native: ${detail} ` + 'Descendants keep resolving `var(--primary)` and friends against the ' + 'app-wide preset. Install the optional peer (`npx expo install nativewind`) ' + `to enable scoped presets. Reason: ${unavailableReason}`);
|
|
105
|
+
}
|
|
15
106
|
|
|
16
107
|
/**
|
|
17
108
|
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
@@ -52,8 +143,15 @@ export function buildScopeVars(colorPreset, mode, accents) {
|
|
|
52
143
|
*/
|
|
53
144
|
export function getVariableContextProvider() {
|
|
54
145
|
if (Platform.OS === 'web') return null;
|
|
55
|
-
const module =
|
|
56
|
-
if (!module
|
|
146
|
+
const module = loadNativeWindVars();
|
|
147
|
+
if (!module) {
|
|
148
|
+
warnScopeInert('the optional peer `nativewind` could not be loaded.');
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (typeof module.VariableContextProvider !== 'function') {
|
|
152
|
+
warnScopeInert('the installed `nativewind` exports no `VariableContextProvider` (the ' + 'NativeWind 5 / react-native-css@3 API this needs).');
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
57
155
|
return module.VariableContextProvider;
|
|
58
156
|
}
|
|
59
157
|
|
|
@@ -72,8 +170,11 @@ export function getVariableContextProvider() {
|
|
|
72
170
|
*/
|
|
73
171
|
export function buildNativePresetStyle(colorPreset, mode) {
|
|
74
172
|
if (Platform.OS === 'web') return undefined;
|
|
75
|
-
const module =
|
|
76
|
-
if (!module
|
|
173
|
+
const module = loadNativeWindVars();
|
|
174
|
+
if (!module) {
|
|
175
|
+
warnScopeInert('the optional peer `nativewind` could not be loaded.');
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
77
178
|
return module.vars(buildScopeVars(colorPreset, mode));
|
|
78
179
|
}
|
|
79
180
|
//# sourceMappingURL=style-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","CANONICAL_TOKENS","getResolvedTokens","
|
|
1
|
+
{"version":3,"names":["Platform","CANONICAL_TOKENS","getResolvedTokens","nativeWindModule","unavailableReason","hasWarned","loadNativeWindVars","undefined","require","loaded","vars","error","Error","message","String","warnScopeInert","detail","process","env","NODE_ENV","console","warn","buildScopeVars","colorPreset","mode","accents","tokens","token","value","getVariableContextProvider","OS","module","VariableContextProvider","buildNativePresetStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;AACA,SAASA,QAAQ,QAAwC,cAAc;AAEvE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,sBAAmB;;AAIvE;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;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;;AAMA;AACA,IAAIC,gBAAyD;AAC7D;AACA,IAAIC,iBAAiB,GAAG,EAAE;AAC1B,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA,SAASC,kBAAkBA,CAAA,EAAgC;EACzD,IAAIH,gBAAgB,KAAKI,SAAS,EAAE,OAAOJ,gBAAgB;EAC3DA,gBAAgB,GAAG,IAAI;;EAEvB;EACA;EACA;EACA,IAAI,OAAOK,OAAO,KAAK,WAAW,EAAE;IAClCJ,iBAAiB,G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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmB,0BAA0BA,CAAA,EAA4C;EACpF,IAAI7B,QAAQ,CAAC8B,EAAE,KAAK,KAAK,EAAE,OAAO,IAAI;EACtC,MAAMC,MAAM,GAAGzB,kBAAkB,CAAC,CAAC;EACnC,IAAI,CAACyB,MAAM,EAAE;IACXhB,cAAc,CAAC,qDAAqD,CAAC;IACrE,OAAO,IAAI;EACb;EACA,IAAI,OAAOgB,MAAM,CAACC,uBAAuB,KAAK,UAAU,EAAE;IACxDjB,cAAc,CACZ,uEAAuE,GACrE,oDACJ,CAAC;IACD,OAAO,IAAI;EACb;EACA,OAAOgB,MAAM,CAACC,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCV,WAAyB,EACzBC,IAAsB,EACA;EACtB,IAAIxB,QAAQ,CAAC8B,EAAE,KAAK,KAAK,EAAE,OAAOvB,SAAS;EAC3C,MAAMwB,MAAM,GAAGzB,kBAAkB,CAAC,CAAC;EACnC,IAAI,CAACyB,MAAM,EAAE;IACXhB,cAAc,CAAC,qDAAqD,CAAC;IACrE,OAAOR,SAAS;EAClB;EACA,OAAOwB,MAAM,CAACrB,IAAI,CAACY,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
|
|
@@ -66,20 +66,22 @@ function tryCallSetFlag() {
|
|
|
66
66
|
let mod;
|
|
67
67
|
// `require` does not exist in an ES module, so guard before touching it —
|
|
68
68
|
// an unguarded reference is a ReferenceError, not a resolution failure.
|
|
69
|
-
// Matches the pattern used by every other optional-module load in Bloom
|
|
70
|
-
// (`utils/lazy-require.ts`, `theme/adaptive-colors.ts`,
|
|
71
|
-
// `bottom-sheet/index.tsx`).
|
|
72
69
|
if (typeof require === 'undefined') return;
|
|
73
70
|
try {
|
|
74
|
-
// Dynamic require: css-interop is
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
71
|
+
// Dynamic require: css-interop is neither a Bloom dependency nor a declared
|
|
72
|
+
// peer. The specifier goes through a variable to keep a plain-text
|
|
73
|
+
// `require('react-native-css-interop')` out of the file, so bundlers that
|
|
74
|
+
// scan for one do not try to resolve (and warn about, or fail on) a module
|
|
75
|
+
// Bloom never asked for.
|
|
78
76
|
//
|
|
79
|
-
//
|
|
80
|
-
// `
|
|
81
|
-
//
|
|
82
|
-
//
|
|
77
|
+
// Metro is not among them: its dependency collector EVALUATES the argument,
|
|
78
|
+
// folds this `const`, and treats the call exactly as it would a literal —
|
|
79
|
+
// optional, because it is a direct statement of a `try` block. So the
|
|
80
|
+
// indirection buys nothing under Metro and costs nothing either. It is not a
|
|
81
|
+
// pattern to copy: a specifier Metro cannot evaluate (a function parameter,
|
|
82
|
+
// a computed value) collects no dependency at all and is rewritten into a
|
|
83
|
+
// thrower, which is how `lazyRequire` silently killed four subsystems. See
|
|
84
|
+
// `connection-status/netinfo.ts` for the shape a real peer must use.
|
|
83
85
|
const moduleName = 'react-native-css-interop';
|
|
84
86
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
85
87
|
mod = require(moduleName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","initialized","warned","CSS_VAR_NAME","CSS_VAR_VALUE","warnOnce","message","error","console","warn","setWebCssVariable","document","root","documentElement","current","style","getPropertyValue","setProperty","tryCallSetFlag","mod","require","moduleName","setFlag","StyleSheet","call","initCssInteropDarkMode","OS"],"sourceRoot":"../../../src","sources":["theme/init-css-interop.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;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,IAAIC,WAAW,GAAG,KAAK;AACvB,IAAIC,MAAM,GAAG,KAAK;AAElB,MAAMC,YAAY,GAAG,wBAAwB;AAC7C,MAAMC,aAAa,GAAG,YAAY;AAUlC,SAASC,QAAQA,CAACC,OAAe,EAAEC,KAAe,EAAQ;EACxD,IAAIL,MAAM,EAAE;EACZA,MAAM,GAAG,IAAI;EACb;EACA;EACA;EACAM,OAAO,CAACC,IAAI,CAAC,WAAWH,OAAO,EAAE,EAAEC,KAAK,IAAI,EAAE,CAAC;AACjD;AAEA,SAASG,iBAAiBA,CAAA,EAAS;EACjC,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;EACrC,MAAMC,IAAI,GAAGD,QAAQ,CAACE,eAAe;EACrC,IAAI,CAACD,IAAI,EAAE;EACX;EACA;EACA;EACA,MAAME,OAAO,GAAGF,IAAI,CAACG,KAAK,CAACC,gBAAgB,CAACb,YAAY,CAAC;EACzD,IAAIW,OAAO,EAAE;EACbF,IAAI,CAACG,KAAK,CAACE,WAAW,CAACd,YAAY,EAAEC,aAAa,CAAC;AACrD;AAEA,SAASc,cAAcA,CAAA,EAAS;EAC9B,IAAIC,GAAiC;EACrC;EACA;EACA
|
|
1
|
+
{"version":3,"names":["Platform","initialized","warned","CSS_VAR_NAME","CSS_VAR_VALUE","warnOnce","message","error","console","warn","setWebCssVariable","document","root","documentElement","current","style","getPropertyValue","setProperty","tryCallSetFlag","mod","require","moduleName","setFlag","StyleSheet","call","initCssInteropDarkMode","OS"],"sourceRoot":"../../../src","sources":["theme/init-css-interop.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;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,IAAIC,WAAW,GAAG,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0EAA0E,GACxE,kDAAkD,EACpDE,KACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASkB,sBAAsBA,CAAA,EAAS;EAC7C,IAAIxB,WAAW,EAAE;EACjBA,WAAW,GAAG,IAAI;EAElB,IAAID,QAAQ,CAAC0B,EAAE,KAAK,KAAK,EAAE;IACzBhB,iBAAiB,CAAC,CAAC;EACrB;EAEAQ,cAAc,CAAC,CAAC;AAClB;;AAEA;AACA;AACA;AACAO,sBAAsB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -24,6 +24,7 @@ import { ToastHost } from './ToastHost';
|
|
|
24
24
|
import { ToastRow } from "./ToastRow.js";
|
|
25
25
|
import { toastStore } from "./toast-store.js";
|
|
26
26
|
import { useAppStateChange } from "./use-app-state.js";
|
|
27
|
+
import { useSingleOutletGuard } from "./use-single-outlet-guard.js";
|
|
27
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
29
|
const ALL_POSITIONS = ['top-center', 'bottom-center', 'center'];
|
|
29
30
|
|
|
@@ -65,6 +66,10 @@ export const Toaster = ({
|
|
|
65
66
|
style,
|
|
66
67
|
styles: styleOverrides
|
|
67
68
|
}) => {
|
|
69
|
+
// Before any early return, and independent of whether a toast is up: a second
|
|
70
|
+
// outlet duplicates every row from the moment it mounts, not from the first
|
|
71
|
+
// toast, so the warning must not wait for one.
|
|
72
|
+
useSingleOutletGuard();
|
|
68
73
|
const {
|
|
69
74
|
toasts,
|
|
70
75
|
shouldShowOverlay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","toastDefaults","DynamicToastContext","ToastContext","getOrderedToastIds","Positioner","ToastHost","ToastRow","toastStore","useAppStateChange","jsx","_jsx","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","offset","visibleToasts","swipeToDismissDirection","closeButton","gap","theme","invert","richColors","enableStacking","autoWiggleOnUpdate","pauseWhenPageIsHidden","allowFontScaling","maxFontSizeMultiplier","toastOptions","icons","animation","unstyled","positionerStyle","style","styles","styleOverrides","shouldShowOverlay","toastHeights","isExpanded","useSyncExternalStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","set","onDismiss","id","dismissToast","children","Provider","value","Array","from","currentPosition","toastsForPosition","orderedToastIds","map","index","row","numberOfToasts","ref","getToastRef","toastId","displayName"],"sourceRoot":"../../../src","sources":["toast/Toaster.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,aAAa,QAAQ,gBAAa;AAC3C,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,cAAW;AAC7D,SAASC,kBAAkB,QAAQ,qBAAkB;AACrD,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,UAAU,QAAQ,kBAAe;AAQ1C,SAASC,iBAAiB,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","toastDefaults","DynamicToastContext","ToastContext","getOrderedToastIds","Positioner","ToastHost","ToastRow","toastStore","useAppStateChange","useSingleOutletGuard","jsx","_jsx","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","offset","visibleToasts","swipeToDismissDirection","closeButton","gap","theme","invert","richColors","enableStacking","autoWiggleOnUpdate","pauseWhenPageIsHidden","allowFontScaling","maxFontSizeMultiplier","toastOptions","icons","animation","unstyled","positionerStyle","style","styles","styleOverrides","shouldShowOverlay","toastHeights","isExpanded","useSyncExternalStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","set","onDismiss","id","dismissToast","children","Provider","value","Array","from","currentPosition","toastsForPosition","orderedToastIds","map","index","row","numberOfToasts","ref","getToastRef","toastId","displayName"],"sourceRoot":"../../../src","sources":["toast/Toaster.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,aAAa,QAAQ,gBAAa;AAC3C,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,cAAW;AAC7D,SAASC,kBAAkB,QAAQ,qBAAkB;AACrD,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,UAAU,QAAQ,kBAAe;AAQ1C,SAASC,iBAAiB,QAAQ,oBAAiB;AACnD,SAASC,oBAAoB,QAAQ,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjE,MAAMC,aAA8B,GAAG,CACrC,YAAY,EACZ,eAAe,EACf,QAAQ,CACT;;AAED;AACA,MAAMC,mBAA8D,GAAG,CAAC,CAAC;AACzE,MAAMC,WAA+C,GAAG,CAAC,CAAC;AAC1D,MAAMC,eAAuD,GAAG,CAAC,CAAC;;AAElE;AACA;AACA;AACA;AACA,SAASC,uBAAuBA,CAC9BC,MAAoB,EACpBC,QAAuB,EACT;EACd,OAAOA,QAAQ,KAAK,YAAY,GAAGD,MAAM,CAACE,KAAK,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAGH,MAAM;AACtE;AAEA,OAAO,MAAM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3
|
+
/**
|
|
4
|
+
* Bloom-original — the dev-only guard against a SECOND toast outlet.
|
|
5
|
+
*
|
|
6
|
+
* Every `Toaster` subscribes to the ONE module-level `toastStore`, which has no
|
|
7
|
+
* notion of an owning outlet, so N mounted outlets each render the full row set:
|
|
8
|
+
* a toast appears N times. Nothing in the engine can dedupe that — the outlets
|
|
9
|
+
* are legitimate, independent subscribers — so the contract is "mount exactly
|
|
10
|
+
* one" and this is what enforces it.
|
|
11
|
+
*
|
|
12
|
+
* WHY A WARNING IS WORTH ITS WEIGHT: the copies are not visually separated, so
|
|
13
|
+
* the defect does not look like duplication. Two bare outlets take identical
|
|
14
|
+
* defaults and land pixel-identical; two outlets whose `offset` differs by a
|
|
15
|
+
* point land 1px apart. Only counting the rendered rows reveals it, which is not
|
|
16
|
+
* something anyone thinks to do — the reports this guard comes from all read as
|
|
17
|
+
* "the toast looks wrong", never as "there are two of them". Stacking is on by
|
|
18
|
+
* default, so a duplicate outlet now doubles the rows INSIDE a stack.
|
|
19
|
+
*
|
|
20
|
+
* The counter is decremented on unmount, so a remount, a route change that moves
|
|
21
|
+
* the outlet, Fast Refresh and React's StrictMode double-invoke (setup, cleanup,
|
|
22
|
+
* setup) all pass through a count of 1 and stay silent. The latch keeps the
|
|
23
|
+
* warning to exactly one per module lifetime rather than one per extra outlet,
|
|
24
|
+
* and — because StrictMode replays the setups — one per app, not two.
|
|
25
|
+
*
|
|
26
|
+
* Gated on `process.env.NODE_ENV`, the same mechanism as
|
|
27
|
+
* `content-panel/nesting-context.ts`: Metro and Vite/Rolldown both fold it
|
|
28
|
+
* statically, so production keeps the counter, the branch and the message out of
|
|
29
|
+
* the bundle entirely. Deliberately NOT `__DEV__`, which is a Metro global that a
|
|
30
|
+
* plain web bundler does not define. It only ever warns — a duplicate outlet
|
|
31
|
+
* renders a redundant toast, it does not break the app, so it must never throw.
|
|
32
|
+
*/
|
|
33
|
+
import * as React from 'react';
|
|
34
|
+
let mountedOutlets = 0;
|
|
35
|
+
let hasWarned = false;
|
|
36
|
+
export function useSingleOutletGuard() {
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (process.env.NODE_ENV === 'production') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
mountedOutlets += 1;
|
|
42
|
+
if (mountedOutlets > 1 && !hasWarned) {
|
|
43
|
+
hasWarned = true;
|
|
44
|
+
// Internal Bloom diagnostic: the consumer's tree is the only place this
|
|
45
|
+
// can be fixed, so it names the usual cause rather than just the symptom.
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.warn(`[Bloom] Toaster: ${mountedOutlets} toast outlets are mounted, so every ` + 'toast renders once per outlet. The copies overlap almost exactly, so ' + 'this reads as a rendering glitch rather than as duplicate rows. Mount ' + "exactly one: @oxyhq/services' OxyProvider already renders a " + 'ToastOutlet, so an app that uses it must not render its own.');
|
|
48
|
+
}
|
|
49
|
+
return () => {
|
|
50
|
+
mountedOutlets -= 1;
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Test-only reset: both the counter and the one-shot latch are module state that
|
|
57
|
+
* outlives a render tree, so without this the first suite to mount two outlets
|
|
58
|
+
* would latch the warning and leave every later suite asserting against a guard
|
|
59
|
+
* that can no longer fire — passing whatever the implementation did.
|
|
60
|
+
*/
|
|
61
|
+
export function resetSingleOutletGuardForTests() {
|
|
62
|
+
mountedOutlets = 0;
|
|
63
|
+
hasWarned = false;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=use-single-outlet-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","mountedOutlets","hasWarned","useSingleOutletGuard","useEffect","process","env","NODE_ENV","console","warn","resetSingleOutletGuardForTests"],"sourceRoot":"../../../src","sources":["toast/use-single-outlet-guard.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,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,IAAIC,cAAc,GAAG,CAAC;AACtB,IAAIC,SAAS,GAAG,KAAK;AAErB,OAAO,SAASC,oBAAoBA,CAAA,EAAS;EAC3CH,KAAK,CAACI,SAAS,CAAC,MAAM;IACpB,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;MACzC;IACF;IAEAN,cAAc,IAAI,CAAC;IACnB,IAAIA,cAAc,GAAG,CAAC,IAAI,CAACC,SAAS,EAAE;MACpCA,SAAS,GAAG,IAAI;MAChB;MACA;MACA;MACAM,OAAO,CAACC,IAAI,CACV,oBAAoBR,cAAc,uCAAuC,GACvE,uEAAuE,GACvE,wEAAwE,GACxE,8DAA8D,GAC9D,8DACJ,CAAC;IACH;IAEA,OAAO,MAAM;MACXA,cAAc,IAAI,CAAC;IACrB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,8BAA8BA,CAAA,EAAS;EACrDT,cAAc,GAAG,CAAC;EAClBC,SAAS,GAAG,KAAK;AACnB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedCheck.d.ts","sourceRoot":"","sources":["../../../../src/animated-check/AnimatedCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AnimatedCheck.d.ts","sourceRoot":"","sources":["../../../../src/animated-check/AnimatedCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AA4B5E,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD;;;;GAIG;AACH,eAAO,MAAM,aAAa,6FAyDzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../src/avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAY/D,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AAoX7D,eAAO,MAAM,MAAM,yCAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarRing.d.ts","sourceRoot":"","sources":["../../../../src/avatar/AvatarRing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAM7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOxE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,UAAU,eAAe;IACvB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,uDAAuD;IACvD,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,iBAAiB,EAAE,2BAA2B,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"AvatarRing.d.ts","sourceRoot":"","sources":["../../../../src/avatar/AvatarRing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAM7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOxE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,UAAU,eAAe;IACvB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,uDAAuD;IACvD,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,iBAAiB,EAAE,2BAA2B,CAAC;CAChD;AA2HD,eAAO,MAAM,UAAU,6CAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bottom-sheet/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEtB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bottom-sheet/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEtB,MAAM,mBAAmB,CAAC;AAmF3B,QAAA,MAAM,WAAW,yFAEf,CAAC;AAUH,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC;AACjD,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/connection-status/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAA6B,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAEvF,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAE5D,mDAAmD;AACnD,wBAAgB,sBAAsB,CAAC,KAAK,GAAE,2BAAgC,GAAG,IAAI,CAsBpF;yBAtBe,sBAAsB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional-peer boundary for `@react-native-community/netinfo`.
|
|
3
|
+
*
|
|
4
|
+
* netinfo is an OPTIONAL peer, and a static `import` contradicts that: an
|
|
5
|
+
* optional peer that is omitted does not degrade, it fails to RESOLVE, and Metro
|
|
6
|
+
* aborts the whole bundle with `Unable to resolve module
|
|
7
|
+
* @react-native-community/netinfo` — naming a package the app never mentions.
|
|
8
|
+
* Bloom's other optional-peer static imports are immune by accident (`expo-font`
|
|
9
|
+
* ships inside `expo`; `react-dom` is required by react-native-web), but netinfo
|
|
10
|
+
* arrives with nothing, so for this one the failure is real.
|
|
11
|
+
*
|
|
12
|
+
* Metro treats a `require()` of a STRING LITERAL inside a `try` block as an
|
|
13
|
+
* optional dependency: it resolves the real module when installed, and writes
|
|
14
|
+
* `null` into the dependency map when it is not, so the failure moves from build
|
|
15
|
+
* time to the `catch` below. Three constraints the shape has to respect, each
|
|
16
|
+
* checked against metro 0.83.5's own `collectDependencies`:
|
|
17
|
+
*
|
|
18
|
+
* - The specifier must be STATICALLY EVALUABLE, and a literal is the only form
|
|
19
|
+
* worth relying on. Metro rewrites a require it cannot evaluate — the
|
|
20
|
+
* specifier arriving as a function parameter, say — into a thrower ("Dynamic
|
|
21
|
+
* require defined at line N; not supported by Metro"), collecting no
|
|
22
|
+
* dependency at all, so it resolves nothing whether or not the package is
|
|
23
|
+
* installed. That is the defect that made Bloom's haptics, spinner and
|
|
24
|
+
* native color scoping silently dead before it was swept out.
|
|
25
|
+
* - The require must be a DIRECT statement of the try block.
|
|
26
|
+
* `isOptionalDependency` walks up from the call and returns at the first
|
|
27
|
+
* BlockStatement it meets, marking the dependency optional only if that
|
|
28
|
+
* block belongs to a `try`. One `if`/`else` of nesting is enough to lose it,
|
|
29
|
+
* and a non-optional dependency that cannot be resolved fails the BUILD —
|
|
30
|
+
* precisely what this boundary exists to avoid. Hence the `typeof require`
|
|
31
|
+
* guard below sits outside the try rather than inside it.
|
|
32
|
+
* - `require` may not exist at all (this file also backs the `import`
|
|
33
|
+
* condition, i.e. an ESM build under Node), hence that guard.
|
|
34
|
+
*
|
|
35
|
+
* The caller degrades to inert rather than throwing: an absent netinfo costs the
|
|
36
|
+
* outage toast and nothing else, and crashing an app root over a missing
|
|
37
|
+
* cosmetic affordance would be a worse trade than the build failure this
|
|
38
|
+
* replaces. The degradation is silent by construction — a connection toast that
|
|
39
|
+
* never appears looks exactly like a connection that never dropped — so
|
|
40
|
+
* {@link warnNetInfoUnavailable} names the missing package once, in dev.
|
|
41
|
+
*/
|
|
42
|
+
/** The slice of netinfo's state this component reads. */
|
|
43
|
+
export interface NetInfoStateLike {
|
|
44
|
+
isConnected: boolean | null;
|
|
45
|
+
isInternetReachable: boolean | null | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The slice of netinfo's module surface this component calls.
|
|
49
|
+
*
|
|
50
|
+
* Hand-written rather than `typeof import('@react-native-community/netinfo')` so
|
|
51
|
+
* no netinfo type reaches Bloom's emitted declarations — a consumer that skips
|
|
52
|
+
* the optional peer must not inherit a TS7016 from Bloom's own `.d.ts`. The two
|
|
53
|
+
* are kept in step by the assignability check in
|
|
54
|
+
* `__tests__/connection-status-netinfo.test.tsx`, which is excluded from the
|
|
55
|
+
* build and so may name the real package.
|
|
56
|
+
*/
|
|
57
|
+
export interface NetInfoLike {
|
|
58
|
+
addEventListener: (listener: (state: NetInfoStateLike) => void) => () => void;
|
|
59
|
+
}
|
|
60
|
+
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
61
|
+
export declare function loadNetInfo(): NetInfoLike | null;
|
|
62
|
+
/**
|
|
63
|
+
* One warning per module lifetime, and none in production — the same mechanism
|
|
64
|
+
* as `toast/use-single-outlet-guard.ts`. Metro and Vite/Rolldown both fold the
|
|
65
|
+
* `NODE_ENV` check statically, so a production bundle keeps neither the branch
|
|
66
|
+
* nor the message.
|
|
67
|
+
*/
|
|
68
|
+
export declare function warnNetInfoUnavailable(): void;
|
|
69
|
+
//# sourceMappingURL=netinfo.d.ts.map
|
|
@@ -0,0 +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;AAQD,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,WAAW,GAAG,IAAI,CAiChD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAa7C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional-peer boundary for `expo-haptics`.
|
|
3
|
+
*
|
|
4
|
+
* The load has to be dynamic — an optional peer that is omitted does not
|
|
5
|
+
* degrade when it is imported statically, it fails to RESOLVE and Metro aborts
|
|
6
|
+
* the whole bundle naming a package the app never mentions. But it also has to
|
|
7
|
+
* be dynamic in the ONE shape Metro understands: a `require()` of a STRING
|
|
8
|
+
* LITERAL inside a `try` block, which Metro collects as an optional dependency
|
|
9
|
+
* (resolving the real module when installed, writing `null` into the dependency
|
|
10
|
+
* map when it is not, so the failure lands in the `catch` below at evaluation
|
|
11
|
+
* time instead of at build time).
|
|
12
|
+
*
|
|
13
|
+
* The shape this replaced — the deleted `utils/lazy-require.ts`, which took the
|
|
14
|
+
* specifier as a function PARAMETER — satisfied neither. Metro can only collect
|
|
15
|
+
* a dependency whose specifier it can evaluate statically; a parameter it
|
|
16
|
+
* cannot, so it collected nothing and rewrote the call into a thrower ("Dynamic
|
|
17
|
+
* require defined at line N; not supported by Metro"). From a consumer's
|
|
18
|
+
* `node_modules` that resolved NOTHING, installed or not: `expo-haptics` was
|
|
19
|
+
* never loaded on any device and every haptic in Bloom was a silent no-op. It
|
|
20
|
+
* only ever worked under jest, which is CommonJS with a real dynamic `require`.
|
|
21
|
+
*
|
|
22
|
+
* `require` may also not exist at all (this file backs the `import` condition
|
|
23
|
+
* too, i.e. an ESM build under Node), hence the `typeof` guard.
|
|
24
|
+
*
|
|
25
|
+
* A missing haptic is invisible — indistinguishable from a device with haptics
|
|
26
|
+
* turned off — so {@link warnHapticsUnavailable} names the package once, in dev.
|
|
27
|
+
*
|
|
28
|
+
* @see connection-status/netinfo.ts — the same boundary for netinfo.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The slice of expo-haptics' module surface this hook calls.
|
|
32
|
+
*
|
|
33
|
+
* Hand-written rather than `typeof import('expo-haptics')` so no expo-haptics
|
|
34
|
+
* type reaches Bloom's emitted declarations — a consumer that skips the optional
|
|
35
|
+
* peer must not inherit a TS7016 from Bloom's own `.d.ts`. The two are kept in
|
|
36
|
+
* step by the assignability check in `__tests__/useHaptics.test.tsx`, which is
|
|
37
|
+
* excluded from the build and so may name the real package.
|
|
38
|
+
*
|
|
39
|
+
* `impactAsync` is declared in METHOD syntax deliberately: `strictFunctionTypes`
|
|
40
|
+
* exempts method parameters from contravariance, which is what keeps the real
|
|
41
|
+
* `(style?: ImpactFeedbackStyle) => Promise<void>` assignable to a `string`
|
|
42
|
+
* parameter here. The widening cannot admit a bad value in practice — the only
|
|
43
|
+
* arguments passed are read straight back out of `ImpactFeedbackStyle`.
|
|
44
|
+
*/
|
|
45
|
+
export interface HapticsLike {
|
|
46
|
+
ImpactFeedbackStyle: Record<'Light' | 'Medium' | 'Heavy', string>;
|
|
47
|
+
impactAsync(style?: string): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
/** The expo-haptics module, or `null` when the optional peer is not installed. */
|
|
50
|
+
export declare function loadHaptics(): HapticsLike | null;
|
|
51
|
+
/**
|
|
52
|
+
* One warning per module lifetime, and none in production — the same mechanism
|
|
53
|
+
* as `connection-status/netinfo.ts` and `toast/use-single-outlet-guard.ts`.
|
|
54
|
+
* Metro and Vite/Rolldown both fold the `NODE_ENV` check statically, so a
|
|
55
|
+
* production bundle keeps neither the branch nor the message.
|
|
56
|
+
*/
|
|
57
|
+
export declare function warnHapticsUnavailable(): void;
|
|
58
|
+
//# sourceMappingURL=haptics-module.d.ts.map
|