react-native-bottom-sheet-stack 1.6.0 → 1.7.0
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 +9 -7
- package/lib/commonjs/BottomSheet.context.js +1 -2
- package/lib/commonjs/BottomSheet.context.js.map +1 -1
- package/lib/commonjs/BottomSheetBackdrop.js +23 -32
- package/lib/commonjs/BottomSheetBackdrop.js.map +1 -1
- package/lib/commonjs/BottomSheetHost.js +17 -254
- package/lib/commonjs/BottomSheetHost.js.map +1 -1
- package/lib/commonjs/BottomSheetManaged.js +87 -54
- package/lib/commonjs/BottomSheetManaged.js.map +1 -1
- package/lib/commonjs/BottomSheetPersistent.js +113 -0
- package/lib/commonjs/BottomSheetPersistent.js.map +1 -0
- package/lib/commonjs/BottomSheetPortal.js +4 -3
- package/lib/commonjs/BottomSheetPortal.js.map +1 -1
- package/lib/commonjs/BottomSheetRef.context.js +17 -0
- package/lib/commonjs/BottomSheetRef.context.js.map +1 -0
- package/lib/commonjs/QueueItem.js +167 -0
- package/lib/commonjs/QueueItem.js.map +1 -0
- package/lib/commonjs/animatedRegistry.js +9 -0
- package/lib/commonjs/animatedRegistry.js.map +1 -1
- package/lib/commonjs/bottomSheet.store.js +11 -133
- package/lib/commonjs/bottomSheet.store.js.map +1 -1
- package/lib/commonjs/bottomSheetCoordinator.js +9 -10
- package/lib/commonjs/bottomSheetCoordinator.js.map +1 -1
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/portalSessionRegistry.js +32 -0
- package/lib/commonjs/portalSessionRegistry.js.map +1 -0
- package/lib/commonjs/refsMap.js +9 -0
- package/lib/commonjs/refsMap.js.map +1 -1
- package/lib/commonjs/store/helpers.js +59 -0
- package/lib/commonjs/store/helpers.js.map +1 -0
- package/lib/commonjs/store/hooks.js +176 -0
- package/lib/commonjs/store/hooks.js.map +1 -0
- package/lib/commonjs/store/index.js +52 -0
- package/lib/commonjs/store/index.js.map +1 -0
- package/lib/commonjs/store/store.js +140 -0
- package/lib/commonjs/store/store.js.map +1 -0
- package/lib/commonjs/store/types.js +6 -0
- package/lib/commonjs/store/types.js.map +1 -0
- package/lib/commonjs/useBottomSheetContext.js +24 -42
- package/lib/commonjs/useBottomSheetContext.js.map +1 -1
- package/lib/commonjs/useBottomSheetControl.js +8 -14
- package/lib/commonjs/useBottomSheetControl.js.map +1 -1
- package/lib/commonjs/useBottomSheetManager.js +3 -13
- package/lib/commonjs/useBottomSheetManager.js.map +1 -1
- package/lib/commonjs/useBottomSheetStatus.js +9 -17
- package/lib/commonjs/useBottomSheetStatus.js.map +1 -1
- package/lib/commonjs/useEvent.js +39 -0
- package/lib/commonjs/useEvent.js.map +1 -0
- package/lib/commonjs/useScaleAnimation.js +53 -30
- package/lib/commonjs/useScaleAnimation.js.map +1 -1
- package/lib/commonjs/useSheetRenderData.js +62 -0
- package/lib/commonjs/useSheetRenderData.js.map +1 -0
- package/lib/typescript/example/src/App.d.ts.map +1 -1
- package/lib/typescript/example/src/screens/HomeScreen.d.ts.map +1 -1
- package/lib/typescript/example/src/sheets/NavigationSheets.d.ts.map +1 -1
- package/lib/typescript/example/src/sheets/ScannerNestedSheets.d.ts +4 -0
- package/lib/typescript/example/src/sheets/ScannerNestedSheets.d.ts.map +1 -0
- package/lib/typescript/example/src/sheets/ScannerSheet.d.ts +3 -0
- package/lib/typescript/example/src/sheets/ScannerSheet.d.ts.map +1 -0
- package/lib/typescript/example/src/sheets/index.d.ts +1 -0
- package/lib/typescript/example/src/sheets/index.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheet.context.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetBackdrop.d.ts +0 -5
- package/lib/typescript/src/BottomSheetBackdrop.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetHost.d.ts +1 -3
- package/lib/typescript/src/BottomSheetHost.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetManaged.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetPersistent.d.ts +9 -0
- package/lib/typescript/src/BottomSheetPersistent.d.ts.map +1 -0
- package/lib/typescript/src/BottomSheetPortal.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetRef.context.d.ts +11 -0
- package/lib/typescript/src/BottomSheetRef.context.d.ts.map +1 -0
- package/lib/typescript/src/QueueItem.d.ts +8 -0
- package/lib/typescript/src/QueueItem.d.ts.map +1 -0
- package/lib/typescript/src/animatedRegistry.d.ts +5 -0
- package/lib/typescript/src/animatedRegistry.d.ts.map +1 -1
- package/lib/typescript/src/bottomSheet.store.d.ts +1 -37
- package/lib/typescript/src/bottomSheet.store.d.ts.map +1 -1
- package/lib/typescript/src/bottomSheetCoordinator.d.ts +2 -1
- package/lib/typescript/src/bottomSheetCoordinator.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/portalSessionRegistry.d.ts +8 -0
- package/lib/typescript/src/portalSessionRegistry.d.ts.map +1 -0
- package/lib/typescript/src/refsMap.d.ts +5 -0
- package/lib/typescript/src/refsMap.d.ts.map +1 -1
- package/lib/typescript/src/store/helpers.d.ts +11 -0
- package/lib/typescript/src/store/helpers.d.ts.map +1 -0
- package/lib/typescript/src/store/hooks.d.ts +16 -0
- package/lib/typescript/src/store/hooks.d.ts.map +1 -0
- package/lib/typescript/src/store/index.d.ts +5 -0
- package/lib/typescript/src/store/index.d.ts.map +1 -0
- package/lib/typescript/src/store/store.d.ts +11 -0
- package/lib/typescript/src/store/store.d.ts.map +1 -0
- package/lib/typescript/src/store/types.d.ts +37 -0
- package/lib/typescript/src/store/types.d.ts.map +1 -0
- package/lib/typescript/src/useBottomSheetContext.d.ts.map +1 -1
- package/lib/typescript/src/useBottomSheetControl.d.ts.map +1 -1
- package/lib/typescript/src/useBottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/src/useBottomSheetStatus.d.ts +1 -2
- package/lib/typescript/src/useBottomSheetStatus.d.ts.map +1 -1
- package/lib/typescript/src/useEvent.d.ts +4 -0
- package/lib/typescript/src/useEvent.d.ts.map +1 -0
- package/lib/typescript/src/useScaleAnimation.d.ts +10 -13
- package/lib/typescript/src/useScaleAnimation.d.ts.map +1 -1
- package/lib/typescript/src/useSheetRenderData.d.ts +17 -0
- package/lib/typescript/src/useSheetRenderData.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/BottomSheet.context.ts +1 -3
- package/src/BottomSheetBackdrop.tsx +10 -19
- package/src/BottomSheetHost.tsx +13 -99
- package/src/BottomSheetManaged.tsx +24 -2
- package/src/BottomSheetPersistent.tsx +57 -0
- package/src/BottomSheetPortal.tsx +5 -7
- package/src/BottomSheetRef.context.ts +14 -0
- package/src/QueueItem.tsx +83 -0
- package/src/animatedRegistry.ts +8 -0
- package/src/bottomSheet.store.ts +1 -173
- package/src/bottomSheetCoordinator.ts +10 -8
- package/src/index.tsx +7 -1
- package/src/portalSessionRegistry.ts +25 -0
- package/src/refsMap.ts +8 -0
- package/src/store/helpers.ts +65 -0
- package/src/store/hooks.ts +50 -0
- package/src/store/index.ts +4 -0
- package/src/store/store.ts +168 -0
- package/src/store/types.ts +42 -0
- package/src/useBottomSheetContext.ts +6 -15
- package/src/useBottomSheetControl.ts +16 -7
- package/src/useBottomSheetManager.tsx +9 -10
- package/src/useBottomSheetStatus.ts +4 -14
- package/src/useEvent.ts +17 -0
- package/src/useScaleAnimation.ts +67 -35
- package/src/useSheetRenderData.ts +74 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBottomSheetStore = void 0;
|
|
7
|
+
var _middleware = require("zustand/middleware");
|
|
8
|
+
var _traditional = require("zustand/traditional");
|
|
9
|
+
var _helpers = require("./helpers");
|
|
10
|
+
var _portalSessionRegistry = require("../portalSessionRegistry");
|
|
11
|
+
const useBottomSheetStore = exports.useBottomSheetStore = (0, _traditional.createWithEqualityFn)((0, _middleware.subscribeWithSelector)(set => ({
|
|
12
|
+
sheetsById: {},
|
|
13
|
+
stackOrder: [],
|
|
14
|
+
open: (sheet, mode = 'push') => set(state => {
|
|
15
|
+
const existingSheet = state.sheetsById[sheet.id];
|
|
16
|
+
if (existingSheet && !(0, _helpers.isActivatableKeepMounted)(existingSheet)) {
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
19
|
+
const updatedSheetsById = (0, _helpers.applyModeToTopSheet)(state.sheetsById, state.stackOrder, mode);
|
|
20
|
+
|
|
21
|
+
// Get next portalSession from registry for portal-based sheets
|
|
22
|
+
// Registry persists across sheet deletions to ensure unique Portal/PortalHost names
|
|
23
|
+
const nextPortalSession = sheet.usePortal ? (0, _portalSessionRegistry.getNextPortalSession)(sheet.id) : undefined;
|
|
24
|
+
const newSheet = existingSheet ? {
|
|
25
|
+
...existingSheet,
|
|
26
|
+
status: 'opening',
|
|
27
|
+
scaleBackground: sheet.scaleBackground ?? existingSheet.scaleBackground,
|
|
28
|
+
params: sheet.params ?? existingSheet.params,
|
|
29
|
+
portalSession: nextPortalSession ?? existingSheet.portalSession
|
|
30
|
+
} : {
|
|
31
|
+
...sheet,
|
|
32
|
+
status: 'opening',
|
|
33
|
+
portalSession: nextPortalSession
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
sheetsById: {
|
|
37
|
+
...updatedSheetsById,
|
|
38
|
+
[sheet.id]: newSheet
|
|
39
|
+
},
|
|
40
|
+
stackOrder: [...state.stackOrder, sheet.id]
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
43
|
+
markOpen: id => set(state => {
|
|
44
|
+
if (!state.sheetsById[id]) return state;
|
|
45
|
+
return {
|
|
46
|
+
sheetsById: (0, _helpers.updateSheet)(state.sheetsById, id, {
|
|
47
|
+
status: 'open'
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
51
|
+
startClosing: id => set(state => {
|
|
52
|
+
const sheet = state.sheetsById[id];
|
|
53
|
+
if (!sheet || (0, _helpers.isHidden)(sheet) || (0, _helpers.isOpening)(sheet)) return state;
|
|
54
|
+
let updatedSheetsById = (0, _helpers.updateSheet)(state.sheetsById, id, {
|
|
55
|
+
status: 'closing'
|
|
56
|
+
});
|
|
57
|
+
const belowId = (0, _helpers.getSheetBelowId)(state.stackOrder, id);
|
|
58
|
+
if (belowId && (0, _helpers.isHidden)(updatedSheetsById[belowId])) {
|
|
59
|
+
updatedSheetsById = (0, _helpers.updateSheet)(updatedSheetsById, belowId, {
|
|
60
|
+
status: 'opening'
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
sheetsById: updatedSheetsById
|
|
65
|
+
};
|
|
66
|
+
}),
|
|
67
|
+
finishClosing: id => set(state => {
|
|
68
|
+
const sheet = state.sheetsById[id];
|
|
69
|
+
if (!sheet) return state;
|
|
70
|
+
let updatedSheetsById = {
|
|
71
|
+
...state.sheetsById
|
|
72
|
+
};
|
|
73
|
+
if (sheet.keepMounted) {
|
|
74
|
+
updatedSheetsById = (0, _helpers.updateSheet)(updatedSheetsById, id, {
|
|
75
|
+
status: 'hidden'
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
delete updatedSheetsById[id];
|
|
79
|
+
}
|
|
80
|
+
const newStackOrder = (0, _helpers.removeFromStack)(state.stackOrder, id);
|
|
81
|
+
const topId = (0, _helpers.getTopSheetId)(newStackOrder);
|
|
82
|
+
if (topId && (0, _helpers.isHidden)(updatedSheetsById[topId])) {
|
|
83
|
+
updatedSheetsById = (0, _helpers.updateSheet)(updatedSheetsById, topId, {
|
|
84
|
+
status: 'opening'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
sheetsById: updatedSheetsById,
|
|
89
|
+
stackOrder: newStackOrder
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
updateParams: (id, params) => set(state => {
|
|
93
|
+
if (!state.sheetsById[id]) return state;
|
|
94
|
+
return {
|
|
95
|
+
sheetsById: (0, _helpers.updateSheet)(state.sheetsById, id, {
|
|
96
|
+
params
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
}),
|
|
100
|
+
clearGroup: groupId => set(state => {
|
|
101
|
+
const idsToRemove = new Set(Object.keys(state.sheetsById).filter(id => state.sheetsById[id]?.groupId === groupId));
|
|
102
|
+
if (idsToRemove.size === 0) return state;
|
|
103
|
+
const updatedSheetsById = {
|
|
104
|
+
...state.sheetsById
|
|
105
|
+
};
|
|
106
|
+
idsToRemove.forEach(id => delete updatedSheetsById[id]);
|
|
107
|
+
return {
|
|
108
|
+
sheetsById: updatedSheetsById,
|
|
109
|
+
stackOrder: state.stackOrder.filter(id => !idsToRemove.has(id))
|
|
110
|
+
};
|
|
111
|
+
}),
|
|
112
|
+
clearAll: () => set({
|
|
113
|
+
sheetsById: {},
|
|
114
|
+
stackOrder: []
|
|
115
|
+
}),
|
|
116
|
+
mount: sheet => set(state => {
|
|
117
|
+
if (state.sheetsById[sheet.id]) return state;
|
|
118
|
+
return {
|
|
119
|
+
sheetsById: {
|
|
120
|
+
...state.sheetsById,
|
|
121
|
+
[sheet.id]: {
|
|
122
|
+
...sheet,
|
|
123
|
+
status: 'hidden'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}),
|
|
128
|
+
unmount: id => set(state => {
|
|
129
|
+
if (!state.sheetsById[id]) return state;
|
|
130
|
+
const updatedSheetsById = {
|
|
131
|
+
...state.sheetsById
|
|
132
|
+
};
|
|
133
|
+
delete updatedSheetsById[id];
|
|
134
|
+
return {
|
|
135
|
+
sheetsById: updatedSheetsById,
|
|
136
|
+
stackOrder: (0, _helpers.removeFromStack)(state.stackOrder, id)
|
|
137
|
+
};
|
|
138
|
+
})
|
|
139
|
+
})));
|
|
140
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_middleware","require","_traditional","_helpers","_portalSessionRegistry","useBottomSheetStore","exports","create","subscribeWithSelector","set","sheetsById","stackOrder","open","sheet","mode","state","existingSheet","id","isActivatableKeepMounted","updatedSheetsById","applyModeToTopSheet","nextPortalSession","usePortal","getNextPortalSession","undefined","newSheet","status","scaleBackground","params","portalSession","markOpen","updateSheet","startClosing","isHidden","isOpening","belowId","getSheetBelowId","finishClosing","keepMounted","newStackOrder","removeFromStack","topId","getTopSheetId","updateParams","clearGroup","groupId","idsToRemove","Set","Object","keys","filter","size","forEach","has","clearAll","mount","unmount"],"sourceRoot":"../../../src","sources":["store/store.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAUA,IAAAG,sBAAA,GAAAH,OAAA;AAGO,MAAMI,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,iCAAM,EACvC,IAAAC,iCAAqB,EAAoBC,GAAG,KAAM;EAChDC,UAAU,EAAE,CAAC,CAAC;EACdC,UAAU,EAAE,EAAE;EAEdC,IAAI,EAAEA,CAACC,KAAK,EAAEC,IAAI,GAAG,MAAM,KACzBL,GAAG,CAAEM,KAAK,IAAK;IACb,MAAMC,aAAa,GAAGD,KAAK,CAACL,UAAU,CAACG,KAAK,CAACI,EAAE,CAAC;IAEhD,IAAID,aAAa,IAAI,CAAC,IAAAE,iCAAwB,EAACF,aAAa,CAAC,EAAE;MAC7D,OAAOD,KAAK;IACd;IAEA,MAAMI,iBAAiB,GAAG,IAAAC,4BAAmB,EAC3CL,KAAK,CAACL,UAAU,EAChBK,KAAK,CAACJ,UAAU,EAChBG,IACF,CAAC;;IAED;IACA;IACA,MAAMO,iBAAiB,GAAGR,KAAK,CAACS,SAAS,GACrC,IAAAC,2CAAoB,EAACV,KAAK,CAACI,EAAE,CAAC,GAC9BO,SAAS;IAEb,MAAMC,QAA0B,GAAGT,aA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KAAK,CAACL,UAAU;QACnB,CAACG,KAAK,CAACI,EAAE,GAAG;UAAE,GAAGJ,KAAK;UAAEa,MAAM,EAAE;QAAS;MAC3C;IACF,CAAC;EACH,CAAC,CAAC;EAEJ8B,OAAO,EAAGvC,EAAE,IACVR,GAAG,CAAEM,KAAK,IAAK;IACb,IAAI,CAACA,KAAK,CAACL,UAAU,CAACO,EAAE,CAAC,EAAE,OAAOF,KAAK;IAEvC,MAAMI,iBAAiB,GAAG;MAAE,GAAGJ,KAAK,CAACL;IAAW,CAAC;IACjD,OAAOS,iBAAiB,CAACF,EAAE,CAAC;IAE5B,OAAO;MACLP,UAAU,EAAES,iBAAiB;MAC7BR,UAAU,EAAE,IAAA6B,wBAAe,EAACzB,KAAK,CAACJ,UAAU,EAAEM,EAAE;IAClD,CAAC;EACH,CAAC;AACL,CAAC,CAAC,CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["store/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useBottomSheetContext = useBottomSheetContext;
|
|
7
7
|
exports.useBottomSheetState = void 0;
|
|
8
8
|
var _compilerRuntime = require("react/compiler-runtime");
|
|
9
|
-
var _shallow = require("zustand/shallow");
|
|
10
9
|
var _BottomSheet = require("./BottomSheet.context");
|
|
11
10
|
var _bottomSheet = require("./bottomSheet.store");
|
|
12
11
|
/** Without generic - params typed as unknown */
|
|
@@ -14,61 +13,44 @@ var _bottomSheet = require("./bottomSheet.store");
|
|
|
14
13
|
/** With generic - params typed based on portal registry */
|
|
15
14
|
|
|
16
15
|
function useBottomSheetContext() {
|
|
17
|
-
const $ = (0, _compilerRuntime.c)(
|
|
16
|
+
const $ = (0, _compilerRuntime.c)(7);
|
|
18
17
|
const context = (0, _BottomSheet.useMaybeBottomSheetContext)();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
id: state.sheetsById[context?.id]?.id,
|
|
23
|
-
params: state.sheetsById[context?.id]?.params
|
|
24
|
-
});
|
|
25
|
-
$[0] = context?.id;
|
|
26
|
-
$[1] = t0;
|
|
27
|
-
} else {
|
|
28
|
-
t0 = $[1];
|
|
29
|
-
}
|
|
30
|
-
const {
|
|
31
|
-
id,
|
|
32
|
-
params
|
|
33
|
-
} = (0, _bottomSheet.useBottomSheetStore)(t0, _shallow.shallow);
|
|
34
|
-
const startClosing = (0, _bottomSheet.useBottomSheetStore)(_temp);
|
|
35
|
-
if (!id) {
|
|
18
|
+
const params = (0, _bottomSheet.useSheetParams)(context?.id || "");
|
|
19
|
+
const startClosing = (0, _bottomSheet.useStartClosing)();
|
|
20
|
+
if (!context?.id) {
|
|
36
21
|
throw new Error("useBottomSheetContext must be used within a BottomSheet component");
|
|
37
22
|
}
|
|
38
|
-
let
|
|
39
|
-
if ($[
|
|
40
|
-
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
23
|
+
let t0;
|
|
24
|
+
if ($[0] !== context.id || $[1] !== startClosing) {
|
|
25
|
+
t0 = () => startClosing(context.id);
|
|
26
|
+
$[0] = context.id;
|
|
27
|
+
$[1] = startClosing;
|
|
28
|
+
$[2] = t0;
|
|
44
29
|
} else {
|
|
45
|
-
|
|
30
|
+
t0 = $[2];
|
|
46
31
|
}
|
|
47
|
-
const close =
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
if ($[
|
|
51
|
-
|
|
52
|
-
id,
|
|
53
|
-
params:
|
|
32
|
+
const close = t0;
|
|
33
|
+
const t1 = params;
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[3] !== close || $[4] !== context.id || $[5] !== t1) {
|
|
36
|
+
t2 = {
|
|
37
|
+
id: context.id,
|
|
38
|
+
params: t1,
|
|
54
39
|
close,
|
|
55
40
|
closeBottomSheet: close
|
|
56
41
|
};
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
42
|
+
$[3] = close;
|
|
43
|
+
$[4] = context.id;
|
|
44
|
+
$[5] = t1;
|
|
45
|
+
$[6] = t2;
|
|
61
46
|
} else {
|
|
62
|
-
|
|
47
|
+
t2 = $[6];
|
|
63
48
|
}
|
|
64
|
-
return
|
|
49
|
+
return t2;
|
|
65
50
|
}
|
|
66
51
|
|
|
67
52
|
/**
|
|
68
53
|
* @deprecated Use `useBottomSheetContext` instead
|
|
69
54
|
*/
|
|
70
|
-
function _temp(state_0) {
|
|
71
|
-
return state_0.startClosing;
|
|
72
|
-
}
|
|
73
55
|
const useBottomSheetState = exports.useBottomSheetState = useBottomSheetContext;
|
|
74
56
|
//# sourceMappingURL=useBottomSheetContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_BottomSheet","require","_bottomSheet","useBottomSheetContext","$","_compilerRuntime","c","context","useMaybeBottomSheetContext","params","useSheetParams","id","startClosing","useStartClosing","Error","t0","close","t1","t2","closeBottomSheet","useBottomSheetState","exports"],"sourceRoot":"../../src","sources":["useBottomSheetContext.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAcA;;AAEA;;AAIO,SAAAE,sBAAA;EAAA,MAAAC,CAAA,OAAAC,gBAAA,CAAAC,CAAA;EAGL,MAAAC,OAAA,GAAgB,IAAAC,uCAA0B,EAAC,CAAC;EAC5C,MAAAC,MAAA,GAAe,IAAAC,2BAAc,EAACH,OAAO,EAAAI,EAAU,IAAjB,EAAiB,CAAC;EAChD,MAAAC,YAAA,GAAqB,IAAAC,4BAAe,EAAC,CAAC;EAEtC,IAAI,CAACN,OAAO,EAAAI,EAAI;IACd,MAAM,IAAIG,KAAK,CACb,mEACF,CAAC;EAAC;EACH,IAAAC,EAAA;EAAA,IAAAX,CAAA,QAAAG,OAAA,CAAAI,EAAA,IAAAP,CAAA,QAAAQ,YAAA;IAEaG,EAAA,GAAAA,CAAA,KAAMH,YAAY,CAACL,OAAO,CAAAI,EAAG,CAAC;IAAAP,CAAA,MAAAG,OAAA,CAAAI,EAAA;IAAAP,CAAA,MAAAQ,YAAA;IAAAR,CAAA,MAAAW,EAAA;EAAA;IAAAA,EAAA,GAAAX,CAAA;EAAA;EAA5C,MAAAY,KAAA,GAAcD,EAA8B;EAIlC,MAAAE,EAAA,GAAAR,MAAM;EAA8B,IAAAS,EAAA;EAAA,IAAAd,CAAA,QAAAY,KAAA,IAAAZ,CAAA,QAAAG,OAAA,CAAAI,EAAA,IAAAP,CAAA,QAAAa,EAAA;IAFvCC,EAAA;MAAAP,EAAA,EACDJ,OAAO,CAAAI,EAAG;MAAAF,MAAA,EACNQ,EAAoC;MAAAD,KAAA;MAAAG,gBAAA,EAE1BH;IACpB,CAAC;IAAAZ,CAAA,MAAAY,KAAA;IAAAZ,CAAA,MAAAG,OAAA,CAAAI,EAAA;IAAAP,CAAA,MAAAa,EAAA;IAAAb,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EAAA,OALMc,EAKN;AAAA;;AAGH;AACA;AACA;AACO,MAAME,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGjB,qBAAqB","ignoreList":[]}
|
|
@@ -13,15 +13,18 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
13
13
|
function useBottomSheetControl(id) {
|
|
14
14
|
const $ = (0, _compilerRuntime.c)(18);
|
|
15
15
|
const bottomSheetManagerContext = (0, _BottomSheetManager.useMaybeBottomSheetManagerContext)();
|
|
16
|
-
const storeOpen = (0, _bottomSheet.
|
|
17
|
-
const startClosing = (0, _bottomSheet.
|
|
18
|
-
const storeUpdateParams = (0, _bottomSheet.
|
|
16
|
+
const storeOpen = (0, _bottomSheet.useOpen)();
|
|
17
|
+
const startClosing = (0, _bottomSheet.useStartClosing)();
|
|
18
|
+
const storeUpdateParams = (0, _bottomSheet.useUpdateParams)();
|
|
19
19
|
let t0;
|
|
20
20
|
if ($[0] !== bottomSheetManagerContext?.groupId || $[1] !== id || $[2] !== storeOpen) {
|
|
21
21
|
t0 = options => {
|
|
22
22
|
const groupId = bottomSheetManagerContext?.groupId || "default";
|
|
23
|
-
const
|
|
24
|
-
(
|
|
23
|
+
const existingRef = (0, _refsMap.getSheetRef)(id);
|
|
24
|
+
if (!existingRef) {
|
|
25
|
+
const ref = /*#__PURE__*/_react.default.createRef();
|
|
26
|
+
(0, _refsMap.setSheetRef)(id, ref);
|
|
27
|
+
}
|
|
25
28
|
storeOpen({
|
|
26
29
|
id,
|
|
27
30
|
groupId,
|
|
@@ -94,13 +97,4 @@ function useBottomSheetControl(id) {
|
|
|
94
97
|
}
|
|
95
98
|
return t5;
|
|
96
99
|
}
|
|
97
|
-
function _temp3(state_1) {
|
|
98
|
-
return state_1.updateParams;
|
|
99
|
-
}
|
|
100
|
-
function _temp2(state_0) {
|
|
101
|
-
return state_0.startClosing;
|
|
102
|
-
}
|
|
103
|
-
function _temp(state) {
|
|
104
|
-
return state.open;
|
|
105
|
-
}
|
|
106
100
|
//# sourceMappingURL=useBottomSheetControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bottomSheet","_BottomSheetManager","_refsMap","e","__esModule","default","useBottomSheetControl","id","$","_compilerRuntime","c","bottomSheetManagerContext","useMaybeBottomSheetManagerContext","storeOpen","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bottomSheet","_BottomSheetManager","_refsMap","e","__esModule","default","useBottomSheetControl","id","$","_compilerRuntime","c","bottomSheetManagerContext","useMaybeBottomSheetManagerContext","storeOpen","useOpen","startClosing","useStartClosing","storeUpdateParams","useUpdateParams","t0","groupId","options","existingRef","getSheetRef","ref","React","createRef","setSheetRef","content","usePortal","scaleBackground","params","mode","open","t1","close","t2","updateParams","t3","undefined","resetParams","t4","t5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C,CAAA,SAAA2B,KAAA,IAAA3B,CAAA,SAAAgC,WAAA,IAAAhC,CAAA,SAAAiC,EAAA,IAAAjC,CAAA,SAAA6B,YAAA;IADxBK,EAAA;MAAAT,IAAA,EACCQ,EAAuB;MAAAN,KAAA;MAAAE,YAAA;MAAAG;IAI/B,CAAC;IAAAhC,CAAA,OAAA2B,KAAA;IAAA3B,CAAA,OAAAgC,WAAA;IAAAhC,CAAA,OAAAiC,EAAA;IAAAjC,CAAA,OAAA6B,YAAA;IAAA7B,CAAA,OAAAkC,EAAA;EAAA;IAAAA,EAAA,GAAAlC,CAAA;EAAA;EAAA,OALMkC,EAKN;AAAA","ignoreList":[]}
|
|
@@ -9,16 +9,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _bottomSheet = require("./bottomSheet.store");
|
|
10
10
|
var _BottomSheetManager = require("./BottomSheetManager.provider");
|
|
11
11
|
var _refsMap = require("./refsMap");
|
|
12
|
-
var _shallow = require("zustand/shallow");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
const useBottomSheetManager = () => {
|
|
15
14
|
const $ = (0, _compilerRuntime.c)(12);
|
|
16
15
|
const bottomSheetManagerContext = (0, _BottomSheetManager.useMaybeBottomSheetManagerContext)();
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
storeClearGroup
|
|
21
|
-
} = (0, _bottomSheet.useBottomSheetStore)(_temp, _shallow.shallow);
|
|
16
|
+
const storeOpen = (0, _bottomSheet.useOpen)();
|
|
17
|
+
const startClosing = (0, _bottomSheet.useStartClosing)();
|
|
18
|
+
const storeClearGroup = (0, _bottomSheet.useClearGroup)();
|
|
22
19
|
let t0;
|
|
23
20
|
if ($[0] !== bottomSheetManagerContext?.groupId || $[1] !== storeOpen) {
|
|
24
21
|
t0 = (content, t1) => {
|
|
@@ -88,11 +85,4 @@ const useBottomSheetManager = () => {
|
|
|
88
85
|
return t3;
|
|
89
86
|
};
|
|
90
87
|
exports.useBottomSheetManager = useBottomSheetManager;
|
|
91
|
-
function _temp(store) {
|
|
92
|
-
return {
|
|
93
|
-
storeOpen: store.open,
|
|
94
|
-
storeClearGroup: store.clearGroup,
|
|
95
|
-
startClosing: store.startClosing
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
88
|
//# sourceMappingURL=useBottomSheetManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_bottomSheet","_BottomSheetManager","_refsMap","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_bottomSheet","_BottomSheetManager","_refsMap","e","__esModule","default","useBottomSheetManager","$","_compilerRuntime","c","bottomSheetManagerContext","useMaybeBottomSheetManagerContext","storeOpen","useOpen","startClosing","useStartClosing","storeClearGroup","useClearGroup","t0","groupId","content","t1","options","undefined","id","Math","random","toString","ref","React","createRef","setSheetRef","contentWithRef","cloneElement","scaleBackground","mode","openBottomSheet","id_0","close","t2","groupId_0","clear","t3","open","clearAll","exports"],"sourceRoot":"../../src","sources":["useBottomSheetManager.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAwC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGjC,MAAMG,qBAAqB,GAAGA,CAAA;EAAA,MAAAC,CAAA,OAAAC,gBAAA,CAAAC,CAAA;EACnC,MAAAC,yBAAA,GAAkC,IAAAC,qDAAiC,EAAC,CAAC;EAErE,MAAAC,SAAA,GAAkB,IAAAC,oBAAO,EAAC,CAAC;EAC3B,MAAAC,YAAA,GAAqB,IAAAC,4BAAe,EAAC,CAAC;EACtC,MAAAC,eAAA,GAAwB,IA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EAFD,MAAA+B,KAAA,GAAcjB,EAEb;EAAC,IAAAkB,EAAA;EAAA,IAAAhC,CAAA,QAAAG,yBAAA,EAAAS,OAAA,IAAAZ,CAAA,QAAAS,eAAA;IAEYuB,EAAA,GAAAA,CAAA;MACZ,MAAAC,SAAA,GAAgB9B,yBAAyB,EAAAS,OAAsB,IAA/C,SAA+C;MAC/DH,eAAe,CAACG,SAAO,CAAC;IAAA,CACzB;IAAAZ,CAAA,MAAAG,yBAAA,EAAAS,OAAA;IAAAZ,CAAA,MAAAS,eAAA;IAAAT,CAAA,MAAAgC,EAAA;EAAA;IAAAA,EAAA,GAAAhC,CAAA;EAAA;EAHD,MAAAkC,KAAA,GAAcF,EAGb;EAAC,IAAAG,EAAA;EAAA,IAAAnC,CAAA,QAAAkC,KAAA,IAAAlC,CAAA,QAAA+B,KAAA,IAAA/B,CAAA,SAAA6B,eAAA;IAEKM,EAAA;MAAAC,IAAA,EACCP,eAAe;MAAAE,KAAA;MAAAG,KAAA;MAAAL,eAAA;MAAAQ,QAAA,EAMXH;IACZ,CAAC;IAAAlC,CAAA,MAAAkC,KAAA;IAAAlC,CAAA,MAAA+B,KAAA;IAAA/B,CAAA,OAAA6B,eAAA;IAAA7B,CAAA,OAAAmC,EAAA;EAAA;IAAAA,EAAA,GAAAnC,CAAA;EAAA;EAAA,OARMmC,EAQN;AAAA,CACF;AAACG,OAAA,CAAAvC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -7,28 +7,20 @@ exports.useBottomSheetStatus = useBottomSheetStatus;
|
|
|
7
7
|
var _compilerRuntime = require("react/compiler-runtime");
|
|
8
8
|
var _bottomSheet = require("./bottomSheet.store");
|
|
9
9
|
function useBottomSheetStatus(id) {
|
|
10
|
-
const $ = (0, _compilerRuntime.c)(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
t0 = state => state.sheetsById[id]?.status ?? null;
|
|
14
|
-
$[0] = id;
|
|
15
|
-
$[1] = t0;
|
|
16
|
-
} else {
|
|
17
|
-
t0 = $[1];
|
|
18
|
-
}
|
|
19
|
-
const status = (0, _bottomSheet.useBottomSheetStore)(t0);
|
|
20
|
-
const isOpen = status === "open" || status === "opening";
|
|
10
|
+
const $ = (0, _compilerRuntime.c)(3);
|
|
11
|
+
const status = (0, _bottomSheet.useSheetStatus)(id) ?? null;
|
|
12
|
+
const t0 = status === "open" || status === "opening";
|
|
21
13
|
let t1;
|
|
22
|
-
if ($[
|
|
14
|
+
if ($[0] !== status || $[1] !== t0) {
|
|
23
15
|
t1 = {
|
|
24
16
|
status,
|
|
25
|
-
isOpen
|
|
17
|
+
isOpen: t0
|
|
26
18
|
};
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
$[
|
|
19
|
+
$[0] = status;
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
$[2] = t1;
|
|
30
22
|
} else {
|
|
31
|
-
t1 = $[
|
|
23
|
+
t1 = $[2];
|
|
32
24
|
}
|
|
33
25
|
return t1;
|
|
34
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bottomSheet","require","useBottomSheetStatus","id","$","_compilerRuntime","c","
|
|
1
|
+
{"version":3,"names":["_bottomSheet","require","useBottomSheetStatus","id","$","_compilerRuntime","c","status","useSheetStatus","t0","t1","isOpen"],"sourceRoot":"../../src","sources":["useBottomSheetStatus.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOO,SAAAC,qBAAAC,EAAA;EAAA,MAAAC,CAAA,OAAAC,gBAAA,CAAAC,CAAA;EACL,MAAAC,MAAA,GAAe,IAAAC,2BAAc,EAACL,EAAU,CAAC,IAA1B,IAA0B;EAI/B,MAAAM,EAAA,GAAAF,MAAM,KAAK,MAA8B,IAApBA,MAAM,KAAK,SAAS;EAAA,IAAAG,EAAA;EAAA,IAAAN,CAAA,QAAAG,MAAA,IAAAH,CAAA,QAAAK,EAAA;IAF5CC,EAAA;MAAAH,MAAA;MAAAI,MAAA,EAEGF;IACV,CAAC;IAAAL,CAAA,MAAAG,MAAA;IAAAH,CAAA,MAAAK,EAAA;IAAAL,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAAA,OAHMM,EAGN;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEvent = void 0;
|
|
7
|
+
var _compilerRuntime = require("react/compiler-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
// biome-ignore lint/suspicious/noExplicitAny: No better alternative available.
|
|
10
|
+
|
|
11
|
+
// RFC: https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
|
|
12
|
+
const useEvent = callback => {
|
|
13
|
+
const $ = (0, _compilerRuntime.c)(3);
|
|
14
|
+
const callbackRef = (0, _react.useRef)(callback);
|
|
15
|
+
let t0;
|
|
16
|
+
if ($[0] !== callback) {
|
|
17
|
+
t0 = () => {
|
|
18
|
+
callbackRef.current = callback;
|
|
19
|
+
};
|
|
20
|
+
$[0] = callback;
|
|
21
|
+
$[1] = t0;
|
|
22
|
+
} else {
|
|
23
|
+
t0 = $[1];
|
|
24
|
+
}
|
|
25
|
+
(0, _react.useLayoutEffect)(t0);
|
|
26
|
+
let t1;
|
|
27
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
28
|
+
t1 = (...t2) => {
|
|
29
|
+
const args = t2;
|
|
30
|
+
return callbackRef.current(...args);
|
|
31
|
+
};
|
|
32
|
+
$[2] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[2];
|
|
35
|
+
}
|
|
36
|
+
return t1;
|
|
37
|
+
};
|
|
38
|
+
exports.useEvent = useEvent;
|
|
39
|
+
//# sourceMappingURL=useEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","useEvent","callback","$","_compilerRuntime","c","callbackRef","useRef","t0","current","useLayoutEffect","t1","Symbol","for","t2","args","exports"],"sourceRoot":"../../src","sources":["useEvent.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;;AAGA;AACO,MAAMC,QAAQ,GAAGC,QAAA;EAAA,MAAAC,CAAA,OAAAC,gBAAA,CAAAC,CAAA;EACtB,MAAAC,WAAA,GAAoB,IAAAC,aAAM,EAACL,QAAQ,CAAC;EAAC,IAAAM,EAAA;EAAA,IAAAL,CAAA,QAAAD,QAAA;IAErBM,EAAA,GAAAA,CAAA;MACdF,WAAW,CAAAG,OAAA,GAAWP,QAAH;IAAA,CACpB;IAAAC,CAAA,MAAAD,QAAA;IAAAC,CAAA,MAAAK,EAAA;EAAA;IAAAA,EAAA,GAAAL,CAAA;EAAA;EAFD,IAAAO,sBAAe,EAACF,EAEf,CAAC;EAAA,IAAAG,EAAA;EAAA,IAAAR,CAAA,QAAAS,MAAA,CAAAC,GAAA;IAEiBF,EAAA,GAAAA,CAAA,GAAAG,EAAA;MAAC,MAAAC,IAAA,GAAAD,EAAsB;MAAA,OACjCR,WAAW,CAAAG,OAAQ,IAAIM,IAAI,CAAC;IAAA,CACpC;IAAAZ,CAAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAAA,OAFMQ,EAED;AAAA,CACP;AAACK,OAAA,CAAAf,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -4,48 +4,71 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useScaleAnimatedStyle = useScaleAnimatedStyle;
|
|
7
|
-
exports.useScaleDepth = useScaleDepth;
|
|
8
7
|
var _compilerRuntime = require("react/compiler-runtime");
|
|
9
8
|
var _react = require("react");
|
|
10
9
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
11
10
|
var _bottomSheet = require("./bottomSheet.store");
|
|
12
11
|
var _BottomSheetManager = require("./BottomSheetManager.provider");
|
|
12
|
+
const DEFAULT_ANIMATION = {
|
|
13
|
+
type: 'timing',
|
|
14
|
+
config: {
|
|
15
|
+
duration: 300
|
|
16
|
+
}
|
|
17
|
+
};
|
|
13
18
|
const DEFAULT_CONFIG = {
|
|
14
19
|
scale: 0.92,
|
|
15
20
|
translateY: 10,
|
|
16
21
|
borderRadius: 12,
|
|
17
|
-
|
|
22
|
+
animation: DEFAULT_ANIMATION
|
|
18
23
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
function useBackgroundScaleDepth(groupId) {
|
|
25
|
+
const $ = (0, _compilerRuntime.c)(2);
|
|
26
|
+
let t0;
|
|
27
|
+
if ($[0] !== groupId) {
|
|
28
|
+
t0 = state => {
|
|
29
|
+
const {
|
|
30
|
+
stackOrder,
|
|
31
|
+
sheetsById
|
|
32
|
+
} = state;
|
|
33
|
+
for (let i = 0; i < stackOrder.length; i++) {
|
|
34
|
+
const id = stackOrder[i];
|
|
35
|
+
const sheet = sheetsById[id];
|
|
36
|
+
if (sheet && sheet.groupId === groupId && sheet.scaleBackground && sheet.status !== "closing" && sheet.status !== "hidden") {
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return 0;
|
|
41
|
+
};
|
|
42
|
+
$[0] = groupId;
|
|
43
|
+
$[1] = t0;
|
|
44
|
+
} else {
|
|
45
|
+
t0 = $[1];
|
|
46
|
+
}
|
|
47
|
+
return (0, _bottomSheet.useBottomSheetStore)(t0);
|
|
48
|
+
}
|
|
49
|
+
function useSheetScaleDepth(groupId, sheetId) {
|
|
27
50
|
const $ = (0, _compilerRuntime.c)(3);
|
|
28
51
|
const prevDepthRef = (0, _react.useRef)(0);
|
|
29
52
|
let t0;
|
|
30
53
|
if ($[0] !== groupId || $[1] !== sheetId) {
|
|
31
54
|
t0 = state => {
|
|
55
|
+
if (!sheetId) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
32
58
|
const {
|
|
33
59
|
stackOrder,
|
|
34
60
|
sheetsById
|
|
35
61
|
} = state;
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
62
|
+
const sheetIndex = stackOrder.indexOf(sheetId);
|
|
63
|
+
if (sheetIndex === -1) {
|
|
38
64
|
return prevDepthRef.current;
|
|
39
65
|
}
|
|
40
66
|
let depth = 0;
|
|
41
|
-
for (let i =
|
|
67
|
+
for (let i = sheetIndex + 1; i < stackOrder.length; i++) {
|
|
42
68
|
const id = stackOrder[i];
|
|
43
69
|
const sheet = sheetsById[id];
|
|
44
|
-
if (sheet && sheet.groupId === groupId && sheet.scaleBackground && sheet.status !== "closing") {
|
|
70
|
+
if (sheet && sheet.groupId === groupId && sheet.scaleBackground && sheet.status !== "closing" && sheet.status !== "hidden") {
|
|
45
71
|
depth++;
|
|
46
|
-
if (!sheetId) {
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
72
|
}
|
|
50
73
|
}
|
|
51
74
|
prevDepthRef.current = depth;
|
|
@@ -57,14 +80,8 @@ function useScaleDepth(groupId, sheetId) {
|
|
|
57
80
|
} else {
|
|
58
81
|
t0 = $[2];
|
|
59
82
|
}
|
|
60
|
-
|
|
61
|
-
return (0, _bottomSheet.useBottomSheetStore)(scaleDepthSelector);
|
|
83
|
+
return (0, _bottomSheet.useBottomSheetStore)(t0);
|
|
62
84
|
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns animated style for scale effect based on depth.
|
|
66
|
-
* Uses power scaling: scale^depth for cascading effect.
|
|
67
|
-
*/
|
|
68
85
|
function useScaleAnimatedStyle(t0) {
|
|
69
86
|
const $ = (0, _compilerRuntime.c)(2);
|
|
70
87
|
let t1;
|
|
@@ -82,20 +99,26 @@ function useScaleAnimatedStyle(t0) {
|
|
|
82
99
|
groupId,
|
|
83
100
|
scaleConfig
|
|
84
101
|
} = (0, _BottomSheetManager.useBottomSheetManagerContext)();
|
|
85
|
-
const scaleDepth = useScaleDepth(groupId, id);
|
|
86
102
|
const {
|
|
87
103
|
scale: t2,
|
|
88
104
|
translateY: t3,
|
|
89
105
|
borderRadius: t4,
|
|
90
|
-
|
|
106
|
+
animation: t5
|
|
91
107
|
} = scaleConfig ?? {};
|
|
92
108
|
const scale = t2 === undefined ? DEFAULT_CONFIG.scale : t2;
|
|
93
109
|
const translateY = t3 === undefined ? DEFAULT_CONFIG.translateY : t3;
|
|
94
110
|
const borderRadius = t4 === undefined ? DEFAULT_CONFIG.borderRadius : t4;
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
111
|
+
const animation = t5 === undefined ? DEFAULT_CONFIG.animation : t5;
|
|
112
|
+
const isBackground = id === undefined;
|
|
113
|
+
const backgroundDepth = useBackgroundScaleDepth(groupId);
|
|
114
|
+
const sheetDepth = useSheetScaleDepth(groupId, id);
|
|
115
|
+
const scaleDepth = isBackground ? backgroundDepth : sheetDepth;
|
|
116
|
+
const progress = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
117
|
+
if (animation.type === "spring") {
|
|
118
|
+
return (0, _reactNativeReanimated.withSpring)(scaleDepth, animation.config);
|
|
119
|
+
}
|
|
120
|
+
return (0, _reactNativeReanimated.withTiming)(scaleDepth, animation.config);
|
|
121
|
+
});
|
|
99
122
|
return (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
100
123
|
const p = progress.value;
|
|
101
124
|
if (p === 0) {
|