@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
|
@@ -8,7 +8,48 @@ exports.buildScopeVars = buildScopeVars;
|
|
|
8
8
|
exports.getVariableContextProvider = getVariableContextProvider;
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _tokenRegistry = require("../token-registry.js");
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The optional-peer boundary for `nativewind`.
|
|
13
|
+
*
|
|
14
|
+
* The consumer's OWN nativewind has to be the one that answers: its version
|
|
15
|
+
* decides which var mechanism exists (`VariableContextProvider` under
|
|
16
|
+
* NativeWind 5 / react-native-css@3, `vars()` before it), and a scope built
|
|
17
|
+
* against a second copy would publish into a context nothing reads. That rules
|
|
18
|
+
* out reaching for Bloom's own `react-native-css` dependency, and an optional
|
|
19
|
+
* peer rules out a static import — Metro resolves those eagerly, so an app
|
|
20
|
+
* without nativewind would fail to BUILD rather than degrade.
|
|
21
|
+
*
|
|
22
|
+
* What is left is the one dynamic shape Metro understands: `require()` of a
|
|
23
|
+
* STRING LITERAL as a DIRECT statement of a `try` block, collected as an
|
|
24
|
+
* optional dependency. Both halves matter, and both were verified against metro
|
|
25
|
+
* 0.83.5's own `collectDependencies`:
|
|
26
|
+
*
|
|
27
|
+
* - The shape this replaced — the deleted `utils/lazy-require.ts`, which took
|
|
28
|
+
* the specifier as a function PARAMETER — is not statically evaluable, so
|
|
29
|
+
* Metro collected no dependency at all and rewrote the call into a thrower
|
|
30
|
+
* ("Dynamic require defined at line N; not supported by Metro"). It resolved
|
|
31
|
+
* NOTHING from a consumer's `node_modules` whether or not nativewind was
|
|
32
|
+
* installed, and `BloomColorScope` could never scope NativeWind classes on a
|
|
33
|
+
* device.
|
|
34
|
+
* - `isOptionalDependency` returns at the first BlockStatement above the call,
|
|
35
|
+
* so one `if`/`else` of nesting inside the try loses the optional marking and
|
|
36
|
+
* an absent nativewind fails the BUILD. Hence the `typeof require` guard
|
|
37
|
+
* below sits outside the try.
|
|
38
|
+
*
|
|
39
|
+
* `require` may not exist at all (this file also backs the `import` condition,
|
|
40
|
+
* i.e. an ESM build under Node), hence that guard. Both callers below return
|
|
41
|
+
* before loading on web, where the vars are written to `document.documentElement`
|
|
42
|
+
* instead.
|
|
43
|
+
*
|
|
44
|
+
* @see connection-status/netinfo.ts — the same boundary for netinfo.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Declared locally rather than taken from the ambient `NodeRequire`, which
|
|
49
|
+
* returns `any`: `unknown` forces the module handle to be narrowed below instead
|
|
50
|
+
* of leaking an untyped value into the caller.
|
|
51
|
+
*/
|
|
52
|
+
|
|
12
53
|
/**
|
|
13
54
|
* Component that provides inline CSS variables to a subtree via NativeWind's
|
|
14
55
|
* (react-native-css's) real `VariableContext`. The runtime strips the leading
|
|
@@ -16,7 +57,57 @@ var _lazyRequire = require("../../utils/lazy-require.js");
|
|
|
16
57
|
* record produced by `buildScopeVars`.
|
|
17
58
|
*/
|
|
18
59
|
|
|
19
|
-
|
|
60
|
+
/**
|
|
61
|
+
* The slice of nativewind's surface Bloom uses. Hand-written so no nativewind
|
|
62
|
+
* type reaches Bloom's emitted declarations — a consumer that skips the optional
|
|
63
|
+
* peer must not inherit a TS7016 from Bloom's own `.d.ts`.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
67
|
+
let nativeWindModule;
|
|
68
|
+
/** Why the scope cannot be applied, quoted verbatim in the dev warning. */
|
|
69
|
+
let unavailableReason = '';
|
|
70
|
+
let hasWarned = false;
|
|
71
|
+
|
|
72
|
+
/** The nativewind module, or `null` when the optional peer is not installed. */
|
|
73
|
+
function loadNativeWindVars() {
|
|
74
|
+
if (nativeWindModule !== undefined) return nativeWindModule;
|
|
75
|
+
nativeWindModule = null;
|
|
76
|
+
|
|
77
|
+
// The `typeof require` guard sits OUTSIDE the try on purpose — see the second
|
|
78
|
+
// constraint above. Nested one `if`/`else` deeper, the require stops counting
|
|
79
|
+
// as optional and an app without nativewind fails to BUILD.
|
|
80
|
+
if (typeof require === 'undefined') {
|
|
81
|
+
unavailableReason = 'this bundle has no CommonJS `require`';
|
|
82
|
+
return nativeWindModule;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const loaded = require('nativewind');
|
|
86
|
+
if (typeof loaded?.vars === 'function') {
|
|
87
|
+
nativeWindModule = loaded;
|
|
88
|
+
} else {
|
|
89
|
+
unavailableReason = 'the module resolved without a `vars` export';
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
unavailableReason = error instanceof Error ? error.message : String(error);
|
|
93
|
+
}
|
|
94
|
+
return nativeWindModule;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* One warning per module lifetime, and none in production — the same mechanism
|
|
99
|
+
* as `connection-status/netinfo.ts`. A scope that does not scope is invisible:
|
|
100
|
+
* the subtree keeps rendering, just in the app-wide palette instead of the
|
|
101
|
+
* requested one.
|
|
102
|
+
*/
|
|
103
|
+
function warnScopeInert(detail) {
|
|
104
|
+
if (process.env.NODE_ENV === 'production' || hasWarned) return;
|
|
105
|
+
hasWarned = true;
|
|
106
|
+
// Internal Bloom diagnostic: only the consumer's package.json can fix this,
|
|
107
|
+
// so it names the package and the install command.
|
|
108
|
+
// eslint-disable-next-line no-console
|
|
109
|
+
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}`);
|
|
110
|
+
}
|
|
20
111
|
|
|
21
112
|
/**
|
|
22
113
|
* Build the CSS custom-property map for a preset, ready to be applied to a
|
|
@@ -57,8 +148,15 @@ function buildScopeVars(colorPreset, mode, accents) {
|
|
|
57
148
|
*/
|
|
58
149
|
function getVariableContextProvider() {
|
|
59
150
|
if (_reactNative.Platform.OS === 'web') return null;
|
|
60
|
-
const module =
|
|
61
|
-
if (!module
|
|
151
|
+
const module = loadNativeWindVars();
|
|
152
|
+
if (!module) {
|
|
153
|
+
warnScopeInert('the optional peer `nativewind` could not be loaded.');
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (typeof module.VariableContextProvider !== 'function') {
|
|
157
|
+
warnScopeInert('the installed `nativewind` exports no `VariableContextProvider` (the ' + 'NativeWind 5 / react-native-css@3 API this needs).');
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
62
160
|
return module.VariableContextProvider;
|
|
63
161
|
}
|
|
64
162
|
|
|
@@ -77,8 +175,11 @@ function getVariableContextProvider() {
|
|
|
77
175
|
*/
|
|
78
176
|
function buildNativePresetStyle(colorPreset, mode) {
|
|
79
177
|
if (_reactNative.Platform.OS === 'web') return undefined;
|
|
80
|
-
const module =
|
|
81
|
-
if (!module
|
|
178
|
+
const module = loadNativeWindVars();
|
|
179
|
+
if (!module) {
|
|
180
|
+
warnScopeInert('the optional peer `nativewind` could not be loaded.');
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
82
183
|
return module.vars(buildScopeVars(colorPreset, mode));
|
|
83
184
|
}
|
|
84
185
|
//# sourceMappingURL=style-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_tokenRegistry","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_tokenRegistry","nativeWindModule","unavailableReason","hasWarned","loadNativeWindVars","undefined","loaded","vars","error","Error","message","String","warnScopeInert","detail","process","env","NODE_ENV","console","warn","buildScopeVars","colorPreset","mode","accents","tokens","getResolvedTokens","token","CANONICAL_TOKENS","value","getVariableContextProvider","Platform","OS","module","VariableContextProvider","buildNativePresetStyle"],"sourceRoot":"../../../../src","sources":["theme/color-scope/style-builder.ts"],"mappings":";;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AqD,CAAC;IACrE,OAAOP,SAAS;EAClB;EACA,OAAO0B,MAAM,CAACxB,IAAI,CAACY,cAAc,CAACC,WAAW,EAAEC,IAAI,CAAC,CAAC;AACvD","ignoreList":[]}
|
|
@@ -69,20 +69,22 @@ function tryCallSetFlag() {
|
|
|
69
69
|
let mod;
|
|
70
70
|
// `require` does not exist in an ES module, so guard before touching it —
|
|
71
71
|
// an unguarded reference is a ReferenceError, not a resolution failure.
|
|
72
|
-
// Matches the pattern used by every other optional-module load in Bloom
|
|
73
|
-
// (`utils/lazy-require.ts`, `theme/adaptive-colors.ts`,
|
|
74
|
-
// `bottom-sheet/index.tsx`).
|
|
75
72
|
if (typeof require === 'undefined') return;
|
|
76
73
|
try {
|
|
77
|
-
// Dynamic require: css-interop is
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
74
|
+
// Dynamic require: css-interop is neither a Bloom dependency nor a declared
|
|
75
|
+
// peer. The specifier goes through a variable to keep a plain-text
|
|
76
|
+
// `require('react-native-css-interop')` out of the file, so bundlers that
|
|
77
|
+
// scan for one do not try to resolve (and warn about, or fail on) a module
|
|
78
|
+
// Bloom never asked for.
|
|
81
79
|
//
|
|
82
|
-
//
|
|
83
|
-
// `
|
|
84
|
-
//
|
|
85
|
-
//
|
|
80
|
+
// Metro is not among them: its dependency collector EVALUATES the argument,
|
|
81
|
+
// folds this `const`, and treats the call exactly as it would a literal —
|
|
82
|
+
// optional, because it is a direct statement of a `try` block. So the
|
|
83
|
+
// indirection buys nothing under Metro and costs nothing either. It is not a
|
|
84
|
+
// pattern to copy: a specifier Metro cannot evaluate (a function parameter,
|
|
85
|
+
// a computed value) collects no dependency at all and is rewritten into a
|
|
86
|
+
// thrower, which is how `lazyRequire` silently killed four subsystems. See
|
|
87
|
+
// `connection-status/netinfo.ts` for the shape a real peer must use.
|
|
86
88
|
const moduleName = 'react-native-css-interop';
|
|
87
89
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
88
90
|
mod = require(moduleName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","initialized","warned","CSS_VAR_NAME","CSS_VAR_VALUE","warnOnce","message","error","console","warn","setWebCssVariable","document","root","documentElement","current","style","getPropertyValue","setProperty","tryCallSetFlag","mod","moduleName","setFlag","StyleSheet","call","initCssInteropDarkMode","Platform","OS"],"sourceRoot":"../../../src","sources":["theme/init-css-interop.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;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":["_reactNative","require","initialized","warned","CSS_VAR_NAME","CSS_VAR_VALUE","warnOnce","message","error","console","warn","setWebCssVariable","document","root","documentElement","current","style","getPropertyValue","setProperty","tryCallSetFlag","mod","moduleName","setFlag","StyleSheet","call","initCssInteropDarkMode","Platform","OS"],"sourceRoot":"../../../src","sources":["theme/init-css-interop.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;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,IAAI,OAAOnB,OAAO,KAAK,WAAW,EAAE;EACpC,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMoB,UAAU,GAAG,0BAA0B;IAC7C;IACAD,GAAG,GAAGnB,OAAO,CAACoB,UAAU,CAAqB;EAC/C,CAAC,CAAC,MAAM;IACN;EACF;EAEA,MAAMC,OAAO,GAAGF,GAAG,EAAEG,UAAU,EAAED,OAAO;EACxC,IAAI,OAAOA,OAAO,KAAK,UAAU,EAAE;IACjC;IACA;IACA;IACA;IACA;EACF;EAEA,IAAI;IACFA,OAAO,CAACE,IAAI,CAACJ,GAAG,EAAEG,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC;EACpD,CAAC,CAAC,OAAOf,KAAK,EAAE;IACdF,QAAQ,CACN,0EAA0E,GACxE,kDAAkD,EACpDE,KACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACO,SAASiB,sBAAsBA,CAAA,EAAS;EAC7C,IAAIvB,WAAW,EAAE;EACjBA,WAAW,GAAG,IAAI;EAElB,IAAIwB,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzBhB,iBAAiB,CAAC,CAAC;EACrB;EAEAQ,cAAc,CAAC,CAAC;AAClB;;AAEA;AACA;AACA;AACAM,sBAAsB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@ var _ToastHost = require("./ToastHost");
|
|
|
13
13
|
var _ToastRow = require("./ToastRow.js");
|
|
14
14
|
var _toastStore = require("./toast-store.js");
|
|
15
15
|
var _useAppState = require("./use-app-state.js");
|
|
16
|
+
var _useSingleOutletGuard = require("./use-single-outlet-guard.js");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
19
|
/**
|
|
@@ -71,6 +72,10 @@ const Toaster = ({
|
|
|
71
72
|
style,
|
|
72
73
|
styles: styleOverrides
|
|
73
74
|
}) => {
|
|
75
|
+
// Before any early return, and independent of whether a toast is up: a second
|
|
76
|
+
// outlet duplicates every row from the moment it mounts, not from the first
|
|
77
|
+
// toast, so the warning must not wait for one.
|
|
78
|
+
(0, _useSingleOutletGuard.useSingleOutletGuard)();
|
|
74
79
|
const {
|
|
75
80
|
toasts,
|
|
76
81
|
shouldShowOverlay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_constants","_context","_positionUtils","_Positioner","_ToastHost","_ToastRow","_toastStore","_useAppState","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","toastDefaults","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","toastStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","useAppStateChange","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","onDismiss","id","dismissToast","jsx","ToastHost","children","ToastContext","Provider","value","DynamicToastContext","Array","from","currentPosition","toastsForPosition","orderedToastIds","getOrderedToastIds","Positioner","map","index","row","ToastRow","numberOfToasts","ref","getToastRef","toastId","exports","displayName"],"sourceRoot":"../../../src","sources":["toast/Toaster.tsx"],"mappings":";;;;;;AAeA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAQA,IAAAQ,YAAA,GAAAR,OAAA;
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_constants","_context","_positionUtils","_Positioner","_ToastHost","_ToastRow","_toastStore","_useAppState","_useSingleOutletGuard","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","toastDefaults","offset","visibleToasts","swipeToDismissDirection","closeButton","gap","theme","invert","richColors","enableStacking","autoWiggleOnUpdate","pauseWhenPageIsHidden","allowFontScaling","maxFontSizeMultiplier","toastOptions","icons","animation","unstyled","positionerStyle","style","styles","styleOverrides","useSingleOutletGuard","shouldShowOverlay","toastHeights","isExpanded","useSyncExternalStore","toastStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","useAppStateChange","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","onDismiss","id","dismissToast","jsx","ToastHost","children","ToastContext","Provider","value","DynamicToastContext","Array","from","currentPosition","toastsForPosition","orderedToastIds","getOrderedToastIds","Positioner","map","index","row","ToastRow","numberOfToasts","ref","getToastRef","toastId","exports","displayName"],"sourceRoot":"../../../src","sources":["toast/Toaster.tsx"],"mappings":";;;;;;AAeA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAQA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AAAiE,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,wBAAAY,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAY,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,K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AAA,EAEtBQ,iBAAiB,CAACI,GAAG,CAAC,CAACnB,KAAK,EAAEoB,KAAK,KAAK;cACvC,MAAMC,GAAG,gBACP,IAAAxG,WAAA,CAAAwF,GAAA,EAAC5F,SAAA,CAAA6G,QAAQ;gBAAA,GAEHtB,KAAK;gBACT/B,KAAK,EAAE+B,KAAK,CAAC/B,KAAK,IAAIA,KAAM;gBAC5BC,MAAM,EAAE8B,KAAK,CAAC9B,MAAM,IAAIC,cAAe;gBACvCiD,KAAK,EAAEA,KAAM;gBACbG,cAAc,EAAER,iBAAiB,CAACd,MAAO;gBACzCe,eAAe,EAAEA,eAAgB;gBACjCd,SAAS,EAAEA,SAAU;gBACrBsB,GAAG,EAAE/C,sBAAU,CAACgD,WAAW,CAACzB,KAAK,CAACG,EAAE;cAAE,GARjCH,KAAK,CAACG,EASZ,CACF;cAED,OAAOvD,YAAY,gBACjB,IAAA/B,WAAA,CAAAwF,GAAA,EAACzD,YAAY;gBAAgB8E,OAAO,EAAE1B,KAAK,CAACG,EAAG;gBAAAI,QAAA,EAC5Cc;cAAG,GADarB,KAAK,CAACG,EAEX,CAAC,GAEfkB,GACD;YACH,CAAC;UAAC,GA1BGP,eA2BK,CAAC;QAEjB,CAAC;MAAC,CAC0B;IAAC,CACV;EAAC,CACf,CAAC;AAEhB,CAAC;AAACa,OAAA,CAAAjF,OAAA,GAAAA,OAAA;AAEFA,OAAO,CAACkF,WAAW,GAAG,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resetSingleOutletGuardForTests = resetSingleOutletGuardForTests;
|
|
7
|
+
exports.useSingleOutletGuard = useSingleOutletGuard;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
/**
|
|
11
|
+
* Bloom-original — the dev-only guard against a SECOND toast outlet.
|
|
12
|
+
*
|
|
13
|
+
* Every `Toaster` subscribes to the ONE module-level `toastStore`, which has no
|
|
14
|
+
* notion of an owning outlet, so N mounted outlets each render the full row set:
|
|
15
|
+
* a toast appears N times. Nothing in the engine can dedupe that — the outlets
|
|
16
|
+
* are legitimate, independent subscribers — so the contract is "mount exactly
|
|
17
|
+
* one" and this is what enforces it.
|
|
18
|
+
*
|
|
19
|
+
* WHY A WARNING IS WORTH ITS WEIGHT: the copies are not visually separated, so
|
|
20
|
+
* the defect does not look like duplication. Two bare outlets take identical
|
|
21
|
+
* defaults and land pixel-identical; two outlets whose `offset` differs by a
|
|
22
|
+
* point land 1px apart. Only counting the rendered rows reveals it, which is not
|
|
23
|
+
* something anyone thinks to do — the reports this guard comes from all read as
|
|
24
|
+
* "the toast looks wrong", never as "there are two of them". Stacking is on by
|
|
25
|
+
* default, so a duplicate outlet now doubles the rows INSIDE a stack.
|
|
26
|
+
*
|
|
27
|
+
* The counter is decremented on unmount, so a remount, a route change that moves
|
|
28
|
+
* the outlet, Fast Refresh and React's StrictMode double-invoke (setup, cleanup,
|
|
29
|
+
* setup) all pass through a count of 1 and stay silent. The latch keeps the
|
|
30
|
+
* warning to exactly one per module lifetime rather than one per extra outlet,
|
|
31
|
+
* and — because StrictMode replays the setups — one per app, not two.
|
|
32
|
+
*
|
|
33
|
+
* Gated on `process.env.NODE_ENV`, the same mechanism as
|
|
34
|
+
* `content-panel/nesting-context.ts`: Metro and Vite/Rolldown both fold it
|
|
35
|
+
* statically, so production keeps the counter, the branch and the message out of
|
|
36
|
+
* the bundle entirely. Deliberately NOT `__DEV__`, which is a Metro global that a
|
|
37
|
+
* plain web bundler does not define. It only ever warns — a duplicate outlet
|
|
38
|
+
* renders a redundant toast, it does not break the app, so it must never throw.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
let mountedOutlets = 0;
|
|
42
|
+
let hasWarned = false;
|
|
43
|
+
function useSingleOutletGuard() {
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
if (process.env.NODE_ENV === 'production') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
mountedOutlets += 1;
|
|
49
|
+
if (mountedOutlets > 1 && !hasWarned) {
|
|
50
|
+
hasWarned = true;
|
|
51
|
+
// Internal Bloom diagnostic: the consumer's tree is the only place this
|
|
52
|
+
// can be fixed, so it names the usual cause rather than just the symptom.
|
|
53
|
+
// eslint-disable-next-line no-console
|
|
54
|
+
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.');
|
|
55
|
+
}
|
|
56
|
+
return () => {
|
|
57
|
+
mountedOutlets -= 1;
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Test-only reset: both the counter and the one-shot latch are module state that
|
|
64
|
+
* outlives a render tree, so without this the first suite to mount two outlets
|
|
65
|
+
* would latch the warning and leave every later suite asserting against a guard
|
|
66
|
+
* that can no longer fire — passing whatever the implementation did.
|
|
67
|
+
*/
|
|
68
|
+
function resetSingleOutletGuardForTests() {
|
|
69
|
+
mountedOutlets = 0;
|
|
70
|
+
hasWarned = false;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=use-single-outlet-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","mountedOutlets","hasWarned","useSingleOutletGuard","useEffect","process","env","NODE_ENV","console","warn","resetSingleOutletGuardForTests"],"sourceRoot":"../../../src","sources":["toast/use-single-outlet-guard.ts"],"mappings":";;;;;;;AA8BA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AA9B/B;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;;AAGA,IAAIkB,cAAc,GAAG,CAAC;AACtB,IAAIC,SAAS,GAAG,KAAK;AAEd,SAASC,oBAAoBA,CAAA,EAAS;EAC3CxB,KAAK,CAACyB,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;AACO,SAASS,8BAA8BA,CAAA,EAAS;EACrDT,cAAc,GAAG,CAAC;EAClBC,SAAS,GAAG,KAAK;AACnB","ignoreList":[]}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, useCallback, useImperativeHandle
|
|
4
|
-
import { StyleSheet, Text } from 'react-native';
|
|
3
|
+
import React, { forwardRef, useCallback, useImperativeHandle } from 'react';
|
|
5
4
|
import Animated, { Easing, useAnimatedProps, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
|
|
6
|
-
import {
|
|
5
|
+
import Svg, { Circle, Path } from 'react-native-svg';
|
|
7
6
|
import { useTheme } from "../theme/index.js";
|
|
8
7
|
|
|
9
|
-
/** The resolved `react-native-svg` module (non-null branch). */
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
8
|
/** Square viewBox the ring + check are drawn on. */
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
10
|
const VIEW_BOX = 52;
|
|
13
11
|
/** Ring radius within the viewBox. */
|
|
14
12
|
const CIRCLE_RADIUS = 24;
|
|
@@ -24,33 +22,22 @@ const CIRCLE_DURATION = 500;
|
|
|
24
22
|
/** Check draw-on duration (ms), started once the ring completes. */
|
|
25
23
|
const CHECK_DURATION = 300;
|
|
26
24
|
// `Animated.createAnimatedComponent` must be called once per underlying
|
|
27
|
-
// component
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
/** The animated SVG implementation, rendered only when react-native-svg exists. */
|
|
42
|
-
const AnimatedCheckSvg = /*#__PURE__*/forwardRef(function AnimatedCheckSvg({
|
|
43
|
-
size,
|
|
44
|
-
color,
|
|
45
|
-
svg
|
|
25
|
+
// component — calling it per render would remount the element and break the
|
|
26
|
+
// animation — so the wrappers are built once at module scope.
|
|
27
|
+
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
28
|
+
const AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A draw-on checkmark: a ring strokes on, then the check strokes in. Expose a
|
|
32
|
+
* ref and call `ref.current?.play()` to (re)play — e.g. on a successful submit.
|
|
33
|
+
* Ported from Bluesky's `AnimatedCheck`.
|
|
34
|
+
*/
|
|
35
|
+
export const AnimatedCheck = /*#__PURE__*/forwardRef(function AnimatedCheck({
|
|
36
|
+
size = 24,
|
|
37
|
+
color
|
|
46
38
|
}, ref) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
} = svg;
|
|
50
|
-
const {
|
|
51
|
-
Circle,
|
|
52
|
-
Path
|
|
53
|
-
} = getAnimatedSvg(svg);
|
|
39
|
+
const theme = useTheme();
|
|
40
|
+
const resolvedColor = color ?? theme.colors.success;
|
|
54
41
|
const circleProgress = useSharedValue(0);
|
|
55
42
|
const checkProgress = useSharedValue(0);
|
|
56
43
|
|
|
@@ -85,79 +72,23 @@ const AnimatedCheckSvg = /*#__PURE__*/forwardRef(function AnimatedCheckSvg({
|
|
|
85
72
|
viewBox: `0 0 ${VIEW_BOX} ${VIEW_BOX}`,
|
|
86
73
|
width: size,
|
|
87
74
|
height: size,
|
|
88
|
-
children: [/*#__PURE__*/_jsx(
|
|
75
|
+
children: [/*#__PURE__*/_jsx(AnimatedCircle, {
|
|
89
76
|
animatedProps: circleAnimatedProps,
|
|
90
77
|
cx: VIEW_BOX / 2,
|
|
91
78
|
cy: VIEW_BOX / 2,
|
|
92
79
|
r: CIRCLE_RADIUS,
|
|
93
80
|
fill: "none",
|
|
94
|
-
stroke:
|
|
81
|
+
stroke: resolvedColor,
|
|
95
82
|
strokeWidth: STROKE_WIDTH,
|
|
96
83
|
strokeDasharray: CIRCLE_LENGTH
|
|
97
|
-
}), /*#__PURE__*/_jsx(
|
|
84
|
+
}), /*#__PURE__*/_jsx(AnimatedPath, {
|
|
98
85
|
animatedProps: checkAnimatedProps,
|
|
99
86
|
d: CHECK_PATH,
|
|
100
|
-
stroke:
|
|
87
|
+
stroke: resolvedColor,
|
|
101
88
|
strokeWidth: STROKE_WIDTH,
|
|
102
89
|
strokeDasharray: CHECK_LENGTH
|
|
103
90
|
})]
|
|
104
91
|
});
|
|
105
92
|
});
|
|
106
|
-
/**
|
|
107
|
-
* Static fallback rendered when react-native-svg is unavailable (e.g. a web
|
|
108
|
-
* bundle that omits the optional peer). Draws a plain Unicode check so the
|
|
109
|
-
* component still communicates "done"; `play()` is a no-op.
|
|
110
|
-
*/
|
|
111
|
-
const StaticCheck = /*#__PURE__*/forwardRef(function StaticCheck({
|
|
112
|
-
size,
|
|
113
|
-
color
|
|
114
|
-
}, ref) {
|
|
115
|
-
useImperativeHandle(ref, () => ({
|
|
116
|
-
play: () => undefined
|
|
117
|
-
}), []);
|
|
118
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
119
|
-
accessibilityElementsHidden: true,
|
|
120
|
-
style: [styles.staticCheck, {
|
|
121
|
-
width: size,
|
|
122
|
-
fontSize: size * 0.8,
|
|
123
|
-
lineHeight: size,
|
|
124
|
-
color
|
|
125
|
-
}],
|
|
126
|
-
children: '✓'
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* A draw-on checkmark: a ring strokes on, then the check strokes in. Expose a
|
|
132
|
-
* ref and call `ref.current?.play()` to (re)play — e.g. on a successful submit.
|
|
133
|
-
* Ported from Bluesky's `AnimatedCheck`.
|
|
134
|
-
*/
|
|
135
|
-
export const AnimatedCheck = /*#__PURE__*/forwardRef(function AnimatedCheck({
|
|
136
|
-
size = 24,
|
|
137
|
-
color
|
|
138
|
-
}, ref) {
|
|
139
|
-
const theme = useTheme();
|
|
140
|
-
const resolvedColor = color ?? theme.colors.success;
|
|
141
|
-
const svg = useMemo(() => getSvgModule(), []);
|
|
142
|
-
if (!svg) {
|
|
143
|
-
return /*#__PURE__*/_jsx(StaticCheck, {
|
|
144
|
-
ref: ref,
|
|
145
|
-
size: size,
|
|
146
|
-
color: resolvedColor
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return /*#__PURE__*/_jsx(AnimatedCheckSvg, {
|
|
150
|
-
ref: ref,
|
|
151
|
-
size: size,
|
|
152
|
-
color: resolvedColor,
|
|
153
|
-
svg: svg
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
93
|
AnimatedCheck.displayName = 'AnimatedCheck';
|
|
157
|
-
const styles = StyleSheet.create({
|
|
158
|
-
staticCheck: {
|
|
159
|
-
textAlign: 'center',
|
|
160
|
-
fontWeight: '700'
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
94
|
//# sourceMappingURL=AnimatedCheck.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useCallback","useImperativeHandle","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useCallback","useImperativeHandle","Animated","Easing","useAnimatedProps","useSharedValue","withDelay","withTiming","Svg","Circle","Path","useTheme","jsx","_jsx","jsxs","_jsxs","VIEW_BOX","CIRCLE_RADIUS","CIRCLE_LENGTH","CHECK_LENGTH","CHECK_PATH","STROKE_WIDTH","CIRCLE_DURATION","CHECK_DURATION","AnimatedCircle","createAnimatedComponent","AnimatedPath","AnimatedCheck","size","color","ref","theme","resolvedColor","colors","success","circleProgress","checkProgress","circleAnimatedProps","strokeDashoffset","value","checkAnimatedProps","play","duration","easing","linear","fill","viewBox","width","height","children","animatedProps","cx","cy","r","stroke","strokeWidth","strokeDasharray","d","displayName"],"sourceRoot":"../../../src","sources":["animated-check/AnimatedCheck.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,mBAAmB,QAAQ,OAAO;AAC3E,OAAOC,QAAQ,IACbC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,EACTC,UAAU,QACL,yBAAyB;AAChC,OAAOC,GAAG,IAAIC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AAEpD,SAASC,QAAQ,QAAQ,mBAAU;;AAEnC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,QAAQ,GAAG,EAAE;AACnB;AACA,MAAMC,aAAa,GAAG,EAAE;AACxB;AACA,MAAMC,aAAa,GAAG,GAAG;AACzB;AACA,MAAMC,YAAY,GAAG,EAAE;AACvB;AACA,MAAMC,UAAU,GAAG,8BAA8B;AACj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C,MAAM,CAACyC;IACjB,CAAC,CAAC;IACFR,aAAa,CAACG,KAAK,GAAGjC,SAAS,CAC7BgB,eAAe,EACff,UAAU,CAAC,CAAC,EAAE;MAAEmC,QAAQ,EAAEnB,cAAc;MAAEoB,MAAM,EAAExC,MAAM,CAACyC;IAAO,CAAC,CACnE,CAAC;EACH,CAAC,EAAE,CAACT,cAAc,EAAEC,aAAa,CAAC,CAAC;EAEnCnC,mBAAmB,CAAC6B,GAAG,EAAE,OAAO;IAAEW;EAAK,CAAC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAElD,oBACE1B,KAAA,CAACP,GAAG;IAACqC,IAAI,EAAC,MAAM;IAACC,OAAO,EAAE,OAAO9B,QAAQ,IAAIA,QAAQ,EAAG;IAAC+B,KAAK,EAAEnB,IAAK;IAACoB,MAAM,EAAEpB,IAAK;IAAAqB,QAAA,gBACjFpC,IAAA,CAACW,cAAc;MACb0B,aAAa,EAAEb,mBAAoB;MACnCc,EAAE,EAAEnC,QAAQ,GAAG,CAAE;MACjBoC,EAAE,EAAEpC,QAAQ,GAAG,CAAE;MACjBqC,CAAC,EAAEpC,aAAc;MACjB4B,IAAI,EAAC,MAAM;MACXS,MAAM,EAAEtB,aAAc;MACtBuB,WAAW,EAAElC,YAAa;MAC1BmC,eAAe,EAAEtC;IAAc,CAChC,CAAC,eACFL,IAAA,CAACa,YAAY;MACXwB,aAAa,EAAEV,kBAAmB;MAClCiB,CAAC,EAAErC,UAAW;MACdkC,MAAM,EAAEtB,aAAc;MACtBuB,WAAW,EAAElC,YAAa;MAC1BmC,eAAe,EAAErC;IAAa,CAC/B,CAAC;EAAA,CACC,CAAC;AAEV,CACF,CAAC;AAEDQ,aAAa,CAAC+B,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { memo, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { View, Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
|
5
|
+
import Svg, { ClipPath, Defs, Image as SvgImage, Path } from 'react-native-svg';
|
|
5
6
|
import { useTheme } from "../theme/use-theme.js";
|
|
6
7
|
import { useImageResolver } from "../image-resolver/context.js";
|
|
7
8
|
import { Z_INDEX } from "../styles/z-index.js";
|
|
8
9
|
import { useAvatarPlaceholder } from "./placeholder-context.js";
|
|
9
10
|
import { LiveBadge } from "./LiveBadge.js";
|
|
10
11
|
import { AvatarRing, getRingOuterSize } from "./AvatarRing.js";
|
|
11
|
-
import { getSvgModule } from "./svg-module.js";
|
|
12
12
|
import { SQUIRCLE_PATH } from "./squircle-path.js";
|
|
13
13
|
// Google Contacts-inspired palette used to pick a deterministic background
|
|
14
14
|
// color for name-based placeholder avatars.
|
|
@@ -46,24 +46,6 @@ function SquircleImage({
|
|
|
46
46
|
onError
|
|
47
47
|
}) {
|
|
48
48
|
const clipId = useMemo(() => `bloom-sqc${clipIdCounter++}`, []);
|
|
49
|
-
const svg = getSvgModule();
|
|
50
|
-
if (!svg) {
|
|
51
|
-
// Fallback to a circle if react-native-svg is not installed. The ring (if
|
|
52
|
-
// any) is drawn separately by AvatarRing, which also degrades to a circle.
|
|
53
|
-
return /*#__PURE__*/_jsx(CircleFallback, {
|
|
54
|
-
size: size,
|
|
55
|
-
fallbackColor: fallbackColor,
|
|
56
|
-
icon: placeholderIcon,
|
|
57
|
-
name: name
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
const {
|
|
61
|
-
default: Svg,
|
|
62
|
-
Defs,
|
|
63
|
-
ClipPath,
|
|
64
|
-
Path,
|
|
65
|
-
Image: SvgImage
|
|
66
|
-
} = svg;
|
|
67
49
|
const href = uri ? {
|
|
68
50
|
uri
|
|
69
51
|
} : fallbackSource;
|