@oxyhq/bloom 1.1.0 → 1.2.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/docs/media-flight.mdx +272 -0
- package/docs/migrating-the-media-gallery.mdx +103 -0
- package/docs/migrating-to-1.0.mdx +1 -1
- package/docs/zoomable-media-gallery.mdx +116 -0
- package/lib/commonjs/image-aspect-ratio-cache/aspect-ratio-cache.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/media-flight/MediaFlightLayer.js +151 -0
- package/lib/commonjs/media-flight/MediaFlightLayer.js.map +1 -0
- package/lib/commonjs/media-flight/MediaSurface.js +188 -0
- package/lib/commonjs/media-flight/MediaSurface.js.map +1 -0
- package/lib/commonjs/media-flight/constants.js +39 -0
- package/lib/commonjs/media-flight/constants.js.map +1 -0
- package/lib/commonjs/media-flight/expo-video-module.js +148 -0
- package/lib/commonjs/media-flight/expo-video-module.js.map +1 -0
- package/lib/commonjs/media-flight/index.js +102 -0
- package/lib/commonjs/media-flight/index.js.map +1 -0
- package/lib/commonjs/media-flight/store.js +457 -0
- package/lib/commonjs/media-flight/store.js.map +1 -0
- package/lib/commonjs/media-flight/types.js +6 -0
- package/lib/commonjs/media-flight/types.js.map +1 -0
- package/lib/commonjs/media-flight/use-media-flight.js +41 -0
- package/lib/commonjs/media-flight/use-media-flight.js.map +1 -0
- package/lib/commonjs/tab-bar/TabBarBase.js +1 -1
- package/lib/commonjs/{zoomable-image-gallery/ZoomableImageGallery.js → zoomable-media-gallery/ZoomableMediaGallery.js} +185 -131
- package/lib/commonjs/zoomable-media-gallery/ZoomableMediaGallery.js.map +1 -0
- package/lib/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/constants.js.map +1 -1
- package/lib/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/index.js +5 -5
- package/lib/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/index.js.map +1 -1
- package/lib/commonjs/zoomable-media-gallery/types.js +6 -0
- package/lib/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/types.js.map +1 -1
- package/lib/module/image-aspect-ratio-cache/aspect-ratio-cache.js +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/media-flight/MediaFlightLayer.js +146 -0
- package/lib/module/media-flight/MediaFlightLayer.js.map +1 -0
- package/lib/module/media-flight/MediaSurface.js +180 -0
- package/lib/module/media-flight/MediaSurface.js.map +1 -0
- package/lib/module/media-flight/constants.js +35 -0
- package/lib/module/media-flight/constants.js.map +1 -0
- package/lib/module/media-flight/expo-video-module.js +142 -0
- package/lib/module/media-flight/expo-video-module.js.map +1 -0
- package/lib/module/media-flight/index.js +9 -0
- package/lib/module/media-flight/index.js.map +1 -0
- package/lib/module/media-flight/store.js +439 -0
- package/lib/module/media-flight/store.js.map +1 -0
- package/lib/module/media-flight/types.js +4 -0
- package/lib/module/media-flight/types.js.map +1 -0
- package/lib/module/media-flight/use-media-flight.js +36 -0
- package/lib/module/media-flight/use-media-flight.js.map +1 -0
- package/lib/module/tab-bar/TabBarBase.js +1 -1
- package/lib/module/{zoomable-image-gallery/ZoomableImageGallery.js → zoomable-media-gallery/ZoomableMediaGallery.js} +184 -130
- package/lib/module/zoomable-media-gallery/ZoomableMediaGallery.js.map +1 -0
- package/lib/module/{zoomable-image-gallery → zoomable-media-gallery}/constants.js.map +1 -1
- package/lib/module/zoomable-media-gallery/index.js +5 -0
- package/lib/module/zoomable-media-gallery/index.js.map +1 -0
- package/lib/module/zoomable-media-gallery/types.js +4 -0
- package/lib/module/{zoomable-image-gallery → zoomable-media-gallery}/types.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-flight/MediaFlightLayer.d.ts +11 -0
- package/lib/typescript/commonjs/media-flight/MediaFlightLayer.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/MediaSurface.d.ts +106 -0
- package/lib/typescript/commonjs/media-flight/MediaSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/constants.d.ts +18 -0
- package/lib/typescript/commonjs/media-flight/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/expo-video-module.d.ts +103 -0
- package/lib/typescript/commonjs/media-flight/expo-video-module.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/index.d.ts +9 -0
- package/lib/typescript/commonjs/media-flight/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/store.d.ts +132 -0
- package/lib/typescript/commonjs/media-flight/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/types.d.ts +195 -0
- package/lib/typescript/commonjs/media-flight/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-flight/use-media-flight.d.ts +4 -0
- package/lib/typescript/commonjs/media-flight/use-media-flight.d.ts.map +1 -0
- package/lib/typescript/commonjs/zoomable-media-gallery/ZoomableMediaGallery.d.ts +5 -0
- package/lib/typescript/commonjs/zoomable-media-gallery/ZoomableMediaGallery.d.ts.map +1 -0
- package/lib/typescript/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/zoomable-media-gallery/index.d.ts +4 -0
- package/lib/typescript/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/zoomable-media-gallery/types.d.ts +90 -0
- package/lib/typescript/commonjs/zoomable-media-gallery/types.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/media-flight/MediaFlightLayer.d.ts +11 -0
- package/lib/typescript/module/media-flight/MediaFlightLayer.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/MediaSurface.d.ts +106 -0
- package/lib/typescript/module/media-flight/MediaSurface.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/constants.d.ts +18 -0
- package/lib/typescript/module/media-flight/constants.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/expo-video-module.d.ts +103 -0
- package/lib/typescript/module/media-flight/expo-video-module.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/index.d.ts +9 -0
- package/lib/typescript/module/media-flight/index.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/store.d.ts +132 -0
- package/lib/typescript/module/media-flight/store.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/types.d.ts +195 -0
- package/lib/typescript/module/media-flight/types.d.ts.map +1 -0
- package/lib/typescript/module/media-flight/use-media-flight.d.ts +4 -0
- package/lib/typescript/module/media-flight/use-media-flight.d.ts.map +1 -0
- package/lib/typescript/module/zoomable-media-gallery/ZoomableMediaGallery.d.ts +5 -0
- package/lib/typescript/module/zoomable-media-gallery/ZoomableMediaGallery.d.ts.map +1 -0
- package/lib/typescript/module/{zoomable-image-gallery → zoomable-media-gallery}/constants.d.ts.map +1 -1
- package/lib/typescript/module/zoomable-media-gallery/index.d.ts +4 -0
- package/lib/typescript/module/{zoomable-image-gallery → zoomable-media-gallery}/index.d.ts.map +1 -1
- package/lib/typescript/module/zoomable-media-gallery/types.d.ts +90 -0
- package/lib/typescript/module/zoomable-media-gallery/types.d.ts.map +1 -0
- package/package.json +42 -8
- package/src/image-aspect-ratio-cache/aspect-ratio-cache.ts +1 -1
- package/src/index.ts +2 -1
- package/src/index.web.ts +2 -1
- package/src/media-flight/MediaFlightLayer.tsx +144 -0
- package/src/media-flight/MediaSurface.tsx +233 -0
- package/src/media-flight/constants.ts +32 -0
- package/src/media-flight/expo-video-module.ts +181 -0
- package/src/media-flight/index.ts +33 -0
- package/src/media-flight/store.ts +497 -0
- package/src/media-flight/types.ts +210 -0
- package/src/media-flight/use-media-flight.ts +42 -0
- package/src/tab-bar/TabBarBase.tsx +1 -1
- package/src/{zoomable-image-gallery/ZoomableImageGallery.tsx → zoomable-media-gallery/ZoomableMediaGallery.tsx} +192 -117
- package/src/zoomable-media-gallery/index.ts +11 -0
- package/src/zoomable-media-gallery/types.ts +100 -0
- package/docs/zoomable-image-gallery.mdx +0 -66
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +0 -1
- package/lib/commonjs/zoomable-image-gallery/types.js +0 -2
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +0 -1
- package/lib/module/zoomable-image-gallery/index.js +0 -5
- package/lib/module/zoomable-image-gallery/index.js.map +0 -1
- package/lib/module/zoomable-image-gallery/types.js +0 -2
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts +0 -5
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +0 -1
- package/lib/typescript/commonjs/zoomable-image-gallery/index.d.ts +0 -4
- package/lib/typescript/commonjs/zoomable-image-gallery/types.d.ts +0 -56
- package/lib/typescript/commonjs/zoomable-image-gallery/types.d.ts.map +0 -1
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts +0 -5
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +0 -1
- package/lib/typescript/module/zoomable-image-gallery/index.d.ts +0 -4
- package/lib/typescript/module/zoomable-image-gallery/types.d.ts +0 -56
- package/lib/typescript/module/zoomable-image-gallery/types.d.ts.map +0 -1
- package/src/zoomable-image-gallery/index.ts +0 -9
- package/src/zoomable-image-gallery/types.ts +0 -59
- /package/lib/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/constants.js +0 -0
- /package/lib/module/{zoomable-image-gallery → zoomable-media-gallery}/constants.js +0 -0
- /package/lib/typescript/commonjs/{zoomable-image-gallery → zoomable-media-gallery}/constants.d.ts +0 -0
- /package/lib/typescript/module/{zoomable-image-gallery → zoomable-media-gallery}/constants.d.ts +0 -0
- /package/src/{zoomable-image-gallery → zoomable-media-gallery}/constants.ts +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DEFAULT_FLIGHT_CORNER_RADIUS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _store.DEFAULT_FLIGHT_CORNER_RADIUS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "EmptyMediaSurface", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _MediaSurface.EmptyMediaSurface;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "MediaFlightLayer", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _MediaFlightLayer.MediaFlightLayer;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "MediaPoster", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _MediaSurface.MediaPoster;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "MediaSurface", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _MediaSurface.MediaSurface;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SURFACE_MOUNT_TIMEOUT_MS", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _constants.SURFACE_MOUNT_TIMEOUT_MS;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "flightProgress", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _store.flightProgress;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "handOffFlight", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _store.handOffFlight;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "hasFlight", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _store.hasFlight;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "loadExpoVideo", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _expoVideoModule.loadExpoVideo;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "releaseFlight", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _store.releaseFlight;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "resetExpoVideoModule", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _expoVideoModule.resetExpoVideoModule;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "resetMediaFlight", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _store.resetMediaFlight;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "useMediaFlight", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _useMediaFlight.useMediaFlight;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "warnExpoVideoUnavailable", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _expoVideoModule.warnExpoVideoUnavailable;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
var _MediaFlightLayer = require("./MediaFlightLayer.js");
|
|
97
|
+
var _MediaSurface = require("./MediaSurface.js");
|
|
98
|
+
var _useMediaFlight = require("./use-media-flight.js");
|
|
99
|
+
var _store = require("./store.js");
|
|
100
|
+
var _constants = require("./constants.js");
|
|
101
|
+
var _expoVideoModule = require("./expo-video-module.js");
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_MediaFlightLayer","require","_MediaSurface","_useMediaFlight","_store","_constants","_expoVideoModule"],"sourceRoot":"../../../src","sources":["media-flight/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAQA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_FLIGHT_CORNER_RADIUS = void 0;
|
|
7
|
+
exports.flightProgress = flightProgress;
|
|
8
|
+
exports.flyBack = flyBack;
|
|
9
|
+
exports.flyTo = flyTo;
|
|
10
|
+
exports.getFlights = getFlights;
|
|
11
|
+
exports.handOffFlight = handOffFlight;
|
|
12
|
+
exports.hasFlight = hasFlight;
|
|
13
|
+
exports.measureAnchor = measureAnchor;
|
|
14
|
+
exports.notifySurfaceMounted = notifySurfaceMounted;
|
|
15
|
+
exports.notifySurfaceSettled = notifySurfaceSettled;
|
|
16
|
+
exports.registerAnchor = registerAnchor;
|
|
17
|
+
exports.releaseFlight = releaseFlight;
|
|
18
|
+
exports.resetMediaFlight = resetMediaFlight;
|
|
19
|
+
exports.subscribeToFlights = subscribeToFlights;
|
|
20
|
+
var _reactNative = require("react-native");
|
|
21
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
22
|
+
var _index = require("../design-tokens/index.js");
|
|
23
|
+
var _constants = require("./constants.js");
|
|
24
|
+
var _constants2 = require("../zoomable-media-gallery/constants.js");
|
|
25
|
+
/**
|
|
26
|
+
* The media-flight registry: anchors, live surfaces, and the animation that
|
|
27
|
+
* moves them.
|
|
28
|
+
*
|
|
29
|
+
* ## Why the animation lives HERE and not in the layer
|
|
30
|
+
*
|
|
31
|
+
* A flight is started by an imperative call (`flyTo`) from a screen that may be
|
|
32
|
+
* about to unmount. If the layer drove the animation from an effect keyed on the
|
|
33
|
+
* flight record, the first frame would be one commit late — and on web, where
|
|
34
|
+
* the origin route is genuinely gone by the next commit, that frame is the one
|
|
35
|
+
* the user sees. Driving the shared value at the call site makes the leg start
|
|
36
|
+
* exactly when the caller says it does and leaves the layer a pure painter.
|
|
37
|
+
*
|
|
38
|
+
* The shared values are created with `makeMutable` rather than `useSharedValue`
|
|
39
|
+
* for the same reason: they belong to a flight, not to a component, and the
|
|
40
|
+
* component that paints a flight is not the one that starts it.
|
|
41
|
+
*
|
|
42
|
+
* ## Why the registry is anchored on `globalThis`
|
|
43
|
+
*
|
|
44
|
+
* Same reason as the portal group and the overlay stack: `exports` ships a
|
|
45
|
+
* `react-native` → `src` condition beside the `lib/module` and `lib/commonjs`
|
|
46
|
+
* forks, and a bundler can resolve `@oxyhq/bloom/media-flight` through different
|
|
47
|
+
* conditions from different call sites. Two physical copies of this module would
|
|
48
|
+
* each keep their own registry, and the `<MediaFlightLayer>` mounted at the app
|
|
49
|
+
* root would never see the flight a screen started.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Default corner radius of a flying box — Bloom's `radius-12`, the same value
|
|
54
|
+
* the media gallery fits its media at, so a flight that lands in the gallery
|
|
55
|
+
* lands on an identical shape.
|
|
56
|
+
*/
|
|
57
|
+
const DEFAULT_FLIGHT_CORNER_RADIUS = exports.DEFAULT_FLIGHT_CORNER_RADIUS = _index.RADIUS['radius-12'];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Bookkeeping the layer does not RENDER, kept out of the `MediaFlight` record
|
|
61
|
+
* on purpose.
|
|
62
|
+
*
|
|
63
|
+
* The record is replaced on every visual change so its identity tells React the
|
|
64
|
+
* leg moved; folding these flags into it would churn that identity on events
|
|
65
|
+
* nobody paints, and folding the record into these would put mutable state back
|
|
66
|
+
* in a rendered position. They are separate because they answer to different
|
|
67
|
+
* consumers.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
function emptyRegistry() {
|
|
71
|
+
return {
|
|
72
|
+
anchors: new Map(),
|
|
73
|
+
flights: new Map(),
|
|
74
|
+
status: new Map(),
|
|
75
|
+
listeners: new Set(),
|
|
76
|
+
snapshot: [],
|
|
77
|
+
progress: (0, _reactNativeReanimated.makeMutable)(0)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function statusFor(id) {
|
|
81
|
+
const reg = registry();
|
|
82
|
+
let status = reg.status.get(id);
|
|
83
|
+
if (!status) {
|
|
84
|
+
status = {
|
|
85
|
+
mounted: false,
|
|
86
|
+
settled: false,
|
|
87
|
+
handedOff: false,
|
|
88
|
+
mountWaiters: [],
|
|
89
|
+
mountTimer: null
|
|
90
|
+
};
|
|
91
|
+
reg.status.set(id, status);
|
|
92
|
+
}
|
|
93
|
+
return status;
|
|
94
|
+
}
|
|
95
|
+
function clearTimers(status) {
|
|
96
|
+
if (status.mountTimer !== null) clearTimeout(status.mountTimer);
|
|
97
|
+
status.mountTimer = null;
|
|
98
|
+
}
|
|
99
|
+
function resolveMountWaiters(status) {
|
|
100
|
+
const waiters = status.mountWaiters;
|
|
101
|
+
status.mountWaiters = [];
|
|
102
|
+
if (status.mountTimer !== null) {
|
|
103
|
+
clearTimeout(status.mountTimer);
|
|
104
|
+
status.mountTimer = null;
|
|
105
|
+
}
|
|
106
|
+
for (const waiter of waiters) waiter();
|
|
107
|
+
}
|
|
108
|
+
function registry() {
|
|
109
|
+
globalThis.__oxyhq_bloom_media_flight__ ??= emptyRegistry();
|
|
110
|
+
return globalThis.__oxyhq_bloom_media_flight__;
|
|
111
|
+
}
|
|
112
|
+
function publish(reg) {
|
|
113
|
+
reg.snapshot = [...reg.flights.values()];
|
|
114
|
+
for (const listener of reg.listeners) listener();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Subscribe to the live-surface set. The layer's `useSyncExternalStore` half. */
|
|
118
|
+
function subscribeToFlights(listener) {
|
|
119
|
+
const reg = registry();
|
|
120
|
+
reg.listeners.add(listener);
|
|
121
|
+
return () => {
|
|
122
|
+
reg.listeners.delete(listener);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The live surfaces, oldest first. Stable identity between changes. */
|
|
127
|
+
function getFlights() {
|
|
128
|
+
return registry().snapshot;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** The shared progress value of the most recent leg. */
|
|
132
|
+
function flightProgress() {
|
|
133
|
+
return registry().progress;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Register (or clear) the node that anchors `id`.
|
|
138
|
+
*
|
|
139
|
+
* A `Map` re-insertion moves the key to the end, which is what makes "the most
|
|
140
|
+
* recently registered node is the anchor" true even when an origin screen's
|
|
141
|
+
* callback ref fires again after the destination has registered.
|
|
142
|
+
*/
|
|
143
|
+
function registerAnchor(id, node) {
|
|
144
|
+
const reg = registry();
|
|
145
|
+
reg.anchors.delete(id);
|
|
146
|
+
if (node !== null) reg.anchors.set(id, node);
|
|
147
|
+
}
|
|
148
|
+
function measureAnchor(id) {
|
|
149
|
+
const node = registry().anchors.get(id);
|
|
150
|
+
if (!node) return Promise.resolve(null);
|
|
151
|
+
return new Promise(resolve => {
|
|
152
|
+
node.measureInWindow((x, y, width, height) => {
|
|
153
|
+
// A zero-area measurement is what a node reports while it is laid out but
|
|
154
|
+
// not yet on screen. Flying to it would collapse the surface to a point,
|
|
155
|
+
// so it reads as "no anchor" and the caller skips the transition.
|
|
156
|
+
resolve(width > 0 && height > 0 ? {
|
|
157
|
+
x,
|
|
158
|
+
y,
|
|
159
|
+
width,
|
|
160
|
+
height
|
|
161
|
+
} : null);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Whether a surface is currently live for `id`. */
|
|
167
|
+
function hasFlight(id) {
|
|
168
|
+
return registry().flights.has(id);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Take the surface for `id` live (if it is not already) and move it to `rect`.
|
|
173
|
+
*
|
|
174
|
+
* Retargeting mid-flight keeps the SAME `MediaFlight` record — and therefore the
|
|
175
|
+
* same mounted `VideoView` — which is the whole point. A second record would be
|
|
176
|
+
* a second surface for one id, and swapping between them is exactly the remount
|
|
177
|
+
* that restarts playback.
|
|
178
|
+
*
|
|
179
|
+
* ## Why it returns a promise, and what the promise means
|
|
180
|
+
*
|
|
181
|
+
* It resolves once the layer has COMMITTED a surface for this id — not once
|
|
182
|
+
* that surface has painted.
|
|
183
|
+
*
|
|
184
|
+
* The distinction is the whole ordering contract. expo-video's web player keeps
|
|
185
|
+
* a `Set` of mounted `<video>` elements and, on each mount, copies
|
|
186
|
+
* `currentTime`, play state, volume, muted and rate from `[...set][0]`. If the
|
|
187
|
+
* set is EMPTY when the new element mounts, it returns early and the element
|
|
188
|
+
* starts at zero — a restart. So the layer's surface has to enter that set while
|
|
189
|
+
* the origin's is still in it, which means the caller must not tear the origin
|
|
190
|
+
* down (on web: must not navigate) until this promise resolves.
|
|
191
|
+
*
|
|
192
|
+
* That knowledge lives here rather than in the caller, which is the point: a
|
|
193
|
+
* consumer that has to know the mount order is a consumer that will get it wrong
|
|
194
|
+
* once and produce an intermittent restart nobody can reproduce locally.
|
|
195
|
+
*
|
|
196
|
+
* Painting is deliberately NOT waited on. `MediaSurface` renders the poster
|
|
197
|
+
* BEHIND the video on both platforms, and neither an unpainted `<video>` (no
|
|
198
|
+
* `poster` attribute is set) nor an Android `TextureView` with the ExoPlayer
|
|
199
|
+
* shutter off draws anything opaque — so the still shows through until the first
|
|
200
|
+
* frame lands, and there is no black box to hide. Waiting for a decode would
|
|
201
|
+
* trade an invisible problem for a laggy tap.
|
|
202
|
+
*/
|
|
203
|
+
function flyTo(id, rect, content, options) {
|
|
204
|
+
const reg = registry();
|
|
205
|
+
const existing = reg.flights.get(id);
|
|
206
|
+
if (existing) {
|
|
207
|
+
// A retarget REPLACES the record rather than mutating it. Identity is what
|
|
208
|
+
// tells React (and the React Compiler) that the leg changed: a mutated
|
|
209
|
+
// record has the same identity, so a memoized read of `flight.from` would
|
|
210
|
+
// keep returning the previous leg's origin forever — the exact
|
|
211
|
+
// external-mutable-state stale read the compiler is documented to produce.
|
|
212
|
+
// The shared value is carried over untouched, so the surface resumes rather
|
|
213
|
+
// than restarting.
|
|
214
|
+
const next = {
|
|
215
|
+
...existing,
|
|
216
|
+
// The leg that was running is abandoned where it stands: `from` becomes
|
|
217
|
+
// the rect the surface is CURRENTLY at, so a retarget never snaps.
|
|
218
|
+
from: interpolateRect(existing.from, existing.to, existing.progress.value),
|
|
219
|
+
to: rect,
|
|
220
|
+
content,
|
|
221
|
+
cornerRadius: options?.cornerRadius ?? existing.cornerRadius,
|
|
222
|
+
contentFit: options?.contentFit ?? existing.contentFit,
|
|
223
|
+
// NOT retargetable: `MediaSurface` captures it on first render because
|
|
224
|
+
// expo-video forbids changing it at runtime, so a new value here would be
|
|
225
|
+
// silently ignored by the view it is meant to configure.
|
|
226
|
+
surfaceType: existing.surfaceType,
|
|
227
|
+
landing: false,
|
|
228
|
+
generation: existing.generation + 1
|
|
229
|
+
};
|
|
230
|
+
reg.flights.set(id, next);
|
|
231
|
+
const retargeted = statusFor(id);
|
|
232
|
+
retargeted.settled = false;
|
|
233
|
+
animate(next, false);
|
|
234
|
+
publish(reg);
|
|
235
|
+
return awaitSurfaceMount(id);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Nothing live yet. `from` is the origin rect the caller measured; without one
|
|
239
|
+
// the surface simply appears at `rect` rather than flying in from a corner.
|
|
240
|
+
const flight = {
|
|
241
|
+
id,
|
|
242
|
+
content,
|
|
243
|
+
from: options?.from ?? rect,
|
|
244
|
+
to: rect,
|
|
245
|
+
cornerRadius: options?.cornerRadius ?? DEFAULT_FLIGHT_CORNER_RADIUS,
|
|
246
|
+
contentFit: options?.contentFit ?? 'cover',
|
|
247
|
+
surfaceType: options?.surfaceType ?? 'textureView',
|
|
248
|
+
progress: (0, _reactNativeReanimated.makeMutable)(0),
|
|
249
|
+
landing: false,
|
|
250
|
+
generation: 0
|
|
251
|
+
};
|
|
252
|
+
reg.flights.set(id, flight);
|
|
253
|
+
const status = statusFor(id);
|
|
254
|
+
status.mounted = false;
|
|
255
|
+
status.settled = false;
|
|
256
|
+
status.handedOff = false;
|
|
257
|
+
animate(flight, false);
|
|
258
|
+
publish(reg);
|
|
259
|
+
return awaitSurfaceMount(id);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Resolve once `<MediaFlightLayer>` reports it has committed the surface, or
|
|
264
|
+
* after {@link SURFACE_MOUNT_TIMEOUT_MS} — which is what happens when no layer
|
|
265
|
+
* is mounted at all. Degrading to "carry on without a transition" is right;
|
|
266
|
+
* never resolving would mean an app that forgot one line at its root has a feed
|
|
267
|
+
* whose videos cannot be opened.
|
|
268
|
+
*/
|
|
269
|
+
function awaitSurfaceMount(id) {
|
|
270
|
+
const status = statusFor(id);
|
|
271
|
+
if (status.mounted) return Promise.resolve();
|
|
272
|
+
return new Promise(resolve => {
|
|
273
|
+
status.mountWaiters.push(resolve);
|
|
274
|
+
if (status.mountTimer !== null) return;
|
|
275
|
+
status.mountTimer = setTimeout(() => {
|
|
276
|
+
status.mountTimer = null;
|
|
277
|
+
warnNoLayerMounted();
|
|
278
|
+
resolveMountWaiters(status);
|
|
279
|
+
}, _constants.SURFACE_MOUNT_TIMEOUT_MS);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* The layer calls this from the surface's mount effect. It is the commit signal
|
|
285
|
+
* `flyTo` waits on, and the only thing that makes the ordering contract above
|
|
286
|
+
* true rather than hopeful.
|
|
287
|
+
*/
|
|
288
|
+
function notifySurfaceMounted(id) {
|
|
289
|
+
const status = statusFor(id);
|
|
290
|
+
status.mounted = true;
|
|
291
|
+
resolveMountWaiters(status);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** The layer calls this when a leg's animation finishes. */
|
|
295
|
+
function notifySurfaceSettled(id) {
|
|
296
|
+
const status = statusFor(id);
|
|
297
|
+
status.settled = true;
|
|
298
|
+
if (status.handedOff) releaseFlight(id);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* A destination surface reporting that it is LIVE — it has presented a frame of
|
|
303
|
+
* its own, so the flying copy is now redundant and can go.
|
|
304
|
+
*
|
|
305
|
+
* This is the release condition, and it is deliberately not the animation's
|
|
306
|
+
* clock. Measured against production, a fullscreen video route needs ~1 s from
|
|
307
|
+
* tap to first presented frame; releasing when a ~300 ms animation ends would
|
|
308
|
+
* leave ~700 ms with nothing live on screen — the hole the transition exists to
|
|
309
|
+
* cover, made longer.
|
|
310
|
+
*
|
|
311
|
+
* Wire it by giving the destination's `<MediaSurface>` a `flightId`; it calls
|
|
312
|
+
* this itself on its first frame. A destination that renders something other
|
|
313
|
+
* than a Bloom surface can call it directly.
|
|
314
|
+
*/
|
|
315
|
+
function handOffFlight(id) {
|
|
316
|
+
const reg = registry();
|
|
317
|
+
if (!reg.flights.has(id)) return;
|
|
318
|
+
const status = statusFor(id);
|
|
319
|
+
status.handedOff = true;
|
|
320
|
+
// Mid-flight the surface is still travelling: releasing now would make it
|
|
321
|
+
// vanish somewhere between the two rects. `notifySurfaceSettled` picks it up.
|
|
322
|
+
if (status.settled) releaseFlight(id);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Aim the live surface at its anchor and release it once it lands.
|
|
327
|
+
*
|
|
328
|
+
* With no measurable anchor there is nothing to fly to, so the surface is
|
|
329
|
+
* released immediately — whoever owns the media renders its own copy again at
|
|
330
|
+
* that point, and holding a flying copy over it would double the video.
|
|
331
|
+
*/
|
|
332
|
+
function flyBack(id) {
|
|
333
|
+
const flight = registry().flights.get(id);
|
|
334
|
+
if (!flight) return;
|
|
335
|
+
void measureAnchor(id).then(rect => {
|
|
336
|
+
// Re-read: the flight may have been released or retargeted while the
|
|
337
|
+
// measurement was outstanding (`measureInWindow` is asynchronous on both
|
|
338
|
+
// platforms), and landing a stale record would fly the wrong surface.
|
|
339
|
+
const reg = registry();
|
|
340
|
+
if (reg.flights.get(id) !== flight) return;
|
|
341
|
+
if (rect === null) {
|
|
342
|
+
releaseFlight(id);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const landing = {
|
|
346
|
+
...flight,
|
|
347
|
+
from: interpolateRect(flight.from, flight.to, flight.progress.value),
|
|
348
|
+
to: rect,
|
|
349
|
+
landing: true,
|
|
350
|
+
generation: flight.generation + 1
|
|
351
|
+
};
|
|
352
|
+
reg.flights.set(id, landing);
|
|
353
|
+
animate(landing, true);
|
|
354
|
+
publish(reg);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** Drop the surface for `id`. Called when a landing leg settles, and on teardown. */
|
|
359
|
+
function releaseFlight(id) {
|
|
360
|
+
const reg = registry();
|
|
361
|
+
const status = reg.status.get(id);
|
|
362
|
+
if (status) {
|
|
363
|
+
// A waiter still parked on `flyTo`'s promise would otherwise hang until its
|
|
364
|
+
// own timeout, holding a caller that has nothing left to wait for.
|
|
365
|
+
clearTimers(status);
|
|
366
|
+
resolveMountWaiters(status);
|
|
367
|
+
reg.status.delete(id);
|
|
368
|
+
}
|
|
369
|
+
if (!reg.flights.delete(id)) return;
|
|
370
|
+
publish(reg);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** Test seam — drops every anchor and surface. */
|
|
374
|
+
function resetMediaFlight() {
|
|
375
|
+
const existing = globalThis.__oxyhq_bloom_media_flight__;
|
|
376
|
+
// Timers outlive a registry swap: an unfired mount timeout from the previous
|
|
377
|
+
// suite would warn — and resolve a waiter nobody is holding — inside the next.
|
|
378
|
+
if (existing) for (const status of existing.status.values()) clearTimers(status);
|
|
379
|
+
globalThis.__oxyhq_bloom_media_flight__ = emptyRegistry();
|
|
380
|
+
hasWarnedNoLayer = false;
|
|
381
|
+
}
|
|
382
|
+
let hasWarnedNoLayer = false;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* One warning per module lifetime, and none in production — the same mechanism
|
|
386
|
+
* as the optional-peer boundaries. A missing `<MediaFlightLayer>` is otherwise
|
|
387
|
+
* completely silent: every `flyTo` resolves on its timeout and the app simply
|
|
388
|
+
* never shows a transition, which looks like the feature not being wired rather
|
|
389
|
+
* than the root not being.
|
|
390
|
+
*/
|
|
391
|
+
function warnNoLayerMounted() {
|
|
392
|
+
if (process.env.NODE_ENV === 'production' || hasWarnedNoLayer) return;
|
|
393
|
+
hasWarnedNoLayer = true;
|
|
394
|
+
// eslint-disable-next-line no-console
|
|
395
|
+
console.warn('[Bloom] flyTo() timed out waiting for a media surface to mount. Nothing is ' + 'rendering <MediaFlightLayer>, so no media transition will ever run and a ' + 'video opened from a feed will restart. Mount it ONCE at the app root ' + '(app/_layout.tsx), above the router.');
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** Rect at `t` along `from` → `to`, so a retarget resumes rather than snapping. */
|
|
399
|
+
function interpolateRect(from, to, t) {
|
|
400
|
+
const clamped = t < 0 ? 0 : t > 1 ? 1 : t;
|
|
401
|
+
return {
|
|
402
|
+
x: from.x + (to.x - from.x) * clamped,
|
|
403
|
+
y: from.y + (to.y - from.y) * clamped,
|
|
404
|
+
width: from.width + (to.width - from.width) * clamped,
|
|
405
|
+
height: from.height + (to.height - from.height) * clamped
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Run one leg: 0 → 1 on the flight's own value, and on the shared `progress` a
|
|
411
|
+
* consumer reads.
|
|
412
|
+
*
|
|
413
|
+
* Both are driven with the SAME curve rather than one deriving from the other,
|
|
414
|
+
* because deriving would need a `useAnimatedReaction` — a hook, in a module with
|
|
415
|
+
* no component to hang it on. Two animations on two shared values cost a few
|
|
416
|
+
* bytes on the UI thread and keep the driver at the call site.
|
|
417
|
+
*
|
|
418
|
+
* The springs and the web timings are the media gallery's, imported rather than
|
|
419
|
+
* re-tuned: a flight that lands in the gallery and the gallery's own open
|
|
420
|
+
* transition are the same motion, and two copies of a spring config drift.
|
|
421
|
+
*/
|
|
422
|
+
function animate(flight, landing) {
|
|
423
|
+
const reg = registry();
|
|
424
|
+
const id = flight.id;
|
|
425
|
+
// EVERY leg reports its settlement, because the release condition is now
|
|
426
|
+
// "settled AND the destination is live" and either can arrive first. A
|
|
427
|
+
// `finished === false` callback means the leg was interrupted by a retarget,
|
|
428
|
+
// which owns the surface from then on.
|
|
429
|
+
//
|
|
430
|
+
// A LANDING leg is the one case that releases on its own: it has flown back to
|
|
431
|
+
// its anchor and there is nothing left to cover.
|
|
432
|
+
const onSettled = finished => {
|
|
433
|
+
'worklet';
|
|
434
|
+
|
|
435
|
+
if (finished === false) return;
|
|
436
|
+
(0, _reactNativeReanimated.runOnJS)(landing ? releaseFlight : notifySurfaceSettled)(id);
|
|
437
|
+
};
|
|
438
|
+
flight.progress.value = 0;
|
|
439
|
+
reg.progress.value = 0;
|
|
440
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
441
|
+
const duration = landing ? _constants2.CLOSE_DURATION_WEB : _constants2.OPEN_DURATION_WEB;
|
|
442
|
+
const easing = landing ? _reactNativeReanimated.Easing.in(_reactNativeReanimated.Easing.cubic) : _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic);
|
|
443
|
+
flight.progress.value = (0, _reactNativeReanimated.withTiming)(1, {
|
|
444
|
+
duration,
|
|
445
|
+
easing
|
|
446
|
+
}, onSettled);
|
|
447
|
+
reg.progress.value = (0, _reactNativeReanimated.withTiming)(1, {
|
|
448
|
+
duration,
|
|
449
|
+
easing
|
|
450
|
+
});
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const spring = landing ? _constants2.CLOSE_SPRING : _constants2.OPEN_SPRING;
|
|
454
|
+
flight.progress.value = (0, _reactNativeReanimated.withSpring)(1, spring, onSettled);
|
|
455
|
+
reg.progress.value = (0, _reactNativeReanimated.withSpring)(1, spring);
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeReanimated","_index","_constants","_constants2","DEFAULT_FLIGHT_CORNER_RADIUS","exports","RADIUS","emptyRegistry","anchors","Map","flights","status","listeners","Set","snapshot","progress","makeMutable","statusFor","id","reg","registry","get","mounted","settled","handedOff","mountWaiters","mountTimer","set","clearTimers","clearTimeout","resolveMountWaiters","waiters","waiter","globalThis","__oxyhq_bloom_media_flight__","publish","values","listener","subscribeToFlights","add","delete","getFlights","flightProgress","registerAnchor","node","measureAnchor","Promise","resolve","measureInWindow","x","y","width","height","hasFlight","has","flyTo","rect","content","options","existing","next","from","interpolateRect","to","value","cornerRadius","contentFit","surfaceType","landing","generation","retargeted","animate","awaitSurfaceMount","flight","push","setTimeout","warnNoLayerMounted","SURFACE_MOUNT_TIMEOUT_MS","notifySurfaceMounted","notifySurfaceSettled","releaseFlight","handOffFlight","flyBack","then","resetMediaFlight","hasWarnedNoLayer","process","env","NODE_ENV","console","warn","t","clamped","onSettled","finished","runOnJS","Platform","OS","duration","CLOSE_DURATION_WEB","OPEN_DURATION_WEB","easing","Easing","in","cubic","out","withTiming","spring","CLOSE_SPRING","OPEN_SPRING","withSpring"],"sourceRoot":"../../../src","sources":["media-flight/store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,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMediaFlight = useMediaFlight;
|
|
7
|
+
var _store = require("./store.js");
|
|
8
|
+
/**
|
|
9
|
+
* The consumer-facing handle on the flight layer.
|
|
10
|
+
*
|
|
11
|
+
* Every member is a module-level function over a `globalThis`-anchored registry,
|
|
12
|
+
* so the object is a frozen constant rather than something rebuilt per render:
|
|
13
|
+
* a caller may hold it in a dependency array, a callback ref or a gesture
|
|
14
|
+
* closure without any of them going stale, and there is no provider to mount.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `flyTo` / `flyBack` / `registerAnchor` / `measureAnchor`, plus the shared
|
|
19
|
+
* `progress` value of the most recent leg.
|
|
20
|
+
*
|
|
21
|
+
* `progress` is resolved through a getter rather than captured at module load,
|
|
22
|
+
* because `resetMediaFlight()` (the test seam) replaces the registry — a
|
|
23
|
+
* captured value would keep pointing at the discarded one and every assertion
|
|
24
|
+
* about progress would read a box nothing writes.
|
|
25
|
+
*/
|
|
26
|
+
const controller = Object.freeze({
|
|
27
|
+
registerAnchor: _store.registerAnchor,
|
|
28
|
+
measureAnchor: _store.measureAnchor,
|
|
29
|
+
flyTo: _store.flyTo,
|
|
30
|
+
flyBack: _store.flyBack,
|
|
31
|
+
handOff: _store.handOffFlight,
|
|
32
|
+
get progress() {
|
|
33
|
+
return (0, _store.flightProgress)();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** The media-flight controller. Stable for the life of the bundle. */
|
|
38
|
+
function useMediaFlight() {
|
|
39
|
+
return controller;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=use-media-flight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_store","require","controller","Object","freeze","registerAnchor","measureAnchor","flyTo","flyBack","handOff","handOffFlight","progress","flightProgress","useMediaFlight"],"sourceRoot":"../../../src","sources":["media-flight/use-media-flight.ts"],"mappings":";;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAiC,GAAGC,MAAM,CAACC,MAAM,CAAC;EACtDC,cAAc,EAAdA,qBAAc;EACdC,aAAa,EAAbA,oBAAa;EACbC,KAAK,EAALA,YAAK;EACLC,OAAO,EAAPA,cAAO;EACPC,OAAO,EAAEC,oBAAa;EACtB,IAAIC,QAAQA,CAAA,EAAG;IACb,OAAO,IAAAC,qBAAc,EAAC,CAAC;EACzB;AACF,CAAC,CAAC;;AAEF;AACO,SAASC,cAAcA,CAAA,EAA0B;EACtD,OAAOX,UAAU;AACnB","ignoreList":[]}
|
|
@@ -245,7 +245,7 @@ function TabBarBody({
|
|
|
245
245
|
// never minimize and the highlight would never move, with no error anywhere.
|
|
246
246
|
// Native (plugin present) auto-tracks and ignores the extra deps, so listing
|
|
247
247
|
// them is correct on both platforms. Same rule as `BottomSheetBase` and
|
|
248
|
-
// `
|
|
248
|
+
// `ZoomableMediaGallery`. Do NOT strip these.
|
|
249
249
|
const barStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
250
250
|
const height = (0, _reactNativeReanimated.interpolate)(progress.value, [0, 1], [_shared.EXPANDED_HEIGHT, _shared.MINIMIZED_HEIGHT], _reactNativeReanimated.Extrapolation.CLAMP);
|
|
251
251
|
// Revolut-style: the pill shrinks in both dimensions.
|