@onekeyfe/react-native-native-overlay 6.7.0-alpha.475 → 6.8.0-11

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 (102) hide show
  1. package/README.md +119 -21
  2. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEntryRootView.kt +60 -0
  3. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayHost.kt +37 -5
  4. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPackage.kt +1 -1
  5. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToastCardView.kt +869 -0
  6. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToastSpec.kt +327 -0
  7. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToasterView.kt +574 -0
  8. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToasterViewManager.kt +54 -0
  9. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayView.kt +12 -0
  10. package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayViewManager.kt +8 -0
  11. package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayAccessibilityIsolationTest.kt +172 -0
  12. package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayMotionTest.kt +42 -0
  13. package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlaySheetInsetTest.kt +78 -0
  14. package/docs/SPEC.md +324 -33
  15. package/ios/NativeOverlayContainerView.swift +6 -0
  16. package/ios/NativeOverlayToastCardView.swift +572 -0
  17. package/ios/NativeOverlayToastSpec.swift +356 -0
  18. package/ios/NativeOverlayToasterView.swift +519 -0
  19. package/ios/NativeOverlayWindowManager.swift +244 -7
  20. package/ios/RCTNativeOverlayToasterComponentView.h +11 -0
  21. package/ios/RCTNativeOverlayToasterComponentView.mm +85 -0
  22. package/lib/module/NativeOverlayNativeComponent.ts +13 -0
  23. package/lib/module/NativeOverlayToasterNativeComponent.ts +24 -0
  24. package/lib/module/OverlayView.js +7 -1
  25. package/lib/module/OverlayView.js.map +1 -1
  26. package/lib/module/animation/anchoredOrigin.js +26 -0
  27. package/lib/module/animation/anchoredOrigin.js.map +1 -0
  28. package/lib/module/animation/resolveAnimation.js +26 -4
  29. package/lib/module/animation/resolveAnimation.js.map +1 -1
  30. package/lib/module/index.js +3 -0
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/toast/OverlayToastHost.js +42 -0
  33. package/lib/module/toast/OverlayToastHost.js.map +1 -0
  34. package/lib/module/toast/OverlayToastHost.web.js +32 -0
  35. package/lib/module/toast/OverlayToastHost.web.js.map +1 -0
  36. package/lib/module/toast/OverlayToastStore.js +217 -0
  37. package/lib/module/toast/OverlayToastStore.js.map +1 -0
  38. package/lib/module/toast/toastBridge.js +65 -0
  39. package/lib/module/toast/toastBridge.js.map +1 -0
  40. package/lib/module/toast/toastDomContent.web.js +298 -0
  41. package/lib/module/toast/toastDomContent.web.js.map +1 -0
  42. package/lib/module/toast/toastDomRenderer.web.js +695 -0
  43. package/lib/module/toast/toastDomRenderer.web.js.map +1 -0
  44. package/lib/module/toast/toastStyles.web.js +97 -0
  45. package/lib/module/toast/toastStyles.web.js.map +1 -0
  46. package/lib/module/toast/types.js +2 -0
  47. package/lib/module/toast/types.js.map +1 -0
  48. package/lib/module/web/animateTransition.js +38 -12
  49. package/lib/module/web/animateTransition.js.map +1 -1
  50. package/lib/module/web/overlayLayers.js +5 -0
  51. package/lib/module/web/overlayLayers.js.map +1 -1
  52. package/lib/typescript/src/NativeOverlayNativeComponent.d.ts +13 -0
  53. package/lib/typescript/src/NativeOverlayNativeComponent.d.ts.map +1 -1
  54. package/lib/typescript/src/NativeOverlayToasterNativeComponent.d.ts +19 -0
  55. package/lib/typescript/src/NativeOverlayToasterNativeComponent.d.ts.map +1 -0
  56. package/lib/typescript/src/OverlayView.d.ts.map +1 -1
  57. package/lib/typescript/src/animation/anchoredOrigin.d.ts +7 -0
  58. package/lib/typescript/src/animation/anchoredOrigin.d.ts.map +1 -0
  59. package/lib/typescript/src/animation/resolveAnimation.d.ts +9 -3
  60. package/lib/typescript/src/animation/resolveAnimation.d.ts.map +1 -1
  61. package/lib/typescript/src/animation/types.d.ts +5 -1
  62. package/lib/typescript/src/animation/types.d.ts.map +1 -1
  63. package/lib/typescript/src/index.d.ts +5 -0
  64. package/lib/typescript/src/index.d.ts.map +1 -1
  65. package/lib/typescript/src/toast/OverlayToastHost.d.ts +6 -0
  66. package/lib/typescript/src/toast/OverlayToastHost.d.ts.map +1 -0
  67. package/lib/typescript/src/toast/OverlayToastHost.web.d.ts +6 -0
  68. package/lib/typescript/src/toast/OverlayToastHost.web.d.ts.map +1 -0
  69. package/lib/typescript/src/toast/OverlayToastStore.d.ts +47 -0
  70. package/lib/typescript/src/toast/OverlayToastStore.d.ts.map +1 -0
  71. package/lib/typescript/src/toast/toastBridge.d.ts +11 -0
  72. package/lib/typescript/src/toast/toastBridge.d.ts.map +1 -0
  73. package/lib/typescript/src/toast/toastDomContent.web.d.ts +15 -0
  74. package/lib/typescript/src/toast/toastDomContent.web.d.ts.map +1 -0
  75. package/lib/typescript/src/toast/toastDomRenderer.web.d.ts +8 -0
  76. package/lib/typescript/src/toast/toastDomRenderer.web.d.ts.map +1 -0
  77. package/lib/typescript/src/toast/toastStyles.web.d.ts +2 -0
  78. package/lib/typescript/src/toast/toastStyles.web.d.ts.map +1 -0
  79. package/lib/typescript/src/toast/types.d.ts +240 -0
  80. package/lib/typescript/src/toast/types.d.ts.map +1 -0
  81. package/lib/typescript/src/web/animateTransition.d.ts +12 -0
  82. package/lib/typescript/src/web/animateTransition.d.ts.map +1 -1
  83. package/lib/typescript/src/web/overlayLayers.d.ts.map +1 -1
  84. package/package.json +3 -2
  85. package/react-native.config.js +1 -0
  86. package/src/NativeOverlayNativeComponent.ts +13 -0
  87. package/src/NativeOverlayToasterNativeComponent.ts +24 -0
  88. package/src/OverlayView.tsx +7 -0
  89. package/src/animation/anchoredOrigin.ts +35 -0
  90. package/src/animation/resolveAnimation.ts +28 -7
  91. package/src/animation/types.ts +5 -1
  92. package/src/index.ts +24 -0
  93. package/src/toast/OverlayToastHost.tsx +62 -0
  94. package/src/toast/OverlayToastHost.web.tsx +29 -0
  95. package/src/toast/OverlayToastStore.ts +254 -0
  96. package/src/toast/toastBridge.ts +62 -0
  97. package/src/toast/toastDomContent.web.ts +351 -0
  98. package/src/toast/toastDomRenderer.web.ts +856 -0
  99. package/src/toast/toastStyles.web.ts +97 -0
  100. package/src/toast/types.ts +251 -0
  101. package/src/web/animateTransition.ts +54 -14
  102. package/src/web/overlayLayers.ts +7 -0
@@ -0,0 +1,47 @@
1
+ import type { IOverlayToastEvent, IOverlayToastHandle, IOverlayToastHandlers, IOverlayToastItem, IOverlayToastSpec, IOverlayToasterConfig } from './types';
2
+ export interface IOverlayToastSnapshot {
3
+ /** Newest first. */
4
+ items: readonly IOverlayToastItem[];
5
+ config: IOverlayToasterConfig;
6
+ }
7
+ /**
8
+ * The single source of truth for message toasts. Callers push data in; a
9
+ * platform renderer (attached by `OverlayToastHost`) draws it and reports
10
+ * what happened to each card through `handleEvent`.
11
+ *
12
+ * A toast leaves the list only when its renderer reports `close`, so the exit
13
+ * animation always has a card to play on. With no renderer attached there is
14
+ * no animation to wait for and a dismissal removes the toast at once.
15
+ */
16
+ export declare class OverlayToastStore {
17
+ private items;
18
+ private config;
19
+ private snapshot;
20
+ private readonly handlers;
21
+ private readonly dismissReasons;
22
+ private readonly listeners;
23
+ private renderers;
24
+ private nextId;
25
+ private nextGeneration;
26
+ getSnapshot: () => IOverlayToastSnapshot;
27
+ subscribe: (listener: () => void) => (() => void);
28
+ /** A renderer is drawing the list; returns its detach function. */
29
+ attachRenderer(): () => void;
30
+ createId(): string;
31
+ show(spec: IOverlayToastSpec, handlers?: IOverlayToastHandlers): IOverlayToastHandle;
32
+ /**
33
+ * Redraws a toast that is on screen with a new spec (a theme or layout
34
+ * change) without restarting its lifetime. Unknown or leaving ids are
35
+ * ignored.
36
+ */
37
+ update(spec: IOverlayToastSpec): void;
38
+ dismiss(id: string): void;
39
+ dismissAll(): void;
40
+ configure(config: IOverlayToasterConfig): void;
41
+ /** Renderer → store. */
42
+ handleEvent(event: IOverlayToastEvent): void;
43
+ private remove;
44
+ private emit;
45
+ }
46
+ export declare const overlayToastStore: OverlayToastStore;
47
+ //# sourceMappingURL=OverlayToastStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OverlayToastStore.d.ts","sourceRoot":"","sources":["../../../../src/toast/OverlayToastStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,qBAAqB;IACpC,oBAAoB;IACpB,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAKD;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA2B;IAExC,OAAO,CAAC,MAAM,CAA6B;IAE3C,OAAO,CAAC,QAAQ,CAAoD;IAEpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4C;IAErE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG3B;IAEJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,OAAO,CAAC,SAAS,CAAK;IAEtB,OAAO,CAAC,MAAM,CAAK;IAEnB,OAAO,CAAC,cAAc,CAAK;IAE3B,WAAW,QAAO,qBAAqB,CAAkB;IAEzD,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAK9C;IAEF,mEAAmE;IACnE,cAAc,IAAI,MAAM,IAAI;IAuB5B,QAAQ,IAAI,MAAM;IAKlB,IAAI,CACF,IAAI,EAAE,iBAAiB,EACvB,QAAQ,GAAE,qBAA0B,GACnC,mBAAmB;IAmCtB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAWrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAiBzB,UAAU,IAAI,IAAI;IAIlB,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI;IAU9C,wBAAwB;IACxB,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAgD5C,OAAO,CAAC,MAAM;IAyBd,OAAO,CAAC,IAAI;CAIb;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { IOverlayToastEvent, IOverlayToastItem } from './types';
2
+ /** How a toast that never times out crosses the bridge: JSON has no Infinity. */
3
+ export declare const TOAST_DURATION_INFINITE = -1;
4
+ export declare function serializeToastItems(items: readonly IOverlayToastItem[]): string;
5
+ export declare function toToastEvent(native: {
6
+ toastId: string;
7
+ generation?: number;
8
+ type: string;
9
+ value: string;
10
+ }): IOverlayToastEvent | undefined;
11
+ //# sourceMappingURL=toastBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toastBridge.d.ts","sourceRoot":"","sources":["../../../../src/toast/toastBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAS1C,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,iBAAiB,EAAE,GAClC,MAAM,CAYR;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,kBAAkB,GAAG,SAAS,CAoBjC"}
@@ -0,0 +1,15 @@
1
+ import type { IOverlayToastSpec } from './types';
2
+ export type IToastContentEvent = {
3
+ type: 'action';
4
+ actionId: string;
5
+ } | {
6
+ type: 'link';
7
+ link: string;
8
+ } | {
9
+ type: 'press';
10
+ };
11
+ type IEmit = (event: IToastContentEvent) => void;
12
+ /** Builds the body of one card. The caller owns the card element. */
13
+ export declare function buildToastContent(spec: IOverlayToastSpec, emit: IEmit): HTMLElement;
14
+ export {};
15
+ //# sourceMappingURL=toastDomContent.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toastDomContent.web.d.ts","sourceRoot":"","sources":["../../../../src/toast/toastDomContent.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAajB,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;AA+NjD,qEAAqE;AACrE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,KAAK,GACV,WAAW,CAkGb"}
@@ -0,0 +1,8 @@
1
+ import type { IOverlayToastEvent, IOverlayToastRenderer } from './types';
2
+ /**
3
+ * Draws message toasts with plain DOM in the `toast` overlay layer. No React:
4
+ * the cards, their stacking, timers, swipe and transitions live here, and the
5
+ * stylesheet reproduces the previous renderer's chrome rule for rule.
6
+ */
7
+ export declare function createToastDomRenderer(report: (event: IOverlayToastEvent) => void): IOverlayToastRenderer;
8
+ //# sourceMappingURL=toastDomRenderer.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toastDomRenderer.web.d.ts","sourceRoot":"","sources":["../../../../src/toast/toastDomRenderer.web.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,kBAAkB,EAGlB,qBAAqB,EAGtB,MAAM,SAAS,CAAC;AAoGjB;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAC1C,qBAAqB,CA8tBvB"}
@@ -0,0 +1,2 @@
1
+ export declare function ensureOverlayToastStyles(): void;
2
+ //# sourceMappingURL=toastStyles.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toastStyles.web.d.ts","sourceRoot":"","sources":["../../../../src/toast/toastStyles.web.ts"],"names":[],"mappings":"AAoFA,wBAAgB,wBAAwB,SAYvC"}
@@ -0,0 +1,240 @@
1
+ /**
2
+ * The message-toast contract. A toast is plain data: the platform draws the
3
+ * card (DOM on web, UIKit on iOS, Android views on Android) and owns its
4
+ * stacking, timers, gestures and motion. Nothing here is a React node.
5
+ *
6
+ * Every colour is a resolved CSS colour string and every length is in points
7
+ * (CSS px on web), so the package carries no design tokens of its own.
8
+ */
9
+ /** Where a toast group is anchored. */
10
+ export type IOverlayToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
11
+ /** Why a toast left. `programmatic` is a caller's `dismiss`. */
12
+ export type IOverlayToastDismissReason = 'timeout' | 'swipe' | 'close' | 'programmatic';
13
+ export type IOverlayToastFontWeight = '400' | '500' | '600' | '700';
14
+ /** One inline run of a paragraph. Unset fields inherit the paragraph. */
15
+ export interface IOverlayToastTextRun {
16
+ text: string;
17
+ color?: string;
18
+ fontWeight?: IOverlayToastFontWeight;
19
+ fontSize?: number;
20
+ underline?: boolean;
21
+ /**
22
+ * Makes the run tappable. The value is opaque to the platform and comes
23
+ * back through `onLink`.
24
+ */
25
+ link?: string;
26
+ }
27
+ export interface IOverlayToastText {
28
+ /** Paragraphs, each laid out as its own block. */
29
+ paragraphs: IOverlayToastTextRun[][];
30
+ color: string;
31
+ fontSize: number;
32
+ lineHeight: number;
33
+ fontWeight: IOverlayToastFontWeight;
34
+ letterSpacing?: number;
35
+ /** A CSS font-family list on web, a font family name on native. */
36
+ fontFamily?: string;
37
+ /**
38
+ * Native: the font name for each weight, for a typeface that ships one
39
+ * face per weight. A weight listed here selects that face.
40
+ */
41
+ fontFaces?: Partial<Record<IOverlayToastFontWeight, string>>;
42
+ /** Equal-width digits. */
43
+ tabularNumbers?: boolean;
44
+ /** Web: let the text be selected. Off by default. */
45
+ selectable?: boolean;
46
+ /** Clamp per paragraph; unset means no clamp. */
47
+ numberOfLines?: number;
48
+ /** Web: background of a link run under the pointer and while pressed. */
49
+ linkHoverColor?: string;
50
+ linkPressedColor?: string;
51
+ }
52
+ export type IOverlayToastIcon = {
53
+ kind: 'icon';
54
+ /** Icon name for the native icon registry. */
55
+ name: string;
56
+ /** Target of an SVG `<use>`; web draws this with `currentColor`. */
57
+ href?: string;
58
+ color: string;
59
+ size: number;
60
+ } | {
61
+ kind: 'spinner';
62
+ color: string;
63
+ size: number;
64
+ } | {
65
+ kind: 'image';
66
+ uri: string;
67
+ size: number;
68
+ borderRadius?: number;
69
+ };
70
+ export interface IOverlayToastAction {
71
+ /** Opaque id reported through `onAction`. */
72
+ id: string;
73
+ label: string;
74
+ disabled?: boolean;
75
+ testID?: string;
76
+ /** Drawn before the label. */
77
+ icon?: IOverlayToastIcon;
78
+ /** Space between the icon and the label. */
79
+ iconGap?: number;
80
+ color: string;
81
+ backgroundColor: string;
82
+ hoverBackgroundColor?: string;
83
+ pressedBackgroundColor?: string;
84
+ focusRingColor?: string;
85
+ fontSize: number;
86
+ lineHeight: number;
87
+ fontWeight: IOverlayToastFontWeight;
88
+ fontFamily?: string;
89
+ /** Native: the font name for each weight. */
90
+ fontFaces?: Partial<Record<IOverlayToastFontWeight, string>>;
91
+ paddingHorizontal: number;
92
+ paddingVertical: number;
93
+ /** Outer margins; negative values pull the button over its neighbours. */
94
+ marginHorizontal?: number;
95
+ marginVertical?: number;
96
+ /** A transparent border that only adds to the button's size. */
97
+ borderWidth?: number;
98
+ borderRadius: number;
99
+ /** Opacity while `disabled`. */
100
+ disabledOpacity?: number;
101
+ }
102
+ interface IOverlayToastBase {
103
+ /** Stable id. Showing an id that is on screen updates that toast. */
104
+ id: string;
105
+ /** Auto-dismiss delay in ms. `Infinity` keeps it until dismissed. */
106
+ duration: number;
107
+ /** Defaults to the toaster's position. */
108
+ position?: IOverlayToastPosition;
109
+ testID?: string;
110
+ }
111
+ /**
112
+ * Status icon, title, message and an optional action row:
113
+ *
114
+ * ```
115
+ * [icon] title
116
+ * message
117
+ * [action] [action]
118
+ * ```
119
+ */
120
+ export interface IOverlayMessageToast extends IOverlayToastBase {
121
+ layout: 'message';
122
+ icon?: IOverlayToastIcon;
123
+ title?: IOverlayToastText;
124
+ message?: IOverlayToastText;
125
+ actions?: IOverlayToastAction[];
126
+ actionsAlign?: 'left' | 'right';
127
+ }
128
+ /**
129
+ * A pressable notification row:
130
+ *
131
+ * ```
132
+ * (badge) title [image]
133
+ * message
134
+ * ```
135
+ */
136
+ export interface IOverlayNotificationToast extends IOverlayToastBase {
137
+ layout: 'notification';
138
+ /** Drawn centred inside a round badge. */
139
+ icon: IOverlayToastIcon;
140
+ badgeColor: string;
141
+ badgeSize: number;
142
+ title?: IOverlayToastText;
143
+ message?: IOverlayToastText;
144
+ /** Trailing thumbnail. */
145
+ image?: {
146
+ uri: string;
147
+ size: number;
148
+ borderRadius?: number;
149
+ };
150
+ actions?: IOverlayToastAction[];
151
+ actionsAlign?: 'left' | 'right';
152
+ /** Report presses on the row through `onPress`. */
153
+ pressable?: boolean;
154
+ }
155
+ export type IOverlayToastSpec = IOverlayMessageToast | IOverlayNotificationToast;
156
+ export interface IOverlayToastHandlers {
157
+ /** The toast started leaving. */
158
+ onDismiss?: (reason: IOverlayToastDismissReason) => void;
159
+ /** The exit animation finished and the card is gone. */
160
+ onClose?: (reason: IOverlayToastDismissReason) => void;
161
+ onAction?: (actionId: string) => void;
162
+ onLink?: (link: string) => void;
163
+ onPress?: () => void;
164
+ }
165
+ /** Toaster-wide settings. Every field has a platform default. */
166
+ export interface IOverlayToasterConfig {
167
+ position?: IOverlayToastPosition;
168
+ /** Web chrome follows this; native reads `cardColor`. */
169
+ theme?: 'light' | 'dark';
170
+ /** Native card surface. */
171
+ cardColor?: string;
172
+ /**
173
+ * Native: the width of the card's content box. The card adds its own
174
+ * padding around it.
175
+ */
176
+ contentWidth?: number;
177
+ /** Native: the tallest a card's content may grow. */
178
+ contentMaxHeight?: number;
179
+ /** Web: the tallest a card's content may grow. */
180
+ webContentMaxHeight?: number;
181
+ /**
182
+ * Bottom edge, in window points, of something hanging from the top of the
183
+ * window where top toasts land. Top toasts rest under it. 0 clears it.
184
+ */
185
+ topObstruction?: number;
186
+ /** Air between the obstruction and the first toast under it. */
187
+ topObstructionGap?: number;
188
+ /** Room a toast keeps above the usable area's bottom edge. */
189
+ topObstructionRoom?: number;
190
+ /** Follow the system reduced-motion setting. Defaults to true. */
191
+ respectReducedMotion?: boolean;
192
+ /** Web: accessible label of the close button. */
193
+ closeButtonLabel?: string;
194
+ testID?: string;
195
+ }
196
+ export interface IOverlayToastHandle {
197
+ id: string;
198
+ dismiss: () => void;
199
+ }
200
+ /** What a platform renderer receives: the active toasts, newest first. */
201
+ export interface IOverlayToastItem {
202
+ spec: IOverlayToastSpec;
203
+ /** False once a caller dismissed it; the renderer plays the exit. */
204
+ visible: boolean;
205
+ /** Bumped whenever the spec changes, so the card is redrawn. */
206
+ revision: number;
207
+ /** Bumped by `show` only: a new generation restarts the toast's lifetime. */
208
+ generation: number;
209
+ }
210
+ export type IOverlayToastEvent = {
211
+ id: string;
212
+ generation?: number;
213
+ type: 'dismiss';
214
+ reason: IOverlayToastDismissReason;
215
+ } | {
216
+ id: string;
217
+ generation?: number;
218
+ type: 'close';
219
+ reason: IOverlayToastDismissReason;
220
+ } | {
221
+ id: string;
222
+ generation?: number;
223
+ type: 'action';
224
+ actionId: string;
225
+ } | {
226
+ id: string;
227
+ generation?: number;
228
+ type: 'link';
229
+ link: string;
230
+ } | {
231
+ id: string;
232
+ generation?: number;
233
+ type: 'press';
234
+ };
235
+ export interface IOverlayToastRenderer {
236
+ sync: (items: readonly IOverlayToastItem[], config: IOverlayToasterConfig) => void;
237
+ destroy: () => void;
238
+ }
239
+ export {};
240
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/toast/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uCAAuC;AACvC,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,gEAAgE;AAChE,MAAM,MAAM,0BAA0B,GAClC,SAAS,GACT,OAAO,GACP,OAAO,GACP,cAAc,CAAC;AAEnB,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpE,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,UAAU,EAAE,oBAAoB,EAAE,EAAE,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,uBAAuB,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,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CAAE,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,CACJ,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,MAAM,EAAE,qBAAqB,KAC1B,IAAI,CAAC;IACV,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
@@ -8,6 +8,18 @@ export interface IContentExtent {
8
8
  }
9
9
  /** Union of the rendered children rects; the content wrapper is full-window. */
10
10
  export declare function measureContentExtent(container: HTMLElement): IContentExtent;
11
+ export interface ITransitionKeyframeInput {
12
+ transition: IResolvedOverlayTransition;
13
+ extent: IContentExtent;
14
+ direction: 'in' | 'out';
15
+ /** Rendered frames of an interrupted run; the new run starts from them. */
16
+ sampled?: Keyframe;
17
+ }
18
+ /**
19
+ * Keyframes for one enter/exit run. Pure so the interruption rules can be
20
+ * tested without a DOM.
21
+ */
22
+ export declare function buildTransitionKeyframes({ transition, extent, direction, sampled, }: ITransitionKeyframeInput): [Keyframe, Keyframe];
11
23
  /**
12
24
  * Runs an enter (`direction: 'in'`) or exit transition on `element`. The
13
25
  * slide distance and scale origin come from the children of `contentRoot`,
@@ -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,EAA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AAI,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"}
@@ -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;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
+ {"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;AAqF3D,0EAA0E;AAC1E,wBAAgB,gBAAgB,SAsC/B;AA2BD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CASxE;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-overlay",
3
- "version": "6.7.0-alpha.475",
3
+ "version": "6.8.0-11",
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",
@@ -182,7 +182,8 @@
182
182
  "ios": {
183
183
  "componentProvider": {
184
184
  "RNCNativeOverlay": "RCTNativeOverlayComponentView",
185
- "RNCNativeOverlayPageHost": "RCTNativeOverlayPageHostComponentView"
185
+ "RNCNativeOverlayPageHost": "RCTNativeOverlayPageHostComponentView",
186
+ "RNCNativeOverlayToaster": "RCTNativeOverlayToasterComponentView"
186
187
  }
187
188
  }
188
189
  }
@@ -5,6 +5,7 @@ module.exports = {
5
5
  componentDescriptors: [
6
6
  'RNCNativeOverlayComponentDescriptor',
7
7
  'RNCNativeOverlayPageHostComponentDescriptor',
8
+ 'RNCNativeOverlayToasterComponentDescriptor',
8
9
  ],
9
10
  cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
10
11
  packageImportPath:
@@ -54,6 +54,19 @@ export interface INativeOverlayNativeProps extends ViewProps {
54
54
  sheetCornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Double, 24>;
55
55
  showHandle?: CodegenTypes.WithDefault<boolean, false>;
56
56
  sheetBackgroundColor?: ColorValue;
57
+ /**
58
+ * `sheet` presentation: paints the platform sheet's bottom inset (the
59
+ * navigation-bar strip padded below the fitted content) with the drawn
60
+ * surface color. Android hosts the sheet inside the activity content view,
61
+ * so a JS view below the content root is not composited there; iOS uses the
62
+ * JS safe-area tail instead.
63
+ */
64
+ sheetBottomInsetColor?: ColorValue;
65
+ /**
66
+ * `sheet` presentation: horizontal inset of the drawn surface inside the
67
+ * platform sheet, in points, so the bottom inset paint stops with it.
68
+ */
69
+ sheetBottomInsetHorizontal?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
57
70
  dismissOnPanDown?: CodegenTypes.WithDefault<boolean, true>;
58
71
  /** JSON of the resolved animation (`IResolvedOverlayAnimation`). */
59
72
  animationConfig?: CodegenTypes.WithDefault<string, ''>;
@@ -0,0 +1,24 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+
3
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
4
+
5
+ type INativeOverlayToastEvent = Readonly<{
6
+ toastId: string;
7
+ generation: CodegenTypes.Int32;
8
+ /** `dismiss` | `close` | `action` | `link` | `press`. */
9
+ type: string;
10
+ /** The dismiss reason, action id or link of the event; empty otherwise. */
11
+ value: string;
12
+ }>;
13
+
14
+ export interface INativeOverlayToasterNativeProps extends ViewProps {
15
+ /** JSON of `IOverlayToastItem[]`, newest first. */
16
+ toasts?: CodegenTypes.WithDefault<string, ''>;
17
+ /** JSON of `IOverlayToasterConfig`. */
18
+ config?: CodegenTypes.WithDefault<string, ''>;
19
+ onToastEvent?: CodegenTypes.DirectEventHandler<INativeOverlayToastEvent>;
20
+ }
21
+
22
+ export default codegenNativeComponent<INativeOverlayToasterNativeProps>(
23
+ 'RNCNativeOverlayToaster'
24
+ ) as HostComponent<INativeOverlayToasterNativeProps>;
@@ -217,6 +217,13 @@ export function OverlayView(props: IOverlayViewProps) {
217
217
  sheetBackgroundColor={
218
218
  hasSheetSurface ? 'transparent' : sheet?.backgroundColor
219
219
  }
220
+ // Android hosts the sheet inside the activity content view, so the JS
221
+ // safe-area tail below the content root is not composited there. Have
222
+ // native paint the padded bottom inset with the drawn surface color.
223
+ sheetBottomInsetColor={
224
+ hasSheetSurface ? sheetSurfaceBackgroundColor : undefined
225
+ }
226
+ sheetBottomInsetHorizontal={hasSheetSurface ? sheetInset : 0}
220
227
  dismissOnPanDown={sheet?.dismissOnPanDown ?? true}
221
228
  animationConfig={animationConfig}
222
229
  onPresented={onHostPresented}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The transform origin for an anchored panel placed on `placement` of its
3
+ * anchor (Floating UI notation, e.g. `bottom-end`): the panel grows out of
4
+ * the side and corner that face the anchor. Undefined for an unknown value.
5
+ */
6
+ export function getAnchoredTransformOrigin(
7
+ placement: string | undefined
8
+ ): string | undefined {
9
+ if (!placement) {
10
+ return undefined;
11
+ }
12
+ const [side, align] = placement.split('-');
13
+ const facing = (
14
+ {
15
+ top: 'bottom',
16
+ bottom: 'top',
17
+ left: 'right',
18
+ right: 'left',
19
+ } as Record<string, string>
20
+ )[side ?? ''];
21
+ if (!facing) {
22
+ return undefined;
23
+ }
24
+ const vertical = side === 'top' || side === 'bottom';
25
+ const cross = !align
26
+ ? 'center'
27
+ : vertical
28
+ ? align === 'start'
29
+ ? 'left'
30
+ : 'right'
31
+ : align === 'start'
32
+ ? 'top'
33
+ : 'bottom';
34
+ return vertical ? `${cross} ${facing}` : `${facing} ${cross}`;
35
+ }
@@ -19,13 +19,22 @@ export interface IResolvedOverlayAnimation {
19
19
  }
20
20
 
21
21
  /**
22
- * Defaults match today's visuals: Dialog center (scale 0.85 + fade, quick),
23
- * Tamagui Sheet (slide from bottom, quick), message toasts (slide from top,
24
- * 300ms quad), Popover floating content (scale 0.95 + fade, popoverQuick).
22
+ * Defaults match today's visuals: Dialog center (scale 0.85 + fade in, then a
23
+ * fade-free scale 0.96 out), Tamagui Sheet (slide from bottom, quick), message
24
+ * toasts (slide from top, 300ms quad), Popover floating content (scale 0.95 +
25
+ * fade, popoverQuick).
26
+ *
27
+ * `exit` defaults to the presentation's own exit below; presentations without
28
+ * one mirror `enter`.
25
29
  */
26
30
  export const DEFAULT_OVERLAY_ANIMATIONS: Record<
27
31
  IOverlayPresentation,
28
- { enter: IOverlayTransition; backdrop: IOverlayMotionPreset }
32
+ {
33
+ enter: IOverlayTransition;
34
+ /** Mirrors `enter` when omitted. */
35
+ exit?: IOverlayTransition;
36
+ backdrop: IOverlayMotionPreset;
37
+ }
29
38
  > = {
30
39
  sheet: {
31
40
  enter: { type: 'slide', edge: 'bottom', motion: 'quick' },
@@ -33,6 +42,12 @@ export const DEFAULT_OVERLAY_ANIMATIONS: Record<
33
42
  },
34
43
  center: {
35
44
  enter: { type: 'scale', scale: 0.85, fade: true, motion: 'quick' },
45
+ // OK-66647: the centered card is a solid surface. Fading it out lets any
46
+ // opaque content behind it (a text-heavy page, a list inside another
47
+ // overlay) show through the card for the whole transition, which reads as
48
+ // a doubled/ghosted render. Keep the card opaque while it shrinks and let
49
+ // the host unmount it at the end of the exit.
50
+ exit: { type: 'scale', scale: 0.96, fade: false, motion: 'quick' },
36
51
  backdrop: 'quick',
37
52
  },
38
53
  toast: {
@@ -86,9 +101,15 @@ export function resolveOverlayAnimation(
86
101
  const enterInput = animation?.enter ?? defaults.enter;
87
102
  const fallbackMotion = defaults.enter.motion ?? 'quick';
88
103
  const enter = resolveTransition(enterInput, fallbackMotion, presets);
89
- const exit = animation?.exit
90
- ? resolveTransition(animation.exit, fallbackMotion, presets)
91
- : enter;
104
+ // A caller-supplied enter keeps mirroring when its exit is omitted; the
105
+ // presentation default exit only applies when neither transition was
106
+ // customized.
107
+ const exitInput =
108
+ animation?.exit ?? animation?.enter ?? defaults.exit ?? enterInput;
109
+ // A presentation default exit keeps its own fallback motion instead of
110
+ // inheriting the enter's.
111
+ const exitFallbackMotion = defaults.exit?.motion ?? fallbackMotion;
112
+ const exit = resolveTransition(exitInput, exitFallbackMotion, presets);
92
113
  return {
93
114
  enter,
94
115
  exit,
@@ -57,7 +57,11 @@ export interface IOverlayTransition {
57
57
 
58
58
  export interface IOverlayAnimation {
59
59
  enter?: IOverlayTransition;
60
- /** Defaults to the reverse of `enter`. */
60
+ /**
61
+ * Defaults to the presentation's default exit (see
62
+ * `DEFAULT_OVERLAY_ANIMATIONS`), or the reverse of `enter` when the
63
+ * presentation has no default exit.
64
+ */
61
65
  exit?: IOverlayTransition;
62
66
  /** Backdrop fade; runs on the same clock as the content by default. */
63
67
  backdrop?: { motion?: IOverlayMotionInput };
package/src/index.ts CHANGED
@@ -35,6 +35,7 @@ export {
35
35
  springToAndroidSpringForce,
36
36
  springToCssLinear,
37
37
  } from './animation/spring';
38
+ export { getAnchoredTransformOrigin } from './animation/anchoredOrigin';
38
39
  export { OverlayView } from './OverlayView';
39
40
  export {
40
41
  useEnclosingOverlayLevel,
@@ -53,3 +54,26 @@ export {
53
54
  } from './OverlayPageScope';
54
55
  export type { IOverlayPageScope } from './OverlayPageScope';
55
56
  export { OverlayPageHost } from './OverlayPageHost';
57
+ export { OverlayToastHost } from './toast/OverlayToastHost';
58
+ export {
59
+ OverlayToastStore,
60
+ overlayToastStore,
61
+ } from './toast/OverlayToastStore';
62
+ export type { IOverlayToastSnapshot } from './toast/OverlayToastStore';
63
+ export type {
64
+ IOverlayMessageToast,
65
+ IOverlayNotificationToast,
66
+ IOverlayToastAction,
67
+ IOverlayToastDismissReason,
68
+ IOverlayToastEvent,
69
+ IOverlayToastFontWeight,
70
+ IOverlayToastHandle,
71
+ IOverlayToastHandlers,
72
+ IOverlayToastIcon,
73
+ IOverlayToastItem,
74
+ IOverlayToastPosition,
75
+ IOverlayToastSpec,
76
+ IOverlayToastText,
77
+ IOverlayToastTextRun,
78
+ IOverlayToasterConfig,
79
+ } from './toast/types';