react-native-nitro-modal 0.1.5 → 0.3.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -11
- package/android/src/main/java/com/margelo/nitro/nitromodal/BottomSheetPresenter.kt +335 -34
- package/android/src/main/java/com/margelo/nitro/nitromodal/HybridNitroModal.kt +63 -22
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalConfig.kt +31 -1
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalContentRoot.kt +48 -5
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalPresenter.kt +63 -4
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalHostView.kt +68 -8
- package/ios/HybridNitroModal.swift +111 -20
- package/ios/ModalConfig.swift +44 -2
- package/ios/NitroModalHostView.swift +73 -8
- package/ios/SheetView.swift +575 -0
- package/ios/SheetViewController.swift +19 -450
- package/lib/module/NitroModal.js +39 -7
- package/lib/module/NitroModal.js.map +1 -1
- package/lib/module/NitroModalView.js +4 -3
- package/lib/module/NitroModalView.js.map +1 -1
- package/lib/module/NitroModalView.native.js +3 -0
- package/lib/module/NitroModalView.native.js.map +1 -1
- package/lib/module/NitroModalView.web.js +159 -0
- package/lib/module/NitroModalView.web.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/web/AnimatedValue.js +126 -0
- package/lib/module/web/AnimatedValue.js.map +1 -0
- package/lib/module/web/ModalConfig.js +30 -0
- package/lib/module/web/ModalConfig.js.map +1 -0
- package/lib/module/web/ModalController.js +306 -0
- package/lib/module/web/ModalController.js.map +1 -0
- package/lib/module/web/ModalPresenter.js +280 -0
- package/lib/module/web/ModalPresenter.js.map +1 -0
- package/lib/module/web/PopupPresenter.js +117 -0
- package/lib/module/web/PopupPresenter.js.map +1 -0
- package/lib/module/web/SheetPresenter.js +494 -0
- package/lib/module/web/SheetPresenter.js.map +1 -0
- package/lib/module/web/dom.js +138 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/typescript/src/NitroModal.d.ts +35 -4
- package/lib/typescript/src/NitroModal.d.ts.map +1 -1
- package/lib/typescript/src/NitroModal.nitro.d.ts +29 -2
- package/lib/typescript/src/NitroModal.nitro.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.d.ts +2 -1
- package/lib/typescript/src/NitroModalView.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.native.d.ts +1 -0
- package/lib/typescript/src/NitroModalView.native.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.web.d.ts +6 -0
- package/lib/typescript/src/NitroModalView.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/web/AnimatedValue.d.ts +49 -0
- package/lib/typescript/src/web/AnimatedValue.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalConfig.d.ts +30 -0
- package/lib/typescript/src/web/ModalConfig.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalController.d.ts +70 -0
- package/lib/typescript/src/web/ModalController.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalPresenter.d.ts +107 -0
- package/lib/typescript/src/web/ModalPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/PopupPresenter.d.ts +20 -0
- package/lib/typescript/src/web/PopupPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/SheetPresenter.d.ts +65 -0
- package/lib/typescript/src/web/SheetPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/dom.d.ts +42 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp +60 -6
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.hpp +10 -2
- package/nitrogen/generated/android/c++/JNamedSheetDetent.hpp +64 -0
- package/nitrogen/generated/android/c++/JSheetDetent.cpp +26 -0
- package/nitrogen/generated/android/c++/JSheetDetent.hpp +42 -37
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp +20 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt +40 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/NamedSheetDetent.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/SheetDetent.kt +47 -10
- package/nitrogen/generated/android/nitromodal+autolinking.cmake +1 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.hpp +53 -8
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Umbrella.hpp +4 -3
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.hpp +32 -5
- package/nitrogen/generated/ios/c++/views/HybridNitroModalComponent.mm +24 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec_cxx.swift +110 -5
- package/nitrogen/generated/ios/swift/NamedSheetDetent.swift +48 -0
- package/nitrogen/generated/ios/swift/SheetDetent.swift +15 -33
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp +8 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.hpp +14 -5
- package/nitrogen/generated/shared/c++/{SheetDetent.hpp → NamedSheetDetent.hpp} +17 -17
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp +9 -1
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.hpp +15 -2
- package/nitrogen/generated/shared/json/NitroModalConfig.json +4 -0
- package/package.json +3 -2
- package/src/NitroModal.nitro.ts +30 -2
- package/src/NitroModal.tsx +71 -8
- package/src/NitroModalView.native.tsx +4 -0
- package/src/NitroModalView.tsx +9 -4
- package/src/NitroModalView.web.tsx +180 -0
- package/src/index.tsx +2 -0
- package/src/web/AnimatedValue.ts +193 -0
- package/src/web/ModalConfig.ts +67 -0
- package/src/web/ModalController.ts +338 -0
- package/src/web/ModalPresenter.ts +333 -0
- package/src/web/PopupPresenter.ts +129 -0
- package/src/web/SheetPresenter.ts +647 -0
- package/src/web/dom.ts +171 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/// <reference lib="dom" />
|
|
4
|
+
|
|
5
|
+
import { canUseDOM, estimateViewport, inlineInsets, readSafeAreaInsets } from "./dom.js";
|
|
6
|
+
import { isSameConfig, makeConfig } from "./ModalConfig.js";
|
|
7
|
+
import { popupContentArea, PopupPresenter } from "./PopupPresenter.js";
|
|
8
|
+
import { sheetContentArea, SheetPresenter } from "./SheetPresenter.js";
|
|
9
|
+
/**
|
|
10
|
+
* The web counterpart of the native `HybridNitroModal`: receives the host
|
|
11
|
+
* view's props and drives one presenter per presentation.
|
|
12
|
+
*
|
|
13
|
+
* Presentation is a small state machine so that rapid `isOpen` toggles, user
|
|
14
|
+
* dismissals and unmounts always settle on a consistent state, and every
|
|
15
|
+
* accepted present request ends with exactly one `onDismiss`. Transitions are
|
|
16
|
+
* interrupted rather than queued: closing mid-enter turns the enter around,
|
|
17
|
+
* and opening mid-exit turns the exit around (that session carries on, so it
|
|
18
|
+
* gets no `onDismiss` and at most one `onPresent`).
|
|
19
|
+
*/
|
|
20
|
+
export class ModalController {
|
|
21
|
+
methods = {
|
|
22
|
+
present: () => this.requestPresent(),
|
|
23
|
+
dismiss: () => this.requestDismiss('programmatic'),
|
|
24
|
+
snapToDetent: index => {
|
|
25
|
+
if (Number.isFinite(index)) {
|
|
26
|
+
this.presenter?.snapToDetent(Math.trunc(index));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
props = null;
|
|
31
|
+
config = null;
|
|
32
|
+
isOpen = false;
|
|
33
|
+
phase = 'idle';
|
|
34
|
+
/** What React (or an imperative call) asked for. */
|
|
35
|
+
wantsOpen = false;
|
|
36
|
+
/** A present request was accepted and its `onDismiss` is still owed. */
|
|
37
|
+
sessionActive = false;
|
|
38
|
+
/** `onPresent` was sent for the current session. */
|
|
39
|
+
presentSent = false;
|
|
40
|
+
dismissReason = 'programmatic';
|
|
41
|
+
reconcileScheduled = false;
|
|
42
|
+
isAttached = false;
|
|
43
|
+
presenter = null;
|
|
44
|
+
elements = null;
|
|
45
|
+
/** Inline: the element the sheet fills. */
|
|
46
|
+
host = null;
|
|
47
|
+
lastContentArea = null;
|
|
48
|
+
|
|
49
|
+
/** `setMounted` renders (or removes) the modal's elements. */
|
|
50
|
+
constructor(setMounted) {
|
|
51
|
+
this.setMounted = setMounted;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Host view lifecycle
|
|
55
|
+
|
|
56
|
+
attach() {
|
|
57
|
+
this.isAttached = true;
|
|
58
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The host view unmounted. Also runs for React's strict-mode remount, so `attach` must work again. */
|
|
62
|
+
detach() {
|
|
63
|
+
this.isAttached = false;
|
|
64
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
65
|
+
this.presenter?.destroy();
|
|
66
|
+
this.presenter = null;
|
|
67
|
+
this.phase = 'idle';
|
|
68
|
+
this.wantsOpen = false;
|
|
69
|
+
this.sessionActive = false;
|
|
70
|
+
this.presentSent = false;
|
|
71
|
+
this.dismissReason = 'programmatic';
|
|
72
|
+
// Applied again from the props on the next `update`.
|
|
73
|
+
this.isOpen = false;
|
|
74
|
+
this.config = null;
|
|
75
|
+
this.lastContentArea = null;
|
|
76
|
+
this.setMounted(false);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The host view rendered with new props. */
|
|
80
|
+
update(props) {
|
|
81
|
+
this.props = props;
|
|
82
|
+
const next = makeConfig(props);
|
|
83
|
+
if (!this.config || !isSameConfig(next, this.config)) {
|
|
84
|
+
this.config = next;
|
|
85
|
+
if (this.presenter) {
|
|
86
|
+
this.presenter.update(next);
|
|
87
|
+
} else {
|
|
88
|
+
this.reportEstimatedContentArea();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (props.isOpen !== this.isOpen) {
|
|
92
|
+
this.isOpen = props.isOpen;
|
|
93
|
+
if (props.isOpen) {
|
|
94
|
+
this.requestPresent();
|
|
95
|
+
} else {
|
|
96
|
+
this.requestDismiss('programmatic');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Inline: the element the sheet fills, rendered in place. */
|
|
102
|
+
hostDidChange(host) {
|
|
103
|
+
if (host === this.host) return;
|
|
104
|
+
this.host = host;
|
|
105
|
+
if (!this.presenter) {
|
|
106
|
+
this.reportEstimatedContentArea();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
elementsDidMount(elements) {
|
|
110
|
+
this.elements = elements;
|
|
111
|
+
if (this.presenter && !this.presenter.isShown) {
|
|
112
|
+
this.presenter.show(elements);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
elementsWillUnmount() {
|
|
116
|
+
this.elements = null;
|
|
117
|
+
}
|
|
118
|
+
contentDidRender() {
|
|
119
|
+
this.presenter?.contentDidRender();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Escape key, routed by React Native Web's `Modal` to the topmost modal. */
|
|
123
|
+
handleBackPress = () => {
|
|
124
|
+
// Already on its way out: the press is spent.
|
|
125
|
+
if (!this.isVisible) return;
|
|
126
|
+
this.props?.onBackButtonPress?.();
|
|
127
|
+
if (!this.config?.dismissOnBackButton) return;
|
|
128
|
+
this.requestDismiss('backButton');
|
|
129
|
+
this.reconcile();
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// State machine
|
|
133
|
+
|
|
134
|
+
get isVisible() {
|
|
135
|
+
return this.phase === 'presenting' || this.phase === 'presented';
|
|
136
|
+
}
|
|
137
|
+
requestPresent() {
|
|
138
|
+
if (!this.isAttached) return;
|
|
139
|
+
this.wantsOpen = true;
|
|
140
|
+
this.sessionActive = true;
|
|
141
|
+
this.scheduleReconcile();
|
|
142
|
+
}
|
|
143
|
+
requestDismiss(reason) {
|
|
144
|
+
if (this.wantsOpen) {
|
|
145
|
+
this.dismissReason = reason;
|
|
146
|
+
}
|
|
147
|
+
this.wantsOpen = false;
|
|
148
|
+
this.scheduleReconcile();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Coalesces the requests made in one task, e.g. an open and a close in the same handler. */
|
|
152
|
+
scheduleReconcile() {
|
|
153
|
+
if (this.reconcileScheduled) return;
|
|
154
|
+
this.reconcileScheduled = true;
|
|
155
|
+
queueMicrotask(() => {
|
|
156
|
+
this.reconcileScheduled = false;
|
|
157
|
+
if (this.isAttached) {
|
|
158
|
+
this.reconcile();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
reconcile() {
|
|
163
|
+
switch (this.phase) {
|
|
164
|
+
case 'presenting':
|
|
165
|
+
case 'presented':
|
|
166
|
+
if (!this.wantsOpen) {
|
|
167
|
+
this.startDismiss();
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
case 'dismissing':
|
|
171
|
+
if (this.wantsOpen && this.presenter?.cancelDismiss()) {
|
|
172
|
+
this.phase = 'presenting';
|
|
173
|
+
this.dismissReason = 'programmatic';
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case 'idle':
|
|
177
|
+
if (this.wantsOpen) {
|
|
178
|
+
this.startPresent();
|
|
179
|
+
} else if (this.sessionActive) {
|
|
180
|
+
this.endSession(); // Cancelled before anything appeared.
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
startPresent() {
|
|
186
|
+
const {
|
|
187
|
+
config
|
|
188
|
+
} = this;
|
|
189
|
+
if (!canUseDOM || !config) return;
|
|
190
|
+
const presenter = config.mode === 'popup' ? new PopupPresenter(config, this) : new SheetPresenter(config, this);
|
|
191
|
+
this.presenter = presenter;
|
|
192
|
+
this.phase = 'presenting';
|
|
193
|
+
this.setMounted(true);
|
|
194
|
+
// Still mounted from a presentation that just ended.
|
|
195
|
+
if (this.elements) {
|
|
196
|
+
presenter.show(this.elements);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
startDismiss() {
|
|
200
|
+
const {
|
|
201
|
+
presenter
|
|
202
|
+
} = this;
|
|
203
|
+
if (!presenter?.isShown) {
|
|
204
|
+
// Its elements never mounted.
|
|
205
|
+
presenter?.destroy();
|
|
206
|
+
this.finishDismiss();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.phase = 'dismissing';
|
|
210
|
+
presenter.dismiss();
|
|
211
|
+
}
|
|
212
|
+
finishDismiss() {
|
|
213
|
+
this.phase = 'idle';
|
|
214
|
+
this.presenter = null;
|
|
215
|
+
this.setMounted(false);
|
|
216
|
+
this.endSession();
|
|
217
|
+
this.reconcile();
|
|
218
|
+
}
|
|
219
|
+
endSession() {
|
|
220
|
+
if (!this.sessionActive) return;
|
|
221
|
+
const reason = this.dismissReason;
|
|
222
|
+
this.dismissReason = 'programmatic';
|
|
223
|
+
this.presentSent = false;
|
|
224
|
+
// A present requested while we were dismissing starts a new session.
|
|
225
|
+
this.sessionActive = this.wantsOpen;
|
|
226
|
+
if (this.isAttached) {
|
|
227
|
+
this.props?.onDismiss?.(reason);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// PresenterListener
|
|
232
|
+
|
|
233
|
+
onPresented() {
|
|
234
|
+
if (this.phase !== 'presenting') return;
|
|
235
|
+
this.phase = 'presented';
|
|
236
|
+
if (!this.presentSent) {
|
|
237
|
+
this.presentSent = true;
|
|
238
|
+
this.props?.onPresent?.();
|
|
239
|
+
}
|
|
240
|
+
this.reconcile();
|
|
241
|
+
}
|
|
242
|
+
onDismissed() {
|
|
243
|
+
this.finishDismiss();
|
|
244
|
+
}
|
|
245
|
+
onBackdropPress() {
|
|
246
|
+
this.props?.onBackdropPress?.();
|
|
247
|
+
if (!this.config?.dismissOnBackdropPress || !this.isVisible) return;
|
|
248
|
+
this.requestDismiss('backdrop');
|
|
249
|
+
this.reconcile();
|
|
250
|
+
}
|
|
251
|
+
onSwipeDismiss() {
|
|
252
|
+
if (!this.config?.dismissOnSwipe || !this.isVisible) return;
|
|
253
|
+
this.requestDismiss('swipe');
|
|
254
|
+
this.reconcile();
|
|
255
|
+
}
|
|
256
|
+
onDetentChange(index) {
|
|
257
|
+
this.props?.onDetentChange?.(index);
|
|
258
|
+
}
|
|
259
|
+
onPullToRefresh() {
|
|
260
|
+
this.props?.onPullToRefresh?.();
|
|
261
|
+
}
|
|
262
|
+
onContentAreaChange(width, height) {
|
|
263
|
+
const area = {
|
|
264
|
+
width: Math.floor(width),
|
|
265
|
+
height: Math.floor(height)
|
|
266
|
+
};
|
|
267
|
+
const last = this.lastContentArea;
|
|
268
|
+
if (area.width <= 0 || area.height <= 0) return;
|
|
269
|
+
if (last?.width === area.width && last.height === area.height) return;
|
|
270
|
+
this.lastContentArea = area;
|
|
271
|
+
this.props?.onContentAreaChange?.(area);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Helpers
|
|
275
|
+
|
|
276
|
+
/** Lets React size the content before the first presentation. */
|
|
277
|
+
reportEstimatedContentArea() {
|
|
278
|
+
const {
|
|
279
|
+
config
|
|
280
|
+
} = this;
|
|
281
|
+
if (!canUseDOM || !this.isAttached || !config) return;
|
|
282
|
+
if (config.isInline) {
|
|
283
|
+
const {
|
|
284
|
+
host
|
|
285
|
+
} = this;
|
|
286
|
+
if (!host || host.clientWidth === 0 || host.clientHeight === 0) return;
|
|
287
|
+
const viewport = {
|
|
288
|
+
width: host.clientWidth,
|
|
289
|
+
height: host.clientHeight
|
|
290
|
+
};
|
|
291
|
+
const area = sheetContentArea(config.detents, viewport, inlineInsets(host), true);
|
|
292
|
+
this.onContentAreaChange(area.width, area.height);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const viewport = estimateViewport();
|
|
296
|
+
const insets = readSafeAreaInsets();
|
|
297
|
+
const area = config.mode === 'popup' ? popupContentArea(viewport, insets) : sheetContentArea(config.detents, viewport, insets, false);
|
|
298
|
+
this.onContentAreaChange(area.width, area.height);
|
|
299
|
+
}
|
|
300
|
+
handleWindowResize = () => {
|
|
301
|
+
if (!this.presenter) {
|
|
302
|
+
this.reportEstimatedContentArea();
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=ModalController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["canUseDOM","estimateViewport","inlineInsets","readSafeAreaInsets","isSameConfig","makeConfig","popupContentArea","PopupPresenter","sheetContentArea","SheetPresenter","ModalController","methods","present","requestPresent","dismiss","requestDismiss","snapToDetent","index","Number","isFinite","presenter","Math","trunc","props","config","isOpen","phase","wantsOpen","sessionActive","presentSent","dismissReason","reconcileScheduled","isAttached","elements","host","lastContentArea","constructor","setMounted","attach","window","addEventListener","handleWindowResize","detach","removeEventListener","destroy","update","next","reportEstimatedContentArea","hostDidChange","elementsDidMount","isShown","show","elementsWillUnmount","contentDidRender","handleBackPress","isVisible","onBackButtonPress","dismissOnBackButton","reconcile","scheduleReconcile","reason","queueMicrotask","startDismiss","cancelDismiss","startPresent","endSession","mode","finishDismiss","onDismiss","onPresented","onPresent","onDismissed","onBackdropPress","dismissOnBackdropPress","onSwipeDismiss","dismissOnSwipe","onDetentChange","onPullToRefresh","onContentAreaChange","width","height","area","floor","last","isInline","clientWidth","clientHeight","viewport","detents","insets"],"sourceRoot":"../../../src","sources":["web/ModalController.ts"],"mappings":";;AAAA;;AAQA,SACEA,SAAS,EACTC,gBAAgB,EAChBC,YAAY,EACZC,kBAAkB,QACb,UAAO;AACd,SAASC,YAAY,EAAEC,UAAU,QAA0B,kBAAe;AAM1E,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,qBAAkB;AACnE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,qBAAkB;AAInE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAA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ACnD;EAEQvC,kBAAkB,GAAGA,CAAA,KAAM;IACjC,IAAI,CAAC,IAAI,CAACrB,SAAS,EAAE;MACnB,IAAI,CAAC2B,0BAA0B,CAAC,CAAC;IACnC;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/// <reference lib="dom" />
|
|
4
|
+
|
|
5
|
+
import { canScrollWithin, clipOverflow, inlineInsets, readKeyboardHeight, readSafeAreaInsets, toCSSColor, ZERO_INSETS } from "./dom.js";
|
|
6
|
+
|
|
7
|
+
/** DOM rendered by the web host view for one presentation. */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Owns one presentation from show to dismiss. Subclasses lay out the surface
|
|
11
|
+
* and drive the enter/exit animations; this class tracks the viewport, the
|
|
12
|
+
* on-screen keyboard and the content size, and handles the backdrop and
|
|
13
|
+
* teardown.
|
|
14
|
+
*
|
|
15
|
+
* Transitions are interruptible: dismissing mid-enter turns the enter around,
|
|
16
|
+
* and `cancelDismiss` turns an exit back around. Once an exit starts the modal
|
|
17
|
+
* stops taking input.
|
|
18
|
+
*
|
|
19
|
+
* Inline, the elements fill the host view in place of a full-window layer:
|
|
20
|
+
* only the surface takes input, and the keyboard is left to the page.
|
|
21
|
+
*/
|
|
22
|
+
export class ModalPresenter {
|
|
23
|
+
elements = null;
|
|
24
|
+
viewport = {
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0
|
|
27
|
+
};
|
|
28
|
+
insets = ZERO_INSETS;
|
|
29
|
+
/** Part of the viewport covered by the on-screen keyboard, from the bottom. */
|
|
30
|
+
keyboardHeight = 0;
|
|
31
|
+
/** Measured size of the React content. */
|
|
32
|
+
contentSize = {
|
|
33
|
+
width: 0,
|
|
34
|
+
height: 0
|
|
35
|
+
};
|
|
36
|
+
entering = false;
|
|
37
|
+
isDismissing = false;
|
|
38
|
+
finished = false;
|
|
39
|
+
observedContent = null;
|
|
40
|
+
resizeObserver = null;
|
|
41
|
+
/** Inline: follows the host's size, which can change without a window resize. */
|
|
42
|
+
hostObserver = null;
|
|
43
|
+
constructor(config, listener) {
|
|
44
|
+
this.config = config;
|
|
45
|
+
this.listener = listener;
|
|
46
|
+
}
|
|
47
|
+
get isShown() {
|
|
48
|
+
return this.elements != null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Takes over the rendered elements and starts the enter transition. */
|
|
52
|
+
show(elements) {
|
|
53
|
+
if (this.elements || this.finished) return;
|
|
54
|
+
this.elements = elements;
|
|
55
|
+
// The elements can outlive a previous presentation (an immediate re-present).
|
|
56
|
+
this.setInteractive(true);
|
|
57
|
+
elements.surface.style.overflow = clipOverflow();
|
|
58
|
+
elements.surface.style.opacity = '';
|
|
59
|
+
elements.surface.style.transform = '';
|
|
60
|
+
elements.backdrop.style.display = this.config.isInline ? 'none' : '';
|
|
61
|
+
window.addEventListener('resize', this.handleResize);
|
|
62
|
+
if (this.config.isInline) {
|
|
63
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
64
|
+
this.hostObserver = new ResizeObserver(this.handleResize);
|
|
65
|
+
this.hostObserver.observe(elements.overlay);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
window.visualViewport?.addEventListener('resize', this.handleKeyboard);
|
|
69
|
+
window.visualViewport?.addEventListener('scroll', this.handleKeyboard);
|
|
70
|
+
elements.backdrop.addEventListener('click', this.handleBackdropClick);
|
|
71
|
+
elements.overlay.addEventListener('wheel', this.handleWheel, {
|
|
72
|
+
passive: false
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
76
|
+
this.resizeObserver = new ResizeObserver(this.handleContentResize);
|
|
77
|
+
}
|
|
78
|
+
this.measureViewport();
|
|
79
|
+
this.observeContent();
|
|
80
|
+
this.applyBackdrop();
|
|
81
|
+
this.didShow();
|
|
82
|
+
this.entering = true;
|
|
83
|
+
this.animateIn();
|
|
84
|
+
}
|
|
85
|
+
update(config) {
|
|
86
|
+
const previous = this.config;
|
|
87
|
+
this.config = config;
|
|
88
|
+
if (!this.elements) return;
|
|
89
|
+
this.applyBackdrop();
|
|
90
|
+
this.configDidChange(previous);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The React content re-rendered; its root element may have changed. */
|
|
94
|
+
contentDidRender() {
|
|
95
|
+
if (this.elements && this.observeContent()) {
|
|
96
|
+
this.contentSizeDidChange();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Animated dismissal, also from mid-enter. `onDismissed` follows when it
|
|
102
|
+
* completes, unless `cancelDismiss` turns it around first.
|
|
103
|
+
*/
|
|
104
|
+
dismiss() {
|
|
105
|
+
const elements = this.elements;
|
|
106
|
+
if (!elements || this.isDismissing || this.finished) return;
|
|
107
|
+
this.isDismissing = true;
|
|
108
|
+
this.entering = false;
|
|
109
|
+
this.setInteractive(false);
|
|
110
|
+
// Also hides the on-screen keyboard.
|
|
111
|
+
const focused = document.activeElement;
|
|
112
|
+
if (focused instanceof HTMLElement && elements.overlay.contains(focused)) {
|
|
113
|
+
focused.blur();
|
|
114
|
+
}
|
|
115
|
+
this.animateOut(() => this.finish());
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Reverses a running exit from wherever it is. `onPresented` follows once
|
|
120
|
+
* it settles. Returns false when there is no exit to reverse.
|
|
121
|
+
*/
|
|
122
|
+
cancelDismiss() {
|
|
123
|
+
if (!this.elements || !this.isDismissing || this.finished) return false;
|
|
124
|
+
this.isDismissing = false;
|
|
125
|
+
this.setInteractive(true);
|
|
126
|
+
this.entering = true;
|
|
127
|
+
this.animateIn();
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Tears down without animating or notifying the listener. */
|
|
132
|
+
destroy() {
|
|
133
|
+
if (this.finished) return;
|
|
134
|
+
this.finished = true;
|
|
135
|
+
this.teardown();
|
|
136
|
+
}
|
|
137
|
+
snapToDetent(_index) {}
|
|
138
|
+
|
|
139
|
+
/** The elements are in place; lay out the hidden state. */
|
|
140
|
+
|
|
141
|
+
/** Animates from the current state to presented, then calls `notifyPresented`. */
|
|
142
|
+
|
|
143
|
+
/** Animates from the current state (possibly mid-enter) to gone, then calls `onEnd`. */
|
|
144
|
+
|
|
145
|
+
/** The viewport size, safe area or keyboard height changed. */
|
|
146
|
+
|
|
147
|
+
/** For subclasses: the running enter animation settled. */
|
|
148
|
+
notifyPresented() {
|
|
149
|
+
if (!this.entering || this.isDismissing || this.finished) return;
|
|
150
|
+
this.entering = false;
|
|
151
|
+
this.listener.onPresented();
|
|
152
|
+
}
|
|
153
|
+
reportContentArea(width, height) {
|
|
154
|
+
if (width > 0 && height > 0) {
|
|
155
|
+
this.listener.onContentAreaChange(width, height);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
teardown() {
|
|
159
|
+
this.stopAnimations();
|
|
160
|
+
window.removeEventListener('resize', this.handleResize);
|
|
161
|
+
window.visualViewport?.removeEventListener('resize', this.handleKeyboard);
|
|
162
|
+
window.visualViewport?.removeEventListener('scroll', this.handleKeyboard);
|
|
163
|
+
this.elements?.backdrop.removeEventListener('click', this.handleBackdropClick);
|
|
164
|
+
this.elements?.overlay.removeEventListener('wheel', this.handleWheel);
|
|
165
|
+
this.resizeObserver?.disconnect();
|
|
166
|
+
this.resizeObserver = null;
|
|
167
|
+
this.hostObserver?.disconnect();
|
|
168
|
+
this.hostObserver = null;
|
|
169
|
+
this.observedContent = null;
|
|
170
|
+
}
|
|
171
|
+
finish() {
|
|
172
|
+
if (this.finished) return;
|
|
173
|
+
this.finished = true;
|
|
174
|
+
this.teardown();
|
|
175
|
+
this.listener.onDismissed();
|
|
176
|
+
}
|
|
177
|
+
applyBackdrop() {
|
|
178
|
+
const {
|
|
179
|
+
backdrop,
|
|
180
|
+
surface
|
|
181
|
+
} = this.elements;
|
|
182
|
+
const {
|
|
183
|
+
config
|
|
184
|
+
} = this;
|
|
185
|
+
backdrop.style.backgroundColor = toCSSColor(config.backdropColor, config.backdropOpacity);
|
|
186
|
+
const blur = config.backdropBlurRadius > 0 ? `blur(${config.backdropBlurRadius}px)` : '';
|
|
187
|
+
backdrop.style.setProperty('backdrop-filter', blur);
|
|
188
|
+
backdrop.style.setProperty('-webkit-backdrop-filter', blur);
|
|
189
|
+
// `Canvas` follows the page's `color-scheme`, like a system background.
|
|
190
|
+
surface.style.backgroundColor = config.contentBackgroundColor != null ? toCSSColor(config.contentBackgroundColor) : 'Canvas';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Inline, only the surface takes input; the rest reaches the page. */
|
|
194
|
+
setInteractive(interactive) {
|
|
195
|
+
const {
|
|
196
|
+
overlay,
|
|
197
|
+
surface
|
|
198
|
+
} = this.elements;
|
|
199
|
+
if (this.config.isInline) {
|
|
200
|
+
overlay.style.pointerEvents = 'none';
|
|
201
|
+
surface.style.pointerEvents = interactive ? 'auto' : 'none';
|
|
202
|
+
} else {
|
|
203
|
+
overlay.style.pointerEvents = interactive ? '' : 'none';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
measureViewport() {
|
|
207
|
+
const {
|
|
208
|
+
overlay
|
|
209
|
+
} = this.elements;
|
|
210
|
+
this.viewport = {
|
|
211
|
+
width: overlay.clientWidth,
|
|
212
|
+
height: overlay.clientHeight
|
|
213
|
+
};
|
|
214
|
+
if (this.config.isInline) {
|
|
215
|
+
this.insets = inlineInsets(overlay);
|
|
216
|
+
this.keyboardHeight = 0;
|
|
217
|
+
} else {
|
|
218
|
+
this.insets = readSafeAreaInsets();
|
|
219
|
+
this.keyboardHeight = readKeyboardHeight(this.viewport.height);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Re-targets the observer at the content's root element. Returns whether its size changed. */
|
|
224
|
+
observeContent() {
|
|
225
|
+
const root = this.elements?.content.firstElementChild;
|
|
226
|
+
const element = root instanceof HTMLElement ? root : null;
|
|
227
|
+
if (element !== this.observedContent) {
|
|
228
|
+
if (this.observedContent) {
|
|
229
|
+
this.resizeObserver?.unobserve(this.observedContent);
|
|
230
|
+
}
|
|
231
|
+
this.observedContent = element;
|
|
232
|
+
if (element) {
|
|
233
|
+
this.resizeObserver?.observe(element);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return this.measureContent();
|
|
237
|
+
}
|
|
238
|
+
measureContent() {
|
|
239
|
+
// Layout sizes, unaffected by the transition's transforms.
|
|
240
|
+
const width = this.observedContent?.offsetWidth ?? 0;
|
|
241
|
+
const height = this.observedContent?.offsetHeight ?? 0;
|
|
242
|
+
if (width === this.contentSize.width && height === this.contentSize.height) return false;
|
|
243
|
+
this.contentSize = {
|
|
244
|
+
width,
|
|
245
|
+
height
|
|
246
|
+
};
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
handleContentResize = () => {
|
|
250
|
+
if (this.measureContent()) {
|
|
251
|
+
this.contentSizeDidChange();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
handleResize = () => {
|
|
255
|
+
if (!this.elements) return;
|
|
256
|
+
this.measureViewport();
|
|
257
|
+
this.viewportDidChange();
|
|
258
|
+
};
|
|
259
|
+
handleKeyboard = () => {
|
|
260
|
+
if (this.config.isInline) return;
|
|
261
|
+
const height = readKeyboardHeight(this.viewport.height);
|
|
262
|
+
if (height === this.keyboardHeight) return;
|
|
263
|
+
this.keyboardHeight = height;
|
|
264
|
+
this.viewportDidChange();
|
|
265
|
+
};
|
|
266
|
+
handleBackdropClick = () => {
|
|
267
|
+
if (!this.isDismissing && !this.finished) {
|
|
268
|
+
this.listener.onBackdropPress();
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/** Keeps the page behind the modal from scrolling; scrollable content still scrolls. */
|
|
273
|
+
handleWheel = event => {
|
|
274
|
+
if (event.ctrlKey || Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;
|
|
275
|
+
if (!canScrollWithin(event.target, this.elements.overlay, event.deltaY)) {
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=ModalPresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["canScrollWithin","clipOverflow","inlineInsets","readKeyboardHeight","readSafeAreaInsets","toCSSColor","ZERO_INSETS","ModalPresenter","elements","viewport","width","height","insets","keyboardHeight","contentSize","entering","isDismissing","finished","observedContent","resizeObserver","hostObserver","constructor","config","listener","isShown","show","setInteractive","surface","style","overflow","opacity","transform","backdrop","display","isInline","window","addEventListener","handleResize","ResizeObserver","observe","overlay","visualViewport","handleKeyboard","handleBackdropClick","handleWheel","passive","handleContentResize","measureViewport","observeContent","applyBackdrop","didShow","animateIn","update","previous","configDidChange","contentDidRender","contentSizeDidChange","dismiss","focused","document","activeElement","HTMLElement","contains","blur","animateOut","finish","cancelDismiss","destroy","teardown","snapToDetent","_index","notifyPresented","onPresented","reportContentArea","onContentAreaChange","stopAnimations","removeEventListener","disconnect","onDismissed","backgroundColor","backdropColor","backdropOpacity","backdropBlurRadius","setProperty","contentBackgroundColor","interactive","pointerEvents","clientWidth","clientHeight","root","content","firstElementChild","element","unobserve","measureContent","offsetWidth","offsetHeight","viewportDidChange","onBackdropPress","event","ctrlKey","Math","abs","deltaX","deltaY","target","preventDefault"],"sourceRoot":"../../../src","sources":["web/ModalPresenter.ts"],"mappings":";;AAAA;;AAEA,SACEA,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,WAAW,QAGN,UAAO;;AAGd;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAeC,cAAc,CAAC;EACzBC,QAAQ,GAAyB,IAAI;EACrCC,QAAQ,GAAS;IAAEC,KAAK,EAAE,C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