@oxyhq/bloom 0.54.1 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/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/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/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/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 +1 -1
- 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/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,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":[]}
|
|
@@ -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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAetB,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAYzD,KAAK,sBAAsB,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG;IAC5D,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CACtC,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CA8JhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/toast/constants.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,6EAA6E;A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AO,MAAM,mBAAmB,QAAqB,CAAC;AAEtD,qGAAqG;AACrG,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,2BAA2B,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,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WAAW,GAAI,IAAI,MAAM,GAAG,MAAM,UAahC;IAEF,WAAW,GACT,IAAI,MAAM,GAAG,MAAM,KAClB,KAAK,CAAC,SAAS,CAAC,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"}
|
|
@@ -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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAetB,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAYzD,KAAK,sBAAsB,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG;IAC5D,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,CAAC,IAA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C;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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AAiB,CAQvB;IAEF,UAAU,GAAI,IAAI,MAAM,GAAG,MAAM,UAE/B;IAEF,WAAW,GAAI,IAAI,MAAM,GAAG,MAAM,UAEhC;IAEF,cAAc,aAEZ;IAEF,eAAe,aAEb;IAEF,OAAO,CAAC,aAAa,CAwCnB;IAEF,QAAQ,GACN,SAAS,IAAI,CACX,UAAU,EACV,IAAI,GAAG,gBAAgB,GAAG,OAAO,GAAG,iBAAiB,CACtD,GAAG;QACF,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACtB,KACA,MAAM,GAAG,MAAM,CAkHhB;IAEF,wCAAwC;IACxC,YAAY,GACV,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS,EAC/B,SAAS,WAAW,GAAG,aAAa,KACnC,MAAM,GAAG,MAAM,GAAG,SAAS,CAyF5B;IAEF,4EAA4E;IAC5E,OAAO,CAAC,mBAAmB,CAazB;IAEF,WAAW,GAAI,IAAI,MAAM,GAAG,MAAM,UAahC;IAEF,WAAW,GACT,IAAI,MAAM,GAAG,MAAM,KAClB,KAAK,CAAC,SAAS,CAAC,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"}
|