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,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/// <reference lib="dom" />
|
|
4
|
+
|
|
5
|
+
import { AnimatedValue, INSTANT } from "./AnimatedValue.js";
|
|
6
|
+
import { prefersReducedMotion } from "./dom.js";
|
|
7
|
+
import { ModalPresenter } from "./ModalPresenter.js";
|
|
8
|
+
const MARGIN = 16;
|
|
9
|
+
const DEFAULT_CORNER_RADIUS = 16;
|
|
10
|
+
const ENTER_SCALE = 0.9;
|
|
11
|
+
const ENTER = {
|
|
12
|
+
type: 'spring',
|
|
13
|
+
response: 0.3,
|
|
14
|
+
dampingRatio: 0.82
|
|
15
|
+
};
|
|
16
|
+
const EXIT = {
|
|
17
|
+
type: 'timing',
|
|
18
|
+
duration: 200,
|
|
19
|
+
easing: t => t * t
|
|
20
|
+
};
|
|
21
|
+
/** Area a card may occupy, clear of the safe area and the part of the keyboard above it. */
|
|
22
|
+
function availableRect(viewport, insets, keyboardHeight) {
|
|
23
|
+
const covered = Math.max(0, keyboardHeight - insets.bottom);
|
|
24
|
+
return {
|
|
25
|
+
x: insets.left + MARGIN,
|
|
26
|
+
y: insets.top + MARGIN,
|
|
27
|
+
width: Math.max(0, viewport.width - insets.left - insets.right - 2 * MARGIN),
|
|
28
|
+
height: Math.max(0, viewport.height - insets.top - insets.bottom - 2 * MARGIN - covered)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Best guess of the content area before the popup is on screen. */
|
|
33
|
+
export function popupContentArea(viewport, insets) {
|
|
34
|
+
const {
|
|
35
|
+
width,
|
|
36
|
+
height
|
|
37
|
+
} = availableRect(viewport, insets, 0);
|
|
38
|
+
return {
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** `popup` mode: a centered card over the backdrop with a fade/scale transition. */
|
|
45
|
+
export class PopupPresenter extends ModalPresenter {
|
|
46
|
+
/** 0 hidden, 1 presented. */
|
|
47
|
+
progress = new AnimatedValue(0, 0.001, value => this.render(value));
|
|
48
|
+
didShow() {
|
|
49
|
+
this.layout();
|
|
50
|
+
this.progress.set(0);
|
|
51
|
+
}
|
|
52
|
+
animateIn() {
|
|
53
|
+
this.progress.animateTo(1, this.isAnimated ? ENTER : INSTANT, {
|
|
54
|
+
onEnd: () => this.notifyPresented()
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
animateOut(onEnd) {
|
|
58
|
+
this.progress.animateTo(0, this.isAnimated ? EXIT : INSTANT, {
|
|
59
|
+
onEnd
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
configDidChange() {
|
|
63
|
+
this.layout();
|
|
64
|
+
this.render(this.progress.value);
|
|
65
|
+
}
|
|
66
|
+
viewportDidChange() {
|
|
67
|
+
this.layout();
|
|
68
|
+
}
|
|
69
|
+
contentSizeDidChange() {
|
|
70
|
+
this.layout();
|
|
71
|
+
}
|
|
72
|
+
stopAnimations() {
|
|
73
|
+
this.progress.stop();
|
|
74
|
+
}
|
|
75
|
+
get isAnimated() {
|
|
76
|
+
return this.config.popupAnimation !== 'none' && !prefersReducedMotion();
|
|
77
|
+
}
|
|
78
|
+
layout() {
|
|
79
|
+
const {
|
|
80
|
+
surface,
|
|
81
|
+
content,
|
|
82
|
+
grabber
|
|
83
|
+
} = this.elements;
|
|
84
|
+
const behavior = this.config.keyboardBehavior;
|
|
85
|
+
const available = availableRect(this.viewport, this.insets, behavior === 'none' ? 0 : this.keyboardHeight);
|
|
86
|
+
const width = Math.min(this.contentSize.width, available.width);
|
|
87
|
+
const height = Math.min(this.contentSize.height, available.height);
|
|
88
|
+
Object.assign(surface.style, {
|
|
89
|
+
left: `${available.x + (available.width - width) / 2}px`,
|
|
90
|
+
top: `${available.y + (available.height - height) / 2}px`,
|
|
91
|
+
width: `${width}px`,
|
|
92
|
+
height: `${height}px`,
|
|
93
|
+
borderRadius: `${this.config.cornerRadius ?? DEFAULT_CORNER_RADIUS}px`
|
|
94
|
+
});
|
|
95
|
+
grabber.style.display = 'none';
|
|
96
|
+
|
|
97
|
+
// The content host also bounds the content's own (shrink-to-fit) width.
|
|
98
|
+
const area = behavior === 'resize' ? available : availableRect(this.viewport, this.insets, 0);
|
|
99
|
+
content.style.width = `${area.width}px`;
|
|
100
|
+
content.style.height = `${area.height}px`;
|
|
101
|
+
this.reportContentArea(area.width, area.height);
|
|
102
|
+
}
|
|
103
|
+
render(progress) {
|
|
104
|
+
if (!this.elements) return;
|
|
105
|
+
const {
|
|
106
|
+
surface,
|
|
107
|
+
backdrop
|
|
108
|
+
} = this.elements;
|
|
109
|
+
const visible = Math.min(Math.max(progress, 0), 1);
|
|
110
|
+
const animation = this.config.popupAnimation;
|
|
111
|
+
backdrop.style.opacity = String(visible);
|
|
112
|
+
surface.style.opacity = animation === 'none' ? '1' : String(visible);
|
|
113
|
+
const scale = animation === 'scale' ? ENTER_SCALE + (1 - ENTER_SCALE) * progress : 1;
|
|
114
|
+
surface.style.transform = `scale(${scale})`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=PopupPresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AnimatedValue","INSTANT","prefersReducedMotion","ModalPresenter","MARGIN","DEFAULT_CORNER_RADIUS","ENTER_SCALE","ENTER","type","response","dampingRatio","EXIT","duration","easing","t","availableRect","viewport","insets","keyboardHeight","covered","Math","max","bottom","x","left","y","top","width","right","height","popupContentArea","PopupPresenter","progress","value","render","didShow","layout","set","animateIn","animateTo","isAnimated","onEnd","notifyPresented","animateOut","configDidChange","viewportDidChange","contentSizeDidChange","stopAnimations","stop","config","popupAnimation","surface","content","grabber","elements","behavior","keyboardBehavior","available","min","contentSize","Object","assign","style","borderRadius","cornerRadius","display","area","reportContentArea","backdrop","visible","animation","opacity","String","scale","transform"],"sourceRoot":"../../../src","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IAAI,CAACC,MAAM,EAAE,CAAC,CAAC;IAClDmC,OAAO,CAACU,KAAK,CAACnC,KAAK,GAAG,GAAGuC,IAAI,CAACvC,KAAK,IAAI;IACvCyB,OAAO,CAACU,KAAK,CAACjC,MAAM,GAAG,GAAGqC,IAAI,CAACrC,MAAM,IAAI;IACzC,IAAI,CAACsC,iBAAiB,CAACD,IAAI,CAACvC,KAAK,EAAEuC,IAAI,CAACrC,MAAM,CAAC;EACjD;EAEQK,MAAMA,CAACF,QAAgB,EAAE;IAC/B,IAAI,CAAC,IAAI,CAACsB,QAAQ,EAAE;IACpB,MAAM;MAAEH,OAAO;MAAEiB;IAAS,CAAC,GAAG,IAAI,CAACd,QAAQ;IAC3C,MAAMe,OAAO,GAAGjD,IAAI,CAACsC,GAAG,CAACtC,IAAI,CAACC,GAAG,CAACW,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,MAAMsC,SAAS,GAAG,IAAI,CAACrB,MAAM,CAACC,cAAc;IAC5CkB,QAAQ,CAACN,KAAK,CAACS,OAAO,GAAGC,MAAM,CAACH,OAAO,CAAC;IACxClB,OAAO,CAACW,KAAK,CAACS,OAAO,GAAGD,SAAS,KAAK,MAAM,GAAG,GAAG,GAAGE,MAAM,CAACH,OAAO,CAAC;IACpE,MAAMI,KAAK,GACTH,SAAS,KAAK,OAAO,GAAGhE,WAAW,GAAG,CAAC,CAAC,GAAGA,WAAW,IAAI0B,QAAQ,GAAG,CAAC;IACxEmB,OAAO,CAACW,KAAK,CAACY,SAAS,GAAG,SAASD,KAAK,GAAG;EAC7C;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/// <reference lib="dom" />
|
|
4
|
+
|
|
5
|
+
import { AnimatedValue, INSTANT } from "./AnimatedValue.js";
|
|
6
|
+
import { findVerticalScroller, isTextInput, prefersReducedMotion, suppressNextClick } from "./dom.js";
|
|
7
|
+
import { ModalPresenter } from "./ModalPresenter.js";
|
|
8
|
+
|
|
9
|
+
/** Gap kept above a modal sheet at its tallest. */
|
|
10
|
+
const TOP_GAP = 10;
|
|
11
|
+
/** How far below its lowest detent the sheet must be pulled to refresh. */
|
|
12
|
+
const REFRESH_THRESHOLD = 56;
|
|
13
|
+
/**
|
|
14
|
+
* Extra sheet height below the viewport so it stays attached to the bottom
|
|
15
|
+
* edge while rubber-banding upward.
|
|
16
|
+
*/
|
|
17
|
+
const OVERSCROLL = 400;
|
|
18
|
+
const DEFAULT_CORNER_RADIUS = 16;
|
|
19
|
+
const MAX_WIDTH = 640;
|
|
20
|
+
/** Mouse movement before a press turns into a drag. */
|
|
21
|
+
const POINTER_SLOP = 6;
|
|
22
|
+
/** Pointer samples used for the release velocity. */
|
|
23
|
+
const VELOCITY_WINDOW_MS = 100;
|
|
24
|
+
const ENTER = {
|
|
25
|
+
type: 'spring',
|
|
26
|
+
response: 0.4,
|
|
27
|
+
dampingRatio: 0.9
|
|
28
|
+
};
|
|
29
|
+
const SETTLE = {
|
|
30
|
+
type: 'spring',
|
|
31
|
+
response: 0.4,
|
|
32
|
+
dampingRatio: 0.9
|
|
33
|
+
};
|
|
34
|
+
/** Underdamped and stopped at the bottom edge, so the exit ends on a fast frame instead of a slow tail. */
|
|
35
|
+
const EXIT = {
|
|
36
|
+
type: 'spring',
|
|
37
|
+
response: 0.45,
|
|
38
|
+
dampingRatio: 0.8
|
|
39
|
+
};
|
|
40
|
+
function sheetWidth(available, isInline) {
|
|
41
|
+
return isInline ? available : Math.min(available, MAX_WIDTH);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Tallest height the content may occupy (excludes the bottom safe area). */
|
|
45
|
+
function maximumDetentValue(viewportHeight, insets, isInline) {
|
|
46
|
+
const gap = isInline ? 0 : TOP_GAP;
|
|
47
|
+
return Math.max(0, viewportHeight - insets.top - insets.bottom - gap);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Content height at `detent`; `fitContent` uses the measured `fitting` height. */
|
|
51
|
+
function detentHeight(detent, maximum, fitting) {
|
|
52
|
+
switch (detent) {
|
|
53
|
+
case 'small':
|
|
54
|
+
return maximum * 0.25;
|
|
55
|
+
case 'medium':
|
|
56
|
+
return maximum * 0.5;
|
|
57
|
+
case 'large':
|
|
58
|
+
return maximum;
|
|
59
|
+
case 'fitContent':
|
|
60
|
+
return Math.min(Math.max(fitting, 1), maximum);
|
|
61
|
+
default:
|
|
62
|
+
return Number.isFinite(detent) ? Math.min(Math.max(detent, 1), maximum) : maximum;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Height the content may occupy at the largest of `detents`. */
|
|
67
|
+
function contentHeight(detents, maximum) {
|
|
68
|
+
if (detents.length === 0) return maximum;
|
|
69
|
+
// `fitContent` content can grow up to the maximum.
|
|
70
|
+
return Math.max(...detents.map(detent => detentHeight(detent, maximum, maximum)));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Best guess of the content area before the sheet is on screen. */
|
|
74
|
+
export function sheetContentArea(detents, viewport, insets, isInline) {
|
|
75
|
+
return {
|
|
76
|
+
width: sheetWidth(viewport.width, isInline),
|
|
77
|
+
height: contentHeight(detents, maximumDetentValue(viewport.height, insets, isInline))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function rubberBand(offset, dimension) {
|
|
81
|
+
return (1 - 1 / (offset * 0.55 / dimension + 1)) * dimension;
|
|
82
|
+
}
|
|
83
|
+
function findTouch(touches, id) {
|
|
84
|
+
for (let i = 0; i < touches.length; i++) {
|
|
85
|
+
const touch = touches.item(i);
|
|
86
|
+
if (touch?.identifier === id) return touch;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* `bottomSheet` mode: an edge-attached sheet with detents, dragging,
|
|
93
|
+
* swipe-to-dismiss and hand-off to scrollable content, like the iOS
|
|
94
|
+
* implementation.
|
|
95
|
+
*/
|
|
96
|
+
export class SheetPresenter extends ModalPresenter {
|
|
97
|
+
selectedIndex = 0;
|
|
98
|
+
/** The sheet sits below the viewport (before presenting / while dismissing). */
|
|
99
|
+
isOffscreen = true;
|
|
100
|
+
drag = null;
|
|
101
|
+
/** Vertical velocity of the swipe that requested the dismissal. */
|
|
102
|
+
releaseVelocity = 0;
|
|
103
|
+
/** The sheet's top edge in the viewport. */
|
|
104
|
+
top = new AnimatedValue(0, 0.5, value => this.render(value));
|
|
105
|
+
constructor(config, listener) {
|
|
106
|
+
super(config, listener);
|
|
107
|
+
this.selectedIndex = Math.min(Math.max(config.initialDetentIndex, 0), this.detents.length - 1);
|
|
108
|
+
}
|
|
109
|
+
snapToDetent(index) {
|
|
110
|
+
if (index < 0 || index >= this.detents.length) return;
|
|
111
|
+
this.selectedIndex = index;
|
|
112
|
+
this.animateToRest();
|
|
113
|
+
this.listener.onDetentChange(index);
|
|
114
|
+
}
|
|
115
|
+
didShow() {
|
|
116
|
+
const {
|
|
117
|
+
surface
|
|
118
|
+
} = this.elements;
|
|
119
|
+
surface.addEventListener('touchstart', this.handleTouchStart, {
|
|
120
|
+
passive: true
|
|
121
|
+
});
|
|
122
|
+
surface.addEventListener('touchmove', this.handleTouchMove, {
|
|
123
|
+
passive: false
|
|
124
|
+
});
|
|
125
|
+
surface.addEventListener('touchend', this.handleTouchEnd);
|
|
126
|
+
surface.addEventListener('touchcancel', this.handleTouchEnd);
|
|
127
|
+
surface.addEventListener('pointerdown', this.handlePointerDown);
|
|
128
|
+
this.layout();
|
|
129
|
+
this.top.set(this.viewport.height);
|
|
130
|
+
}
|
|
131
|
+
animateIn() {
|
|
132
|
+
this.isOffscreen = false;
|
|
133
|
+
this.settle(ENTER);
|
|
134
|
+
}
|
|
135
|
+
animateOut(onEnd) {
|
|
136
|
+
this.cancelDrag();
|
|
137
|
+
this.isOffscreen = true;
|
|
138
|
+
const velocity = this.releaseVelocity;
|
|
139
|
+
this.releaseVelocity = 0;
|
|
140
|
+
this.top.animateTo(this.viewport.height, this.motion(EXIT), {
|
|
141
|
+
velocity: velocity > 0 ? velocity : undefined,
|
|
142
|
+
stopAtTarget: true,
|
|
143
|
+
onEnd
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
configDidChange() {
|
|
147
|
+
this.selectedIndex = Math.min(this.selectedIndex, this.detents.length - 1);
|
|
148
|
+
this.layout();
|
|
149
|
+
this.animateToRest();
|
|
150
|
+
}
|
|
151
|
+
viewportDidChange() {
|
|
152
|
+
this.layout();
|
|
153
|
+
this.animateToRest();
|
|
154
|
+
}
|
|
155
|
+
contentSizeDidChange() {
|
|
156
|
+
if (this.config.detents.includes('fitContent')) {
|
|
157
|
+
this.animateToRest();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
stopAnimations() {
|
|
161
|
+
this.top.stop();
|
|
162
|
+
}
|
|
163
|
+
teardown() {
|
|
164
|
+
super.teardown();
|
|
165
|
+
this.cancelDrag();
|
|
166
|
+
const surface = this.elements?.surface;
|
|
167
|
+
surface?.removeEventListener('touchstart', this.handleTouchStart);
|
|
168
|
+
surface?.removeEventListener('touchmove', this.handleTouchMove);
|
|
169
|
+
surface?.removeEventListener('touchend', this.handleTouchEnd);
|
|
170
|
+
surface?.removeEventListener('touchcancel', this.handleTouchEnd);
|
|
171
|
+
surface?.removeEventListener('pointerdown', this.handlePointerDown);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Layout
|
|
175
|
+
|
|
176
|
+
get detents() {
|
|
177
|
+
return this.config.detents.length > 0 ? this.config.detents : ['fitContent'];
|
|
178
|
+
}
|
|
179
|
+
get maximumDetentValue() {
|
|
180
|
+
return maximumDetentValue(this.viewport.height, this.insets, this.config.isInline);
|
|
181
|
+
}
|
|
182
|
+
get keyboardLift() {
|
|
183
|
+
return this.config.keyboardBehavior === 'none' ? 0 : Math.max(0, this.keyboardHeight - this.insets.bottom);
|
|
184
|
+
}
|
|
185
|
+
height(detent) {
|
|
186
|
+
return detentHeight(detent, this.maximumDetentValue, this.contentSize.height);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Sheet top when resting on `detents[index]`. The bottom safe area is added below the content. */
|
|
190
|
+
restingTop(index) {
|
|
191
|
+
const {
|
|
192
|
+
detents
|
|
193
|
+
} = this;
|
|
194
|
+
const detent = detents[Math.min(Math.max(index, 0), detents.length - 1)] ?? 'fitContent';
|
|
195
|
+
const top = this.viewport.height - this.insets.bottom - this.keyboardLift - this.height(detent);
|
|
196
|
+
return Math.max(top, this.insets.top + (this.config.isInline ? 0 : TOP_GAP));
|
|
197
|
+
}
|
|
198
|
+
get detentTops() {
|
|
199
|
+
return this.detents.map((_, index) => this.restingTop(index));
|
|
200
|
+
}
|
|
201
|
+
layout() {
|
|
202
|
+
const {
|
|
203
|
+
surface,
|
|
204
|
+
content,
|
|
205
|
+
grabber
|
|
206
|
+
} = this.elements;
|
|
207
|
+
const width = sheetWidth(this.viewport.width, this.config.isInline);
|
|
208
|
+
const radius = `${this.config.cornerRadius ?? DEFAULT_CORNER_RADIUS}px`;
|
|
209
|
+
Object.assign(surface.style, {
|
|
210
|
+
left: `${(this.viewport.width - width) / 2}px`,
|
|
211
|
+
top: '0px',
|
|
212
|
+
width: `${width}px`,
|
|
213
|
+
height: `${this.viewport.height + OVERSCROLL}px`,
|
|
214
|
+
borderTopLeftRadius: radius,
|
|
215
|
+
borderTopRightRadius: radius,
|
|
216
|
+
borderBottomLeftRadius: '0px',
|
|
217
|
+
borderBottomRightRadius: '0px'
|
|
218
|
+
});
|
|
219
|
+
content.style.width = `${width}px`;
|
|
220
|
+
content.style.height = `${this.maximumDetentValue}px`;
|
|
221
|
+
grabber.style.display = this.config.grabberVisible ? '' : 'none';
|
|
222
|
+
let height = contentHeight(this.config.detents, this.maximumDetentValue);
|
|
223
|
+
if (this.config.keyboardBehavior === 'resize') {
|
|
224
|
+
height -= this.keyboardLift;
|
|
225
|
+
}
|
|
226
|
+
this.reportContentArea(width, Math.max(height, 0));
|
|
227
|
+
this.render(this.top.value);
|
|
228
|
+
}
|
|
229
|
+
render(top) {
|
|
230
|
+
if (!this.elements) return;
|
|
231
|
+
this.elements.surface.style.transform = `translate3d(0, ${top}px, 0)`;
|
|
232
|
+
this.elements.backdrop.style.opacity = String(this.backdropAlpha(top));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Fully dimmed at every detent; fades out below the lowest one. */
|
|
236
|
+
backdropAlpha(top) {
|
|
237
|
+
const bottom = this.viewport.height;
|
|
238
|
+
const lowest = Math.max(...this.detentTops);
|
|
239
|
+
if (!(bottom > lowest)) return top >= bottom ? 0 : 1;
|
|
240
|
+
return Math.min(Math.max((bottom - top) / (bottom - lowest), 0), 1);
|
|
241
|
+
}
|
|
242
|
+
motion(motion) {
|
|
243
|
+
return prefersReducedMotion() ? INSTANT : motion;
|
|
244
|
+
}
|
|
245
|
+
settle(motion, velocity) {
|
|
246
|
+
this.top.animateTo(this.restingTop(this.selectedIndex), this.motion(motion), {
|
|
247
|
+
velocity,
|
|
248
|
+
// Keeps the enter's completion when a re-layout takes it over.
|
|
249
|
+
onEnd: () => this.notifyPresented()
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
animateToRest() {
|
|
253
|
+
if (!this.elements || this.drag?.active || this.isOffscreen) return;
|
|
254
|
+
this.settle(SETTLE);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Dragging
|
|
258
|
+
|
|
259
|
+
canDrag() {
|
|
260
|
+
return !this.entering && !this.isDismissing && !this.isOffscreen;
|
|
261
|
+
}
|
|
262
|
+
beginDrag(input, id, x, y, target) {
|
|
263
|
+
this.drag = {
|
|
264
|
+
input,
|
|
265
|
+
id,
|
|
266
|
+
startX: x,
|
|
267
|
+
startY: y,
|
|
268
|
+
lastY: y,
|
|
269
|
+
scroller: findVerticalScroller(target, this.elements.surface),
|
|
270
|
+
active: false,
|
|
271
|
+
rawTop: 0,
|
|
272
|
+
sheetDrove: false,
|
|
273
|
+
contentScrolled: false,
|
|
274
|
+
canRefresh: false,
|
|
275
|
+
refreshArmed: false,
|
|
276
|
+
samples: []
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** Decides who handles a gesture once it moves: the sheet, or the content (scrolling, horizontal swipes). */
|
|
281
|
+
claim(drag, x, y, slop) {
|
|
282
|
+
const dx = x - drag.startX;
|
|
283
|
+
const dy = y - drag.startY;
|
|
284
|
+
if (Math.abs(dx) <= slop && Math.abs(dy) <= slop) return 'pending';
|
|
285
|
+
if (Math.abs(dx) > Math.abs(dy)) return 'content';
|
|
286
|
+
const {
|
|
287
|
+
scroller
|
|
288
|
+
} = drag;
|
|
289
|
+
if (!scroller) return 'sheet';
|
|
290
|
+
// Down: scroll back to the top before collapsing the sheet. Up: expand
|
|
291
|
+
// the sheet before scrolling.
|
|
292
|
+
if (dy > 0) return scroller.scrollTop <= 0 ? 'sheet' : 'content';
|
|
293
|
+
return this.top.value > Math.min(...this.detentTops) + 0.5 ? 'sheet' : 'content';
|
|
294
|
+
}
|
|
295
|
+
activate(drag) {
|
|
296
|
+
drag.active = true;
|
|
297
|
+
const isSettled = !this.top.isAnimating;
|
|
298
|
+
this.top.stop();
|
|
299
|
+
drag.rawTop = this.top.value;
|
|
300
|
+
drag.canRefresh = this.config.pullToRefreshEnabled && !this.config.dismissOnSwipe && isSettled && Math.abs(drag.rawTop - Math.max(...this.detentTops)) < 1;
|
|
301
|
+
const {
|
|
302
|
+
surface
|
|
303
|
+
} = this.elements;
|
|
304
|
+
// A native scroll on an ancestor makes React Native Web cancel the press
|
|
305
|
+
// under the pointer, so dragging from a button doesn't leave it pressed.
|
|
306
|
+
surface.dispatchEvent(new Event('scroll'));
|
|
307
|
+
if (drag.input === 'pointer') {
|
|
308
|
+
surface.style.setProperty('user-select', 'none');
|
|
309
|
+
surface.style.setProperty('-webkit-user-select', 'none');
|
|
310
|
+
window.getSelection()?.removeAllRanges();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
moveDrag(drag, y) {
|
|
314
|
+
const delta = y - drag.lastY;
|
|
315
|
+
drag.lastY = y;
|
|
316
|
+
const time = performance.now();
|
|
317
|
+
drag.samples.push({
|
|
318
|
+
time,
|
|
319
|
+
y
|
|
320
|
+
});
|
|
321
|
+
while (drag.samples.length > 2 && time - drag.samples[0].time > VELOCITY_WINDOW_MS) {
|
|
322
|
+
drag.samples.shift();
|
|
323
|
+
}
|
|
324
|
+
const {
|
|
325
|
+
scroller
|
|
326
|
+
} = drag;
|
|
327
|
+
if (scroller) {
|
|
328
|
+
// The browser's own scrolling is prevented for this gesture, so the
|
|
329
|
+
// content is scrolled here whenever the sheet can't move. Up: expand
|
|
330
|
+
// the sheet before scrolling. Down: scroll back to the top before
|
|
331
|
+
// collapsing the sheet, in a separate gesture.
|
|
332
|
+
const minTop = Math.min(...this.detentTops);
|
|
333
|
+
const drive = delta < 0 ? drag.rawTop > minTop + 0.5 : !drag.contentScrolled && scroller.scrollTop <= 0;
|
|
334
|
+
if (drive) {
|
|
335
|
+
drag.rawTop = Math.max(drag.rawTop + delta, minTop);
|
|
336
|
+
} else {
|
|
337
|
+
scroller.scrollTop -= delta;
|
|
338
|
+
if (delta !== 0) {
|
|
339
|
+
drag.contentScrolled = true;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
drag.sheetDrove = drive;
|
|
343
|
+
} else {
|
|
344
|
+
drag.rawTop += delta;
|
|
345
|
+
drag.sheetDrove = true;
|
|
346
|
+
}
|
|
347
|
+
const top = this.constrained(drag.rawTop);
|
|
348
|
+
if (drag.canRefresh) {
|
|
349
|
+
drag.refreshArmed = top - Math.max(...this.detentTops) >= REFRESH_THRESHOLD;
|
|
350
|
+
}
|
|
351
|
+
this.top.set(top);
|
|
352
|
+
}
|
|
353
|
+
release(drag) {
|
|
354
|
+
this.stopTracking();
|
|
355
|
+
this.drag = null;
|
|
356
|
+
if (!drag.active) return;
|
|
357
|
+
if (drag.input === 'pointer') {
|
|
358
|
+
suppressNextClick();
|
|
359
|
+
}
|
|
360
|
+
const velocity = drag.sheetDrove ? this.velocity(drag) : 0;
|
|
361
|
+
const top = this.top.value;
|
|
362
|
+
const tops = this.detentTops;
|
|
363
|
+
const lowest = Math.max(...tops);
|
|
364
|
+
// Where a fling of this velocity would come to rest.
|
|
365
|
+
const projected = top + velocity * 0.2;
|
|
366
|
+
if (this.config.dismissOnSwipe && velocity >= 0 && projected > lowest + (this.viewport.height - lowest) / 2) {
|
|
367
|
+
this.releaseVelocity = velocity;
|
|
368
|
+
this.listener.onSwipeDismiss();
|
|
369
|
+
if (this.isDismissing) return;
|
|
370
|
+
this.releaseVelocity = 0;
|
|
371
|
+
}
|
|
372
|
+
const index = tops.reduce((best, candidate, i) => Math.abs(candidate - projected) < Math.abs(tops[best] - projected) ? i : best, 0);
|
|
373
|
+
if (index !== this.selectedIndex) {
|
|
374
|
+
this.selectedIndex = index;
|
|
375
|
+
this.listener.onDetentChange(index);
|
|
376
|
+
}
|
|
377
|
+
this.settle(SETTLE, velocity);
|
|
378
|
+
if (drag.refreshArmed) {
|
|
379
|
+
this.listener.onPullToRefresh();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** Abandons the gesture without settling (the exit or the content takes over). */
|
|
384
|
+
cancelDrag() {
|
|
385
|
+
this.stopTracking();
|
|
386
|
+
this.drag = null;
|
|
387
|
+
}
|
|
388
|
+
stopTracking() {
|
|
389
|
+
window.removeEventListener('pointermove', this.handlePointerMove);
|
|
390
|
+
window.removeEventListener('pointerup', this.handlePointerUp);
|
|
391
|
+
window.removeEventListener('pointercancel', this.handlePointerUp);
|
|
392
|
+
const surface = this.elements?.surface;
|
|
393
|
+
surface?.style.removeProperty('user-select');
|
|
394
|
+
surface?.style.removeProperty('-webkit-user-select');
|
|
395
|
+
}
|
|
396
|
+
velocity(drag) {
|
|
397
|
+
const now = performance.now();
|
|
398
|
+
const samples = drag.samples.filter(sample => now - sample.time <= VELOCITY_WINDOW_MS);
|
|
399
|
+
const first = samples[0];
|
|
400
|
+
const last = samples[samples.length - 1];
|
|
401
|
+
if (!first || !last || last.time <= first.time) return 0;
|
|
402
|
+
return (last.y - first.y) / (last.time - first.time) * 1000;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** Rubber-bands above the tallest detent, and below the lowest one when swiping can't dismiss. */
|
|
406
|
+
constrained(top) {
|
|
407
|
+
const tops = this.detentTops;
|
|
408
|
+
const minTop = Math.min(...tops);
|
|
409
|
+
const maxTop = Math.max(...tops);
|
|
410
|
+
const dimension = Math.max(this.viewport.height, 1);
|
|
411
|
+
if (top < minTop) {
|
|
412
|
+
return minTop - rubberBand(minTop - top, dimension);
|
|
413
|
+
}
|
|
414
|
+
if (!this.config.dismissOnSwipe && top > maxTop) {
|
|
415
|
+
return maxTop + rubberBand(top - maxTop, dimension);
|
|
416
|
+
}
|
|
417
|
+
return top;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Touch input. Touch events (rather than pointer events) let the sheet
|
|
421
|
+
// cancel the browser's scrolling when it claims the gesture.
|
|
422
|
+
|
|
423
|
+
handleTouchStart = event => {
|
|
424
|
+
if (this.drag) {
|
|
425
|
+
// A second finger before the sheet moved: leave it to the browser.
|
|
426
|
+
if (this.drag.input === 'touch' && !this.drag.active) {
|
|
427
|
+
this.drag = null;
|
|
428
|
+
}
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const touch = event.touches.length === 1 ? event.touches[0] : undefined;
|
|
432
|
+
if (!touch || !this.canDrag()) return;
|
|
433
|
+
this.beginDrag('touch', touch.identifier, touch.clientX, touch.clientY, event.target);
|
|
434
|
+
};
|
|
435
|
+
handleTouchMove = event => {
|
|
436
|
+
const drag = this.drag;
|
|
437
|
+
if (drag?.input !== 'touch') return;
|
|
438
|
+
const touch = findTouch(event.changedTouches, drag.id);
|
|
439
|
+
if (!touch) return;
|
|
440
|
+
if (!drag.active) {
|
|
441
|
+
// Once the browser has started scrolling, the gesture is its.
|
|
442
|
+
const owner = event.cancelable ? this.claim(drag, touch.clientX, touch.clientY, 0) : 'content';
|
|
443
|
+
if (owner === 'pending') return;
|
|
444
|
+
if (owner === 'content') {
|
|
445
|
+
this.drag = null;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
this.activate(drag);
|
|
449
|
+
}
|
|
450
|
+
if (event.cancelable) {
|
|
451
|
+
event.preventDefault();
|
|
452
|
+
}
|
|
453
|
+
this.moveDrag(drag, touch.clientY);
|
|
454
|
+
};
|
|
455
|
+
handleTouchEnd = event => {
|
|
456
|
+
const drag = this.drag;
|
|
457
|
+
if (drag?.input !== 'touch' || !findTouch(event.changedTouches, drag.id)) return;
|
|
458
|
+
this.release(drag);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// Mouse and pen input.
|
|
462
|
+
|
|
463
|
+
handlePointerDown = event => {
|
|
464
|
+
if (event.pointerType === 'touch' || event.button !== 0 || this.drag || !this.canDrag() ||
|
|
465
|
+
// Leave text selection in inputs alone.
|
|
466
|
+
isTextInput(event.target)) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
this.beginDrag('pointer', event.pointerId, event.clientX, event.clientY, event.target);
|
|
470
|
+
window.addEventListener('pointermove', this.handlePointerMove);
|
|
471
|
+
window.addEventListener('pointerup', this.handlePointerUp);
|
|
472
|
+
window.addEventListener('pointercancel', this.handlePointerUp);
|
|
473
|
+
};
|
|
474
|
+
handlePointerMove = event => {
|
|
475
|
+
const drag = this.drag;
|
|
476
|
+
if (drag?.input !== 'pointer' || event.pointerId !== drag.id) return;
|
|
477
|
+
if (!drag.active) {
|
|
478
|
+
const owner = this.claim(drag, event.clientX, event.clientY, POINTER_SLOP);
|
|
479
|
+
if (owner === 'pending') return;
|
|
480
|
+
if (owner === 'content') {
|
|
481
|
+
this.cancelDrag();
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
this.activate(drag);
|
|
485
|
+
}
|
|
486
|
+
this.moveDrag(drag, event.clientY);
|
|
487
|
+
};
|
|
488
|
+
handlePointerUp = event => {
|
|
489
|
+
const drag = this.drag;
|
|
490
|
+
if (drag?.input !== 'pointer' || event.pointerId !== drag.id) return;
|
|
491
|
+
this.release(drag);
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=SheetPresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AnimatedValue","INSTANT","findVerticalScroller","isTextInput","prefersReducedMotion","suppressNextClick","ModalPresenter","TOP_GAP","REFRESH_THRESHOLD","OVERSCROLL","DEFAULT_CORNER_RADIUS","MAX_WIDTH","POINTER_SLOP","VELOCITY_WINDOW_MS","ENTER","type","response","dampingRatio","SETTLE","EXIT","sheetWidth","available","isInline","Math","min","maximumDetentValue","viewportHeight","insets","gap","max","top","bottom","detentHeight","detent","maximum","fitting","Number","isFinite","contentHeight","detents","length","map","sheetContentArea","viewport","width","height","rubberBand","offset","dimension","findTouch","touches","id","i","touch","item","identifier","undefined","SheetPresenter","selectedIndex","isOffscreen","drag","releaseVelocity","value","render","constructor","config","listener","initialDetentIndex","snapToDetent","index","animateToRest","onDetentChange","didShow","surface","elements","addEventListener","handleTouchStart","passive","handleTouchMove","handleTouchEnd","handlePointerDown","layout","set","animateIn","settle","animateOut","onEnd","cancelDrag","velocity","animateTo","motion","stopAtTarget","configDidChange","viewportDidChange","contentSizeDidChange","includes","stopAnimations","stop","teardown","removeEventListener","keyboardLift","keyboardBehavior","keyboardHeight","contentSize","restingTop","detentTops","_","content","grabber","radius","cornerRadius","Object","assign","style","left","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","display","grabberVisible","reportContentArea","transform","backdrop","opacity","String","backdropAlpha","lowest","notifyPresented","active","canDrag","entering","isDismissing","beginDrag","input","x","y","target","startX","startY","lastY","scroller","rawTop","sheetDrove","contentScrolled","canRefresh","refreshArmed","samples","claim","slop","dx","dy","abs","scrollTop","activate","isSettled","isAnimating","pullToRefreshEnabled","dismissOnSwipe","dispatchEvent","Event","setProperty","window","getSelection","removeAllRanges","moveDrag","delta","time","performance","now","push","shift","minTop","drive","constrained","release","stopTracking","tops","projected","onSwipeDismiss","reduce","best","candidate","onPullToRefresh","handlePointerMove","handlePointerUp","removeProperty","filter","sample","first","last","maxTop","event","clientX","clientY","changedTouches","owner","cancelable","preventDefault","pointerType","button","pointerId"],"sourceRoot":"../../../src","sources":["web/SheetPresenter.ts"],"mappings":";;AAAA;;AAGA,SAASA,aAAa,EAAEC,OAAO,QAAqB,oBAAiB;AACrE,SACEC,oBAAoB,EACpBC,WAAW,EACXC,oBAAoB,EACpBC,iBAAiB,QAGZ,UAAO;AAEd,SAASC,cAAc,QAAgC,qBAAkB;;AAEzE;AACA,MAAMC,OAAO,GAAG,EAAE;AAClB;AACA,MAAMC,iBAAiB,GAAG,EAAE;AAC5B;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG,GAAG;AACtB,MAAMC,qBAAqB,GAAG,EAAE;AAChC,MAAMC,SAAS,GAAG,GAAG;AACrB;AACA,MAAMC,YAAY,GAAG,CAAC;AACtB;AACA,MAAMC,kBAAkB,GAAG,GAAG;AAE9B,MAAMC,KAAa,GAAG;EAAEC,IAAI,EAAE,QAAQ;EAAEC,QAAQ,EAAE,GAAG;EAAEC,YAAY,EAAE;AAAI,CAAC;AAC1E,MAAMC,MAAc,GAAG;EAAEH,IAAI,EAAE,QAAQ;EAAEC,QAAQ,EAAE,GAAG;EAAEC,YAAY,EAAE;AAAI,CAAC;AAC3E;AACA,MAAME,IAAY,GAAG;EAAEJ,IAAI,EAAE,QAAQ;EAAEC,QAAQ,EAAE,IAAI;EAAEC,YAAY,EAAE;AAAI,CAAC;AA8B1E,SAASG,UAAUA,CAACC,SAAiB,EAAEC,QAAiB,EAAU;EAChE,OAAOA,QAAQ,GAAGD,SAAS,GAAGE,IAAI,CAACC,GAAG,CAACH,SAAS,EAAEV,SAAS,CAAC;AAC9D;;AA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