@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
|
@@ -33,6 +33,7 @@ class ToastStore {
|
|
|
33
33
|
pendingPromises = new Set();
|
|
34
34
|
collapseCooldown = false;
|
|
35
35
|
collapseCooldownTimeout = null;
|
|
36
|
+
expansionHold = null;
|
|
36
37
|
subscribe = callback => {
|
|
37
38
|
this.subscribers.add(callback);
|
|
38
39
|
return () => {
|
|
@@ -47,6 +48,23 @@ class ToastStore {
|
|
|
47
48
|
setConfig = config => {
|
|
48
49
|
this.config = config;
|
|
49
50
|
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Something outside the store can HOLD an expanded stack open — on web, a pointer
|
|
54
|
+
* resting on it. Registered by the platform trigger (`use-stack-hover`) so this
|
|
55
|
+
* module stays pure JS with no DOM and no platform branch; native registers
|
|
56
|
+
* nothing and the predicate stays `null`.
|
|
57
|
+
*
|
|
58
|
+
* It is asked at DECISION time rather than tracked as state on purpose: a row can
|
|
59
|
+
* stop being under the pointer with no event at all — rows unmount under the
|
|
60
|
+
* cursor and move under a stationary one, and neither fires `pointerleave` —
|
|
61
|
+
* so any cached boolean goes stale. Nothing renders from this, so it is
|
|
62
|
+
* deliberately not part of the snapshot.
|
|
63
|
+
*/
|
|
64
|
+
setExpansionHold = hold => {
|
|
65
|
+
this.expansionHold = hold;
|
|
66
|
+
};
|
|
67
|
+
isHeldOpen = () => this.expansionHold?.() === true;
|
|
50
68
|
notify = () => {
|
|
51
69
|
this.subscribers.forEach(callback => callback());
|
|
52
70
|
};
|
|
@@ -239,7 +257,27 @@ class ToastStore {
|
|
|
239
257
|
...this.state.toastRefs
|
|
240
258
|
};
|
|
241
259
|
delete updatedRefs[id];
|
|
242
|
-
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* An expanded stack collapses itself once a single row is left, because
|
|
263
|
+
* "expanded" then means nothing visually — a lone row resolves to the SAME
|
|
264
|
+
* offset and scale either way (`toast-position-utils.test.ts` pins that) — while
|
|
265
|
+
* `isExpanded` keeps every timer paused, so staying expanded would leave that
|
|
266
|
+
* last toast on screen forever with no visible reason. Inherited from
|
|
267
|
+
* sonner-native and kept deliberately: on native it is invisible and it is the
|
|
268
|
+
* only thing that stops the last row hanging.
|
|
269
|
+
*
|
|
270
|
+
* UNLESS something is holding the stack open. On web that is a pointer resting
|
|
271
|
+
* on it, and collapsing under the cursor would resume the timers hover had just
|
|
272
|
+
* paused — the toast would then expire while the user is reading it, which is
|
|
273
|
+
* exactly what hover exists to prevent.
|
|
274
|
+
*
|
|
275
|
+
* An EMPTY stack always resets, hold or no hold: it no longer exists to be held,
|
|
276
|
+
* and once the rows unmount no `pointerleave` will ever arrive to release it.
|
|
277
|
+
*/
|
|
278
|
+
const isEmpty = filteredToasts.length === 0;
|
|
279
|
+
const heldOpen = !isEmpty && this.isHeldOpen();
|
|
280
|
+
const shouldAutoCollapse = filteredToasts.length <= 1 && this.state.isExpanded && !heldOpen;
|
|
243
281
|
const updatedIndex = this.cloneIndex();
|
|
244
282
|
updatedIndex.delete(id);
|
|
245
283
|
this.state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ENTERING_ANIMATION_DURATION","toastDefaults","areToastsEqual","ToastTimerRegistry","COLLAPSE_COOLDOWN","ToastStore","state","toasts","toastsById","Map","toastsCounter","toastRefs","shouldShowOverlay","toastHeights","isExpanded","subscribers","Set","config","timers","hideOverlayTimeout","pendingPromises","collapseCooldown","collapseCooldownTimeout","subscribe","callback","add","delete","getSnapshot","setConfig","notify","forEach","cloneIndex","resolveDuration","duration","scheduleAutoClose","id","start","onComplete","dismissToast","pauseTimer","pause","resumeTimer","resume","pauseAllTimers","pauseAll","resumeAllTimers","resumeAll","handlePromise","toast","promiseOptions","has","title","promise","addToast","variant","undefined","styles","success","error","options","providedId","length","nextCounter","newToast","numberOfToasts","index","orderedToastIds","existingToast","get","shouldWiggle","autoWiggleOnUpdate","wiggleToast","updatedToasts","map","currentToast","updatedIndex","updatedEntry","find","t","set","newToasts","newToastRefs","createRef","visibleToasts","newIndex","updatedHeights","heightsChanged","removedToast","shift","clear","clearTimeout","origin","clearAll","onDismiss","onAutoClose","scheduleHideOverlay","toastForCallback","filteredToasts","filter","updatedRefs","shouldAutoCollapse","setTimeout","current","wiggle","getToastRef","setToastHeight","height","expand","collapse","toggleExpand","toastStore"],"sourceRoot":"../../../src","sources":["toast/toast-store.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,2BAA2B,EAAEC,aAAa,QAAQ,gBAAa;AACxE,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,kBAAkB,QAAQ,mBAAgB;AAUnD;AACA,MAAMC,iBAAiB,GAAG,GAAG;AAE7B,MAAMC,UAAU,CAAC;EACPC,KAAK,GAAoB;IAC/BC,MAAM,EAAE,EAAE;IACVC,UAAU,EAAE,IAAIC,GAAG,CAAC,CAAC;IACrBC,aAAa,E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CAACD,MAAM,CAAC,CAAC;IACf;EACF,CAAC;AACH;AAEA,OAAO,MAAMG,UAAU,GAAG,IAAIzG,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","ENTERING_ANIMATION_DURATION","toastDefaults","areToastsEqual","ToastTimerRegistry","COLLAPSE_COOLDOWN","ToastStore","state","toasts","toastsById","Map","toastsCounter","toastRefs","shouldShowOverlay","toastHeights","isExpanded","subscribers","Set","config","timers","hideOverlayTimeout","pendingPromises","collapseCooldown","collapseCooldownTimeout","expansionHold","subscribe","callback","add","delete","getSnapshot","setConfig","setExpansionHold","hold","isHeldOpen","notify","forEach","cloneIndex","resolveDuration","duration","scheduleAutoClose","id","start","onComplete","dismissToast","pauseTimer","pause","resumeTimer","resume","pauseAllTimers","pauseAll","resumeAllTimers","resumeAll","handlePromise","toast","promiseOptions","has","title","promise","addToast","variant","undefined","styles","success","error","options","providedId","length","nextCounter","newToast","numberOfToasts","index","orderedToastIds","existingToast","get","shouldWiggle","autoWiggleOnUpdate","wiggleToast","updatedToasts","map","currentToast","updatedIndex","updatedEntry","find","t","set","newToasts","newToastRefs","createRef","visibleToasts","newIndex","updatedHeights","heightsChanged","removedToast","shift","clear","clearTimeout","origin","clearAll","onDismiss","onAutoClose","scheduleHideOverlay","toastForCallback","filteredToasts","filter","updatedRefs","isEmpty","heldOpen","shouldAutoCollapse","setTimeout","current","wiggle","getToastRef","setToastHeight","height","expand","collapse","toggleExpand","toastStore"],"sourceRoot":"../../../src","sources":["toast/toast-store.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,2BAA2B,EAAEC,aAAa,QAAQ,gBAAa;AACxE,SAASC,cAAc,QAAQ,uBAAoB;AACnD,SAASC,kBAAkB,QAAQ,mBAAgB;AAUnD;AACA,MAAMC,iBAAiB,GAAG,GAAG;AAE7B,MAAMC,UAAU,CA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I;IAC5B,IAAI,IAAI,CAACC,uBAAuB,EAAE;MAChCwE,YAAY,CAAC,IAAI,CAACxE,uBAAuB,CAAC;IAC5C;IACA,IAAI,CAACA,uBAAuB,GAAGqF,UAAU,CAAC,MAAM;MAC9C,IAAI,CAACtF,gBAAgB,GAAG,KAAK;MAC7B,IAAI,CAACC,uBAAuB,GAAG,IAAI;IACrC,CAAC,EAAElB,iBAAiB,CAAC;IAErB,IAAI,CAACc,MAAM,CAACgC,SAAS,CAAC,CAAC;IACvB,IAAI,CAACjB,MAAM,CAAC,CAAC;EACf,CAAC;EAEDkF,YAAY,GAAGA,CAAA,KAAM;IACnB,IAAI,CAAC,IAAI,CAAC7G,KAAK,CAACQ,UAAU,IAAI,IAAI,CAACO,gBAAgB,EAAE;MACnD;IACF;IAEA,IAAI,IAAI,CAACf,KAAK,CAACQ,UAAU,EAAE;MACzB,IAAI,CAACoG,QAAQ,CAAC,CAAC;IACjB,CAAC,MAAM;MACL,IAAI,CAACD,MAAM,CAAC,CAAC;IACf;EACF,CAAC;AACH;AAEA,OAAO,MAAMG,UAAU,GAAG,IAAI/G,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bloom-original — WEB/default. `use-stack-hover.native.ts` is the native no-op,
|
|
5
|
+
* filename-resolved by Metro exactly as `ToastHost.native.tsx` is, so `toast/`
|
|
6
|
+
* stays one universal engine with no `index.web` fork.
|
|
7
|
+
*
|
|
8
|
+
* sonner expands its stack on HOVER; sonner-native only has press, because a phone
|
|
9
|
+
* has no pointer. Bloom needs both: press is the touch and native affordance, hover
|
|
10
|
+
* is what a desktop user expects, and a touch-capable web device must not get a
|
|
11
|
+
* phantom hover from its own taps.
|
|
12
|
+
*
|
|
13
|
+
* THIS IS A TRIGGER, NOT A SECOND MECHANISM. It drives the store's existing
|
|
14
|
+
* `expand`/`collapse`, which already pause and resume the auto-close timers
|
|
15
|
+
* (`ToastStore.expand` calls `timers.pauseAll()`, `collapse` calls `resumeAll()`),
|
|
16
|
+
* so hovering to read a toast cannot let it expire under the cursor — no new
|
|
17
|
+
* pausing path, no new store state. With stacking OFF there is nothing to expand,
|
|
18
|
+
* so the pointer pauses the timers directly instead: the reason sonner pauses is
|
|
19
|
+
* that the pointer is over the toast, which has nothing to do with stacking.
|
|
20
|
+
*
|
|
21
|
+
* TWO THINGS ARE LOAD-BEARING:
|
|
22
|
+
*
|
|
23
|
+
* - `pointerType === 'mouse'`. Touch fires `pointerenter` before `pointerdown`
|
|
24
|
+
* and `pointerleave` after `pointerup` (the pointer ceases to exist), so
|
|
25
|
+
* without this guard every TAP on a touch-capable web device would expand then
|
|
26
|
+
* collapse the stack while the press toggle fired too — three handlers fighting
|
|
27
|
+
* over one tap. Hover is additive: pens and touch fall through to press.
|
|
28
|
+
* - THE LEAVE IS DEFERRED BY A FRAME-ISH GRACE PERIOD, and any enter cancels it.
|
|
29
|
+
* Rows are separate absolutely-positioned boxes with `gap` between them once
|
|
30
|
+
* expanded, so moving the pointer from one row to the next leaves the first
|
|
31
|
+
* before entering the second. Collapsing on that would snap the stack shut and
|
|
32
|
+
* reopen it on whatever row ends up under the pointer — a jitter loop, plus a
|
|
33
|
+
* resume/pause pair per crossing that re-banks each timer's remaining time.
|
|
34
|
+
*
|
|
35
|
+
* The state is module-level on purpose: there is ONE stack per document, the same
|
|
36
|
+
* reason `toastStore` is a module singleton. It is written and read only inside
|
|
37
|
+
* event handlers — never in render — so the React Compiler has nothing to freeze.
|
|
38
|
+
*/
|
|
39
|
+
import { useMemo } from 'react';
|
|
40
|
+
import { toastStore } from "./toast-store.js";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* How long a leave waits for a neighbouring row to claim the pointer. One frame is
|
|
44
|
+
* enough for the same-tick leave/enter pair a row crossing produces; this is a
|
|
45
|
+
* little more so a slow frame cannot flash the stack shut. Exported so the suite
|
|
46
|
+
* asserts against the real value rather than a copy of it.
|
|
47
|
+
*/
|
|
48
|
+
export const HOVER_LEAVE_GRACE = 80;
|
|
49
|
+
|
|
50
|
+
/** The portal root every toast row lives under — see `portal/index.web.tsx`. */
|
|
51
|
+
const PORTAL_ROOT_ID = 'bloom-portal-root';
|
|
52
|
+
let hovered = false;
|
|
53
|
+
let leaveTimeout = null;
|
|
54
|
+
const isMouse = event => event.nativeEvent.pointerType === 'mouse';
|
|
55
|
+
const cancelPendingLeave = () => {
|
|
56
|
+
if (leaveTimeout !== null) {
|
|
57
|
+
clearTimeout(leaveTimeout);
|
|
58
|
+
leaveTimeout = null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Whether the pointer is over the stack RIGHT NOW.
|
|
64
|
+
*
|
|
65
|
+
* Two sources, and both are load-bearing:
|
|
66
|
+
*
|
|
67
|
+
* - the `hovered` latch answers "a mouse entered and has not left", which is the
|
|
68
|
+
* only thing available where there is no DOM (jest runs on `testEnvironment:
|
|
69
|
+
* 'node'`), and is a cheap early-out.
|
|
70
|
+
* - the live `:hover` query answers "a row is under the pointer", which the latch
|
|
71
|
+
* CANNOT: a row can stop being hovered with no event whatsoever. Measured — a row
|
|
72
|
+
* culled by `visibleToasts` under a stationary cursor fires no `pointerleave`,
|
|
73
|
+
* `pointerout` or `mouseleave` at all, and the restack then slides the remaining
|
|
74
|
+
* rows out from under the pointer. A latch alone therefore sticks TRUE, which
|
|
75
|
+
* would disable the press toggle for the rest of the session and suppress every
|
|
76
|
+
* later auto-collapse.
|
|
77
|
+
*
|
|
78
|
+
* Requiring both means a stale latch is corrected by the DOM and a stray DOM match
|
|
79
|
+
* (a pen, a touch) is rejected by the latch.
|
|
80
|
+
*
|
|
81
|
+
* COVERAGE, stated plainly: jest cannot see the DOM half at all
|
|
82
|
+
* (`testEnvironment: 'node'`), and a browser cannot isolate it either — its two
|
|
83
|
+
* consequences are a press toggle standing down (unreachable with a mouse, which
|
|
84
|
+
* always hovers what it presses) and a suppressed auto-collapse (which the deferred
|
|
85
|
+
* leave below independently corrects the moment any boundary event fires). Both
|
|
86
|
+
* halves are kept because each is measurably more accurate than the other alone, not
|
|
87
|
+
* because a test proves the composite.
|
|
88
|
+
*
|
|
89
|
+
* `ToastRow` asks so a press does not TOGGLE what hover already opened, and
|
|
90
|
+
* `toastStore` asks before auto-collapsing a stack down to its last row. The press
|
|
91
|
+
* still runs the toast's own `onPress`; only the expansion toggle steps aside.
|
|
92
|
+
*/
|
|
93
|
+
export function isStackHovered() {
|
|
94
|
+
return hovered && rowUnderPointer() !== false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The live DOM answer, or `undefined` where there is no DOM to ask (jest runs on
|
|
99
|
+
* `testEnvironment: 'node'`). Deliberately tri-state: "unknowable" and "no" must not
|
|
100
|
+
* collapse into the same value, because the two callers want opposite defaults —
|
|
101
|
+
* `isStackHovered` trusts the latch when it cannot check, while the deferred leave
|
|
102
|
+
* only stands down on a positive "yes, still hovered".
|
|
103
|
+
*/
|
|
104
|
+
function rowUnderPointer() {
|
|
105
|
+
if (typeof document === 'undefined') {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
return document.querySelector(`#${PORTAL_ROOT_ID} [aria-live]:hover`) !== null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A pointer resting on the stack HOLDS it open, so the store must not auto-collapse
|
|
113
|
+
* it out from under the cursor. Registered here rather than passed in because this
|
|
114
|
+
* file is the one that knows what hovering means; the store only knows that
|
|
115
|
+
* something says "not yet". Native's fork registers nothing.
|
|
116
|
+
*/
|
|
117
|
+
toastStore.setExpansionHold(isStackHovered);
|
|
118
|
+
export function useStackHover({
|
|
119
|
+
enableStacking
|
|
120
|
+
}) {
|
|
121
|
+
// Stable per outlet configuration: these land on the row box as props, and every
|
|
122
|
+
// row re-renders on each stack change.
|
|
123
|
+
return useMemo(() => ({
|
|
124
|
+
onPointerEnter: event => {
|
|
125
|
+
if (!isMouse(event)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
cancelPendingLeave();
|
|
129
|
+
hovered = true;
|
|
130
|
+
if (enableStacking) {
|
|
131
|
+
// Pauses the timers as part of expanding.
|
|
132
|
+
toastStore.expand();
|
|
133
|
+
} else {
|
|
134
|
+
toastStore.pauseAllTimers();
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
onPointerLeave: event => {
|
|
138
|
+
if (!isMouse(event) || !hovered) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
cancelPendingLeave();
|
|
142
|
+
leaveTimeout = setTimeout(() => {
|
|
143
|
+
leaveTimeout = null;
|
|
144
|
+
// The rows may have moved rather than the pointer: an expand, a collapse
|
|
145
|
+
// or a restack slides them under a stationary cursor without firing a
|
|
146
|
+
// single pointer event, so re-ask the DOM before acting on a leave that
|
|
147
|
+
// fired 80ms ago. Only a positive "still hovered" stands the collapse down.
|
|
148
|
+
if (rowUnderPointer() === true) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
hovered = false;
|
|
152
|
+
if (enableStacking) {
|
|
153
|
+
// Resumes the timers as part of collapsing.
|
|
154
|
+
toastStore.collapse();
|
|
155
|
+
} else {
|
|
156
|
+
toastStore.resumeAllTimers();
|
|
157
|
+
}
|
|
158
|
+
}, HOVER_LEAVE_GRACE);
|
|
159
|
+
}
|
|
160
|
+
}), [enableStacking]);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Test-only reset: the module state outlives a render tree, so a suite must clear it. */
|
|
164
|
+
export function resetStackHoverForTests() {
|
|
165
|
+
cancelPendingLeave();
|
|
166
|
+
hovered = false;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=use-stack-hover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","toastStore","HOVER_LEAVE_GRACE","PORTAL_ROOT_ID","hovered","leaveTimeout","isMouse","event","nativeEvent","pointerType","cancelPendingLeave","clearTimeout","isStackHovered","rowUnderPointer","document","undefined","querySelector","setExpansionHold","useStackHover","enableStacking","onPointerEnter","expand","pauseAllTimers","onPointerLeave","setTimeout","collapse","resumeAllTimers","resetStackHoverForTests"],"sourceRoot":"../../../src","sources":["toast/use-stack-hover.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,OAAO;AAE/B,SAASC,UAAU,QAAQ,kBAAe;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,EAAE;;AAEnC;AACA,MAAMC,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,cAAcA,CAAA,EAAY;EACxC,OAAOR,OAAO,IAAIS,eAAe,CAAC,CAAC,KAAK,KAAK;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAeA,CAAA,EAAwB;EAC9C,IAAI,OAAOC,QAAQ,KAAK,W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oreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bloom-original — NATIVE. Metro resolves this over `use-stack-hover.ts` on iOS and
|
|
5
|
+
* Android, the same filename split `ToastHost.native.tsx` uses.
|
|
6
|
+
*
|
|
7
|
+
* Native keeps PRESS as the only way to expand a stack, so this hands back no
|
|
8
|
+
* handlers at all. Two reasons it is a fork rather than a runtime `Platform` check:
|
|
9
|
+
* the web file's module-level hover state and its `setTimeout` have no business
|
|
10
|
+
* existing in a native bundle, and `onPointerEnter`/`onPointerLeave` DO fire on
|
|
11
|
+
* native for touch (RN's pointer events unify touch and mouse), which would make
|
|
12
|
+
* every tap expand-then-collapse while the press toggle fired as well.
|
|
13
|
+
*
|
|
14
|
+
* Keep the shape identical to the web file — `ToastSwipeHandler` spreads whatever
|
|
15
|
+
* this returns onto the row box, and `ToastRow` calls `isStackHovered()`
|
|
16
|
+
* unconditionally.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Parity with the web file's export; nothing here waits for anything. */
|
|
20
|
+
export const HOVER_LEAVE_GRACE = 0;
|
|
21
|
+
|
|
22
|
+
/** Nothing hovers on a touch screen. */
|
|
23
|
+
export function isStackHovered() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One frozen object, so spreading it never changes the row box's props. */
|
|
28
|
+
const NO_HOVER_PROPS = Object.freeze({});
|
|
29
|
+
export function useStackHover(_options) {
|
|
30
|
+
return NO_HOVER_PROPS;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Parity with the web file so the shared suite can call it on either platform. */
|
|
34
|
+
export function resetStackHoverForTests() {}
|
|
35
|
+
//# sourceMappingURL=use-stack-hover.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HOVER_LEAVE_GRACE","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;AACA,OAAO,MAAMA,iBAAiB,GAAG,CAAC;;AAElC;AACA,OAAO,SAASC,cAAcA,CAAA,EAAY;EACxC,OAAO,KAAK;AACd;;AAEA;AACA,MAAMC,cAA+B,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEzD,OAAO,SAASC,aAAaA,CAACC,QAAqC,EAAmB;EACpF,OAAOJ,cAAc;AACvB;;AAEA;AACA,OAAO,SAASK,uBAAuBA,CAAA,EAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `BloomProvider` — the ONE Bloom root an app mounts.
|
|
3
|
+
*
|
|
4
|
+
* Bloom's app-wide state used to be a handful of separate providers that every
|
|
5
|
+
* consumer wired by hand (theme, haptics, image resolution, scroll restoration,
|
|
6
|
+
* tab-bar minimize progress). Mounting them separately means each one can end
|
|
7
|
+
* up at a different depth, and a provider mounted too low fails in ways that
|
|
8
|
+
* are hard to trace:
|
|
9
|
+
*
|
|
10
|
+
* - `useScrollRestoration()` THROWS on web outside `ScrollRestorationProvider`,
|
|
11
|
+
* so any scrollable rendered beside the provider (a right rail, an overlay)
|
|
12
|
+
* crashes the screen.
|
|
13
|
+
* - `useMinimizeState()` silently hands each caller a private fallback, so a
|
|
14
|
+
* tab bar below the provider just never minimizes — no error anywhere.
|
|
15
|
+
*
|
|
16
|
+
* Mounting this single provider at the app root makes both classes of mistake
|
|
17
|
+
* impossible: everything Bloom renders is under all of them, at the same depth.
|
|
18
|
+
* Nesting extra contexts costs nothing at runtime — the win is that scope is no
|
|
19
|
+
* longer a per-app decision.
|
|
20
|
+
*
|
|
21
|
+
* NOT included, on purpose — these are OUTLETS, not state, and their placement
|
|
22
|
+
* in the tree is a real app decision (z-order, safe areas, and mounting a
|
|
23
|
+
* second one duplicates every surface it renders):
|
|
24
|
+
* `<ToastOutlet>`, `<Portal.Provider>`/`<Portal.Outlet>`, `<SurfaceHost>`,
|
|
25
|
+
* `<BloomDialogProvider>`, `<AlertDialogHost>`.
|
|
26
|
+
*/
|
|
27
|
+
import type { ReactNode } from 'react';
|
|
28
|
+
import { type ImageResolver } from '../image-resolver';
|
|
29
|
+
import { type BloomThemeProviderProps } from '../theme';
|
|
30
|
+
export interface BloomProviderProps extends Omit<BloomThemeProviderProps, 'children'> {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves bare media identifiers (Oxy file ids) to loadable URLs for every
|
|
34
|
+
* Bloom surface that takes a `source` — `<Avatar>`, image galleries, cards.
|
|
35
|
+
* Typically `(id, variant) => oxyServices.getFileDownloadUrl(id, variant)`.
|
|
36
|
+
*/
|
|
37
|
+
imageResolver?: ImageResolver;
|
|
38
|
+
/** `false` disables haptic feedback app-wide (honored by every `useHaptics()` call). */
|
|
39
|
+
haptics?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function BloomProvider({ children, imageResolver, haptics, ...themeProps }: BloomProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare namespace BloomProvider {
|
|
43
|
+
var displayName: string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACnF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,OAAc,EACd,GAAG,UAAU,EACd,EAAE,kBAAkB,2CAcpB;yBAnBe,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native/default binding for the scroll-restoration provider used by
|
|
3
|
+
* {@link BloomProvider}.
|
|
4
|
+
*
|
|
5
|
+
* `@oxyhq/bloom/scroll` is web-forked, so its `browser` export condition hands
|
|
6
|
+
* web consumers the real implementation while native gets the no-op. A compiled
|
|
7
|
+
* `lib/module/provider/index.js` cannot benefit from that condition (it imports
|
|
8
|
+
* a relative path, not the package subpath), so the platform choice is made
|
|
9
|
+
* here by FILENAME instead: Metro picks `scroll-provider.web.ts` on web, and
|
|
10
|
+
* every web bundler that resolves `.web.js` picks the compiled sibling. Same
|
|
11
|
+
* mechanism the toast engine uses for `ToastHost.native.tsx`.
|
|
12
|
+
*/
|
|
13
|
+
export { ScrollRestorationProvider } from '../scroll';
|
|
14
|
+
//# sourceMappingURL=scroll-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-provider.d.ts","sourceRoot":"","sources":["../../../../src/provider/scroll-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-provider.web.d.ts","sourceRoot":"","sources":["../../../../src/provider/scroll-provider.web.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastRow.d.ts","sourceRoot":"","sources":["../../../../src/toast/ToastRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ToastRow.d.ts","sourceRoot":"","sources":["../../../../src/toast/ToastRow.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6B/B,OAAO,KAAK,EAEV,aAAa,EAEb,QAAQ,EACR,WAAW,EACZ,MAAM,SAAS,CAAC;AAwDjB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAHR,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI;kCAuWzC,CAAC"}
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* covers `toast.custom` JSX and `unstyled` rows too, which never reach that
|
|
15
15
|
* card. Every distance the gesture measures is a fraction of the capped
|
|
16
16
|
* `rowWidth`, not of the window — see the constant.
|
|
17
|
+
*
|
|
18
|
+
* W13 — being THE row box also makes it the hover target: `useStackHover`'s
|
|
19
|
+
* handlers go here so a pointer over ANY row counts as a pointer over the stack.
|
|
20
|
+
* The handlers are empty on native.
|
|
17
21
|
*/
|
|
18
22
|
import * as React from 'react';
|
|
19
23
|
import { type ViewStyle } from 'react-native';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastSwipeHandler.d.ts","sourceRoot":"","sources":["../../../../src/toast/ToastSwipeHandler.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ToastSwipeHandler.d.ts","sourceRoot":"","sources":["../../../../src/toast/ToastSwipeHandler.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH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A2B,MAAM,CAAC;AAE/C,eAAO,MAAM,aAAa,EAAE;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,EAAE,mBAAmB,CAAC;IAC7C,OAAO,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,kBAAkB,EAAE,UAAU,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;CA+C3B,CAAC"}
|
|
@@ -20,10 +20,25 @@ declare class ToastStore {
|
|
|
20
20
|
private pendingPromises;
|
|
21
21
|
private collapseCooldown;
|
|
22
22
|
private collapseCooldownTimeout;
|
|
23
|
+
private expansionHold;
|
|
23
24
|
subscribe: (callback: Subscriber) => () => void;
|
|
24
25
|
/** Stable while nothing has changed — safe as a `useSyncExternalStore` snapshot. */
|
|
25
26
|
getSnapshot: () => ToastStoreState;
|
|
26
27
|
setConfig: (config: ToastStoreConfig) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Something outside the store can HOLD an expanded stack open — on web, a pointer
|
|
30
|
+
* resting on it. Registered by the platform trigger (`use-stack-hover`) so this
|
|
31
|
+
* module stays pure JS with no DOM and no platform branch; native registers
|
|
32
|
+
* nothing and the predicate stays `null`.
|
|
33
|
+
*
|
|
34
|
+
* It is asked at DECISION time rather than tracked as state on purpose: a row can
|
|
35
|
+
* stop being under the pointer with no event at all — rows unmount under the
|
|
36
|
+
* cursor and move under a stationary one, and neither fires `pointerleave` —
|
|
37
|
+
* so any cached boolean goes stale. Nothing renders from this, so it is
|
|
38
|
+
* deliberately not part of the snapshot.
|
|
39
|
+
*/
|
|
40
|
+
setExpansionHold: (hold: (() => boolean) | null) => void;
|
|
41
|
+
private isHeldOpen;
|
|
27
42
|
private notify;
|
|
28
43
|
private cloneIndex;
|
|
29
44
|
private resolveDuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-store.d.ts","sourceRoot":"","sources":["../../../../src/toast/toast-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,KAAK,UAAU,GAAG,MAAM,IAAI,CAAC;AAK7B,cAAM,UAAU;IACd,OAAO,CAAC,KAAK,CAQX;IAEF,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,kBAAkB,CAA8C;IACxE,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,uBAAuB,CAA8C;
|
|
1
|
+
{"version":3,"file":"toast-store.d.ts","sourceRoot":"","sources":["../../../../src/toast/toast-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,KAAK,UAAU,GAAG,MAAM,IAAI,CAAC;AAK7B,cAAM,UAAU;IACd,OAAO,CAAC,KAAK,CAQX;IAEF,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,MAAM,CAAwB;IACt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AAC,QAAQ,GAAG,IAAI,CAAC,GAAG,SAAS,CAE7C;IAEF,cAAc,GAAI,IAAI,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM,UAWnD;IAEF,MAAM,aAOJ;IAEF,QAAQ,aAiBN;IAEF,YAAY,aAUV;CACH;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long a leave waits for a neighbouring row to claim the pointer. One frame is
|
|
3
|
+
* enough for the same-tick leave/enter pair a row crossing produces; this is a
|
|
4
|
+
* little more so a slow frame cannot flash the stack shut. Exported so the suite
|
|
5
|
+
* asserts against the real value rather than a copy of it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HOVER_LEAVE_GRACE = 80;
|
|
8
|
+
type HoverEvent = {
|
|
9
|
+
nativeEvent: {
|
|
10
|
+
pointerType?: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Whether the pointer is over the stack RIGHT NOW.
|
|
15
|
+
*
|
|
16
|
+
* Two sources, and both are load-bearing:
|
|
17
|
+
*
|
|
18
|
+
* - the `hovered` latch answers "a mouse entered and has not left", which is the
|
|
19
|
+
* only thing available where there is no DOM (jest runs on `testEnvironment:
|
|
20
|
+
* 'node'`), and is a cheap early-out.
|
|
21
|
+
* - the live `:hover` query answers "a row is under the pointer", which the latch
|
|
22
|
+
* CANNOT: a row can stop being hovered with no event whatsoever. Measured — a row
|
|
23
|
+
* culled by `visibleToasts` under a stationary cursor fires no `pointerleave`,
|
|
24
|
+
* `pointerout` or `mouseleave` at all, and the restack then slides the remaining
|
|
25
|
+
* rows out from under the pointer. A latch alone therefore sticks TRUE, which
|
|
26
|
+
* would disable the press toggle for the rest of the session and suppress every
|
|
27
|
+
* later auto-collapse.
|
|
28
|
+
*
|
|
29
|
+
* Requiring both means a stale latch is corrected by the DOM and a stray DOM match
|
|
30
|
+
* (a pen, a touch) is rejected by the latch.
|
|
31
|
+
*
|
|
32
|
+
* COVERAGE, stated plainly: jest cannot see the DOM half at all
|
|
33
|
+
* (`testEnvironment: 'node'`), and a browser cannot isolate it either — its two
|
|
34
|
+
* consequences are a press toggle standing down (unreachable with a mouse, which
|
|
35
|
+
* always hovers what it presses) and a suppressed auto-collapse (which the deferred
|
|
36
|
+
* leave below independently corrects the moment any boundary event fires). Both
|
|
37
|
+
* halves are kept because each is measurably more accurate than the other alone, not
|
|
38
|
+
* because a test proves the composite.
|
|
39
|
+
*
|
|
40
|
+
* `ToastRow` asks so a press does not TOGGLE what hover already opened, and
|
|
41
|
+
* `toastStore` asks before auto-collapsing a stack down to its last row. The press
|
|
42
|
+
* still runs the toast's own `onPress`; only the expansion toggle steps aside.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isStackHovered(): boolean;
|
|
45
|
+
export type StackHoverProps = {
|
|
46
|
+
onPointerEnter: (event: HoverEvent) => void;
|
|
47
|
+
onPointerLeave: (event: HoverEvent) => void;
|
|
48
|
+
};
|
|
49
|
+
export declare function useStackHover({ enableStacking, }: {
|
|
50
|
+
enableStacking: boolean;
|
|
51
|
+
}): StackHoverProps;
|
|
52
|
+
/** Test-only reset: the module state outlives a render tree, so a suite must clear it. */
|
|
53
|
+
export declare function resetStackHoverForTests(): void;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=use-stack-hover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stack-hover.d.ts","sourceRoot":"","sources":["../../../../src/toast/use-stack-hover.ts"],"names":[],"mappings":"AAwCA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAKpC,KAAK,UAAU,GAAG;IAAE,WAAW,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAc5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAwBD,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,cAAc,GACf,EAAE;IACD,cAAc,EAAE,OAAO,CAAC;CACzB,GAAG,eAAe,CA4ClB;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bloom-original — NATIVE. Metro resolves this over `use-stack-hover.ts` on iOS and
|
|
3
|
+
* Android, the same filename split `ToastHost.native.tsx` uses.
|
|
4
|
+
*
|
|
5
|
+
* Native keeps PRESS as the only way to expand a stack, so this hands back no
|
|
6
|
+
* handlers at all. Two reasons it is a fork rather than a runtime `Platform` check:
|
|
7
|
+
* the web file's module-level hover state and its `setTimeout` have no business
|
|
8
|
+
* existing in a native bundle, and `onPointerEnter`/`onPointerLeave` DO fire on
|
|
9
|
+
* native for touch (RN's pointer events unify touch and mouse), which would make
|
|
10
|
+
* every tap expand-then-collapse while the press toggle fired as well.
|
|
11
|
+
*
|
|
12
|
+
* Keep the shape identical to the web file — `ToastSwipeHandler` spreads whatever
|
|
13
|
+
* this returns onto the row box, and `ToastRow` calls `isStackHovered()`
|
|
14
|
+
* unconditionally.
|
|
15
|
+
*/
|
|
16
|
+
export type StackHoverProps = Record<string, never>;
|
|
17
|
+
/** Parity with the web file's export; nothing here waits for anything. */
|
|
18
|
+
export declare const HOVER_LEAVE_GRACE = 0;
|
|
19
|
+
/** Nothing hovers on a touch screen. */
|
|
20
|
+
export declare function isStackHovered(): boolean;
|
|
21
|
+
export declare function useStackHover(_options: {
|
|
22
|
+
enableStacking: boolean;
|
|
23
|
+
}): StackHoverProps;
|
|
24
|
+
/** Parity with the web file so the shared suite can call it on either platform. */
|
|
25
|
+
export declare function resetStackHoverForTests(): void;
|
|
26
|
+
//# sourceMappingURL=use-stack-hover.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-stack-hover.native.d.ts","sourceRoot":"","sources":["../../../../src/toast/use-stack-hover.native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEpD,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,wCAAwC;AACxC,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAKD,wBAAgB,aAAa,CAAC,QAAQ,EAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,GAAG,eAAe,CAEpF;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,IAAI,IAAI,CAAG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `BloomProvider` — the ONE Bloom root an app mounts.
|
|
3
|
+
*
|
|
4
|
+
* Bloom's app-wide state used to be a handful of separate providers that every
|
|
5
|
+
* consumer wired by hand (theme, haptics, image resolution, scroll restoration,
|
|
6
|
+
* tab-bar minimize progress). Mounting them separately means each one can end
|
|
7
|
+
* up at a different depth, and a provider mounted too low fails in ways that
|
|
8
|
+
* are hard to trace:
|
|
9
|
+
*
|
|
10
|
+
* - `useScrollRestoration()` THROWS on web outside `ScrollRestorationProvider`,
|
|
11
|
+
* so any scrollable rendered beside the provider (a right rail, an overlay)
|
|
12
|
+
* crashes the screen.
|
|
13
|
+
* - `useMinimizeState()` silently hands each caller a private fallback, so a
|
|
14
|
+
* tab bar below the provider just never minimizes — no error anywhere.
|
|
15
|
+
*
|
|
16
|
+
* Mounting this single provider at the app root makes both classes of mistake
|
|
17
|
+
* impossible: everything Bloom renders is under all of them, at the same depth.
|
|
18
|
+
* Nesting extra contexts costs nothing at runtime — the win is that scope is no
|
|
19
|
+
* longer a per-app decision.
|
|
20
|
+
*
|
|
21
|
+
* NOT included, on purpose — these are OUTLETS, not state, and their placement
|
|
22
|
+
* in the tree is a real app decision (z-order, safe areas, and mounting a
|
|
23
|
+
* second one duplicates every surface it renders):
|
|
24
|
+
* `<ToastOutlet>`, `<Portal.Provider>`/`<Portal.Outlet>`, `<SurfaceHost>`,
|
|
25
|
+
* `<BloomDialogProvider>`, `<AlertDialogHost>`.
|
|
26
|
+
*/
|
|
27
|
+
import type { ReactNode } from 'react';
|
|
28
|
+
import { type ImageResolver } from '../image-resolver';
|
|
29
|
+
import { type BloomThemeProviderProps } from '../theme';
|
|
30
|
+
export interface BloomProviderProps extends Omit<BloomThemeProviderProps, 'children'> {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves bare media identifiers (Oxy file ids) to loadable URLs for every
|
|
34
|
+
* Bloom surface that takes a `source` — `<Avatar>`, image galleries, cards.
|
|
35
|
+
* Typically `(id, variant) => oxyServices.getFileDownloadUrl(id, variant)`.
|
|
36
|
+
*/
|
|
37
|
+
imageResolver?: ImageResolver;
|
|
38
|
+
/** `false` disables haptic feedback app-wide (honored by every `useHaptics()` call). */
|
|
39
|
+
haptics?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function BloomProvider({ children, imageResolver, haptics, ...themeProps }: BloomProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare namespace BloomProvider {
|
|
43
|
+
var displayName: string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/provider/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;IACnF,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,OAAc,EACd,GAAG,UAAU,EACd,EAAE,kBAAkB,2CAcpB;yBAnBe,aAAa"}
|