@onekeyfe/react-native-native-overlay 3.0.162-alpha.272 → 6.7.0-12
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/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayAnimation.kt +5 -10
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEntryRootView.kt +23 -2
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayHost.kt +17 -12
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayView.kt +3 -1
- package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayBackTest.kt +295 -0
- package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayMotionTest.kt +101 -0
- package/docs/SPEC.md +171 -30
- package/ios/NativeOverlayContainerView.swift +20 -7
- package/ios/NativeOverlaySheetController.swift +37 -1
- package/lib/module/OverlayStore.js +13 -1
- package/lib/module/OverlayStore.js.map +1 -1
- package/lib/module/OverlayView.web.js +104 -25
- package/lib/module/OverlayView.web.js.map +1 -1
- package/lib/module/useOverlayController.js +11 -3
- package/lib/module/useOverlayController.js.map +1 -1
- package/lib/module/web/animateTransition.js +20 -12
- package/lib/module/web/animateTransition.js.map +1 -1
- package/lib/module/web/overlayLayers.js +16 -0
- package/lib/module/web/overlayLayers.js.map +1 -1
- package/lib/module/web/useKeyboardShift.js +1 -1
- package/lib/module/web/useKeyboardShift.js.map +1 -1
- package/lib/module/web/useSheetDrag.js +22 -2
- package/lib/module/web/useSheetDrag.js.map +1 -1
- package/lib/typescript/src/OverlayStore.d.ts +2 -0
- package/lib/typescript/src/OverlayStore.d.ts.map +1 -1
- package/lib/typescript/src/OverlayView.web.d.ts.map +1 -1
- package/lib/typescript/src/useOverlayController.d.ts.map +1 -1
- package/lib/typescript/src/web/animateTransition.d.ts +2 -2
- package/lib/typescript/src/web/animateTransition.d.ts.map +1 -1
- package/lib/typescript/src/web/overlayLayers.d.ts +1 -0
- package/lib/typescript/src/web/overlayLayers.d.ts.map +1 -1
- package/lib/typescript/src/web/useSheetDrag.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/OverlayStore.ts +13 -1
- package/src/OverlayView.web.tsx +193 -56
- package/src/useOverlayController.ts +11 -4
- package/src/web/animateTransition.ts +30 -11
- package/src/web/overlayLayers.ts +20 -0
- package/src/web/useKeyboardShift.ts +1 -1
- package/src/web/useSheetDrag.ts +23 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","DRAG_START_THRESHOLD","DISMISS_DISTANCE_RATIO","DISMISS_VELOCITY","UPWARD_RESISTANCE","SETTLE_TRANSITION","scrolledAncestorWithin","target","sheet","node","HTMLElement","scrollTop","scrollHeight","clientHeight","parentElement","undefined","useSheetDrag","sheetRef","backdropRef","enabled","onDismissByPan","onDismissRef","current","startY","lastY","lastTime","velocity","tracking","dragging","pointerId","setOffset","offset","style","transform","backdrop","opacity","String","Math","max","offsetHeight","onPointerDown","event","button","clientY","timeStamp","onPointerMove","dy","setPointerCapture","transition","dt","onPointerUp","height","addEventListener","clickEvent","stopPropagation","preventDefault","capture","once","removeEventListener"],"sourceRoot":"../../../src","sources":["web/useSheetDrag.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAGzC,MAAMC,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,sBAAsB,GAAG,GAAG;AAClC,MAAMC,gBAAgB,GAAG,GAAG,CAAC,CAAC;AAC9B,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,gDAAgD;AAE1E,SAASC,sBAAsBA,CAC7BC,MAA0B,EAC1BC,KAAkB,EAClB;EACA,IAAIC,IAAI,GAAGF,MAAM,YAAYG,WAAW,GAAGH,MAAM,GAAG,IAAI;EACxD,OAAOE,IAAI,IAAIA,IAAI,KAAKD,KAAK,EAAE;IAC7B,IAAIC,IAAI,CAACE,SAAS,GAAG,CAAC,IAAIF,IAAI,CAACG,YAA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AAG,KAAK;MAChB,MAAMkB,EAAE,GAAGL,KAAK,CAACE,OAAO,GAAGpB,MAAM;MACjC,MAAM4B,MAAM,GAAG3C,KAAK,CAAC+B,YAAY;MACjC/B,KAAK,CAACwB,KAAK,CAACgB,UAAU,GAAG3C,iBAAiB;MAC1C,IAAIyC,EAAE,GAAGK,MAAM,GAAGjD,sBAAsB,IAAIwB,QAAQ,GAAGvB,gBAAgB,EAAE;QACvE2B,SAAS,CAACqB,MAAM,CAAC;QACjB9B,YAAY,CAACC,OAAO,CAAC,CAAC;MACxB,CAAC,MAAM;QACLQ,SAAS,CAAC,CAAC,CAAC;QACZ,IAAIZ,WAAW,CAACI,OAAO,EAAE;UACvBJ,WAAW,CAACI,OAAO,CAACU,KAAK,CAACG,OAAO,GAAG,GAAG;QACzC;MACF;MACA;MACA;MACA3B,KAAK,CAAC4C,gBAAgB,CACpB,OAAO,EACNC,UAAU,IAAK;QACdA,UAAU,CAACC,eAAe,CAAC,CAAC;QAC5BD,UAAU,CAACE,cAAc,CAAC,CAAC;MAC7B,CAAC,EACD;QAAEC,OAAO,EAAE,IAAI;QAAEC,IAAI,EAAE;MAAK,CAC9B,CAAC;IACH,CAAC;
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","DRAG_START_THRESHOLD","DISMISS_DISTANCE_RATIO","DISMISS_VELOCITY","UPWARD_RESISTANCE","SETTLE_TRANSITION","scrolledAncestorWithin","target","sheet","node","HTMLElement","scrollTop","scrollHeight","clientHeight","parentElement","undefined","useSheetDrag","sheetRef","backdropRef","enabled","onDismissByPan","onDismissRef","current","startY","lastY","lastTime","velocity","tracking","dragging","pointerId","setOffset","offset","style","transform","backdrop","opacity","String","Math","max","offsetHeight","onPointerDown","event","button","clientY","timeStamp","onPointerMove","dy","setPointerCapture","transition","dt","onPointerUp","height","addEventListener","clickEvent","stopPropagation","preventDefault","capture","once","onPointerCancel","hasPointerCapture","releasePointerCapture","removeEventListener"],"sourceRoot":"../../../src","sources":["web/useSheetDrag.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AAE,CAACzC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,CAAC,CAAC;AACtC","ignoreList":[]}
|
|
@@ -32,6 +32,8 @@ export declare class OverlayStore {
|
|
|
32
32
|
request(request: IOverlayRequest, handlers?: IOverlayEntryHandlers): IOverlayEntry;
|
|
33
33
|
/** Starts closing an entry; the native side calls `finalize` after its exit animation. */
|
|
34
34
|
dismiss(id: string, reason?: IOverlayDismissReason): void;
|
|
35
|
+
/** Reverses an unfinished close without creating a new presentation cycle. */
|
|
36
|
+
reopen(id: string): void;
|
|
35
37
|
/** Removes a closing (or active) entry once its exit animation finished. */
|
|
36
38
|
finalize(id: string): void;
|
|
37
39
|
dismissAll(filter?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayStore.d.ts","sourceRoot":"","sources":["../../../src/OverlayStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,qBAAqB;IACpC,yFAAyF;IACzF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAyBD,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAE1C,OAAO,CAAC,GAAG,CAAK;IAEhB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;IAE1D,OAAO,CAAC,MAAM,CAAuB;IAErC,OAAO,CAAC,QAAQ,CAA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,MAAM,EAAE,MAAM,GAAE,qBAAsC,GAAG,IAAI;IAMzE,8EAA8E;IAC9E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IASxB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAY1B,UAAU,CACR,MAAM,GAAE;QACN,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAC/B,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,CAAC,EAAE,qBAAqB,CAAC;KAC3B,GACL,IAAI;IAqBP,qFAAqF;IACrF,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAqBxD,0DAA0D;IAC1D,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAalC;;;;OAIG;IACH,WAAW,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,sBAAsB;IAqB5D,6EAA6E;IAC7E,2EAA2E;IAC3E,iBAAiB,IAAI,aAAa,GAAG,SAAS;IAI9C,cAAc,IAAI,aAAa,GAAG,SAAS;IAgB3C,OAAO,CAAC,kBAAkB;IA0B1B,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,IAAI;CASb;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,gBAAgB,GACzB,aAAa,GAAG,SAAS,CAc3B;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayView.web.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OverlayView.web.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.web.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAkY5B,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,sCA2EnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverlayController.d.ts","sourceRoot":"","sources":["../../../src/useOverlayController.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,yBAAyB,CAAC;IACrC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,CAAC;CACtE;AAQD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,GACvB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"useOverlayController.d.ts","sourceRoot":"","sources":["../../../src/useOverlayController.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,yBAAyB,CAAC;IACrC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,CAAC;CACtE;AAQD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,GACvB,kBAAkB,CAsJpB"}
|
|
@@ -13,6 +13,6 @@ export declare function measureContentExtent(container: HTMLElement): IContentEx
|
|
|
13
13
|
* slide distance and scale origin come from the children of `contentRoot`,
|
|
14
14
|
* because the content wrapper itself always fills the window.
|
|
15
15
|
*/
|
|
16
|
-
export declare function animateTransition(element: HTMLElement, contentRoot: HTMLElement, transition: IResolvedOverlayTransition, direction: 'in' | 'out'): Animation | undefined;
|
|
17
|
-
export declare function animateBackdrop(element: HTMLElement, motion: IOverlayMotion, direction: 'in' | 'out'): Animation;
|
|
16
|
+
export declare function animateTransition(element: HTMLElement, contentRoot: HTMLElement, transition: IResolvedOverlayTransition, direction: 'in' | 'out', interruptedFrames?: ReadonlyMap<HTMLElement, Keyframe>): Animation | undefined;
|
|
17
|
+
export declare function animateBackdrop(element: HTMLElement, motion: IOverlayMotion, direction: 'in' | 'out', interruptedFrames?: ReadonlyMap<HTMLElement, Keyframe>): Animation;
|
|
18
18
|
//# sourceMappingURL=animateTransition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animateTransition.d.ts","sourceRoot":"","sources":["../../../../src/web/animateTransition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,cAAc,CAkB3E;AA8DD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,0BAA0B,EACtC,SAAS,EAAE,IAAI,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"animateTransition.d.ts","sourceRoot":"","sources":["../../../../src/web/animateTransition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,cAAc,CAkB3E;AA8DD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,0BAA0B,EACtC,SAAS,EAAE,IAAI,GAAG,KAAK,EACvB,iBAAiB,CAAC,EAAE,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,GACrD,SAAS,GAAG,SAAS,CAqCvB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,IAAI,GAAG,KAAK,EACvB,iBAAiB,CAAC,EAAE,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,GACrD,SAAS,CAOX"}
|
|
@@ -8,5 +8,6 @@ export declare function registerOverlayDismissRequester(id: string, requester: (
|
|
|
8
8
|
/** Re-run after entry DOM nodes mount, since the store emits before commit. */
|
|
9
9
|
export declare function scheduleOverlayInertSync(): void;
|
|
10
10
|
export declare function registerOverlayPageHost(hostKey: string, element: HTMLDivElement): () => void;
|
|
11
|
+
export declare function subscribeOverlayPageHost(hostKey: string | undefined, listener: () => void): () => void;
|
|
11
12
|
export declare function getOverlayPageHost(hostKey: string | undefined): HTMLDivElement | undefined;
|
|
12
13
|
//# sourceMappingURL=overlayLayers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlayLayers.d.ts","sourceRoot":"","sources":["../../../../src/web/overlayLayers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,UAAU,CAAC;AAG7D,eAAO,MAAM,eAAe,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"overlayLayers.d.ts","sourceRoot":"","sources":["../../../../src/web/overlayLayers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,UAAU,CAAC;AAG7D,eAAO,MAAM,eAAe,8BAA8B,CAAC;AA+E3D,0EAA0E;AAC1E,wBAAgB,gBAAgB,SAsC/B;AA2BD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAQxE;AAED,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,GACxD,MAAM,IAAI,CAOZ;AAED,+EAA+E;AAC/E,wBAAgB,wBAAwB,SAEvC;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,GACtB,MAAM,IAAI,CAUZ;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,QAAQ,EAAE,MAAM,IAAI,GACnB,MAAM,IAAI,CAYZ;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,cAAc,GAAG,SAAS,CAE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetDrag.d.ts","sourceRoot":"","sources":["../../../../src/web/useSheetDrag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAsBvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,WAAW,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,
|
|
1
|
+
{"version":3,"file":"useSheetDrag.d.ts","sourceRoot":"","sources":["../../../../src/web/useSheetDrag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAsBvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,WAAW,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,QA6HA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-overlay",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.7.0-12",
|
|
4
4
|
"description": "Native and Web overlay hosts with ordered levels, page scope and Fabric measurement",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
package/src/OverlayStore.ts
CHANGED
|
@@ -148,6 +148,16 @@ export class OverlayStore {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/** Reverses an unfinished close without creating a new presentation cycle. */
|
|
152
|
+
reopen(id: string): void {
|
|
153
|
+
const entry = this.shown.get(id);
|
|
154
|
+
if (!entry || entry.phase !== 'closing') return;
|
|
155
|
+
this.clearClosingTimer(id);
|
|
156
|
+
entry.phase = 'active';
|
|
157
|
+
entry.dismissReason = undefined;
|
|
158
|
+
this.emit();
|
|
159
|
+
}
|
|
160
|
+
|
|
151
161
|
/** Removes a closing (or active) entry once its exit animation finished. */
|
|
152
162
|
finalize(id: string): void {
|
|
153
163
|
const entry = this.shown.get(id);
|
|
@@ -280,7 +290,9 @@ export class OverlayStore {
|
|
|
280
290
|
if (queuedIndex !== -1) {
|
|
281
291
|
this.queued = this.queued.filter((e) => e.id !== id);
|
|
282
292
|
// Queued entries never rendered, so they leave without an exit animation.
|
|
283
|
-
|
|
293
|
+
const handlers = this.handlers.get(id);
|
|
294
|
+
this.handlers.delete(id);
|
|
295
|
+
queueMicrotask(() => handlers?.onRemoved?.(reason));
|
|
284
296
|
return true;
|
|
285
297
|
}
|
|
286
298
|
const entry = this.shown.get(id);
|
package/src/OverlayView.web.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useId,
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
useSyncExternalStore,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import type { KeyboardEvent, ReactNode, SyntheticEvent } from 'react';
|
|
3
10
|
|
|
4
11
|
import { createPortal } from 'react-dom';
|
|
5
12
|
import { StyleSheet, View } from 'react-native';
|
|
@@ -7,6 +14,7 @@ import { StyleSheet, View } from 'react-native';
|
|
|
7
14
|
import { OverlayLevelProvider } from './OverlayLevelContext';
|
|
8
15
|
import { OVERLAY_LEVEL_ORDER, isBlockingLevel } from './OverlayLevels';
|
|
9
16
|
import { OVERLAY_OWNER_ATTRIBUTE } from './OverlayPageHost.web';
|
|
17
|
+
import { overlayStore } from './OverlayStore';
|
|
10
18
|
import { useOverlayController } from './useOverlayController';
|
|
11
19
|
import { animateBackdrop, animateTransition } from './web/animateTransition';
|
|
12
20
|
import {
|
|
@@ -15,6 +23,7 @@ import {
|
|
|
15
23
|
getOverlayPageHost,
|
|
16
24
|
registerOverlayDismissRequester,
|
|
17
25
|
scheduleOverlayInertSync,
|
|
26
|
+
subscribeOverlayPageHost,
|
|
18
27
|
} from './web/overlayLayers';
|
|
19
28
|
import { useKeyboardShift } from './web/useKeyboardShift';
|
|
20
29
|
import { useSheetDrag } from './web/useSheetDrag';
|
|
@@ -94,10 +103,22 @@ function WebOverlayEntry({
|
|
|
94
103
|
const keyboardLayerRef = useRef<HTMLDivElement>(null);
|
|
95
104
|
const backdropRef = useRef<HTMLDivElement>(null);
|
|
96
105
|
const directionRef = useRef<'in' | 'out' | undefined>(undefined);
|
|
106
|
+
const runningAnimationsRef = useRef<Animation[]>([]);
|
|
97
107
|
const restoreFocusRef = useRef<HTMLElement | null>(null);
|
|
98
108
|
const callbacksRef = useRef({ onPresented, onDismissed });
|
|
99
109
|
callbacksRef.current = { onPresented, onDismissed };
|
|
100
110
|
|
|
111
|
+
useLayoutEffect(() => {
|
|
112
|
+
if (!isSheet && sheetRef.current) {
|
|
113
|
+
// The host now survives a presentation switch; clear any in-flight pan.
|
|
114
|
+
sheetRef.current.style.removeProperty('transform');
|
|
115
|
+
sheetRef.current.style.removeProperty('transition');
|
|
116
|
+
if (backdropRef.current) {
|
|
117
|
+
backdropRef.current.style.opacity = '1';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, [isSheet]);
|
|
121
|
+
|
|
101
122
|
useLayoutEffect(() => {
|
|
102
123
|
const content = contentRef.current;
|
|
103
124
|
if (!content) {
|
|
@@ -110,32 +131,61 @@ function WebOverlayEntry({
|
|
|
110
131
|
const neverEntered = directionRef.current === undefined;
|
|
111
132
|
directionRef.current = direction;
|
|
112
133
|
scheduleOverlayInertSync();
|
|
134
|
+
const interruptedFrames = new Map<HTMLElement, Keyframe>();
|
|
135
|
+
for (const running of runningAnimationsRef.current) {
|
|
136
|
+
const target = (running.effect as KeyframeEffect | null)?.target;
|
|
137
|
+
if (running.playState === 'running' && target instanceof HTMLElement) {
|
|
138
|
+
const style = getComputedStyle(target);
|
|
139
|
+
interruptedFrames.set(target, {
|
|
140
|
+
opacity: style.opacity,
|
|
141
|
+
transform: style.transform,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
running.cancel();
|
|
145
|
+
}
|
|
146
|
+
runningAnimationsRef.current = [];
|
|
113
147
|
if (direction === 'out' && (neverEntered || pannedAwayRef.current)) {
|
|
148
|
+
restoreFocusRef.current?.focus?.({ preventScroll: true });
|
|
149
|
+
restoreFocusRef.current = null;
|
|
114
150
|
callbacksRef.current.onDismissed();
|
|
115
151
|
return;
|
|
116
152
|
}
|
|
117
|
-
if (direction === 'in'
|
|
118
|
-
|
|
119
|
-
|
|
153
|
+
if (direction === 'in') {
|
|
154
|
+
pannedAwayRef.current = false;
|
|
155
|
+
sheetRef.current?.style.removeProperty('transform');
|
|
156
|
+
sheetRef.current?.style.removeProperty('transition');
|
|
157
|
+
if (backdropRef.current) {
|
|
158
|
+
backdropRef.current.style.opacity = '1';
|
|
159
|
+
}
|
|
160
|
+
if (blocking) {
|
|
161
|
+
restoreFocusRef.current = document.activeElement as HTMLElement | null;
|
|
162
|
+
entryRef.current?.focus({ preventScroll: true });
|
|
163
|
+
}
|
|
120
164
|
}
|
|
121
|
-
content.getAnimations().forEach((running) => running.cancel());
|
|
122
|
-
backdropRef.current?.getAnimations().forEach((running) => running.cancel());
|
|
123
165
|
// A sheet is measured as a whole; other presentations by the children
|
|
124
166
|
// of the full-window React root.
|
|
125
167
|
const contentRoot = isSheet
|
|
126
168
|
? content
|
|
127
|
-
: (
|
|
169
|
+
: (sheetRef.current?.firstElementChild as HTMLElement | null) ?? content;
|
|
128
170
|
const transition = direction === 'in' ? animation.enter : animation.exit;
|
|
129
171
|
const running = [
|
|
130
|
-
animateTransition(
|
|
172
|
+
animateTransition(
|
|
173
|
+
content,
|
|
174
|
+
contentRoot,
|
|
175
|
+
transition,
|
|
176
|
+
direction,
|
|
177
|
+
interruptedFrames
|
|
178
|
+
),
|
|
131
179
|
backdropRef.current
|
|
132
180
|
? animateBackdrop(
|
|
133
181
|
backdropRef.current,
|
|
134
182
|
animation.backdrop.motion,
|
|
135
|
-
direction
|
|
183
|
+
direction,
|
|
184
|
+
interruptedFrames
|
|
136
185
|
)
|
|
137
186
|
: undefined,
|
|
138
187
|
].filter((item): item is Animation => !!item);
|
|
188
|
+
runningAnimationsRef.current = running;
|
|
139
189
|
void Promise.all(running.map((item) => item.finished))
|
|
140
190
|
.then(() => {
|
|
141
191
|
if (directionRef.current !== direction) {
|
|
@@ -192,6 +242,72 @@ function WebOverlayEntry({
|
|
|
192
242
|
const showBackdrop = !!backdropColor || blocking;
|
|
193
243
|
const cornerRadius = sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS;
|
|
194
244
|
|
|
245
|
+
const onKeyDownCapture = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
246
|
+
const root = entryRef.current;
|
|
247
|
+
if (
|
|
248
|
+
event.key !== 'Tab' ||
|
|
249
|
+
event.defaultPrevented ||
|
|
250
|
+
event.nativeEvent.isComposing ||
|
|
251
|
+
!root ||
|
|
252
|
+
!presented ||
|
|
253
|
+
parked ||
|
|
254
|
+
overlayStore.getBlockingTop()?.id !== entryId
|
|
255
|
+
) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const tabbable = Array.from(
|
|
259
|
+
root.querySelectorAll<HTMLElement>(
|
|
260
|
+
'a[href], area[href], button, input:not([type="hidden"]), select, textarea, iframe, object, embed, [tabindex], [contenteditable]:not([contenteditable="false"])'
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
.filter((node) => {
|
|
264
|
+
if (
|
|
265
|
+
(node.tabIndex < 0 &&
|
|
266
|
+
(node.hasAttribute('tabindex') ||
|
|
267
|
+
!node.hasAttribute('contenteditable'))) ||
|
|
268
|
+
node.matches(':disabled')
|
|
269
|
+
) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
for (
|
|
273
|
+
let ancestor: HTMLElement | null = node;
|
|
274
|
+
ancestor;
|
|
275
|
+
ancestor = ancestor.parentElement
|
|
276
|
+
) {
|
|
277
|
+
const style = getComputedStyle(ancestor);
|
|
278
|
+
if (
|
|
279
|
+
ancestor.inert ||
|
|
280
|
+
ancestor.hasAttribute('inert') ||
|
|
281
|
+
ancestor.hidden ||
|
|
282
|
+
ancestor.getAttribute('aria-hidden') === 'true' ||
|
|
283
|
+
style.display === 'none' ||
|
|
284
|
+
style.visibility === 'hidden'
|
|
285
|
+
) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
290
|
+
})
|
|
291
|
+
.sort((a, b) => {
|
|
292
|
+
const aOrder = a.tabIndex > 0 ? a.tabIndex : Infinity;
|
|
293
|
+
const bOrder = b.tabIndex > 0 ? b.tabIndex : Infinity;
|
|
294
|
+
return aOrder === bOrder ? 0 : aOrder - bOrder;
|
|
295
|
+
});
|
|
296
|
+
const active = document.activeElement;
|
|
297
|
+
const first = tabbable[0];
|
|
298
|
+
const last = tabbable[tabbable.length - 1];
|
|
299
|
+
if (
|
|
300
|
+
!first ||
|
|
301
|
+
active === root ||
|
|
302
|
+
!root.contains(active) ||
|
|
303
|
+
active === (event.shiftKey ? first : last)
|
|
304
|
+
) {
|
|
305
|
+
event.preventDefault();
|
|
306
|
+
(event.shiftKey ? last : first)?.focus({ preventScroll: true });
|
|
307
|
+
if (!first) root.focus({ preventScroll: true });
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
195
311
|
return (
|
|
196
312
|
<div
|
|
197
313
|
ref={entryRef}
|
|
@@ -214,6 +330,7 @@ function WebOverlayEntry({
|
|
|
214
330
|
visibility: parked ? 'hidden' : undefined,
|
|
215
331
|
}}
|
|
216
332
|
{...ISOLATED_EVENT_HANDLERS}
|
|
333
|
+
onKeyDownCapture={onKeyDownCapture}
|
|
217
334
|
>
|
|
218
335
|
{showBackdrop ? (
|
|
219
336
|
<div
|
|
@@ -224,7 +341,7 @@ function WebOverlayEntry({
|
|
|
224
341
|
inset: 0,
|
|
225
342
|
opacity: 0,
|
|
226
343
|
background: backdropColor ?? 'transparent',
|
|
227
|
-
pointerEvents: blocking ? 'auto' : 'none',
|
|
344
|
+
pointerEvents: blocking || dismissOnBackdropPress ? 'auto' : 'none',
|
|
228
345
|
}}
|
|
229
346
|
/>
|
|
230
347
|
) : null}
|
|
@@ -244,48 +361,58 @@ function WebOverlayEntry({
|
|
|
244
361
|
ref={contentRef}
|
|
245
362
|
style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}
|
|
246
363
|
>
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
364
|
+
{/* Keep both hosts and the content slot stable across presentations. */}
|
|
365
|
+
<div
|
|
366
|
+
ref={sheetRef}
|
|
367
|
+
style={
|
|
368
|
+
sheet
|
|
369
|
+
? {
|
|
370
|
+
position: 'absolute',
|
|
371
|
+
left: 0,
|
|
372
|
+
right: 0,
|
|
373
|
+
bottom: 0,
|
|
374
|
+
height: sheet.height,
|
|
375
|
+
maxHeight: sheet.maxHeight ?? DEFAULT_SHEET_MAX_HEIGHT,
|
|
376
|
+
display: 'flex',
|
|
377
|
+
flexDirection: 'column',
|
|
378
|
+
overflow: 'hidden',
|
|
379
|
+
pointerEvents: 'auto',
|
|
380
|
+
touchAction: 'pan-y',
|
|
381
|
+
background: sheet.backgroundColor
|
|
382
|
+
? String(sheet.backgroundColor)
|
|
383
|
+
: undefined,
|
|
384
|
+
borderTopLeftRadius: cornerRadius,
|
|
385
|
+
borderTopRightRadius: cornerRadius,
|
|
386
|
+
}
|
|
387
|
+
: {
|
|
388
|
+
position: 'absolute',
|
|
389
|
+
inset: 0,
|
|
390
|
+
display: 'flex',
|
|
391
|
+
flexDirection: 'column',
|
|
392
|
+
pointerEvents: 'none',
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
>
|
|
396
|
+
{sheet?.showHandle ? (
|
|
397
|
+
<div
|
|
398
|
+
style={{
|
|
399
|
+
alignSelf: 'center',
|
|
400
|
+
width: 36,
|
|
401
|
+
height: 5,
|
|
402
|
+
marginTop: 8,
|
|
403
|
+
borderRadius: 2.5,
|
|
404
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
405
|
+
flexShrink: 0,
|
|
406
|
+
}}
|
|
407
|
+
/>
|
|
408
|
+
) : null}
|
|
409
|
+
<View
|
|
410
|
+
pointerEvents={sheet ? undefined : 'box-none'}
|
|
411
|
+
style={sheet ? { flexShrink: 1 } : StyleSheet.absoluteFill}
|
|
268
412
|
>
|
|
269
|
-
{sheet.showHandle ? (
|
|
270
|
-
<div
|
|
271
|
-
style={{
|
|
272
|
-
alignSelf: 'center',
|
|
273
|
-
width: 36,
|
|
274
|
-
height: 5,
|
|
275
|
-
marginTop: 8,
|
|
276
|
-
borderRadius: 2.5,
|
|
277
|
-
background: 'rgba(0, 0, 0, 0.2)',
|
|
278
|
-
flexShrink: 0,
|
|
279
|
-
}}
|
|
280
|
-
/>
|
|
281
|
-
) : null}
|
|
282
|
-
<View style={{ flexShrink: 1 }}>{children}</View>
|
|
283
|
-
</div>
|
|
284
|
-
) : (
|
|
285
|
-
<View pointerEvents="box-none" style={StyleSheet.absoluteFill}>
|
|
286
413
|
{children}
|
|
287
414
|
</View>
|
|
288
|
-
|
|
415
|
+
</div>
|
|
289
416
|
</div>
|
|
290
417
|
</div>
|
|
291
418
|
</div>
|
|
@@ -320,12 +447,22 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
320
447
|
// Closed with `keepContentMounted`: the same entry stays in the layer,
|
|
321
448
|
// hidden and inert, so the content keeps its state and can be measured.
|
|
322
449
|
const parked = !mounted || !entry;
|
|
450
|
+
const subscribePageHost = useCallback(
|
|
451
|
+
(listener: () => void) => subscribeOverlayPageHost(hostKey, listener),
|
|
452
|
+
[hostKey]
|
|
453
|
+
);
|
|
454
|
+
const getPageHost = useCallback(() => getOverlayPageHost(hostKey), [hostKey]);
|
|
455
|
+
const pageHost = useSyncExternalStore(
|
|
456
|
+
subscribePageHost,
|
|
457
|
+
getPageHost,
|
|
458
|
+
() => undefined
|
|
459
|
+
);
|
|
323
460
|
if (parked && !keepContentMounted) {
|
|
324
461
|
return null;
|
|
325
462
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
463
|
+
if (scope === 'page' && !pageHost) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
329
466
|
return createPortal(
|
|
330
467
|
<WebOverlayEntry
|
|
331
468
|
key="entry"
|
|
@@ -346,15 +483,15 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
346
483
|
sheet={presentation === 'sheet' ? sheet ?? {} : undefined}
|
|
347
484
|
// Inside a page host all levels share one stacking context.
|
|
348
485
|
zIndex={
|
|
349
|
-
|
|
486
|
+
scope === 'page'
|
|
350
487
|
? OVERLAY_LEVEL_ORDER[level] * 1000 + (entry?.seq ?? 0)
|
|
351
488
|
: entry?.seq ?? 0
|
|
352
489
|
}
|
|
353
|
-
ownerKey={
|
|
490
|
+
ownerKey={scope === 'page' ? ownerKey : undefined}
|
|
354
491
|
testID={testID}
|
|
355
492
|
>
|
|
356
493
|
<OverlayLevelProvider value={level}>{children}</OverlayLevelProvider>
|
|
357
494
|
</WebOverlayEntry>,
|
|
358
|
-
pageHost
|
|
495
|
+
scope === 'page' ? pageHost! : getOverlayLayerRoot(level)
|
|
359
496
|
);
|
|
360
497
|
}
|
|
@@ -69,9 +69,7 @@ export function useOverlayController(
|
|
|
69
69
|
const pageScope = useOverlayPageScope();
|
|
70
70
|
const hostKey = props.hostKey ?? pageScope.hostKey;
|
|
71
71
|
const ownerKey = props.ownerKey ?? pageScope.ownerKey;
|
|
72
|
-
|
|
73
|
-
const scope =
|
|
74
|
-
props.scope === 'page' && hostKey && ownerKey ? 'page' : 'global';
|
|
72
|
+
const scope = props.scope ?? 'global';
|
|
75
73
|
const baseId = useId();
|
|
76
74
|
const cycleRef = useRef(0);
|
|
77
75
|
const [entryId, setEntryId] = useState<string | undefined>();
|
|
@@ -79,6 +77,7 @@ export function useOverlayController(
|
|
|
79
77
|
// still true, so the effect below does not immediately reopen it.
|
|
80
78
|
const closedByStoreRef = useRef(false);
|
|
81
79
|
const propsRef = useLatest(props);
|
|
80
|
+
const previousVisibleRef = useRef(visible);
|
|
82
81
|
|
|
83
82
|
const snapshot = useSyncExternalStore(
|
|
84
83
|
overlayStore.subscribe,
|
|
@@ -95,6 +94,9 @@ export function useOverlayController(
|
|
|
95
94
|
);
|
|
96
95
|
|
|
97
96
|
useEffect(() => {
|
|
97
|
+
const reopening = visible && !previousVisibleRef.current;
|
|
98
|
+
previousVisibleRef.current = visible;
|
|
99
|
+
if (reopening && entryId) overlayStore.reopen(entryId);
|
|
98
100
|
if (!visible) {
|
|
99
101
|
closedByStoreRef.current = false;
|
|
100
102
|
if (entryId) {
|
|
@@ -105,6 +107,11 @@ export function useOverlayController(
|
|
|
105
107
|
if (entryId || closedByStoreRef.current) {
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
110
|
+
// Page context can become ready after the caller first opens the overlay.
|
|
111
|
+
// Keep the request in its page boundary instead of presenting globally.
|
|
112
|
+
if (scope === 'page' && (!hostKey || !ownerKey)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
108
115
|
cycleRef.current += 1;
|
|
109
116
|
const id = `overlay-view${baseId}${cycleRef.current}`;
|
|
110
117
|
overlayStore.request(
|
|
@@ -134,7 +141,7 @@ export function useOverlayController(
|
|
|
134
141
|
setEntryId(id);
|
|
135
142
|
// Level / strategy changes apply to the next open cycle only.
|
|
136
143
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
137
|
-
}, [visible, entryId]);
|
|
144
|
+
}, [visible, entryId, scope, hostKey, ownerKey]);
|
|
138
145
|
|
|
139
146
|
useEffect(
|
|
140
147
|
() => () => {
|
|
@@ -100,7 +100,8 @@ export function animateTransition(
|
|
|
100
100
|
element: HTMLElement,
|
|
101
101
|
contentRoot: HTMLElement,
|
|
102
102
|
transition: IResolvedOverlayTransition,
|
|
103
|
-
direction: 'in' | 'out'
|
|
103
|
+
direction: 'in' | 'out',
|
|
104
|
+
interruptedFrames?: ReadonlyMap<HTMLElement, Keyframe>
|
|
104
105
|
): Animation | undefined {
|
|
105
106
|
if (transition.type === 'none') {
|
|
106
107
|
return undefined;
|
|
@@ -109,16 +110,32 @@ export function animateTransition(
|
|
|
109
110
|
? { ...transition, type: 'fade', fade: true }
|
|
110
111
|
: transition;
|
|
111
112
|
const extent = measureContentExtent(contentRoot);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
// The React Native root wraps the positioned panel. Animate that panel so its
|
|
114
|
+
// offset parent stays unscaled; multi-child roots retain their shared motion.
|
|
115
|
+
const anchoredContent =
|
|
116
|
+
effective.origin === 'anchor' && contentRoot.childElementCount === 1
|
|
117
|
+
? contentRoot.firstElementChild
|
|
118
|
+
: undefined;
|
|
119
|
+
const target =
|
|
120
|
+
anchoredContent instanceof HTMLElement ? anchoredContent : element;
|
|
121
|
+
const targetRect =
|
|
122
|
+
target === element ? undefined : target.getBoundingClientRect();
|
|
123
|
+
target.style.transformOrigin = `${
|
|
124
|
+
(extent.left + extent.right) / 2 - (targetRect?.left ?? 0)
|
|
125
|
+
}px ${(extent.top + extent.bottom) / 2 - (targetRect?.top ?? 0)}px`;
|
|
115
126
|
const hidden = hiddenKeyframe(effective, extent);
|
|
116
127
|
const visible: Keyframe = {};
|
|
117
128
|
Object.keys(hidden).forEach((key) => {
|
|
118
129
|
visible[key] = VISIBLE_KEYFRAME[key];
|
|
119
130
|
});
|
|
120
|
-
const
|
|
121
|
-
|
|
131
|
+
const sampled = interruptedFrames?.get(target);
|
|
132
|
+
const initial = direction === 'in' ? hidden : visible;
|
|
133
|
+
const start: Keyframe = {};
|
|
134
|
+
Object.keys(initial).forEach((key) => {
|
|
135
|
+
start[key] = sampled?.[key] ?? initial[key];
|
|
136
|
+
});
|
|
137
|
+
const keyframes = [start, direction === 'in' ? visible : hidden];
|
|
138
|
+
return target.animate(keyframes, {
|
|
122
139
|
...toTiming(effective.motion),
|
|
123
140
|
fill: 'forwards',
|
|
124
141
|
});
|
|
@@ -127,11 +144,13 @@ export function animateTransition(
|
|
|
127
144
|
export function animateBackdrop(
|
|
128
145
|
element: HTMLElement,
|
|
129
146
|
motion: IOverlayMotion,
|
|
130
|
-
direction: 'in' | 'out'
|
|
147
|
+
direction: 'in' | 'out',
|
|
148
|
+
interruptedFrames?: ReadonlyMap<HTMLElement, Keyframe>
|
|
131
149
|
): Animation {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
150
|
+
const sampled = interruptedFrames?.get(element)?.opacity;
|
|
151
|
+
const keyframes = [
|
|
152
|
+
{ opacity: sampled ?? (direction === 'in' ? 0 : 1) },
|
|
153
|
+
{ opacity: direction === 'in' ? 1 : 0 },
|
|
154
|
+
];
|
|
136
155
|
return element.animate(keyframes, { ...toTiming(motion), fill: 'forwards' });
|
|
137
156
|
}
|
package/src/web/overlayLayers.ts
CHANGED
|
@@ -15,6 +15,7 @@ const APP_ROOT_ID = 'root';
|
|
|
15
15
|
|
|
16
16
|
const layerRoots = new Map<IOverlayLevel, HTMLDivElement>();
|
|
17
17
|
const pageHosts = new Map<string, HTMLDivElement>();
|
|
18
|
+
const pageHostListeners = new Map<string, Set<() => void>>();
|
|
18
19
|
const dismissRequesters = new Map<
|
|
19
20
|
string,
|
|
20
21
|
(reason: IOverlayRequestDismissReason) => void
|
|
@@ -186,13 +187,32 @@ export function registerOverlayPageHost(
|
|
|
186
187
|
): () => void {
|
|
187
188
|
installOverlayWebManager();
|
|
188
189
|
pageHosts.set(hostKey, element);
|
|
190
|
+
pageHostListeners.get(hostKey)?.forEach((listener) => listener());
|
|
189
191
|
return () => {
|
|
190
192
|
if (pageHosts.get(hostKey) === element) {
|
|
191
193
|
pageHosts.delete(hostKey);
|
|
194
|
+
pageHostListeners.get(hostKey)?.forEach((listener) => listener());
|
|
192
195
|
}
|
|
193
196
|
};
|
|
194
197
|
}
|
|
195
198
|
|
|
199
|
+
export function subscribeOverlayPageHost(
|
|
200
|
+
hostKey: string | undefined,
|
|
201
|
+
listener: () => void
|
|
202
|
+
): () => void {
|
|
203
|
+
if (!hostKey) return () => {};
|
|
204
|
+
let listeners = pageHostListeners.get(hostKey);
|
|
205
|
+
if (!listeners) {
|
|
206
|
+
listeners = new Set();
|
|
207
|
+
pageHostListeners.set(hostKey, listeners);
|
|
208
|
+
}
|
|
209
|
+
listeners.add(listener);
|
|
210
|
+
return () => {
|
|
211
|
+
listeners.delete(listener);
|
|
212
|
+
if (listeners.size === 0) pageHostListeners.delete(hostKey);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
196
216
|
export function getOverlayPageHost(
|
|
197
217
|
hostKey: string | undefined
|
|
198
218
|
): HTMLDivElement | undefined {
|