@onekeyfe/react-native-native-overlay 3.0.162-alpha.268

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.
Files changed (163) hide show
  1. package/LICENSE +21 -0
  2. package/NativeOverlay.podspec +30 -0
  3. package/README.md +35 -0
  4. package/android/build.gradle +82 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayAnimation.kt +176 -0
  7. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEntryRootView.kt +415 -0
  8. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEvents.kt +38 -0
  9. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayHost.kt +174 -0
  10. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPackage.kt +16 -0
  11. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPageHostView.kt +122 -0
  12. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPageHostViewManager.kt +40 -0
  13. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayView.kt +465 -0
  14. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayViewManager.kt +156 -0
  15. package/android/src/main/jni/CMakeLists.txt +44 -0
  16. package/android/src/main/jni/RNCNativeOverlay.h +19 -0
  17. package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayComponentDescriptor.h +12 -0
  18. package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayShadowNode.cpp +12 -0
  19. package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayShadowNode.h +41 -0
  20. package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayState.h +40 -0
  21. package/docs/SPEC.md +693 -0
  22. package/ios/NativeOverlayAnimation.swift +160 -0
  23. package/ios/NativeOverlayContainerView.swift +688 -0
  24. package/ios/NativeOverlayKeyboard.swift +88 -0
  25. package/ios/NativeOverlayPageHostView.swift +98 -0
  26. package/ios/NativeOverlaySheetController.swift +391 -0
  27. package/ios/NativeOverlayWindowManager.swift +194 -0
  28. package/ios/RCTNativeOverlayComponentView.h +11 -0
  29. package/ios/RCTNativeOverlayComponentView.mm +193 -0
  30. package/ios/RCTNativeOverlayPageHostComponentView.h +11 -0
  31. package/ios/RCTNativeOverlayPageHostComponentView.mm +64 -0
  32. package/lib/module/NativeOverlayNativeComponent.ts +61 -0
  33. package/lib/module/NativeOverlayPageHostNativeComponent.ts +13 -0
  34. package/lib/module/OverlayErrors.js +6 -0
  35. package/lib/module/OverlayErrors.js.map +1 -0
  36. package/lib/module/OverlayLevelContext.js +27 -0
  37. package/lib/module/OverlayLevelContext.js.map +1 -0
  38. package/lib/module/OverlayLevels.js +33 -0
  39. package/lib/module/OverlayLevels.js.map +1 -0
  40. package/lib/module/OverlayPageHost.js +24 -0
  41. package/lib/module/OverlayPageHost.js.map +1 -0
  42. package/lib/module/OverlayPageHost.web.js +49 -0
  43. package/lib/module/OverlayPageHost.web.js.map +1 -0
  44. package/lib/module/OverlayPageScope.js +41 -0
  45. package/lib/module/OverlayPageScope.js.map +1 -0
  46. package/lib/module/OverlayStore.js +305 -0
  47. package/lib/module/OverlayStore.js.map +1 -0
  48. package/lib/module/OverlayView.js +141 -0
  49. package/lib/module/OverlayView.js.map +1 -0
  50. package/lib/module/OverlayView.web.js +290 -0
  51. package/lib/module/OverlayView.web.js.map +1 -0
  52. package/lib/module/OverlayViewTypes.js +4 -0
  53. package/lib/module/OverlayViewTypes.js.map +1 -0
  54. package/lib/module/animation/motionPresets.js +57 -0
  55. package/lib/module/animation/motionPresets.js.map +1 -0
  56. package/lib/module/animation/platformMotionPresets.js +4 -0
  57. package/lib/module/animation/platformMotionPresets.js.map +1 -0
  58. package/lib/module/animation/platformMotionPresets.web.js +4 -0
  59. package/lib/module/animation/platformMotionPresets.web.js.map +1 -0
  60. package/lib/module/animation/resolveAnimation.js +80 -0
  61. package/lib/module/animation/resolveAnimation.js.map +1 -0
  62. package/lib/module/animation/spring.js +69 -0
  63. package/lib/module/animation/spring.js.map +1 -0
  64. package/lib/module/animation/types.js +2 -0
  65. package/lib/module/animation/types.js.map +1 -0
  66. package/lib/module/index.js +16 -0
  67. package/lib/module/index.js.map +1 -0
  68. package/lib/module/package.json +1 -0
  69. package/lib/module/types.js +2 -0
  70. package/lib/module/types.js.map +1 -0
  71. package/lib/module/useOverlayController.js +127 -0
  72. package/lib/module/useOverlayController.js.map +1 -0
  73. package/lib/module/useSuspendedPageOwners.js +16 -0
  74. package/lib/module/useSuspendedPageOwners.js.map +1 -0
  75. package/lib/module/web/animateTransition.js +115 -0
  76. package/lib/module/web/animateTransition.js.map +1 -0
  77. package/lib/module/web/overlayLayers.js +147 -0
  78. package/lib/module/web/overlayLayers.js.map +1 -0
  79. package/lib/module/web/useKeyboardShift.js +110 -0
  80. package/lib/module/web/useKeyboardShift.js.map +1 -0
  81. package/lib/module/web/useSheetDrag.js +126 -0
  82. package/lib/module/web/useSheetDrag.js.map +1 -0
  83. package/lib/typescript/package.json +1 -0
  84. package/lib/typescript/src/NativeOverlayNativeComponent.d.ts +41 -0
  85. package/lib/typescript/src/NativeOverlayNativeComponent.d.ts.map +1 -0
  86. package/lib/typescript/src/NativeOverlayPageHostNativeComponent.d.ts +9 -0
  87. package/lib/typescript/src/NativeOverlayPageHostNativeComponent.d.ts.map +1 -0
  88. package/lib/typescript/src/OverlayErrors.d.ts +4 -0
  89. package/lib/typescript/src/OverlayErrors.d.ts.map +1 -0
  90. package/lib/typescript/src/OverlayLevelContext.d.ts +12 -0
  91. package/lib/typescript/src/OverlayLevelContext.d.ts.map +1 -0
  92. package/lib/typescript/src/OverlayLevels.d.ts +13 -0
  93. package/lib/typescript/src/OverlayLevels.d.ts.map +1 -0
  94. package/lib/typescript/src/OverlayPageHost.d.ts +9 -0
  95. package/lib/typescript/src/OverlayPageHost.d.ts.map +1 -0
  96. package/lib/typescript/src/OverlayPageHost.web.d.ts +11 -0
  97. package/lib/typescript/src/OverlayPageHost.web.d.ts.map +1 -0
  98. package/lib/typescript/src/OverlayPageScope.d.ts +17 -0
  99. package/lib/typescript/src/OverlayPageScope.d.ts.map +1 -0
  100. package/lib/typescript/src/OverlayStore.d.ts +72 -0
  101. package/lib/typescript/src/OverlayStore.d.ts.map +1 -0
  102. package/lib/typescript/src/OverlayView.d.ts +3 -0
  103. package/lib/typescript/src/OverlayView.d.ts.map +1 -0
  104. package/lib/typescript/src/OverlayView.web.d.ts +3 -0
  105. package/lib/typescript/src/OverlayView.web.d.ts.map +1 -0
  106. package/lib/typescript/src/OverlayViewTypes.d.ts +68 -0
  107. package/lib/typescript/src/OverlayViewTypes.d.ts.map +1 -0
  108. package/lib/typescript/src/animation/motionPresets.d.ts +13 -0
  109. package/lib/typescript/src/animation/motionPresets.d.ts.map +1 -0
  110. package/lib/typescript/src/animation/platformMotionPresets.d.ts +2 -0
  111. package/lib/typescript/src/animation/platformMotionPresets.d.ts.map +1 -0
  112. package/lib/typescript/src/animation/platformMotionPresets.web.d.ts +2 -0
  113. package/lib/typescript/src/animation/platformMotionPresets.web.d.ts.map +1 -0
  114. package/lib/typescript/src/animation/resolveAnimation.d.ts +23 -0
  115. package/lib/typescript/src/animation/resolveAnimation.d.ts.map +1 -0
  116. package/lib/typescript/src/animation/spring.d.ts +24 -0
  117. package/lib/typescript/src/animation/spring.d.ts.map +1 -0
  118. package/lib/typescript/src/animation/types.d.ts +56 -0
  119. package/lib/typescript/src/animation/types.d.ts.map +1 -0
  120. package/lib/typescript/src/index.d.ts +18 -0
  121. package/lib/typescript/src/index.d.ts.map +1 -0
  122. package/lib/typescript/src/types.d.ts +59 -0
  123. package/lib/typescript/src/types.d.ts.map +1 -0
  124. package/lib/typescript/src/useOverlayController.d.ts +29 -0
  125. package/lib/typescript/src/useOverlayController.d.ts.map +1 -0
  126. package/lib/typescript/src/useSuspendedPageOwners.d.ts +7 -0
  127. package/lib/typescript/src/useSuspendedPageOwners.d.ts.map +1 -0
  128. package/lib/typescript/src/web/animateTransition.d.ts +18 -0
  129. package/lib/typescript/src/web/animateTransition.d.ts.map +1 -0
  130. package/lib/typescript/src/web/overlayLayers.d.ts +10 -0
  131. package/lib/typescript/src/web/overlayLayers.d.ts.map +1 -0
  132. package/lib/typescript/src/web/useKeyboardShift.d.ts +29 -0
  133. package/lib/typescript/src/web/useKeyboardShift.d.ts.map +1 -0
  134. package/lib/typescript/src/web/useSheetDrag.d.ts +13 -0
  135. package/lib/typescript/src/web/useSheetDrag.d.ts.map +1 -0
  136. package/package.json +188 -0
  137. package/react-native.config.js +16 -0
  138. package/src/NativeOverlayNativeComponent.ts +61 -0
  139. package/src/NativeOverlayPageHostNativeComponent.ts +13 -0
  140. package/src/OverlayErrors.ts +3 -0
  141. package/src/OverlayLevelContext.tsx +32 -0
  142. package/src/OverlayLevels.ts +40 -0
  143. package/src/OverlayPageHost.tsx +21 -0
  144. package/src/OverlayPageHost.web.tsx +53 -0
  145. package/src/OverlayPageScope.tsx +42 -0
  146. package/src/OverlayStore.ts +401 -0
  147. package/src/OverlayView.tsx +165 -0
  148. package/src/OverlayView.web.tsx +356 -0
  149. package/src/OverlayViewTypes.ts +81 -0
  150. package/src/animation/motionPresets.ts +52 -0
  151. package/src/animation/platformMotionPresets.ts +1 -0
  152. package/src/animation/platformMotionPresets.web.ts +1 -0
  153. package/src/animation/resolveAnimation.ts +103 -0
  154. package/src/animation/spring.ts +80 -0
  155. package/src/animation/types.ts +71 -0
  156. package/src/index.ts +55 -0
  157. package/src/types.ts +79 -0
  158. package/src/useOverlayController.ts +199 -0
  159. package/src/useSuspendedPageOwners.ts +26 -0
  160. package/src/web/animateTransition.ts +137 -0
  161. package/src/web/overlayLayers.ts +182 -0
  162. package/src/web/useKeyboardShift.ts +130 -0
  163. package/src/web/useSheetDrag.ts +143 -0
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from 'react';
4
+ import { OVERLAY_MOTION_PRESETS } from './animation/platformMotionPresets';
5
+ import { resolveOverlayAnimation } from "./animation/resolveAnimation.js";
6
+ import { useOverlayPageScope } from "./OverlayPageScope.js";
7
+ import { findStatusBarOwner, overlayStore } from "./OverlayStore.js";
8
+ function useLatest(value) {
9
+ const ref = useRef(value);
10
+ ref.current = value;
11
+ return ref;
12
+ }
13
+
14
+ /**
15
+ * Bridges a declarative overlay to the shared `overlayStore`: requests an
16
+ * entry while `visible`, follows the store's phase, and finalizes the entry
17
+ * once the host reports the end of the exit animation.
18
+ */
19
+ export function useOverlayController(props) {
20
+ const {
21
+ visible,
22
+ level,
23
+ strategy,
24
+ priority,
25
+ replaceKey,
26
+ blocking,
27
+ dismissOnBackPress,
28
+ presentation = 'center',
29
+ animation,
30
+ statusBarStyle
31
+ } = props;
32
+ const pageScope = useOverlayPageScope();
33
+ const hostKey = props.hostKey ?? pageScope.hostKey;
34
+ const ownerKey = props.ownerKey ?? pageScope.ownerKey;
35
+ // Without a host or owner there is nowhere to anchor a page overlay.
36
+ const scope = props.scope === 'page' && hostKey && ownerKey ? 'page' : 'global';
37
+ const baseId = useId();
38
+ const cycleRef = useRef(0);
39
+ const [entryId, setEntryId] = useState();
40
+ // Set when the store closed the entry (replace, back) while `visible` is
41
+ // still true, so the effect below does not immediately reopen it.
42
+ const closedByStoreRef = useRef(false);
43
+ const propsRef = useLatest(props);
44
+ const snapshot = useSyncExternalStore(overlayStore.subscribe, overlayStore.getSnapshot, overlayStore.getSnapshot);
45
+ const entry = useMemo(() => entryId ? snapshot.entries.find(e => e.id === entryId) ?? snapshot.queued.find(e => e.id === entryId) : undefined, [entryId, snapshot]);
46
+ useEffect(() => {
47
+ if (!visible) {
48
+ closedByStoreRef.current = false;
49
+ if (entryId) {
50
+ overlayStore.dismiss(entryId, 'programmatic');
51
+ }
52
+ return;
53
+ }
54
+ if (entryId || closedByStoreRef.current) {
55
+ return;
56
+ }
57
+ cycleRef.current += 1;
58
+ const id = `overlay-view${baseId}${cycleRef.current}`;
59
+ overlayStore.request({
60
+ id,
61
+ scope,
62
+ hostKey,
63
+ ownerKey,
64
+ level,
65
+ strategy,
66
+ priority,
67
+ replaceKey,
68
+ blocking,
69
+ dismissible: dismissOnBackPress,
70
+ statusBarStyle
71
+ }, {
72
+ onRemoved: reason => {
73
+ setEntryId(current => current === id ? undefined : current);
74
+ if (reason !== 'programmatic') {
75
+ closedByStoreRef.current = true;
76
+ }
77
+ propsRef.current.onClose?.(reason);
78
+ }
79
+ });
80
+ setEntryId(id);
81
+ // Level / strategy changes apply to the next open cycle only.
82
+ // eslint-disable-next-line react-hooks/exhaustive-deps
83
+ }, [visible, entryId]);
84
+ useEffect(() => () => {
85
+ if (entryId) {
86
+ overlayStore.dismiss(entryId, 'system');
87
+ overlayStore.finalize(entryId);
88
+ }
89
+ }, [entryId]);
90
+ const resolvedAnimation = useMemo(() => resolveOverlayAnimation(presentation, animation, OVERLAY_MOTION_PRESETS), [presentation, animation]);
91
+ const onHostPresented = useCallback(() => {
92
+ propsRef.current.onPresented?.();
93
+ }, [propsRef]);
94
+ const onHostDismissed = useCallback(() => {
95
+ if (!entryId) {
96
+ return;
97
+ }
98
+ const phase = overlayStore.getEntry(entryId)?.phase;
99
+ if (phase === 'active') {
100
+ // Native closed it on its own, e.g. a lower sheet in the same level
101
+ // window was dismissed and UIKit took the ones above with it.
102
+ overlayStore.dismiss(entryId, 'system');
103
+ }
104
+ overlayStore.finalize(entryId);
105
+ }, [entryId]);
106
+ const onHostRequestDismiss = useCallback(reason => {
107
+ const handler = propsRef.current.onRequestDismiss;
108
+ handler?.(reason);
109
+ if (entryId && (!handler || reason === 'pan')) {
110
+ overlayStore.dismiss(entryId, reason);
111
+ }
112
+ }, [entryId, propsRef]);
113
+ return {
114
+ entry,
115
+ mounted: !!entry && entry.phase !== 'queued',
116
+ presented: !!entry && entry.phase === 'active' && (scope === 'page' || !entry.suspended),
117
+ scope,
118
+ ownsStatusBar: !!entryId && findStatusBarOwner(snapshot)?.id === entryId,
119
+ hostKey: scope === 'page' ? hostKey : undefined,
120
+ ownerKey: scope === 'page' ? ownerKey : undefined,
121
+ animation: resolvedAnimation,
122
+ onHostPresented,
123
+ onHostDismissed,
124
+ onHostRequestDismiss
125
+ };
126
+ }
127
+ //# sourceMappingURL=useOverlayController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useId","useMemo","useRef","useState","useSyncExternalStore","OVERLAY_MOTION_PRESETS","resolveOverlayAnimation","useOverlayPageScope","findStatusBarOwner","overlayStore","useLatest","value","ref","current","useOverlayController","props","visible","level","strategy","priority","replaceKey","blocking","dismissOnBackPress","presentation","animation","statusBarStyle","pageScope","hostKey","ownerKey","scope","baseId","cycleRef","entryId","setEntryId","closedByStoreRef","propsRef","snapshot","subscribe","getSnapshot","entry","entries","find","e","id","queued","undefined","dismiss","request","dismissible","onRemoved","reason","onClose","finalize","resolvedAnimation","onHostPresented","onPresented","onHostDismissed","phase","getEntry","onHostRequestDismiss","handler","onRequestDismiss","mounted","presented","suspended","ownsStatusBar"],"sourceRoot":"../../src","sources":["useOverlayController.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,oBAAoB,QACf,OAAO;AAEd,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,uBAAuB,QAAQ,iCAA8B;AACtE,SAASC,mBAAmB,QAAQ,uBAAoB;AACxD,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,mBAAgB;AA6BjE,SAASC,SAASA,CAAIC,KAAQ,EAAE;EAC9B,MAAMC,GAAG,GAAGV,MAAM,CAACS,KAAK,CAAC;EACzBC,GAAG,CAACC,OAAO,GAAGF,KAAK;EACnB,OAAOC,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,oBAAoBA,CAClCC,KAAwB,EACJ;EACpB,MAAM;IACJC,OAAO;IACPC,KAAK;IACLC,Q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,CAAC,EAAEO,EAAE,KAAKX,OAAO;IACxEL,OAAO,EAAEE,KAAK,KAAK,MAAM,GAAGF,OAAO,GAAGkB,SAAS;IAC/CjB,QAAQ,EAAEC,KAAK,KAAK,MAAM,GAAGD,QAAQ,GAAGiB,SAAS;IACjDrB,SAAS,EAAE6B,iBAAiB;IAC5BC,eAAe;IACfE,eAAe;IACfG;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import { useMemo, useSyncExternalStore } from 'react';
4
+ import { overlayStore } from "./OverlayStore.js";
5
+
6
+ /**
7
+ * Owners whose page overlays in `hostKey` must be hidden. The page host
8
+ * applies this natively: the owning page may be frozen (freezeOnBlur) and
9
+ * cannot re-render its own overlays.
10
+ */
11
+ export function useSuspendedPageOwners(hostKey) {
12
+ const snapshot = useSyncExternalStore(overlayStore.subscribe, overlayStore.getSnapshot, overlayStore.getSnapshot);
13
+ const joined = snapshot.entries.filter(e => e.scope === 'page' && e.hostKey === hostKey && e.suspended).map(e => e.ownerKey ?? '').filter(Boolean).toSorted().join('\n');
14
+ return useMemo(() => joined ? [...new Set(joined.split('\n'))] : [], [joined]);
15
+ }
16
+ //# sourceMappingURL=useSuspendedPageOwners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","useSyncExternalStore","overlayStore","useSuspendedPageOwners","hostKey","snapshot","subscribe","getSnapshot","joined","entries","filter","e","scope","suspended","map","ownerKey","Boolean","toSorted","join","Set","split"],"sourceRoot":"../../src","sources":["useSuspendedPageOwners.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,oBAAoB,QAAQ,OAAO;AAErD,SAASC,YAAY,QAAQ,mBAAgB;;AAE7C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,OAAe,EAAY;EAChE,MAAMC,QAAQ,GAAGJ,oBAAoB,CACnCC,YAAY,CAACI,SAAS,EACtBJ,YAAY,CAACK,WAAW,EACxBL,YAAY,CAACK,WACf,CAAC;EACD,MAAMC,MAAM,GAAGH,QAAQ,CAACI,OAAO,CAC5BC,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,KAAK,KAAK,MAAM,IAAID,CAAC,CAACP,OAAO,KAAKA,OAAO,IAAIO,CAAC,CAACE,SAAS,CAAC,CACzEC,GAAG,CAAEH,CAAC,IAAKA,CAAC,CAACI,QAAQ,IAAI,EAAE,CAAC,CAC5BL,MAAM,CAACM,OAAO,CAAC,CACfC,QAAQ,CAAC,CAAC,CACVC,IAAI,CAAC,IAAI,CAAC;EACb,OAAOlB,OAAO,CACZ,MAAOQ,MAAM,GAAG,CAAC,GAAG,IAAIW,GAAG,CAACX,MAAM,CAACY,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAG,EACtD,CAACZ,MAAM,CACT,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+
3
+ import { springToCssLinear } from "../animation/spring.js";
4
+ /** Union of the rendered children rects; the content wrapper is full-window. */
5
+ export function measureContentExtent(container) {
6
+ const rects = Array.from(container.children).map(child => child.getBoundingClientRect());
7
+ if (rects.length === 0) {
8
+ return {
9
+ top: 0,
10
+ bottom: window.innerHeight,
11
+ left: 0,
12
+ right: window.innerWidth
13
+ };
14
+ }
15
+ return {
16
+ top: Math.min(...rects.map(r => r.top)),
17
+ bottom: Math.max(...rects.map(r => r.bottom)),
18
+ left: Math.min(...rects.map(r => r.left)),
19
+ right: Math.max(...rects.map(r => r.right))
20
+ };
21
+ }
22
+ function toTiming(motion) {
23
+ if (motion.type === 'timing') {
24
+ const [x1, y1, x2, y2] = motion.timing.easing;
25
+ return {
26
+ duration: motion.timing.durationMs,
27
+ easing: `cubic-bezier(${x1}, ${y1}, ${x2}, ${y2})`
28
+ };
29
+ }
30
+ const {
31
+ durationMs,
32
+ easing
33
+ } = springToCssLinear(motion.spring);
34
+ return {
35
+ duration: durationMs,
36
+ easing
37
+ };
38
+ }
39
+ function prefersReducedMotion() {
40
+ return typeof globalThis.matchMedia === 'function' && globalThis.matchMedia('(prefers-reduced-motion: reduce)').matches;
41
+ }
42
+
43
+ /** The off-stage keyframe for a transition: where enter starts / exit ends. */
44
+ function hiddenKeyframe(transition, extent) {
45
+ const frame = {};
46
+ if (transition.fade || transition.type === 'fade') {
47
+ frame.opacity = 0;
48
+ }
49
+ if (transition.type === 'slide') {
50
+ const edge = transition.edge ?? 'bottom';
51
+ const distance = transition.distance ?? {
52
+ top: extent.bottom,
53
+ bottom: window.innerHeight - extent.top,
54
+ left: extent.right,
55
+ right: window.innerWidth - extent.left
56
+ }[edge];
57
+ frame.transform = {
58
+ top: `translate3d(0, ${-distance}px, 0)`,
59
+ bottom: `translate3d(0, ${distance}px, 0)`,
60
+ left: `translate3d(${-distance}px, 0, 0)`,
61
+ right: `translate3d(${distance}px, 0, 0)`
62
+ }[edge];
63
+ } else if (transition.type === 'scale') {
64
+ frame.transform = `translate3d(0, ${transition.offsetY ?? 0}px, 0) scale(${transition.scale ?? 0.95})`;
65
+ }
66
+ return frame;
67
+ }
68
+ const VISIBLE_KEYFRAME = {
69
+ opacity: 1,
70
+ transform: 'translate3d(0, 0, 0) scale(1)'
71
+ };
72
+
73
+ /**
74
+ * Runs an enter (`direction: 'in'`) or exit transition on `element`. The
75
+ * slide distance and scale origin come from the children of `contentRoot`,
76
+ * because the content wrapper itself always fills the window.
77
+ */
78
+ export function animateTransition(element, contentRoot, transition, direction) {
79
+ if (transition.type === 'none') {
80
+ return undefined;
81
+ }
82
+ const effective = prefersReducedMotion() ? {
83
+ ...transition,
84
+ type: 'fade',
85
+ fade: true
86
+ } : transition;
87
+ const extent = measureContentExtent(contentRoot);
88
+ element.style.transformOrigin = `${(extent.left + extent.right) / 2}px ${(extent.top + extent.bottom) / 2}px`;
89
+ const hidden = hiddenKeyframe(effective, extent);
90
+ const visible = {};
91
+ Object.keys(hidden).forEach(key => {
92
+ visible[key] = VISIBLE_KEYFRAME[key];
93
+ });
94
+ const keyframes = direction === 'in' ? [hidden, visible] : [visible, hidden];
95
+ return element.animate(keyframes, {
96
+ ...toTiming(effective.motion),
97
+ fill: 'forwards'
98
+ });
99
+ }
100
+ export function animateBackdrop(element, motion, direction) {
101
+ const keyframes = direction === 'in' ? [{
102
+ opacity: 0
103
+ }, {
104
+ opacity: 1
105
+ }] : [{
106
+ opacity: 1
107
+ }, {
108
+ opacity: 0
109
+ }];
110
+ return element.animate(keyframes, {
111
+ ...toTiming(motion),
112
+ fill: 'forwards'
113
+ });
114
+ }
115
+ //# sourceMappingURL=animateTransition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["springToCssLinear","measureContentExtent","container","rects","Array","from","children","map","child","getBoundingClientRect","length","top","bottom","window","innerHeight","left","right","innerWidth","Math","min","r","max","toTiming","motion","type","x1","y1","x2","y2","timing","easing","duration","durationMs","spring","prefersReducedMotion","globalThis","matchMedia","matches","hiddenKeyframe","transition","extent","frame","fade","opacity","edge","distance","transform","offsetY","scale","VISIBLE_KEYFRAME","animateTransition","element","contentRoot","direction","undefined","effective","style","transformOrigin","hidden","visible","Object","keys","forEach","key","keyframes","animate","fill","animateBackdrop"],"sourceRoot":"../../../src","sources":["web/animateTransition.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,wBAAqB;AAYvD;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAsB,EAAkB;EAC3E,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAACH,SAAS,CAACI,QAAQ,CAAC,CAACC,GAAG,CAAEC,KAAK,IACrDA,KAAK,CAACC,qBAAqB,CAAC,CAC9B,CAAC;EACD,IAAIN,KAAK,CAACO,MAAM,KAAK,CAAC,EAAE;IACtB,OAAO;MACLC,GAAG,EAAE,CAAC;MACNC,MAAM,EAAEC,MAAM,CAACC,WAAW;MAC1BC,IAAI,EAAE,CAAC;MACPC,KAAK,EAAEH,MAAM,CAACI;IAChB,CAAC;EACH;EACA,OAAO;IACLN,GAAG,EAAEO,IA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AC;EACtC,OAAOQ,OAAO,CAACc,OAAO,CAACD,SAAS,EAAE;IAAE,GAAG1C,QAAQ,CAACC,MAAM,CAAC;IAAE2C,IAAI,EAAE;EAAW,CAAC,CAAC;AAC9E","ignoreList":[]}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+
3
+ import { OVERLAY_LEVELS, OVERLAY_LEVEL_ORDER, OVERLAY_WEB_Z_INDEX_BASE } from "../OverlayLevels.js";
4
+ import { overlayStore } from "../OverlayStore.js";
5
+ const LAYER_ATTRIBUTE = 'data-onekey-overlay-layer';
6
+ export const ENTRY_ATTRIBUTE = 'data-onekey-overlay-entry';
7
+ const APP_ROOT_ID = 'root';
8
+ const layerRoots = new Map();
9
+ const pageHosts = new Map();
10
+ const dismissRequesters = new Map();
11
+ let installed = false;
12
+ function createLayerRoot(level) {
13
+ const root = document.createElement('div');
14
+ root.setAttribute(LAYER_ATTRIBUTE, level);
15
+ Object.assign(root.style, {
16
+ position: 'fixed',
17
+ inset: '0',
18
+ pointerEvents: 'none',
19
+ zIndex: String(OVERLAY_WEB_Z_INDEX_BASE[level]),
20
+ isolation: 'isolate'
21
+ });
22
+ // Keep DOM order equal to level order so equal z-index ties stay correct.
23
+ const next = OVERLAY_LEVELS.slice(OVERLAY_LEVELS.indexOf(level) + 1).map(l => layerRoots.get(l)).find(Boolean);
24
+ document.body.insertBefore(root, next ?? null);
25
+ return root;
26
+ }
27
+ function setInert(element, inert) {
28
+ if (element && element.inert !== inert) {
29
+ element.inert = inert;
30
+ }
31
+ }
32
+
33
+ // Elements outside a page host made inert for a blocking page overlay.
34
+ let pageInertElements = new Set();
35
+
36
+ /**
37
+ * A page host lives inside the app root, so a blocking page overlay cannot
38
+ * inert the app root; inert every sibling on the path from the host up to it
39
+ * instead (other routes, the page itself, navigation chrome).
40
+ */
41
+ function siblingsOutside(host, root) {
42
+ const siblings = new Set();
43
+ let node = host;
44
+ while (node !== root && node.parentElement) {
45
+ const parent = node.parentElement;
46
+ for (const sibling of Array.from(parent.children)) {
47
+ if (sibling !== node && sibling instanceof HTMLElement) {
48
+ siblings.add(sibling);
49
+ }
50
+ }
51
+ node = parent;
52
+ }
53
+ return siblings;
54
+ }
55
+ function inertEntriesBelow(container, seq) {
56
+ container.querySelectorAll(`[${ENTRY_ATTRIBUTE}]`).forEach(node => {
57
+ setInert(node, Number(node.dataset.stackOrder) < seq);
58
+ });
59
+ }
60
+
61
+ /** Everything rendered below the topmost blocking entry becomes inert. */
62
+ function syncInert() {
63
+ const top = overlayStore.getBlockingTop();
64
+ const appRoot = document.getElementById(APP_ROOT_ID);
65
+ let nextPageInert = new Set();
66
+ const pageHost = top?.scope === 'page' ? getOverlayPageHost(top.hostKey) : undefined;
67
+ if (top && pageHost && appRoot?.contains(pageHost)) {
68
+ setInert(appRoot, false);
69
+ nextPageInert = siblingsOutside(pageHost, appRoot);
70
+ inertEntriesBelow(pageHost, top.seq);
71
+ } else {
72
+ setInert(appRoot, !!top);
73
+ }
74
+ pageInertElements.forEach(element => {
75
+ if (!nextPageInert.has(element)) {
76
+ setInert(element, false);
77
+ }
78
+ });
79
+ nextPageInert.forEach(element => setInert(element, true));
80
+ pageInertElements = nextPageInert;
81
+ for (const [level, root] of layerRoots) {
82
+ // Global layers render above every page overlay.
83
+ const below = top?.scope === 'global' && OVERLAY_LEVEL_ORDER[level] < OVERLAY_LEVEL_ORDER[top.level];
84
+ setInert(root, below);
85
+ if (top?.scope === 'global' && level === top.level) {
86
+ inertEntriesBelow(root, top.seq);
87
+ }
88
+ }
89
+ }
90
+ function onKeyDown(event) {
91
+ // Escape while composing belongs to the IME.
92
+ if (event.key !== 'Escape' || event.isComposing || event.keyCode === 229) {
93
+ return;
94
+ }
95
+ const resolution = overlayStore.resolveBack();
96
+ if (resolution.kind === 'pass') {
97
+ return;
98
+ }
99
+ event.stopPropagation();
100
+ event.preventDefault();
101
+ if (resolution.kind === 'dismiss') {
102
+ dismissRequesters.get(resolution.id)?.('back');
103
+ }
104
+ }
105
+ function installOverlayWebManager() {
106
+ if (installed || typeof document === 'undefined') {
107
+ return;
108
+ }
109
+ installed = true;
110
+ overlayStore.subscribe(syncInert);
111
+ document.addEventListener('keydown', onKeyDown, true);
112
+ }
113
+ export function getOverlayLayerRoot(level) {
114
+ installOverlayWebManager();
115
+ let root = layerRoots.get(level);
116
+ if (!root || !root.isConnected) {
117
+ root = createLayerRoot(level);
118
+ layerRoots.set(level, root);
119
+ }
120
+ return root;
121
+ }
122
+ export function registerOverlayDismissRequester(id, requester) {
123
+ dismissRequesters.set(id, requester);
124
+ return () => {
125
+ if (dismissRequesters.get(id) === requester) {
126
+ dismissRequesters.delete(id);
127
+ }
128
+ };
129
+ }
130
+
131
+ /** Re-run after entry DOM nodes mount, since the store emits before commit. */
132
+ export function scheduleOverlayInertSync() {
133
+ requestAnimationFrame(syncInert);
134
+ }
135
+ export function registerOverlayPageHost(hostKey, element) {
136
+ installOverlayWebManager();
137
+ pageHosts.set(hostKey, element);
138
+ return () => {
139
+ if (pageHosts.get(hostKey) === element) {
140
+ pageHosts.delete(hostKey);
141
+ }
142
+ };
143
+ }
144
+ export function getOverlayPageHost(hostKey) {
145
+ return hostKey ? pageHosts.get(hostKey) : undefined;
146
+ }
147
+ //# sourceMappingURL=overlayLayers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OVERLAY_LEVELS","OVERLAY_LEVEL_ORDER","OVERLAY_WEB_Z_INDEX_BASE","overlayStore","LAYER_ATTRIBUTE","ENTRY_ATTRIBUTE","APP_ROOT_ID","layerRoots","Map","pageHosts","dismissRequesters","installed","createLayerRoot","level","root","document","createElement","setAttribute","Object","assign","style","position","inset","pointerEvents","zIndex","String","isolation","next","slice","indexOf","map","l","get","find","Boolean","body","insertBefore","setInert","element","inert","pageInertElements","Set","siblingsOutside","host","siblings","node","parentElement","parent","sibling","Array","from","children","HTMLElement","add","inertEntriesBelow","container","seq","querySelectorAll","forEach","Number","dataset","stackOrder","syncInert","top","getBlockingTop","appRoot","getElementById","nextPageInert","pageHost","scope","getOverlayPageHost","hostKey","undefined","contains","has","below","onKeyDown","event","key","isComposing","keyCode","resolution","resolveBack","kind","stopPropagation","preventDefault","id","installOverlayWebManager","subscribe","addEventListener","getOverlayLayerRoot","isConnected","set","registerOverlayDismissRequester","requester","delete","scheduleOverlayInertSync","requestAnimationFrame","registerOverlayPageHost"],"sourceRoot":"../../../src","sources":["web/overlayLayers.ts"],"mappings":";;AAAA,SACEA,cAAc,EACdC,mBAAmB,EACnBC,wBAAwB,QACnB,qBAAkB;AACzB,SAASC,YAAY,QAAQ,oBAAiB;AAK9C,MAAMC,eAAe,GAAG,2BAA2B;AACnD,OAAO,MAAMC,eAAe,GAAG,2BAA2B;AAE1D,MAAMC,WAAW,GAAG,MAAM;AAE1B,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAgC,CAAC;AAC3D,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAyB,CAAC;AACnD,MAAME,iBAAiB,GAAG,IAAIF,GAAG,CAG/B,CAAC;AACH,IAAIG,SAAS,GAAG,KAAK;AAErB,SAASC,eAAeA,CAACC,KAAoB,EAAkB;EAC7D,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC1CF,IAAI,CAACG,YAAY,CAACb,eAAe,EAAES,KAAK,CAAC;EACzCK,MAAM,CAACC,MAAM,CAACL,IAAI,CAACM,KAAK,EAAE;IACxBC,QAAQ,EAAE,OAAO;IACjBC,KAAK,EAAE,GAAG;IACVC,aAAa,EAAE,MAAM;IACrBC,MAAM,EAAEC,MAAM,CAACvB,wBAAwB,CAACW,KAAK,CAAC,CAAC;IAC/Ca,SAAS,EAAE;EACb,CAAC,CAAC;EACF;EACA,MAAMC,IAAI,GAAG3B,cAAc,CAAC4B,KAAK,CAAC5B,cAAc,CAAC6B,OAAO,CAAChB,KAAK,CAAC,GAAG,CAAC,CAAC,CACjEiB,GAAG,CAAEC,CAAC,IAAKxB,UAAU,CAACyB,GAAG,CAACD,C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C,IAAI,CAAC;EAC7B;EACA,OAAOA,IAAI;AACb;AAEA,OAAO,SAAS+E,+BAA+BA,CAC7CP,EAAU,EACVQ,SAAyD,EAC7C;EACZpF,iBAAiB,CAACkF,GAAG,CAACN,EAAE,EAAEQ,SAAS,CAAC;EACpC,OAAO,MAAM;IACX,IAAIpF,iBAAiB,CAACsB,GAAG,CAACsD,EAAE,CAAC,KAAKQ,SAAS,EAAE;MAC3CpF,iBAAiB,CAACqF,MAAM,CAACT,EAAE,CAAC;IAC9B;EACF,CAAC;AACH;;AAEA;AACA,OAAO,SAASU,wBAAwBA,CAAA,EAAG;EACzCC,qBAAqB,CAACnC,SAAS,CAAC;AAClC;AAEA,OAAO,SAASoC,uBAAuBA,CACrC3B,OAAe,EACfjC,OAAuB,EACX;EACZiD,wBAAwB,CAAC,CAAC;EAC1B9E,SAAS,CAACmF,GAAG,CAACrB,OAAO,EAAEjC,OAAO,CAAC;EAC/B,OAAO,MAAM;IACX,IAAI7B,SAAS,CAACuB,GAAG,CAACuC,OAAO,CAAC,KAAKjC,OAAO,EAAE;MACtC7B,SAAS,CAACsF,MAAM,CAACxB,OAAO,CAAC;IAC3B;EACF,CAAC;AACH;AAEA,OAAO,SAASD,kBAAkBA,CAChCC,OAA2B,EACC;EAC5B,OAAOA,OAAO,GAAG9D,SAAS,CAACuB,GAAG,CAACuC,OAAO,CAAC,GAAGC,SAAS;AACrD","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef } from 'react';
4
+ /** Gap between centered content and the keyboard; matches native. */
5
+ export const KEYBOARD_MARGIN = 16;
6
+
7
+ /**
8
+ * How far to lift overlay content above the software keyboard (>= 0), the
9
+ * same rule as iOS and Android: a sheet until its bottom clears the
10
+ * keyboard, other content until its bottom is `KEYBOARD_MARGIN` above it,
11
+ * never above the top edge. Full-window content never moves.
12
+ */
13
+ export function computeKeyboardShift({
14
+ keyboardTop,
15
+ contentTop,
16
+ contentBottom,
17
+ isSheet,
18
+ safeTop = 0
19
+ }) {
20
+ if (keyboardTop === undefined) {
21
+ return 0;
22
+ }
23
+ const needed = isSheet ? contentBottom - keyboardTop : contentBottom + KEYBOARD_MARGIN - keyboardTop;
24
+ const room = contentTop - safeTop;
25
+ return Math.max(0, Math.min(needed, room));
26
+ }
27
+
28
+ /**
29
+ * Vertical extent of the rendered children of the full-window React root,
30
+ * relative to the content wrapper, from layout offsets (no transforms).
31
+ */
32
+ function layoutExtent(content) {
33
+ const root = content?.firstElementChild;
34
+ if (!root) {
35
+ return undefined;
36
+ }
37
+ const children = Array.from(root.children).filter(child => child instanceof HTMLElement);
38
+ if (children.length === 0) {
39
+ return undefined;
40
+ }
41
+ return {
42
+ top: Math.min(...children.map(c => root.offsetTop + c.offsetTop)),
43
+ bottom: Math.max(...children.map(c => root.offsetTop + c.offsetTop + c.offsetHeight))
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Mobile browsers shrink the visual viewport for the keyboard while fixed
49
+ * layers keep the layout viewport; lift the entry's keyboard layer by the
50
+ * covered part.
51
+ */
52
+ export function useKeyboardShift({
53
+ layerRef,
54
+ sheetRef,
55
+ contentRef,
56
+ isSheet,
57
+ enabled
58
+ }) {
59
+ const shiftRef = useRef(0);
60
+ useEffect(() => {
61
+ const viewport = globalThis.visualViewport;
62
+ const layer = layerRef.current;
63
+ if (!viewport || !layer || !enabled) {
64
+ return;
65
+ }
66
+ const update = () => {
67
+ const keyboardBottom = viewport.offsetTop + viewport.height;
68
+ const covered = globalThis.innerHeight - keyboardBottom;
69
+ const current = shiftRef.current;
70
+ // Layout geometry (offsets ignore transforms), placed from the entry,
71
+ // which never transforms: neither the lift (maybe mid-transition) nor
72
+ // the enter / exit animation may skew the resting frame.
73
+ const origin = layer.parentElement?.getBoundingClientRect().top ?? 0;
74
+ let top = origin;
75
+ let bottom = origin + layer.offsetHeight;
76
+ const sheet = sheetRef.current;
77
+ if (isSheet && sheet) {
78
+ top = origin + sheet.offsetTop;
79
+ bottom = top + sheet.offsetHeight;
80
+ } else {
81
+ const extent = layoutExtent(contentRef.current);
82
+ if (extent) {
83
+ top = origin + extent.top;
84
+ bottom = origin + extent.bottom;
85
+ }
86
+ }
87
+ const shift = computeKeyboardShift({
88
+ keyboardTop: covered > 1 ? keyboardBottom : undefined,
89
+ contentTop: top,
90
+ contentBottom: bottom,
91
+ isSheet
92
+ });
93
+ if (Math.abs(shift - current) < 0.5) {
94
+ return;
95
+ }
96
+ shiftRef.current = shift;
97
+ layer.style.transform = shift ? `translate3d(0, ${-shift}px, 0)` : '';
98
+ };
99
+ viewport.addEventListener('resize', update);
100
+ viewport.addEventListener('scroll', update);
101
+ update();
102
+ return () => {
103
+ viewport.removeEventListener('resize', update);
104
+ viewport.removeEventListener('scroll', update);
105
+ shiftRef.current = 0;
106
+ layer.style.transform = '';
107
+ };
108
+ }, [contentRef, enabled, isSheet, layerRef, sheetRef]);
109
+ }
110
+ //# sourceMappingURL=useKeyboardShift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","KEYBOARD_MARGIN","computeKeyboardShift","keyboardTop","contentTop","contentBottom","isSheet","safeTop","undefined","needed","room","Math","max","min","layoutExtent","content","root","firstElementChild","children","Array","from","filter","child","HTMLElement","length","top","map","c","offsetTop","bottom","offsetHeight","useKeyboardShift","layerRef","sheetRef","contentRef","enabled","shiftRef","viewport","globalThis","visualViewport","layer","current","update","keyboardBottom","height","covered","innerHeight","origin","parentElement","getBoundingClientRect","sheet","extent","shift","abs","style","transform","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["web/useKeyboardShift.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAGzC;AACA,OAAO,MAAMC,eAAe,GAAG,EAAE;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAC;EACnCC,WAAW;EACXC,UAAU;EACVC,aAAa;EACbC,OAAO;EACPC,OAAO,GAAG;AAOZ,CA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