@oxyhq/bloom 0.54.1 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/lib/commonjs/provider/index.js +67 -0
- package/lib/commonjs/provider/index.js.map +1 -0
- package/lib/commonjs/provider/scroll-provider.js +13 -0
- package/lib/commonjs/provider/scroll-provider.js.map +1 -0
- package/lib/commonjs/provider/scroll-provider.web.js +13 -0
- package/lib/commonjs/provider/scroll-provider.web.js.map +1 -0
- package/lib/commonjs/toast/ToastRow.js +35 -10
- package/lib/commonjs/toast/ToastRow.js.map +1 -1
- package/lib/commonjs/toast/ToastSwipeHandler.js +15 -5
- package/lib/commonjs/toast/ToastSwipeHandler.js.map +1 -1
- package/lib/commonjs/toast/constants.js +18 -1
- package/lib/commonjs/toast/constants.js.map +1 -1
- package/lib/commonjs/toast/toast-store.js +39 -1
- package/lib/commonjs/toast/toast-store.js.map +1 -1
- package/lib/commonjs/toast/use-stack-hover.js +175 -0
- package/lib/commonjs/toast/use-stack-hover.js.map +1 -0
- package/lib/commonjs/toast/use-stack-hover.native.js +42 -0
- package/lib/commonjs/toast/use-stack-hover.native.js.map +1 -0
- package/lib/module/provider/index.js +63 -0
- package/lib/module/provider/index.js.map +1 -0
- package/lib/module/provider/scroll-provider.js +16 -0
- package/lib/module/provider/scroll-provider.js.map +1 -0
- package/lib/module/provider/scroll-provider.web.js +5 -0
- package/lib/module/provider/scroll-provider.web.js.map +1 -0
- package/lib/module/toast/ToastRow.js +35 -10
- package/lib/module/toast/ToastRow.js.map +1 -1
- package/lib/module/toast/ToastSwipeHandler.js +16 -4
- package/lib/module/toast/ToastSwipeHandler.js.map +1 -1
- package/lib/module/toast/constants.js +18 -1
- package/lib/module/toast/constants.js.map +1 -1
- package/lib/module/toast/toast-store.js +39 -1
- package/lib/module/toast/toast-store.js.map +1 -1
- package/lib/module/toast/use-stack-hover.js +168 -0
- package/lib/module/toast/use-stack-hover.js.map +1 -0
- package/lib/module/toast/use-stack-hover.native.js +35 -0
- package/lib/module/toast/use-stack-hover.native.js.map +1 -0
- package/lib/typescript/commonjs/provider/index.d.ts +45 -0
- package/lib/typescript/commonjs/provider/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/scroll-provider.d.ts +14 -0
- package/lib/typescript/commonjs/provider/scroll-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/scroll-provider.web.d.ts +3 -0
- package/lib/typescript/commonjs/provider/scroll-provider.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts +4 -0
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/toast-store.d.ts +15 -0
- package/lib/typescript/commonjs/toast/toast-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/use-stack-hover.d.ts +55 -0
- package/lib/typescript/commonjs/toast/use-stack-hover.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-stack-hover.native.d.ts +26 -0
- package/lib/typescript/commonjs/toast/use-stack-hover.native.d.ts.map +1 -0
- package/lib/typescript/module/provider/index.d.ts +45 -0
- package/lib/typescript/module/provider/index.d.ts.map +1 -0
- package/lib/typescript/module/provider/scroll-provider.d.ts +14 -0
- package/lib/typescript/module/provider/scroll-provider.d.ts.map +1 -0
- package/lib/typescript/module/provider/scroll-provider.web.d.ts +3 -0
- package/lib/typescript/module/provider/scroll-provider.web.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastRow.d.ts.map +1 -1
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts +4 -0
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts.map +1 -1
- package/lib/typescript/module/toast/constants.d.ts.map +1 -1
- package/lib/typescript/module/toast/toast-store.d.ts +15 -0
- package/lib/typescript/module/toast/toast-store.d.ts.map +1 -1
- package/lib/typescript/module/toast/use-stack-hover.d.ts +55 -0
- package/lib/typescript/module/toast/use-stack-hover.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-stack-hover.native.d.ts +26 -0
- package/lib/typescript/module/toast/use-stack-hover.native.d.ts.map +1 -0
- package/package.json +12 -1
- package/src/__tests__/BloomProvider.web.test.tsx +114 -0
- package/src/__tests__/Toaster.test.tsx +554 -0
- package/src/__tests__/toast-position-utils.test.ts +28 -0
- package/src/__tests__/toast-stack-hover.test.ts +92 -0
- package/src/__tests__/toast-store.test.ts +72 -0
- package/src/provider/index.tsx +68 -0
- package/src/provider/scroll-provider.ts +13 -0
- package/src/provider/scroll-provider.web.ts +2 -0
- package/src/toast/Toast.stories.tsx +10 -0
- package/src/toast/ToastRow.tsx +33 -10
- package/src/toast/ToastSwipeHandler.tsx +14 -2
- package/src/toast/constants.ts +18 -1
- package/src/toast/toast-store.ts +39 -1
- package/src/toast/use-stack-hover.native.ts +34 -0
- package/src/toast/use-stack-hover.ts +182 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HOVER_LEAVE_GRACE = void 0;
|
|
7
|
+
exports.isStackHovered = isStackHovered;
|
|
8
|
+
exports.resetStackHoverForTests = resetStackHoverForTests;
|
|
9
|
+
exports.useStackHover = useStackHover;
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _toastStore = require("./toast-store.js");
|
|
12
|
+
/**
|
|
13
|
+
* Bloom-original — WEB/default. `use-stack-hover.native.ts` is the native no-op,
|
|
14
|
+
* filename-resolved by Metro exactly as `ToastHost.native.tsx` is, so `toast/`
|
|
15
|
+
* stays one universal engine with no `index.web` fork.
|
|
16
|
+
*
|
|
17
|
+
* sonner expands its stack on HOVER; sonner-native only has press, because a phone
|
|
18
|
+
* has no pointer. Bloom needs both: press is the touch and native affordance, hover
|
|
19
|
+
* is what a desktop user expects, and a touch-capable web device must not get a
|
|
20
|
+
* phantom hover from its own taps.
|
|
21
|
+
*
|
|
22
|
+
* THIS IS A TRIGGER, NOT A SECOND MECHANISM. It drives the store's existing
|
|
23
|
+
* `expand`/`collapse`, which already pause and resume the auto-close timers
|
|
24
|
+
* (`ToastStore.expand` calls `timers.pauseAll()`, `collapse` calls `resumeAll()`),
|
|
25
|
+
* so hovering to read a toast cannot let it expire under the cursor — no new
|
|
26
|
+
* pausing path, no new store state. With stacking OFF there is nothing to expand,
|
|
27
|
+
* so the pointer pauses the timers directly instead: the reason sonner pauses is
|
|
28
|
+
* that the pointer is over the toast, which has nothing to do with stacking.
|
|
29
|
+
*
|
|
30
|
+
* TWO THINGS ARE LOAD-BEARING:
|
|
31
|
+
*
|
|
32
|
+
* - `pointerType === 'mouse'`. Touch fires `pointerenter` before `pointerdown`
|
|
33
|
+
* and `pointerleave` after `pointerup` (the pointer ceases to exist), so
|
|
34
|
+
* without this guard every TAP on a touch-capable web device would expand then
|
|
35
|
+
* collapse the stack while the press toggle fired too — three handlers fighting
|
|
36
|
+
* over one tap. Hover is additive: pens and touch fall through to press.
|
|
37
|
+
* - THE LEAVE IS DEFERRED BY A FRAME-ISH GRACE PERIOD, and any enter cancels it.
|
|
38
|
+
* Rows are separate absolutely-positioned boxes with `gap` between them once
|
|
39
|
+
* expanded, so moving the pointer from one row to the next leaves the first
|
|
40
|
+
* before entering the second. Collapsing on that would snap the stack shut and
|
|
41
|
+
* reopen it on whatever row ends up under the pointer — a jitter loop, plus a
|
|
42
|
+
* resume/pause pair per crossing that re-banks each timer's remaining time.
|
|
43
|
+
*
|
|
44
|
+
* The state is module-level on purpose: there is ONE stack per document, the same
|
|
45
|
+
* reason `toastStore` is a module singleton. It is written and read only inside
|
|
46
|
+
* event handlers — never in render — so the React Compiler has nothing to freeze.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* How long a leave waits for a neighbouring row to claim the pointer. One frame is
|
|
51
|
+
* enough for the same-tick leave/enter pair a row crossing produces; this is a
|
|
52
|
+
* little more so a slow frame cannot flash the stack shut. Exported so the suite
|
|
53
|
+
* asserts against the real value rather than a copy of it.
|
|
54
|
+
*/
|
|
55
|
+
const HOVER_LEAVE_GRACE = exports.HOVER_LEAVE_GRACE = 80;
|
|
56
|
+
|
|
57
|
+
/** The portal root every toast row lives under — see `portal/index.web.tsx`. */
|
|
58
|
+
const PORTAL_ROOT_ID = 'bloom-portal-root';
|
|
59
|
+
let hovered = false;
|
|
60
|
+
let leaveTimeout = null;
|
|
61
|
+
const isMouse = event => event.nativeEvent.pointerType === 'mouse';
|
|
62
|
+
const cancelPendingLeave = () => {
|
|
63
|
+
if (leaveTimeout !== null) {
|
|
64
|
+
clearTimeout(leaveTimeout);
|
|
65
|
+
leaveTimeout = null;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whether the pointer is over the stack RIGHT NOW.
|
|
71
|
+
*
|
|
72
|
+
* Two sources, and both are load-bearing:
|
|
73
|
+
*
|
|
74
|
+
* - the `hovered` latch answers "a mouse entered and has not left", which is the
|
|
75
|
+
* only thing available where there is no DOM (jest runs on `testEnvironment:
|
|
76
|
+
* 'node'`), and is a cheap early-out.
|
|
77
|
+
* - the live `:hover` query answers "a row is under the pointer", which the latch
|
|
78
|
+
* CANNOT: a row can stop being hovered with no event whatsoever. Measured — a row
|
|
79
|
+
* culled by `visibleToasts` under a stationary cursor fires no `pointerleave`,
|
|
80
|
+
* `pointerout` or `mouseleave` at all, and the restack then slides the remaining
|
|
81
|
+
* rows out from under the pointer. A latch alone therefore sticks TRUE, which
|
|
82
|
+
* would disable the press toggle for the rest of the session and suppress every
|
|
83
|
+
* later auto-collapse.
|
|
84
|
+
*
|
|
85
|
+
* Requiring both means a stale latch is corrected by the DOM and a stray DOM match
|
|
86
|
+
* (a pen, a touch) is rejected by the latch.
|
|
87
|
+
*
|
|
88
|
+
* COVERAGE, stated plainly: jest cannot see the DOM half at all
|
|
89
|
+
* (`testEnvironment: 'node'`), and a browser cannot isolate it either — its two
|
|
90
|
+
* consequences are a press toggle standing down (unreachable with a mouse, which
|
|
91
|
+
* always hovers what it presses) and a suppressed auto-collapse (which the deferred
|
|
92
|
+
* leave below independently corrects the moment any boundary event fires). Both
|
|
93
|
+
* halves are kept because each is measurably more accurate than the other alone, not
|
|
94
|
+
* because a test proves the composite.
|
|
95
|
+
*
|
|
96
|
+
* `ToastRow` asks so a press does not TOGGLE what hover already opened, and
|
|
97
|
+
* `toastStore` asks before auto-collapsing a stack down to its last row. The press
|
|
98
|
+
* still runs the toast's own `onPress`; only the expansion toggle steps aside.
|
|
99
|
+
*/
|
|
100
|
+
function isStackHovered() {
|
|
101
|
+
return hovered && rowUnderPointer() !== false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The live DOM answer, or `undefined` where there is no DOM to ask (jest runs on
|
|
106
|
+
* `testEnvironment: 'node'`). Deliberately tri-state: "unknowable" and "no" must not
|
|
107
|
+
* collapse into the same value, because the two callers want opposite defaults —
|
|
108
|
+
* `isStackHovered` trusts the latch when it cannot check, while the deferred leave
|
|
109
|
+
* only stands down on a positive "yes, still hovered".
|
|
110
|
+
*/
|
|
111
|
+
function rowUnderPointer() {
|
|
112
|
+
if (typeof document === 'undefined') {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
return document.querySelector(`#${PORTAL_ROOT_ID} [aria-live]:hover`) !== null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A pointer resting on the stack HOLDS it open, so the store must not auto-collapse
|
|
120
|
+
* it out from under the cursor. Registered here rather than passed in because this
|
|
121
|
+
* file is the one that knows what hovering means; the store only knows that
|
|
122
|
+
* something says "not yet". Native's fork registers nothing.
|
|
123
|
+
*/
|
|
124
|
+
_toastStore.toastStore.setExpansionHold(isStackHovered);
|
|
125
|
+
function useStackHover({
|
|
126
|
+
enableStacking
|
|
127
|
+
}) {
|
|
128
|
+
// Stable per outlet configuration: these land on the row box as props, and every
|
|
129
|
+
// row re-renders on each stack change.
|
|
130
|
+
return (0, _react.useMemo)(() => ({
|
|
131
|
+
onPointerEnter: event => {
|
|
132
|
+
if (!isMouse(event)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
cancelPendingLeave();
|
|
136
|
+
hovered = true;
|
|
137
|
+
if (enableStacking) {
|
|
138
|
+
// Pauses the timers as part of expanding.
|
|
139
|
+
_toastStore.toastStore.expand();
|
|
140
|
+
} else {
|
|
141
|
+
_toastStore.toastStore.pauseAllTimers();
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
onPointerLeave: event => {
|
|
145
|
+
if (!isMouse(event) || !hovered) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
cancelPendingLeave();
|
|
149
|
+
leaveTimeout = setTimeout(() => {
|
|
150
|
+
leaveTimeout = null;
|
|
151
|
+
// The rows may have moved rather than the pointer: an expand, a collapse
|
|
152
|
+
// or a restack slides them under a stationary cursor without firing a
|
|
153
|
+
// single pointer event, so re-ask the DOM before acting on a leave that
|
|
154
|
+
// fired 80ms ago. Only a positive "still hovered" stands the collapse down.
|
|
155
|
+
if (rowUnderPointer() === true) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
hovered = false;
|
|
159
|
+
if (enableStacking) {
|
|
160
|
+
// Resumes the timers as part of collapsing.
|
|
161
|
+
_toastStore.toastStore.collapse();
|
|
162
|
+
} else {
|
|
163
|
+
_toastStore.toastStore.resumeAllTimers();
|
|
164
|
+
}
|
|
165
|
+
}, HOVER_LEAVE_GRACE);
|
|
166
|
+
}
|
|
167
|
+
}), [enableStacking]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Test-only reset: the module state outlives a render tree, so a suite must clear it. */
|
|
171
|
+
function resetStackHoverForTests() {
|
|
172
|
+
cancelPendingLeave();
|
|
173
|
+
hovered = false;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=use-stack-hover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_toastStore","HOVER_LEAVE_GRACE","exports","PORTAL_ROOT_ID","hovered","leaveTimeout","isMouse","event","nativeEvent","pointerType","cancelPendingLeave","clearTimeout","isStackHovered","rowUnderPointer","document","undefined","querySelector","toastStore","setExpansionHold","useStackHover","enableStacking","useMemo","onPointerEnter","expand","pauseAllTimers","onPointerLeave","setTimeout","collapse","resumeAllTimers","resetStackHoverForTests"],"sourceRoot":"../../../src","sources":["toast/use-stack-hover.ts"],"mappings":";;;;;;;;;AAoCA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAtCA;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;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,EAAE;;AAEnC;AACA,MAAME,cAAc,GAAG,mBAAmB;AAI1C,IAAIC,OAAO,GAAG,KAAK;AACnB,IAAIC,YAAkD,GAAG,IAAI;AAE7D,MAAMC,OAAO,GAAIC,KAAiB,IAAKA,KAAK,CAACC,WAAW,CAACC,WAAW,KAAK,OAAO;AAEhF,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EAC/B,IAAIL,YAAY,KAAK,IAAI,EAAE;IACzBM,YAAY,CAACN,YAAY,CAAC;IAC1BA,YAAY,GAAG,IAAI;EACrB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,eAAe,CAAC,CAAC;QAC9B;MACF,CAAC,EAAE3B,iBAAiB,CAAC;IACvB;EACF,CAAC,CAAC,EACF,CAACmB,cAAc,CACjB,CAAC;AACH;;AAEA;AACO,SAASS,uBAAuBA,CAAA,EAAS;EAC9CnB,kBAAkB,CAAC,CAAC;EACpBN,OAAO,GAAG,KAAK;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HOVER_LEAVE_GRACE = void 0;
|
|
7
|
+
exports.isStackHovered = isStackHovered;
|
|
8
|
+
exports.resetStackHoverForTests = resetStackHoverForTests;
|
|
9
|
+
exports.useStackHover = useStackHover;
|
|
10
|
+
/**
|
|
11
|
+
* Bloom-original — NATIVE. Metro resolves this over `use-stack-hover.ts` on iOS and
|
|
12
|
+
* Android, the same filename split `ToastHost.native.tsx` uses.
|
|
13
|
+
*
|
|
14
|
+
* Native keeps PRESS as the only way to expand a stack, so this hands back no
|
|
15
|
+
* handlers at all. Two reasons it is a fork rather than a runtime `Platform` check:
|
|
16
|
+
* the web file's module-level hover state and its `setTimeout` have no business
|
|
17
|
+
* existing in a native bundle, and `onPointerEnter`/`onPointerLeave` DO fire on
|
|
18
|
+
* native for touch (RN's pointer events unify touch and mouse), which would make
|
|
19
|
+
* every tap expand-then-collapse while the press toggle fired as well.
|
|
20
|
+
*
|
|
21
|
+
* Keep the shape identical to the web file — `ToastSwipeHandler` spreads whatever
|
|
22
|
+
* this returns onto the row box, and `ToastRow` calls `isStackHovered()`
|
|
23
|
+
* unconditionally.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** Parity with the web file's export; nothing here waits for anything. */
|
|
27
|
+
const HOVER_LEAVE_GRACE = exports.HOVER_LEAVE_GRACE = 0;
|
|
28
|
+
|
|
29
|
+
/** Nothing hovers on a touch screen. */
|
|
30
|
+
function isStackHovered() {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** One frozen object, so spreading it never changes the row box's props. */
|
|
35
|
+
const NO_HOVER_PROPS = Object.freeze({});
|
|
36
|
+
function useStackHover(_options) {
|
|
37
|
+
return NO_HOVER_PROPS;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Parity with the web file so the shared suite can call it on either platform. */
|
|
41
|
+
function resetStackHoverForTests() {}
|
|
42
|
+
//# sourceMappingURL=use-stack-hover.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HOVER_LEAVE_GRACE","exports","isStackHovered","NO_HOVER_PROPS","Object","freeze","useStackHover","_options","resetStackHoverForTests"],"sourceRoot":"../../../src","sources":["toast/use-stack-hover.native.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC;;AAElC;AACO,SAASE,cAAcA,CAAA,EAAY;EACxC,OAAO,KAAK;AACd;;AAEA;AACA,MAAMC,cAA+B,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAElD,SAASC,aAAaA,CAACC,QAAqC,EAAmB;EACpF,OAAOJ,cAAc;AACvB;;AAEA;AACO,SAASK,uBAAuBA,CAAA,EAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `BloomProvider` — the ONE Bloom root an app mounts.
|
|
5
|
+
*
|
|
6
|
+
* Bloom's app-wide state used to be a handful of separate providers that every
|
|
7
|
+
* consumer wired by hand (theme, haptics, image resolution, scroll restoration,
|
|
8
|
+
* tab-bar minimize progress). Mounting them separately means each one can end
|
|
9
|
+
* up at a different depth, and a provider mounted too low fails in ways that
|
|
10
|
+
* are hard to trace:
|
|
11
|
+
*
|
|
12
|
+
* - `useScrollRestoration()` THROWS on web outside `ScrollRestorationProvider`,
|
|
13
|
+
* so any scrollable rendered beside the provider (a right rail, an overlay)
|
|
14
|
+
* crashes the screen.
|
|
15
|
+
* - `useMinimizeState()` silently hands each caller a private fallback, so a
|
|
16
|
+
* tab bar below the provider just never minimizes — no error anywhere.
|
|
17
|
+
*
|
|
18
|
+
* Mounting this single provider at the app root makes both classes of mistake
|
|
19
|
+
* impossible: everything Bloom renders is under all of them, at the same depth.
|
|
20
|
+
* Nesting extra contexts costs nothing at runtime — the win is that scope is no
|
|
21
|
+
* longer a per-app decision.
|
|
22
|
+
*
|
|
23
|
+
* NOT included, on purpose — these are OUTLETS, not state, and their placement
|
|
24
|
+
* in the tree is a real app decision (z-order, safe areas, and mounting a
|
|
25
|
+
* second one duplicates every surface it renders):
|
|
26
|
+
* `<ToastOutlet>`, `<Portal.Provider>`/`<Portal.Outlet>`, `<SurfaceHost>`,
|
|
27
|
+
* `<BloomDialogProvider>`, `<AlertDialogHost>`.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { ImageResolverProvider } from "../image-resolver/index.js";
|
|
31
|
+
import { BloomHapticsProvider } from "../hooks/useHaptics.js";
|
|
32
|
+
import { TabBarMinimizeProvider } from "../tab-bar/minimize-context.js";
|
|
33
|
+
import { BloomThemeProvider } from "../theme/index.js";
|
|
34
|
+
import { ScrollRestorationProvider } from './scroll-provider';
|
|
35
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
|
+
export function BloomProvider({
|
|
37
|
+
children,
|
|
38
|
+
imageResolver,
|
|
39
|
+
haptics = true,
|
|
40
|
+
...themeProps
|
|
41
|
+
}) {
|
|
42
|
+
return (
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
// `value` is passed unconditionally (null when unset) so toggling a resolver
|
|
45
|
+
// never changes the tree shape and remounts everything below it.
|
|
46
|
+
_jsx(ImageResolverProvider, {
|
|
47
|
+
value: imageResolver ?? null,
|
|
48
|
+
children: /*#__PURE__*/_jsx(BloomThemeProvider, {
|
|
49
|
+
...themeProps,
|
|
50
|
+
children: /*#__PURE__*/_jsx(ScrollRestorationProvider, {
|
|
51
|
+
children: /*#__PURE__*/_jsx(BloomHapticsProvider, {
|
|
52
|
+
enabled: haptics,
|
|
53
|
+
children: /*#__PURE__*/_jsx(TabBarMinimizeProvider, {
|
|
54
|
+
children: children
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
BloomProvider.displayName = 'BloomProvider';
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ImageResolverProvider","BloomHapticsProvider","TabBarMinimizeProvider","BloomThemeProvider","ScrollRestorationProvider","jsx","_jsx","BloomProvider","children","imageResolver","haptics","themeProps","value","enabled","displayName"],"sourceRoot":"../../../src","sources":["provider/index.tsx"],"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;;AAGA,SAASA,qBAAqB,QAA4B,4BAAmB;AAC7E,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,sBAAsB,QAAQ,gCAA6B;AACpE,SAASC,kBAAkB,QAAsC,mBAAU;AAC3E,SAASC,yBAAyB,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAc9D,OAAO,SAASC,aAAaA,CAAC;EAC5BC,QAAQ;EACRC,aAAa;EACbC,OAAO,GAAG,IAAI;EACd,GAAGC;AACe,CAAC,EAAE;EACrB;IAAA;IACE;IACA;IACAL,IAAA,CAACN,qBAAqB;MAACY,KAAK,EAAEH,aAAa,IAAI,IAAK;MAAAD,QAAA,eAClDF,IAAA,CAACH,kBAAkB;QAAA,GAAKQ,UAAU;QAAAH,QAAA,eAChCF,IAAA,CAACF,yBAAyB;UAAAI,QAAA,eACxBF,IAAA,CAACL,oBAAoB;YAACY,OAAO,EAAEH,OAAQ;YAAAF,QAAA,eACrCF,IAAA,CAACJ,sBAAsB;cAAAM,QAAA,EAAEA;YAAQ,CAAyB;UAAC,CACvC;QAAC,CACE;MAAC,CACV;IAAC,CACA;EAAC;AAE5B;AAEAD,aAAa,CAACO,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native/default binding for the scroll-restoration provider used by
|
|
5
|
+
* {@link BloomProvider}.
|
|
6
|
+
*
|
|
7
|
+
* `@oxyhq/bloom/scroll` is web-forked, so its `browser` export condition hands
|
|
8
|
+
* web consumers the real implementation while native gets the no-op. A compiled
|
|
9
|
+
* `lib/module/provider/index.js` cannot benefit from that condition (it imports
|
|
10
|
+
* a relative path, not the package subpath), so the platform choice is made
|
|
11
|
+
* here by FILENAME instead: Metro picks `scroll-provider.web.ts` on web, and
|
|
12
|
+
* every web bundler that resolves `.web.js` picks the compiled sibling. Same
|
|
13
|
+
* mechanism the toast engine uses for `ToastHost.native.tsx`.
|
|
14
|
+
*/
|
|
15
|
+
export { ScrollRestorationProvider } from "../scroll/index.js";
|
|
16
|
+
//# sourceMappingURL=scroll-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScrollRestorationProvider"],"sourceRoot":"../../../src","sources":["provider/scroll-provider.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,oBAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScrollRestorationProvider"],"sourceRoot":"../../../src","sources":["provider/scroll-provider.web.ts"],"mappings":";;AAAA;AACA,SAASA,yBAAyB,QAAQ,wBAAqB","ignoreList":[]}
|
|
@@ -45,6 +45,7 @@ import { easeOutQuartFn, useToastLayoutAnimations } from "./animations.js";
|
|
|
45
45
|
import { CLOSE_BUTTON_HIT_AREA, ENTERING_ANIMATION_DURATION, STACKING_ANIMATION_DURATION, TOAST_MAX_ROW_WIDTH, toastDefaults } from "./constants.js";
|
|
46
46
|
import { useDynamicToastContext, useToastContext } from "./context.js";
|
|
47
47
|
import { calculateStackScaleX } from "./position-utils.js";
|
|
48
|
+
import { isStackHovered } from './use-stack-hover';
|
|
48
49
|
import { useAnimatedTarget } from "./use-animated-target.js";
|
|
49
50
|
import { ToastContent } from "./ToastContent.js";
|
|
50
51
|
import { ToastSwipeHandler } from "./ToastSwipeHandler.js";
|
|
@@ -301,24 +302,48 @@ export const ToastRow = /*#__PURE__*/React.forwardRef(function ToastRow({
|
|
|
301
302
|
toastStore.resumeTimer(id);
|
|
302
303
|
}
|
|
303
304
|
}, [id, isExpanded]);
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* INVARIANT: NO TAP ON A STACKED ROW IS INERT. Every one of them dismisses,
|
|
308
|
+
* expands or collapses.
|
|
309
|
+
*
|
|
310
|
+
* The close-button strip dismisses only when a ✕ is actually THERE to aim at,
|
|
311
|
+
* which is exactly `closeButton && dismissible` — the same condition
|
|
312
|
+
* `ToastContent` renders it under, and nothing to do with expansion. Anything
|
|
313
|
+
* else in the strip falls through to the row's own behaviour rather than being
|
|
314
|
+
* swallowed: on a collapsed stack it expands, on an expanded one it collapses.
|
|
315
|
+
*
|
|
316
|
+
* Guarding the strip on `isExpanded` (as this did until now) made two taps do
|
|
317
|
+
* nothing at all — the whole strip at default config, where `closeButton` is
|
|
318
|
+
* `false` so the dismiss branch is unreachable, and the VISIBLE ✕ on a
|
|
319
|
+
* collapsed stack's front row. On Android that second one has no fallback:
|
|
320
|
+
* the RNGH tap wins the race against `ToastContent`'s nested close Pressable,
|
|
321
|
+
* so the ✕ never got its own press either.
|
|
322
|
+
*
|
|
323
|
+
* `x` is relative to the row, which is CAPPED at `TOAST_MAX_ROW_WIDTH`.
|
|
324
|
+
* Measuring the strip from the window edge would put it outside the row
|
|
325
|
+
* entirely on a wide viewport — do not "simplify" this back to `screenWidth`.
|
|
326
|
+
*
|
|
327
|
+
* W13 — the expansion TOGGLE stands down while a mouse is hovering the stack,
|
|
328
|
+
* because hover already owns expansion there (`use-stack-hover`). Without this
|
|
329
|
+
* a desktop click would collapse the stack under the cursor and resume the
|
|
330
|
+
* timers hover had just paused. Dismissing is unaffected, `onPress` always
|
|
331
|
+
* runs, and `isStackHovered()` is always false on native and on any touch web
|
|
332
|
+
* device — so press remains the only trigger wherever there is no pointer.
|
|
333
|
+
*/
|
|
304
334
|
const onSwipePress = React.useCallback(({
|
|
305
335
|
x
|
|
306
336
|
}) => {
|
|
307
337
|
if (enableStacking && numberOfToasts > 1 && position !== 'center') {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (x > rowWidth - CLOSE_BUTTON_HIT_AREA) {
|
|
313
|
-
if (isExpanded && closeButton && dismissible) {
|
|
314
|
-
onDismiss(id);
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
338
|
+
const inCloseStrip = x > rowWidth - CLOSE_BUTTON_HIT_AREA;
|
|
339
|
+
if (inCloseStrip && closeButton && dismissible) {
|
|
340
|
+
onDismiss(id);
|
|
341
|
+
} else if (!isStackHovered()) {
|
|
317
342
|
toggleExpand();
|
|
318
343
|
}
|
|
319
344
|
}
|
|
320
345
|
onPress?.();
|
|
321
|
-
}, [enableStacking, numberOfToasts, position, rowWidth,
|
|
346
|
+
}, [enableStacking, numberOfToasts, position, rowWidth, closeButton, dismissible, onDismiss, id, toggleExpand, onPress]);
|
|
322
347
|
|
|
323
348
|
// Front row on top: later rows in the stack sit progressively behind.
|
|
324
349
|
const stackZIndex = position === 'top-center' ? -(index + 1) : -(numberOfToasts - index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","useWindowDimensions","Animated","useAnimatedStyle","useSharedValue","withRepeat","withTiming","easeOutQuartFn","useToastLayoutAnimations","CLOSE_BUTTON_HIT_AREA","ENTERING_ANIMATION_DURATION","STACKING_ANIMATION_DURATION","TOAST_MAX_ROW_WIDTH","toastDefaults","useDynamicToastContext","useToastContext","calculateStackScaleX","useAnimatedTarget","ToastContent","ToastSwipeHandler","toastStore","useToastPosition","jsx","_jsx","WIGGLE_SCALE","WIGGLE_DURATION","WIGGLE_REPEATS","mergeToastStyles","toastOptions","perToast","variantStyle","toastContainer","toastContainerStyle","toast","style","toastContent","toastContentStyle","textContainer","textContainerStyle","title","titleStyle","description","descriptionStyle","buttons","buttonsStyle","closeButton","closeButtonStyle","closeButtonIcon","closeButtonIconStyle","ToastRow","forwardRef","id","icon","duration","variant","action","cancel","close","onDismiss","dismissible","closeButtonProp","actionButtonStyle","actionButtonTextStyle","cancelButtonStyle","cancelButtonTextStyle","styles","styleOverrides","promiseOptions","position","positionProp","animation","unstyled","unstyledProp","important","richColors","richColorsProp","onPress","allowFontScaling","allowFontScalingProp","maxFontSizeMultiplier","maxFontSizeMultiplierProp","backgroundComponent","backgroundComponentProp","numberOfToasts","index","orderedToastIds","ref","closeButtonCtx","icons","richColorsCtx","allowFontScalingCtx","maxFontSizeMultiplierCtx","enableStacking","gap","positionCtx","visibleToasts","unstyledCtx","toastHeights","isExpanded","toggleExpand","stackGap","mergedStyles","useMemo","undefined","distanceFromFront","isHiddenByLimit","entering","exiting","enterTranslateY","yPosition","allToastHeights","width","screenWidth","rowWidth","Math","min","stackScaleX","easing","stackTransformStyle","transform","translateY","value","scaleX","enterProgress","from","enterDistance","wiggleScale","rowStyle","opacity","scale","wiggle","useCallback","handleWiggle","Infinity","useImperativeHandle","measuredRef","useRef","useLayoutEffect","node","current","getBoundingClientRect","setToastHeight","height","stale","measureInWindow","_x","_y","_width","handleLayout","nativeEvent","layout","onRemove","onSwipeBegin","pauseTimer","onSwipeFinalize","resumeTimer","onSwipePress","x","stackZIndex","View","anchor","anchorFor","zIndex","children","onBegin","onFinalize","enabled","onLayout","create","anchorTop","top","anchorBottom","bottom","anchorCenter"],"sourceRoot":"../../../src","sources":["toast/ToastRow.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,UAAU,EAEVC,mBAAmB,QAEd,cAAc;AACrB,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAEhC,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,iBAAc;AACvE,SACEC,qBAAqB,EACrBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,aAAa,QACR,gBAAa;AACpB,SAASC,sBAAsB,EAAEC,eAAe,QAAQ,cAAW;AACnE,SAASC,oBAAoB,QAAQ,qBAAkB;AACvD,SAASC,iBAAiB,QAAQ,0BAAuB;AACzD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,UAAU,QAAQ,kBAAe;AAQ1C,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,YAAY,GAAG,KAAK;AAC1B,MAAMC,eAAe,GAAG,GAAG;AAC3B,MAAMC,cAAc,GAAG,CAAC;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,YAAuD,EACvDC,QAAiC,EACjCC,YAAkC,EACrB;EACb,OAAO;IACLC,cAAc,EAAE;MACd,GAAGH,Y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YACrBnE,KAAK,EAAEA,KAAM;YACbqC,QAAQ,EAAEA,QAAS;YACnBb,SAAS,EAAEA,SAAU;YACrBG,iBAAiB,EACfA,iBAAiB,IAAIjC,YAAY,CAACiC,iBACnC;YACDC,qBAAqB,EACnBA,qBAAqB,IAAIlC,YAAY,CAACkC,qBACvC;YACDC,iBAAiB,EACfA,iBAAiB,IAAInC,YAAY,CAACmC,iBACnC;YACDC,qBAAqB,EACnBA,qBAAqB,IAAIpC,YAAY,CAACoC,qBACvC;YACDa,gBAAgB,EAAEA,gBAAiB;YACnCE,qBAAqB,EAAEA,qBAAsB;YAC7CE,mBAAmB,EAAEA;UAAoB,CAC1C;QACF,CACY;MAAC,CACH;IAAC,CACC;EAAC,CACP,CAAC;AAEpB,CACF,CAAC;AAED,MAAMhB,MAAM,GAAGjE,UAAU,CAACwK,MAAM,CAAC;EAC/BR,MAAM,EAAE;IACN5F,QAAQ,EAAE,UAAU;IACpB2C,KAAK,EAAE;EACT,CAAC;EACD0D,SAAS,EAAE;IAAEC,GAAG,EAAE;EAAE,CAAC;EACrBC,YAAY,EAAE;IAAEC,MAAM,EAAE;EAAE,CAAC;EAC3B;AACF;AACA;AACA;AACA;AACA;EACEC,YAAY,EAAE;IAAEH,GAAG,EAAE;EAAM;AAC7B,CAAC,CAAC;;AAEF;AACA,SAAST,SAASA,CAAC7F,QAAuB,EAAE;EAC1C,IAAIA,QAAQ,KAAK,eAAe,EAAE;IAChC,OAAOH,MAAM,CAAC0G,YAAY;EAC5B;EACA,IAAIvG,QAAQ,KAAK,QAAQ,EAAE;IACzB,OAAOH,MAAM,CAAC4G,YAAY;EAC5B;EACA,OAAO5G,MAAM,CAACwG,SAAS;AACzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","useWindowDimensions","Animated","useAnimatedStyle","useSharedValue","withRepeat","withTiming","easeOutQuartFn","useToastLayoutAnimations","CLOSE_BUTTON_HIT_AREA","ENTERING_ANIMATION_DURATION","STACKING_ANIMATION_DURATION","TOAST_MAX_ROW_WIDTH","toastDefaults","useDynamicToastContext","useToastContext","calculateStackScaleX","isStackHovered","useAnimatedTarget","ToastContent","ToastSwipeHandler","toastStore","useToastPosition","jsx","_jsx","WIGGLE_SCALE","WIGGLE_DURATION","WIGGLE_REPEATS","mergeToastStyles","toastOptions","perToast","variantStyle","toastContainer","toastContainerStyle","toast","style","toastContent","toastContentStyle","textContainer","textContainerStyle","title","titleStyle","description","descriptionStyle","buttons","buttonsStyle","closeButton","closeButtonStyle","closeButtonIcon","closeButtonIconStyle","ToastRow","forwardRef","id","icon","duration","variant","action","cancel","close","onDismiss","dismissible","closeButtonProp","actionButtonStyle","actionButtonTextStyle","cancelButtonStyle","cancelButtonTextStyle","styles","styleOverrides","promiseOptions","position","positionProp","animation","unstyled","unstyledProp","important","richColors","richColorsProp","onPress","allowFontScaling","allowFontScalingProp","maxFontSizeMultiplier","maxFontSizeMultiplierProp","backgroundComponent","backgroundComponentProp","numberOfToasts","index","orderedToastIds","ref","closeButtonCtx","icons","richColorsCtx","allowFontScalingCtx","maxFontSizeMultiplierCtx","enableStacking","gap","positionCtx","visibleToasts","unstyledCtx","toastHeights","isExpanded","toggleExpand","stackGap","mergedStyles","useMemo","undefined","distanceFromFront","isHiddenByLimit","entering","exiting","enterTranslateY","yPosition","allToastHeights","width","screenWidth","rowWidth","Math","min","stackScaleX","easing","stackTransformStyle","transform","translateY","value","scaleX","enterProgress","from","enterDistance","wiggleScale","rowStyle","opacity","scale","wiggle","useCallback","handleWiggle","Infinity","useImperativeHandle","measuredRef","useRef","useLayoutEffect","node","current","getBoundingClientRect","setToastHeight","height","stale","measureInWindow","_x","_y","_width","handleLayout","nativeEvent","layout","onRemove","onSwipeBegin","pauseTimer","onSwipeFinalize","resumeTimer","onSwipePress","x","inCloseStrip","stackZIndex","View","anchor","anchorFor","zIndex","children","onBegin","onFinalize","enabled","onLayout","create","anchorTop","top","anchorBottom","bottom","anchorCenter"],"sourceRoot":"../../../src","sources":["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M,EAAEoC,YAAa;YACrBnE,KAAK,EAAEA,KAAM;YACbqC,QAAQ,EAAEA,QAAS;YACnBb,SAAS,EAAEA,SAAU;YACrBG,iBAAiB,EACfA,iBAAiB,IAAIjC,YAAY,CAACiC,iBACnC;YACDC,qBAAqB,EACnBA,qBAAqB,IAAIlC,YAAY,CAACkC,qBACvC;YACDC,iBAAiB,EACfA,iBAAiB,IAAInC,YAAY,CAACmC,iBACnC;YACDC,qBAAqB,EACnBA,qBAAqB,IAAIpC,YAAY,CAACoC,qBACvC;YACDa,gBAAgB,EAAEA,gBAAiB;YACnCE,qBAAqB,EAAEA,qBAAsB;YAC7CE,mBAAmB,EAAEA;UAAoB,CAC1C;QACF,CACY;MAAC,CACH;IAAC,CACC;EAAC,CACP,CAAC;AAEpB,CACF,CAAC;AAED,MAAMhB,MAAM,GAAGlE,UAAU,CAAC0K,MAAM,CAAC;EAC/BR,MAAM,EAAE;IACN7F,QAAQ,EAAE,UAAU;IACpB2C,KAAK,EAAE;EACT,CAAC;EACD2D,SAAS,EAAE;IAAEC,GAAG,EAAE;EAAE,CAAC;EACrBC,YAAY,EAAE;IAAEC,MAAM,EAAE;EAAE,CAAC;EAC3B;AACF;AACA;AACA;AACA;AACA;EACEC,YAAY,EAAE;IAAEH,GAAG,EAAE;EAAM;AAC7B,CAAC,CAAC;;AAEF;AACA,SAAST,SAASA,CAAC9F,QAAuB,EAAE;EAC1C,IAAIA,QAAQ,KAAK,eAAe,EAAE;IAChC,OAAOH,MAAM,CAAC2G,YAAY;EAC5B;EACA,IAAIxG,QAAQ,KAAK,QAAQ,EAAE;IACzB,OAAOH,MAAM,CAAC6G,YAAY;EAC5B;EACA,OAAO7G,MAAM,CAACyG,SAAS;AACzB","ignoreList":[]}
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
* covers `toast.custom` JSX and `unstyled` rows too, which never reach that
|
|
17
17
|
* card. Every distance the gesture measures is a fraction of the capped
|
|
18
18
|
* `rowWidth`, not of the window — see the constant.
|
|
19
|
+
*
|
|
20
|
+
* W13 — being THE row box also makes it the hover target: `useStackHover`'s
|
|
21
|
+
* handlers go here so a pointer over ANY row counts as a pointer over the stack.
|
|
22
|
+
* The handlers are empty on native.
|
|
19
23
|
*/
|
|
20
24
|
import * as React from 'react';
|
|
21
25
|
import { Platform, StyleSheet, useWindowDimensions } from 'react-native';
|
|
@@ -24,8 +28,10 @@ import Animated, { Easing, LinearTransition, interpolate, runOnJS, useAnimatedSt
|
|
|
24
28
|
import { easeInOutCircFn } from "./animations.js";
|
|
25
29
|
import { TOAST_MAX_ROW_WIDTH } from "./constants.js";
|
|
26
30
|
import { useToastContext } from "./context.js";
|
|
27
|
-
import {
|
|
31
|
+
import { useStackHover } from './use-stack-hover';
|
|
32
|
+
|
|
28
33
|
/** Fraction of the row a horizontal swipe must cross to dismiss. */
|
|
34
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
35
|
const HORIZONTAL_DISMISS_FRACTION = 0.25;
|
|
30
36
|
/** Below this the gesture reads as a tap, so the row springs back. */
|
|
31
37
|
const TAP_SLOP = 16;
|
|
@@ -53,10 +59,16 @@ export const ToastSwipeHandler = ({
|
|
|
53
59
|
const translate = useSharedValue(0);
|
|
54
60
|
const {
|
|
55
61
|
swipeToDismissDirection: direction,
|
|
56
|
-
position: positionCtx
|
|
62
|
+
position: positionCtx,
|
|
63
|
+
enableStacking
|
|
57
64
|
} = useToastContext();
|
|
58
65
|
const position = positionProps ?? positionCtx;
|
|
59
66
|
const isAndroid = Platform.OS === 'android';
|
|
67
|
+
// W13 — hover lives on THE ROW BOX, so hovering any row counts as hovering the
|
|
68
|
+
// stack. Empty on native; see `use-stack-hover.native.ts`.
|
|
69
|
+
const hoverProps = useStackHover({
|
|
70
|
+
enableStacking
|
|
71
|
+
});
|
|
60
72
|
const pan = Gesture.Pan().onBegin(() => {
|
|
61
73
|
'worklet';
|
|
62
74
|
|
|
@@ -155,11 +167,11 @@ export const ToastSwipeHandler = ({
|
|
|
155
167
|
return /*#__PURE__*/_jsx(GestureDetector, {
|
|
156
168
|
gesture: Gesture.Race(tap, pan),
|
|
157
169
|
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
158
|
-
style: [animatedStyle, unstyled ? undefined : styles.centered, styles.rowBox, style]
|
|
170
|
+
style: [animatedStyle, unstyled ? undefined : styles.centered, styles.rowBox, style],
|
|
171
|
+
...hoverProps,
|
|
159
172
|
// W9 — on web `LinearTransition`'s easing degrades to CSS `ease` because
|
|
160
173
|
// a `bezierFn` result carries no easing-name symbol for the CSS mapper.
|
|
161
174
|
// Accepted: the transition still runs, only its curve differs.
|
|
162
|
-
,
|
|
163
175
|
layout: LinearTransition.easing(easeInOutCircFn)
|
|
164
176
|
// https://reactnative.dev/docs/accessibility#aria-live-android
|
|
165
177
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","StyleSheet","useWindowDimensions","Gesture","GestureDetector","Animated","Easing","LinearTransition","interpolate","runOnJS","useAnimatedStyle","useSharedValue","withTiming","easeInOutCircFn","TOAST_MAX_ROW_WIDTH","useToastContext","jsx","_jsx","HORIZONTAL_DISMISS_FRACTION","TAP_SLOP","VERTICAL_FADE_DISTANCE","SPRING_BACK_EASING_BOUNCINESS","WRONG_DIRECTION_SPRING_DURATION","ToastSwipeHandler","children","onRemove","style","onBegin","onFinalize","enabled","unstyled","important","position","positionProps","onPress","width","windowWidth","rowWidth","Math","min","translate","swipeToDismissDirection","direction","positionCtx","isAndroid","OS","pan","Pan","onChange","event","translationX","value","isBottomPosition","rawTranslation","translationY","elasticResistance","springBack","duration","easing","elastic","dismiss","inOut","ease","isDone","abs","tap","Tap","onEnd","x","y","animatedStyle","transform","translateX","translateY","opacity","gesture","Race","View","undefined","styles","centered","rowBox","layout","create","justifyContent","maxWidth","alignSelf","distance","BASE_RESISTANCE","PROGRESSIVE_DAMPENING"],"sourceRoot":"../../../src","sources":["toast/ToastSwipeHandler.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,UAAU,EACVC,mBAAmB,QAEd,cAAc;AACrB,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,MAAM,EACNC,gBAAgB,EAChBC,WAAW,EACXC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAEhC,SAASC,eAAe,QAAQ,iBAAc;AAC9C,SAASC,mBAAmB,QAAQ,gBAAa;AACjD,SAASC,eAAe,QAAQ,cAAW;
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","useWindowDimensions","Gesture","GestureDetector","Animated","Easing","LinearTransition","interpolate","runOnJS","useAnimatedStyle","useSharedValue","withTiming","easeInOutCircFn","TOAST_MAX_ROW_WIDTH","useToastContext","useStackHover","jsx","_jsx","HORIZONTAL_DISMISS_FRACTION","TAP_SLOP","VERTICAL_FADE_DISTANCE","SPRING_BACK_EASING_BOUNCINESS","WRONG_DIRECTION_SPRING_DURATION","ToastSwipeHandler","children","onRemove","style","onBegin","onFinalize","enabled","unstyled","important","position","positionProps","onPress","width","windowWidth","rowWidth","Math","min","translate","swipeToDismissDirection","direction","positionCtx","enableStacking","isAndroid","OS","hoverProps","pan","Pan","onChange","event","translationX","value","isBottomPosition","rawTranslation","translationY","elasticResistance","springBack","duration","easing","elastic","dismiss","inOut","ease","isDone","abs","tap","Tap","onEnd","x","y","animatedStyle","transform","translateX","translateY","opacity","gesture","Race","View","undefined","styles","centered","rowBox","layout","create","justifyContent","maxWidth","alignSelf","distance","BASE_RESISTANCE","PROGRESSIVE_DAMPENING"],"sourceRoot":"../../../src","sources":["toast/ToastSwipeHandler.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,GAAGjF,UAAU,CAACqF,MAAM,CAAC;EAC/BH,QAAQ,EAAE;IAAEI,cAAc,EAAE;EAAS,CAAC;EACtC;AACF;AACA;AACA;AACA;EACEH,MAAM,EAAE;IACNhD,KAAK,EAAE,MAAM;IACboD,QAAQ,EAAE1E,mBAAmB;IAC7B2E,SAAS,EAAE;EACb;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,SAAS/B,iBAAiBA,CAACgC,QAAgB,EAAE;EAC3C,SAAS;;EACT,MAAMC,eAAe,GAAG,GAAG;EAC3B,MAAMC,qBAAqB,GAAG,IAAI;EAClC,OACEF,QAAQ,GAAGC,eAAe,IAAI,CAAC,IAAI,CAAC,GAAGD,QAAQ,GAAGE,qBAAqB,CAAC,CAAC;AAE7E","ignoreList":[]}
|
|
@@ -72,7 +72,24 @@ export const toastDefaults = {
|
|
|
72
72
|
theme: 'system',
|
|
73
73
|
autoWiggleOnUpdate: 'never',
|
|
74
74
|
richColors: false,
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* ON, unlike upstream — the same class of correction as `TOAST_MAX_ROW_WIDTH`.
|
|
77
|
+
*
|
|
78
|
+
* sonner-NATIVE defaults this off; sonner (web) has no switch at all, because a
|
|
79
|
+
* collapsed stack — front row full size, the ones behind scaled and offset,
|
|
80
|
+
* expanding on interaction — IS its default presentation. The port inherited the
|
|
81
|
+
* mobile default onto every desktop consumer, where an unstacked run of toasts
|
|
82
|
+
* is a column of full cards rather than a stack.
|
|
83
|
+
*
|
|
84
|
+
* Bloom already deviates deliberately elsewhere (`position: 'bottom-center'` vs
|
|
85
|
+
* upstream's `top-center`, `duration: 3000` vs 4000, `gap: 8` vs 14), so this is
|
|
86
|
+
* in keeping rather than a break with the port.
|
|
87
|
+
*
|
|
88
|
+
* Turning it OFF (`<ToastOutlet enableStacking={false} />`) restores the flat
|
|
89
|
+
* column, which is still the right choice for a surface that must show several
|
|
90
|
+
* toasts at once without an interaction.
|
|
91
|
+
*/
|
|
92
|
+
enableStacking: true,
|
|
76
93
|
stackGap: 8,
|
|
77
94
|
allowFontScaling: true
|
|
78
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["space","ESTIMATED_TOAST_HEIGHT","CLOSE_BUTTON_HIT_AREA","OUTSIDE_PRESS_PADDING","MIN_STACK_SCALE_X","TOAST_MAX_ROW_WIDTH","lg","ENTERING_ANIMATION_DURATION","STACKING_ANIMATION_DURATION","toastDefaults","duration","position","offset","swipeToDismissDirection","variant","undefined","visibleToasts","closeButton","dismissible","unstyled","invert","pauseWhenPageIsHidden","gap","theme","autoWiggleOnUpdate","richColors","enableStacking","stackGap","allowFontScaling"],"sourceRoot":"../../../src","sources":["toast/constants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,qBAAkB;AASxC;AACA,OAAO,MAAMC,sBAAsB,GAAG,EAAE;AACxC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC;AACA,OAAO,MAAMC,iBAAiB,GAAG,GAAG;;AAEpC;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,MAAMC,mBAAmB,GAAG,GAAG,GAAGL,KAAK,CAACM,EAAE,GAAG,CAAC;;AAErD;AACA,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAC9C,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAE9C,OAAO,MAAMC,aAmBZ,GAAG;EACFC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,eAAe;EACzB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAE,CAAC;EACTC,uBAAuB,EAAE,MAAM;EAC/B;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAEC,SAAS;EAClBC,aAAa,EAAE,CAAC;EAChBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,IAAI;EACjBC,QAAQ,EAAE,KAAK;EACfC,MAAM,EAAE,KAAK;EACbC,qBAAqB,EAAE,IAAI;EAC3BC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE,QAAQ;EACfC,kBAAkB,EAAE,OAAO;EAC3BC,UAAU,EAAE,KAAK;
|
|
1
|
+
{"version":3,"names":["space","ESTIMATED_TOAST_HEIGHT","CLOSE_BUTTON_HIT_AREA","OUTSIDE_PRESS_PADDING","MIN_STACK_SCALE_X","TOAST_MAX_ROW_WIDTH","lg","ENTERING_ANIMATION_DURATION","STACKING_ANIMATION_DURATION","toastDefaults","duration","position","offset","swipeToDismissDirection","variant","undefined","visibleToasts","closeButton","dismissible","unstyled","invert","pauseWhenPageIsHidden","gap","theme","autoWiggleOnUpdate","richColors","enableStacking","stackGap","allowFontScaling"],"sourceRoot":"../../../src","sources":["toast/constants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,qBAAkB;AASxC;AACA,OAAO,MAAMC,sBAAsB,GAAG,EAAE;AACxC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC;AACA,OAAO,MAAMC,iBAAiB,GAAG,GAAG;;AAEpC;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,MAAMC,mBAAmB,GAAG,GAAG,GAAGL,KAAK,CAACM,EAAE,GAAG,CAAC;;AAErD;AACA,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAC9C,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAE9C,OAAO,MAAMC,aAmBZ,GAAG;EACFC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,eAAe;EACzB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAE,CAAC;EACTC,uBAAuB,EAAE,MAAM;EAC/B;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAEC,SAAS;EAClBC,aAAa,EAAE,CAAC;EAChBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,IAAI;EACjBC,QAAQ,EAAE,KAAK;EACfC,MAAM,EAAE,KAAK;EACbC,qBAAqB,EAAE,IAAI;EAC3BC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE,QAAQ;EACfC,kBAAkB,EAAE,OAAO;EAC3BC,UAAU,EAAE,KAAK;EACjB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,cAAc,EAAE,IAAI;EACpBC,QAAQ,EAAE,CAAC;EACXC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|