@xhub-reels/sdk 0.2.13 → 0.2.15
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/dist/index.cjs +13 -7
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +13 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2927,10 +2927,13 @@ function ReelsFeedThumbnail({
|
|
|
2927
2927
|
prewarmOnClick = true,
|
|
2928
2928
|
getKey
|
|
2929
2929
|
}) {
|
|
2930
|
-
const { items, loading, error, refresh } = useFeed();
|
|
2930
|
+
const { items, loading, error, refresh, loadInitial } = useFeed();
|
|
2931
2931
|
const { setFocusedIndexImmediate } = useResource();
|
|
2932
2932
|
const { open } = useNavigation();
|
|
2933
2933
|
const { adapters } = useSDK();
|
|
2934
|
+
react.useEffect(() => {
|
|
2935
|
+
loadInitial();
|
|
2936
|
+
}, [loadInitial]);
|
|
2934
2937
|
const prefetchedRef = react.useRef(/* @__PURE__ */ new Set());
|
|
2935
2938
|
const prewarm = react.useCallback(
|
|
2936
2939
|
(item) => {
|
|
@@ -3008,15 +3011,18 @@ var DEFAULT_EASING = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
|
3008
3011
|
var DEFAULT_DIRECTION = "up";
|
|
3009
3012
|
var DEFAULT_Z_INDEX = 1e3;
|
|
3010
3013
|
var DEFAULT_PREWARM_FORWARD = 2;
|
|
3014
|
+
var RESTING_TRANSFORM = "translate(0, 0)";
|
|
3011
3015
|
function offscreenTransform(direction) {
|
|
3012
3016
|
switch (direction) {
|
|
3013
3017
|
case "down":
|
|
3014
|
-
return "
|
|
3018
|
+
return "translate(0, -100%)";
|
|
3019
|
+
case "right-to-left":
|
|
3020
|
+
return "translate(100%, 0)";
|
|
3015
3021
|
case "fade":
|
|
3016
|
-
return
|
|
3022
|
+
return RESTING_TRANSFORM;
|
|
3017
3023
|
case "up":
|
|
3018
3024
|
default:
|
|
3019
|
-
return "
|
|
3025
|
+
return "translate(0, 100%)";
|
|
3020
3026
|
}
|
|
3021
3027
|
}
|
|
3022
3028
|
function prefersReducedMotion() {
|
|
@@ -3099,7 +3105,7 @@ function ReelsModal({
|
|
|
3099
3105
|
const reduce = prefersReducedMotion();
|
|
3100
3106
|
const enter = phase === "opening";
|
|
3101
3107
|
const offscreen2 = offscreenTransform(direction);
|
|
3102
|
-
const panelFrames = direction === "fade" ? enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }] : enter ? [{ transform: offscreen2 }, { transform:
|
|
3108
|
+
const panelFrames = direction === "fade" ? enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }] : enter ? [{ transform: offscreen2 }, { transform: RESTING_TRANSFORM }] : [{ transform: RESTING_TRANSFORM }, { transform: offscreen2 }];
|
|
3103
3109
|
const backdropFrames = enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }];
|
|
3104
3110
|
const animDuration = reduce ? 0 : duration;
|
|
3105
3111
|
let cancelled = false;
|
|
@@ -3125,7 +3131,7 @@ function ReelsModal({
|
|
|
3125
3131
|
if (cancelled) return;
|
|
3126
3132
|
if (enter) {
|
|
3127
3133
|
if (direction === "fade") panel.style.opacity = "1";
|
|
3128
|
-
else panel.style.transform =
|
|
3134
|
+
else panel.style.transform = RESTING_TRANSFORM;
|
|
3129
3135
|
if (backdrop) backdrop.style.opacity = "1";
|
|
3130
3136
|
} else {
|
|
3131
3137
|
if (direction === "fade") panel.style.opacity = "0";
|
|
@@ -3207,7 +3213,7 @@ function ReelsModal({
|
|
|
3207
3213
|
if (!target) return null;
|
|
3208
3214
|
const enterStart = phase === "opening";
|
|
3209
3215
|
const offscreen = offscreenTransform(direction);
|
|
3210
|
-
const panelInitialTransform = direction === "fade" ?
|
|
3216
|
+
const panelInitialTransform = direction === "fade" ? RESTING_TRANSFORM : enterStart ? offscreen : RESTING_TRANSFORM;
|
|
3211
3217
|
const panelInitialOpacity = direction === "fade" ? enterStart ? 0 : 1 : 1;
|
|
3212
3218
|
const backdropInitialOpacity = enterStart ? 0 : 1;
|
|
3213
3219
|
const rootStyle = {
|
package/dist/index.d.cts
CHANGED
|
@@ -955,11 +955,15 @@ interface ReelsModalAnimationConfig {
|
|
|
955
955
|
easing?: string;
|
|
956
956
|
/**
|
|
957
957
|
* Panel travel direction:
|
|
958
|
-
* - 'up'
|
|
959
|
-
*
|
|
960
|
-
* - '
|
|
958
|
+
* - 'up' (default): slides up from the bottom edge (bottom-sheet drawer).
|
|
959
|
+
* Exit: slides down back to the bottom edge.
|
|
960
|
+
* - 'down': slides down from the top edge. Exit: slides up.
|
|
961
|
+
* - 'right-to-left': slides in from the right edge (motion goes right→left).
|
|
962
|
+
* Exit: slides back out to the right edge (motion goes left→right) — the
|
|
963
|
+
* panel returns to where it came from, like a side drawer.
|
|
964
|
+
* - 'fade': no translate, opacity only.
|
|
961
965
|
*/
|
|
962
|
-
direction?: 'up' | 'down' | 'fade';
|
|
966
|
+
direction?: 'up' | 'down' | 'right-to-left' | 'fade';
|
|
963
967
|
}
|
|
964
968
|
/** State handed to render-prop customisation callbacks. */
|
|
965
969
|
interface ReelsModalRenderState {
|
package/dist/index.d.ts
CHANGED
|
@@ -955,11 +955,15 @@ interface ReelsModalAnimationConfig {
|
|
|
955
955
|
easing?: string;
|
|
956
956
|
/**
|
|
957
957
|
* Panel travel direction:
|
|
958
|
-
* - 'up'
|
|
959
|
-
*
|
|
960
|
-
* - '
|
|
958
|
+
* - 'up' (default): slides up from the bottom edge (bottom-sheet drawer).
|
|
959
|
+
* Exit: slides down back to the bottom edge.
|
|
960
|
+
* - 'down': slides down from the top edge. Exit: slides up.
|
|
961
|
+
* - 'right-to-left': slides in from the right edge (motion goes right→left).
|
|
962
|
+
* Exit: slides back out to the right edge (motion goes left→right) — the
|
|
963
|
+
* panel returns to where it came from, like a side drawer.
|
|
964
|
+
* - 'fade': no translate, opacity only.
|
|
961
965
|
*/
|
|
962
|
-
direction?: 'up' | 'down' | 'fade';
|
|
966
|
+
direction?: 'up' | 'down' | 'right-to-left' | 'fade';
|
|
963
967
|
}
|
|
964
968
|
/** State handed to render-prop customisation callbacks. */
|
|
965
969
|
interface ReelsModalRenderState {
|
package/dist/index.js
CHANGED
|
@@ -2921,10 +2921,13 @@ function ReelsFeedThumbnail({
|
|
|
2921
2921
|
prewarmOnClick = true,
|
|
2922
2922
|
getKey
|
|
2923
2923
|
}) {
|
|
2924
|
-
const { items, loading, error, refresh } = useFeed();
|
|
2924
|
+
const { items, loading, error, refresh, loadInitial } = useFeed();
|
|
2925
2925
|
const { setFocusedIndexImmediate } = useResource();
|
|
2926
2926
|
const { open } = useNavigation();
|
|
2927
2927
|
const { adapters } = useSDK();
|
|
2928
|
+
useEffect(() => {
|
|
2929
|
+
loadInitial();
|
|
2930
|
+
}, [loadInitial]);
|
|
2928
2931
|
const prefetchedRef = useRef(/* @__PURE__ */ new Set());
|
|
2929
2932
|
const prewarm = useCallback(
|
|
2930
2933
|
(item) => {
|
|
@@ -3002,15 +3005,18 @@ var DEFAULT_EASING = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
|
3002
3005
|
var DEFAULT_DIRECTION = "up";
|
|
3003
3006
|
var DEFAULT_Z_INDEX = 1e3;
|
|
3004
3007
|
var DEFAULT_PREWARM_FORWARD = 2;
|
|
3008
|
+
var RESTING_TRANSFORM = "translate(0, 0)";
|
|
3005
3009
|
function offscreenTransform(direction) {
|
|
3006
3010
|
switch (direction) {
|
|
3007
3011
|
case "down":
|
|
3008
|
-
return "
|
|
3012
|
+
return "translate(0, -100%)";
|
|
3013
|
+
case "right-to-left":
|
|
3014
|
+
return "translate(100%, 0)";
|
|
3009
3015
|
case "fade":
|
|
3010
|
-
return
|
|
3016
|
+
return RESTING_TRANSFORM;
|
|
3011
3017
|
case "up":
|
|
3012
3018
|
default:
|
|
3013
|
-
return "
|
|
3019
|
+
return "translate(0, 100%)";
|
|
3014
3020
|
}
|
|
3015
3021
|
}
|
|
3016
3022
|
function prefersReducedMotion() {
|
|
@@ -3093,7 +3099,7 @@ function ReelsModal({
|
|
|
3093
3099
|
const reduce = prefersReducedMotion();
|
|
3094
3100
|
const enter = phase === "opening";
|
|
3095
3101
|
const offscreen2 = offscreenTransform(direction);
|
|
3096
|
-
const panelFrames = direction === "fade" ? enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }] : enter ? [{ transform: offscreen2 }, { transform:
|
|
3102
|
+
const panelFrames = direction === "fade" ? enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }] : enter ? [{ transform: offscreen2 }, { transform: RESTING_TRANSFORM }] : [{ transform: RESTING_TRANSFORM }, { transform: offscreen2 }];
|
|
3097
3103
|
const backdropFrames = enter ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }];
|
|
3098
3104
|
const animDuration = reduce ? 0 : duration;
|
|
3099
3105
|
let cancelled = false;
|
|
@@ -3119,7 +3125,7 @@ function ReelsModal({
|
|
|
3119
3125
|
if (cancelled) return;
|
|
3120
3126
|
if (enter) {
|
|
3121
3127
|
if (direction === "fade") panel.style.opacity = "1";
|
|
3122
|
-
else panel.style.transform =
|
|
3128
|
+
else panel.style.transform = RESTING_TRANSFORM;
|
|
3123
3129
|
if (backdrop) backdrop.style.opacity = "1";
|
|
3124
3130
|
} else {
|
|
3125
3131
|
if (direction === "fade") panel.style.opacity = "0";
|
|
@@ -3201,7 +3207,7 @@ function ReelsModal({
|
|
|
3201
3207
|
if (!target) return null;
|
|
3202
3208
|
const enterStart = phase === "opening";
|
|
3203
3209
|
const offscreen = offscreenTransform(direction);
|
|
3204
|
-
const panelInitialTransform = direction === "fade" ?
|
|
3210
|
+
const panelInitialTransform = direction === "fade" ? RESTING_TRANSFORM : enterStart ? offscreen : RESTING_TRANSFORM;
|
|
3205
3211
|
const panelInitialOpacity = direction === "fade" ? enterStart ? 0 : 1 : 1;
|
|
3206
3212
|
const backdropInitialOpacity = enterStart ? 0 : 1;
|
|
3207
3213
|
const rootStyle = {
|