@ankhorage/zora 28.6.1 → 28.6.3
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/features/carousel/Carousel.d.ts.map +1 -1
- package/dist/features/carousel/Carousel.js +10 -6
- package/dist/features/carousel/Carousel.js.map +1 -1
- package/package.json +2 -2
- package/src/features/carousel/Carousel.test.ts +42 -0
- package/src/features/carousel/Carousel.tsx +24 -19
- package/web-dist/components/carousel/Carousel.js +13 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 28.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5ee98b5: Update dependencies: `@ankhorage/runtime`.
|
|
8
|
+
|
|
9
|
+
## 28.6.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 53bb42c: Fix Carousel fade animations restarting from opacity 0 when image readiness changes by giving layers a stable transition-completion callback.
|
|
14
|
+
|
|
3
15
|
## 28.6.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# ZORA
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Provides opinionated React Native and React Native Web UI components, theme primitives, registries, and reader surfaces built on @ankhorage/surface.
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../src/features/carousel/Carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,sBAAsB,CAAC;AAI7F;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,UAAU,EACV,UAAmB,EACnB,eAAsB,EACtB,cAAoB,EACpB,YAAmB,EACnB,cAAsB,EACtB,aAAa,EACb,YAAmB,EACnB,cAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,UAAkB,EAClB,cAAsB,EACtB,aAAgC,EAChC,SAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,UAAoB,EACpB,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,GACP,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../src/features/carousel/Carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAqC,MAAM,sBAAsB,CAAC;AAI7F;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,UAAU,EACV,UAAmB,EACnB,eAAsB,EACtB,cAAoB,EACpB,YAAmB,EACnB,cAAsB,EACtB,aAAa,EACb,YAAmB,EACnB,cAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,UAAkB,EAClB,cAAsB,EACtB,aAAgC,EAChC,SAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,UAAoB,EACpB,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,GACP,EAAE,aAAa,4BAuJf"}
|
|
@@ -36,14 +36,18 @@ export function Carousel({ slides, index, defaultIndex, onIndexChange, autoPlay,
|
|
|
36
36
|
setMountedSlideKeys((current) => ensureMountedSlide(current, nextSlideKey));
|
|
37
37
|
}
|
|
38
38
|
}, [activeSlideKey, nextSlideKey]);
|
|
39
|
+
const transitionStateRef = React.useRef({ activeSlideKey, nextSlideKey, readySlideKeys });
|
|
40
|
+
React.useLayoutEffect(() => {
|
|
41
|
+
transitionStateRef.current = { activeSlideKey, nextSlideKey, readySlideKeys };
|
|
42
|
+
}, [activeSlideKey, nextSlideKey, readySlideKeys]);
|
|
43
|
+
// Stable identity: layers run animations from effects, so a changing callback would restart them.
|
|
39
44
|
const completeTransition = React.useCallback((completedSlideKey) => {
|
|
40
|
-
|
|
45
|
+
const { activeSlideKey: currentKey, nextSlideKey: currentNextKey, readySlideKeys: ready, } = transitionStateRef.current;
|
|
46
|
+
if (!currentKey || completedSlideKey !== currentKey)
|
|
41
47
|
return;
|
|
42
|
-
const transitionRetentionKeys = [
|
|
43
|
-
setMountedSlideKeys((current) => new Set(transitionRetentionKeys.filter((slideKey) => slideKey ===
|
|
44
|
-
|
|
45
|
-
readySlideKeys.has(activeSlideKey))));
|
|
46
|
-
}, [activeSlideKey, nextSlideKey, readySlideKeys]);
|
|
48
|
+
const transitionRetentionKeys = [currentKey, currentNextKey].filter((slideKey) => slideKey !== undefined);
|
|
49
|
+
setMountedSlideKeys((current) => new Set(transitionRetentionKeys.filter((slideKey) => slideKey === currentKey || current.has(slideKey) || ready.has(currentKey))));
|
|
50
|
+
}, []);
|
|
47
51
|
if (slides.length === 0)
|
|
48
52
|
return null;
|
|
49
53
|
const canPrevious = enabledLoop || activeIndex > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../../../src/features/carousel/Carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1F,OAAO,EAA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E,EAAE;QACR,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;QAC/B,UAAU,EAAE,QAAQ;KACrB;IACD,OAAO,EAAE;QACP,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,aAAa,EAAE,KAAK;QACpB,GAAG,EAAE,EAAE;QACP,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;IACzC,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;CACrF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Animated, Easing, Image, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport type { CarouselProps, CarouselSlide, CarouselTransition } from '../../types/carousel';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { useCarouselPlayback } from './useCarouselPlayback';\n\n/***\n * Present images, arbitrary React content, or both as a cross-platform slideshow.\n * A published web artifact exposes the same API without consumer source imports.\n */\nexport function Carousel({\n slides,\n index,\n defaultIndex,\n onIndexChange,\n autoPlay,\n paused,\n loop,\n intervalMs,\n transition = 'fade',\n enterDurationMs = 1200,\n exitDurationMs = 800,\n initialScale = 1.06,\n animateOnMount = false,\n reducedMotion,\n showProgress = true,\n progressHeight = 4,\n progressTrackColor,\n progressIndicatorColor,\n progressTrackStyle,\n progressIndicatorStyle,\n showArrows = false,\n showIndicators = false,\n previousLabel = 'Previous slide',\n nextLabel = 'Next slide',\n controlColor,\n controlBackgroundColor,\n controlsStyle,\n activeIndicatorColor,\n inactiveIndicatorColor,\n indicatorsStyle,\n resizeMode = 'cover',\n imageStyle,\n style,\n renderImage,\n testID,\n}: CarouselProps) {\n const { theme } = useZoraTheme();\n const [width, setWidth] = React.useState(0);\n const initialIndex = normalizeSlideIndex(index ?? defaultIndex ?? 0, slides.length);\n const initialSlide = slides.at(initialIndex);\n const [mountedSlideKeys, setMountedSlideKeys] = React.useState<ReadonlySet<string>>(() =>\n initialSlide ? new Set([initialSlide.key]) : new Set(),\n );\n const [readySlideKeys, setReadySlideKeys] = React.useState<ReadonlySet<string>>(() => new Set());\n const {\n activeIndex,\n controlledWithoutHandler,\n direction,\n loop: enabledLoop,\n navigate,\n progress,\n shouldReduceMotion,\n } = useCarouselPlayback({\n slides,\n index,\n defaultIndex,\n onIndexChange,\n autoPlay,\n paused,\n loop,\n intervalMs,\n reducedMotion,\n });\n\n const activeSlide = slides.at(activeIndex);\n const nextIndex = getNextSlideIndex(activeIndex, slides.length, enabledLoop);\n const nextSlide = nextIndex === undefined ? undefined : slides.at(nextIndex);\n const activeSlideKey = activeSlide?.key;\n const nextSlideKey = nextSlide?.key;\n const mountedKeys = ensureMountedSlide(\n ensureMountedSlide(mountedSlideKeys, activeSlideKey),\n getPreloadedSlideKey(activeSlideKey, nextSlideKey, readySlideKeys),\n );\n\n const markSlideLoaded = React.useCallback(\n (slideKey: string) => {\n setReadySlideKeys((current) => ensureMountedSlide(current, slideKey));\n if (slideKey === activeSlideKey) {\n setMountedSlideKeys((current) => ensureMountedSlide(current, nextSlideKey));\n }\n },\n [activeSlideKey, nextSlideKey],\n );\n\n const completeTransition = React.useCallback(\n (completedSlideKey: string) => {\n if (!activeSlideKey || completedSlideKey !== activeSlideKey) return;\n const transitionRetentionKeys = [activeSlideKey, nextSlideKey].filter(\n (slideKey): slideKey is string => slideKey !== undefined,\n );\n setMountedSlideKeys(\n (current) =>\n new Set(\n transitionRetentionKeys.filter(\n (slideKey) =>\n slideKey === activeSlideKey ||\n current.has(slideKey) ||\n readySlideKeys.has(activeSlideKey),\n ),\n ),\n );\n },\n [activeSlideKey, nextSlideKey, readySlideKeys],\n );\n\n if (slides.length === 0) return null;\n\n const canPrevious = enabledLoop || activeIndex > 0;\n const canNext = enabledLoop || activeIndex < slides.length - 1;\n const markerColor = activeIndicatorColor ?? theme.colors.primary;\n const idleMarkerColor = inactiveIndicatorColor ?? theme.semantics.neutral.divider;\n\n return (\n <View\n onLayout={(event) => setWidth(event.nativeEvent.layout.width)}\n testID={testID}\n style={[{ position: 'relative', overflow: 'hidden', width: '100%', height: '100%' }, style]}\n >\n {slides.flatMap((slide, slideIndex) =>\n mountedKeys.has(slide.key)\n ? [\n <CarouselLayer\n key={slide.key}\n active={activeIndex === slideIndex}\n animate={slides.length > 1}\n animateOnMount={animateOnMount || activeIndex !== initialIndex}\n direction={direction}\n enterDurationMs={enterDurationMs}\n exitDurationMs={exitDurationMs}\n imageStyle={imageStyle}\n initialScale={initialScale}\n onImageLoad={() => markSlideLoaded(slide.key)}\n onTransitionComplete={completeTransition}\n reducedMotion={shouldReduceMotion}\n renderImage={renderImage}\n resizeMode={resizeMode}\n slide={slide}\n slideIndex={slideIndex}\n transition={transition}\n width={width}\n />,\n ]\n : [],\n )}\n <CarouselControls\n activeIndex={activeIndex}\n canNext={canNext}\n canPrevious={canPrevious}\n controlBackgroundColor={controlBackgroundColor ?? theme.semantics.surface.raised}\n controlColor={controlColor ?? theme.semantics.content.default}\n controlledWithoutHandler={controlledWithoutHandler}\n controlsStyle={controlsStyle}\n navigate={navigate}\n nextLabel={nextLabel}\n previousLabel={previousLabel}\n show={showArrows && slides.length > 1}\n testID={testID}\n />\n <CarouselIndicators\n activeIndex={activeIndex}\n activeColor={markerColor}\n controlledWithoutHandler={controlledWithoutHandler}\n idleColor={idleMarkerColor}\n indicatorsStyle={indicatorsStyle}\n navigate={navigate}\n show={showIndicators && slides.length > 1}\n slides={slides}\n testID={testID}\n />\n <CarouselProgress\n height={progressHeight}\n indicatorColor={progressIndicatorColor ?? theme.colors.primary}\n indicatorStyle={progressIndicatorStyle}\n progress={progress}\n show={showProgress && slides.length > 1}\n testID={testID}\n trackColor={progressTrackColor ?? theme.semantics.neutral.divider}\n trackStyle={progressTrackStyle}\n />\n </View>\n );\n}\n\ninterface CarouselLayerProps {\n readonly enterDurationMs?: CarouselProps['enterDurationMs'];\n readonly exitDurationMs?: CarouselProps['exitDurationMs'];\n readonly imageStyle: CarouselProps['imageStyle'];\n readonly initialScale?: CarouselProps['initialScale'];\n readonly onImageLoad: () => void;\n readonly onTransitionComplete: (slideKey: string) => void;\n readonly renderImage: CarouselProps['renderImage'];\n readonly resizeMode: CarouselProps['resizeMode'];\n readonly slide: CarouselSlide;\n readonly slideIndex: number;\n readonly active: boolean;\n readonly animate: boolean;\n readonly animateOnMount: boolean;\n readonly direction: 1 | -1;\n readonly width: number;\n readonly transition: CarouselTransition;\n readonly reducedMotion: boolean;\n}\n\n/*** Keep departing slides mounted for an animated overlap without unmounting content. */\nfunction CarouselLayer({\n slide,\n slideIndex,\n active,\n animate,\n animateOnMount,\n direction,\n enterDurationMs = 1200,\n exitDurationMs = 800,\n initialScale = 1.06,\n onImageLoad,\n onTransitionComplete,\n reducedMotion,\n renderImage,\n resizeMode,\n imageStyle,\n transition,\n width,\n}: CarouselLayerProps) {\n const [opacity] = React.useState(() => new Animated.Value(active && !animateOnMount ? 1 : 0));\n const [scale] = React.useState(\n () => new Animated.Value(active && animateOnMount ? initialScale : 1),\n );\n const [offset] = React.useState(() => new Animated.Value(0));\n const hasMounted = React.useRef(false);\n const widthRef = React.useRef(width);\n\n React.useEffect(() => {\n widthRef.current = width;\n }, [width]);\n\n React.useEffect(() => {\n const firstRender = !hasMounted.current;\n hasMounted.current = true;\n if (firstRender && !animateOnMount) return;\n opacity.stopAnimation();\n scale.stopAnimation();\n offset.stopAnimation();\n if (!animate || reducedMotion || transition === 'none') {\n opacity.setValue(active ? 1 : 0);\n scale.setValue(1);\n offset.setValue(0);\n if (active) onTransitionComplete(slide.key);\n return;\n }\n if (transition === 'slide') {\n scale.setValue(1);\n if (active) {\n offset.setValue(direction * widthRef.current);\n opacity.setValue(1);\n }\n Animated.parallel([\n Animated.timing(offset, {\n toValue: active ? 0 : -direction * widthRef.current,\n duration: Math.max(0, active ? enterDurationMs : exitDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: active ? 1 : 0,\n duration: Math.max(0, active ? enterDurationMs : exitDurationMs),\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n ]).start(({ finished }) => {\n if (active && finished) onTransitionComplete(slide.key);\n });\n } else if (active) {\n opacity.setValue(0);\n scale.setValue(initialScale);\n Animated.parallel([\n Animated.timing(opacity, {\n toValue: 1,\n duration: Math.max(0, enterDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n Animated.timing(scale, {\n toValue: 1,\n duration: Math.max(0, enterDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n ]).start(({ finished }) => {\n if (finished) onTransitionComplete(slide.key);\n });\n } else {\n Animated.timing(opacity, {\n toValue: 0,\n duration: Math.max(0, exitDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }).start();\n }\n return () => {\n opacity.stopAnimation();\n scale.stopAnimation();\n offset.stopAnimation();\n };\n }, [\n active,\n animate,\n animateOnMount,\n direction,\n enterDurationMs,\n exitDurationMs,\n initialScale,\n offset,\n opacity,\n reducedMotion,\n scale,\n transition,\n onTransitionComplete,\n slide.key,\n ]);\n\n return (\n <Animated.View\n accessibilityElementsHidden={!active}\n importantForAccessibility={active ? 'auto' : 'no-hide-descendants'}\n pointerEvents={active ? 'auto' : 'none'}\n style={[StyleSheet.absoluteFill, { opacity, transform: [{ scale }, { translateX: offset }] }]}\n >\n {slide.source !== undefined ? (\n renderImage ? (\n renderCarouselImage(renderImage(slide, slideIndex), onImageLoad)\n ) : (\n <Image\n accessibilityLabel={slide.alt}\n accessible={Boolean(slide.alt)}\n resizeMode={resizeMode}\n source={typeof slide.source === 'string' ? { uri: slide.source } : slide.source}\n style={[StyleSheet.absoluteFill, imageStyle]}\n onLoad={onImageLoad}\n />\n )\n ) : null}\n {slide.content}\n </Animated.View>\n );\n}\n\n/*** Retain consumer image behavior while observing readiness for adjacent-slide preloading. */\nfunction renderCarouselImage(image: React.ReactNode, onImageLoad: () => void): React.ReactNode {\n if (!React.isValidElement<{ onLoad?: (event: unknown) => void }>(image)) return image;\n const existingOnLoad = image.props.onLoad;\n return React.cloneElement(image, {\n onLoad: (event: unknown) => {\n existingOnLoad?.(event);\n onImageLoad();\n },\n });\n}\n\n/*** Return an immutable mounted-key set containing one requested slide. */\nfunction ensureMountedSlide(mountedSlideKeys: ReadonlySet<string>, slideKey: string | undefined) {\n if (!slideKey || mountedSlideKeys.has(slideKey)) return mountedSlideKeys;\n return new Set([...mountedSlideKeys, slideKey]);\n}\n\n/*** Return the next slide key only after the active slide image is ready. */\nfunction getPreloadedSlideKey(\n activeSlideKey: string | undefined,\n nextSlideKey: string | undefined,\n readySlideKeys: ReadonlySet<string>,\n) {\n if (!activeSlideKey || !readySlideKeys.has(activeSlideKey)) return undefined;\n return nextSlideKey;\n}\n\n/*** Resolve the slide to preload without wrapping when looping is disabled. */\nfunction getNextSlideIndex(index: number, length: number, loop: boolean): number | undefined {\n if (length < 2 || (!loop && index === length - 1)) return undefined;\n return (index + 1) % length;\n}\n\n/*** Clamp the initial server-rendered slide to the available slide collection. */\nfunction normalizeSlideIndex(index: number, length: number): number {\n if (length === 0) return 0;\n return Math.min(Math.max(Math.trunc(index), 0), length - 1);\n}\n\ninterface CarouselNavigationProps {\n readonly activeIndex: number;\n readonly navigate: (index: number, direction: 1 | -1) => void;\n readonly controlledWithoutHandler: boolean;\n readonly testID: CarouselProps['testID'];\n}\n\ninterface CarouselControlsProps extends CarouselNavigationProps {\n readonly show: boolean;\n readonly canPrevious: boolean;\n readonly canNext: boolean;\n readonly previousLabel: string;\n readonly nextLabel: string;\n readonly controlColor: string;\n readonly controlBackgroundColor: string;\n readonly controlsStyle: CarouselProps['controlsStyle'];\n}\n\n/*** Render optional previous/next buttons without coupling the slide content to navigation. */\nfunction CarouselControls({\n activeIndex,\n canNext,\n canPrevious,\n controlBackgroundColor,\n controlColor,\n controlledWithoutHandler,\n controlsStyle,\n navigate,\n nextLabel,\n previousLabel,\n show,\n testID,\n}: CarouselControlsProps) {\n if (!show) return null;\n const buttonStyle = [styles.control, { backgroundColor: controlBackgroundColor }];\n const labelStyle = { color: controlColor, fontSize: 30 };\n return (\n <View pointerEvents=\"box-none\" style={[styles.controls, controlsStyle]}>\n <Pressable\n accessibilityLabel={previousLabel}\n accessibilityRole=\"button\"\n disabled={!canPrevious || controlledWithoutHandler}\n onPress={() => navigate(activeIndex - 1, -1)}\n style={buttonStyle}\n testID={testID ? `${testID}-previous` : undefined}\n >\n <Text style={labelStyle}>{'‹'}</Text>\n </Pressable>\n <Pressable\n accessibilityLabel={nextLabel}\n accessibilityRole=\"button\"\n disabled={!canNext || controlledWithoutHandler}\n onPress={() => navigate(activeIndex + 1, 1)}\n style={buttonStyle}\n testID={testID ? `${testID}-next` : undefined}\n >\n <Text style={labelStyle}>{'›'}</Text>\n </Pressable>\n </View>\n );\n}\n\ninterface CarouselIndicatorsProps extends CarouselNavigationProps {\n readonly show: boolean;\n readonly slides: CarouselProps['slides'];\n readonly activeColor: string;\n readonly idleColor: string;\n readonly indicatorsStyle: CarouselProps['indicatorsStyle'];\n}\n\n/*** Render accessible selection dots for the currently controlled slide. */\nfunction CarouselIndicators({\n activeIndex,\n activeColor,\n controlledWithoutHandler,\n idleColor,\n indicatorsStyle,\n navigate,\n show,\n slides,\n testID,\n}: CarouselIndicatorsProps) {\n if (!show) return null;\n return (\n <View pointerEvents=\"box-none\" style={[styles.indicators, indicatorsStyle]}>\n {slides.map((slide, slideIndex) => (\n <Pressable\n key={slide.key}\n accessibilityLabel={`Go to slide ${slideIndex + 1} of ${slides.length}`}\n accessibilityRole=\"button\"\n accessibilityState={{ selected: slideIndex === activeIndex }}\n disabled={controlledWithoutHandler}\n onPress={() => navigate(slideIndex, slideIndex < activeIndex ? -1 : 1)}\n style={[\n styles.indicator,\n {\n backgroundColor: slideIndex === activeIndex ? activeColor : idleColor,\n width: slideIndex === activeIndex ? 24 : 8,\n },\n ]}\n testID={testID ? `${testID}-indicator-${slideIndex}` : undefined}\n />\n ))}\n </View>\n );\n}\n\ninterface CarouselProgressProps {\n readonly show: boolean;\n readonly height: number;\n readonly trackColor: string;\n readonly indicatorColor: string;\n readonly trackStyle: CarouselProps['progressTrackStyle'];\n readonly indicatorStyle: CarouselProps['progressIndicatorStyle'];\n readonly progress: Animated.Value;\n readonly testID: CarouselProps['testID'];\n}\n\n/*** Render an optional linear autoplay timer without adding any required UI to slides. */\nfunction CarouselProgress({\n height,\n indicatorColor,\n indicatorStyle,\n progress,\n show,\n testID,\n trackColor,\n trackStyle,\n}: CarouselProgressProps) {\n if (!show) return null;\n return (\n <View\n pointerEvents=\"none\"\n style={[styles.progress, { height, backgroundColor: trackColor }, trackStyle]}\n testID={testID ? `${testID}-progress` : undefined}\n >\n <Animated.View\n style={[\n {\n height: '100%',\n width: '100%',\n transformOrigin: 'left center',\n transform: [{ scaleX: progress }],\n backgroundColor: indicatorColor,\n },\n indicatorStyle,\n ]}\n />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n controls: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 14,\n right: 14,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n control: {\n width: 44,\n height: 44,\n borderRadius: 22,\n justifyContent: 'center',\n alignItems: 'center',\n },\n indicators: {\n position: 'absolute',\n bottom: 24,\n left: 0,\n right: 0,\n flexDirection: 'row',\n gap: 10,\n justifyContent: 'center',\n alignItems: 'center',\n },\n indicator: { height: 8, borderRadius: 8 },\n progress: { position: 'absolute', bottom: 0, left: 0, right: 0, overflow: 'hidden' },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../../../src/features/carousel/Carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1F,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,MAAM,EACN,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,UAAU,EACV,UAAU,GAAG,MAAM,EACnB,eAAe,GAAG,IAAI,EACtB,cAAc,GAAG,GAAG,EACpB,YAAY,GAAG,IAAI,EACnB,cAAc,GAAG,KAAK,EACtB,aAAa,EACb,YAAY,GAAG,IAAI,EACnB,cAAc,GAAG,CAAC,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,GAAG,KAAK,EAClB,cAAc,GAAG,KAAK,EACtB,aAAa,GAAG,gBAAgB,EAChC,SAAS,GAAG,YAAY,EACxB,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,UAAU,GAAG,OAAO,EACpB,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,GACQ;IACd,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,C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EAAE,QAAQ;KACrB;IACD,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE;IACzC,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;CACrF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Animated, Easing, Image, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport type { CarouselProps, CarouselSlide, CarouselTransition } from '../../types/carousel';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { useCarouselPlayback } from './useCarouselPlayback';\n\n/***\n * Present images, arbitrary React content, or both as a cross-platform slideshow.\n * A published web artifact exposes the same API without consumer source imports.\n */\nexport function Carousel({\n slides,\n index,\n defaultIndex,\n onIndexChange,\n autoPlay,\n paused,\n loop,\n intervalMs,\n transition = 'fade',\n enterDurationMs = 1200,\n exitDurationMs = 800,\n initialScale = 1.06,\n animateOnMount = false,\n reducedMotion,\n showProgress = true,\n progressHeight = 4,\n progressTrackColor,\n progressIndicatorColor,\n progressTrackStyle,\n progressIndicatorStyle,\n showArrows = false,\n showIndicators = false,\n previousLabel = 'Previous slide',\n nextLabel = 'Next slide',\n controlColor,\n controlBackgroundColor,\n controlsStyle,\n activeIndicatorColor,\n inactiveIndicatorColor,\n indicatorsStyle,\n resizeMode = 'cover',\n imageStyle,\n style,\n renderImage,\n testID,\n}: CarouselProps) {\n const { theme } = useZoraTheme();\n const [width, setWidth] = React.useState(0);\n const initialIndex = normalizeSlideIndex(index ?? defaultIndex ?? 0, slides.length);\n const initialSlide = slides.at(initialIndex);\n const [mountedSlideKeys, setMountedSlideKeys] = React.useState<ReadonlySet<string>>(() =>\n initialSlide ? new Set([initialSlide.key]) : new Set(),\n );\n const [readySlideKeys, setReadySlideKeys] = React.useState<ReadonlySet<string>>(() => new Set());\n const {\n activeIndex,\n controlledWithoutHandler,\n direction,\n loop: enabledLoop,\n navigate,\n progress,\n shouldReduceMotion,\n } = useCarouselPlayback({\n slides,\n index,\n defaultIndex,\n onIndexChange,\n autoPlay,\n paused,\n loop,\n intervalMs,\n reducedMotion,\n });\n\n const activeSlide = slides.at(activeIndex);\n const nextIndex = getNextSlideIndex(activeIndex, slides.length, enabledLoop);\n const nextSlide = nextIndex === undefined ? undefined : slides.at(nextIndex);\n const activeSlideKey = activeSlide?.key;\n const nextSlideKey = nextSlide?.key;\n const mountedKeys = ensureMountedSlide(\n ensureMountedSlide(mountedSlideKeys, activeSlideKey),\n getPreloadedSlideKey(activeSlideKey, nextSlideKey, readySlideKeys),\n );\n\n const markSlideLoaded = React.useCallback(\n (slideKey: string) => {\n setReadySlideKeys((current) => ensureMountedSlide(current, slideKey));\n if (slideKey === activeSlideKey) {\n setMountedSlideKeys((current) => ensureMountedSlide(current, nextSlideKey));\n }\n },\n [activeSlideKey, nextSlideKey],\n );\n\n const transitionStateRef = React.useRef({ activeSlideKey, nextSlideKey, readySlideKeys });\n React.useLayoutEffect(() => {\n transitionStateRef.current = { activeSlideKey, nextSlideKey, readySlideKeys };\n }, [activeSlideKey, nextSlideKey, readySlideKeys]);\n\n // Stable identity: layers run animations from effects, so a changing callback would restart them.\n const completeTransition = React.useCallback((completedSlideKey: string) => {\n const {\n activeSlideKey: currentKey,\n nextSlideKey: currentNextKey,\n readySlideKeys: ready,\n } = transitionStateRef.current;\n if (!currentKey || completedSlideKey !== currentKey) return;\n const transitionRetentionKeys = [currentKey, currentNextKey].filter(\n (slideKey): slideKey is string => slideKey !== undefined,\n );\n setMountedSlideKeys(\n (current) =>\n new Set(\n transitionRetentionKeys.filter(\n (slideKey) => slideKey === currentKey || current.has(slideKey) || ready.has(currentKey),\n ),\n ),\n );\n }, []);\n\n if (slides.length === 0) return null;\n\n const canPrevious = enabledLoop || activeIndex > 0;\n const canNext = enabledLoop || activeIndex < slides.length - 1;\n const markerColor = activeIndicatorColor ?? theme.colors.primary;\n const idleMarkerColor = inactiveIndicatorColor ?? theme.semantics.neutral.divider;\n\n return (\n <View\n onLayout={(event) => setWidth(event.nativeEvent.layout.width)}\n testID={testID}\n style={[{ position: 'relative', overflow: 'hidden', width: '100%', height: '100%' }, style]}\n >\n {slides.flatMap((slide, slideIndex) =>\n mountedKeys.has(slide.key)\n ? [\n <CarouselLayer\n key={slide.key}\n active={activeIndex === slideIndex}\n animate={slides.length > 1}\n animateOnMount={animateOnMount || activeIndex !== initialIndex}\n direction={direction}\n enterDurationMs={enterDurationMs}\n exitDurationMs={exitDurationMs}\n imageStyle={imageStyle}\n initialScale={initialScale}\n onImageLoad={() => markSlideLoaded(slide.key)}\n onTransitionComplete={completeTransition}\n reducedMotion={shouldReduceMotion}\n renderImage={renderImage}\n resizeMode={resizeMode}\n slide={slide}\n slideIndex={slideIndex}\n transition={transition}\n width={width}\n />,\n ]\n : [],\n )}\n <CarouselControls\n activeIndex={activeIndex}\n canNext={canNext}\n canPrevious={canPrevious}\n controlBackgroundColor={controlBackgroundColor ?? theme.semantics.surface.raised}\n controlColor={controlColor ?? theme.semantics.content.default}\n controlledWithoutHandler={controlledWithoutHandler}\n controlsStyle={controlsStyle}\n navigate={navigate}\n nextLabel={nextLabel}\n previousLabel={previousLabel}\n show={showArrows && slides.length > 1}\n testID={testID}\n />\n <CarouselIndicators\n activeIndex={activeIndex}\n activeColor={markerColor}\n controlledWithoutHandler={controlledWithoutHandler}\n idleColor={idleMarkerColor}\n indicatorsStyle={indicatorsStyle}\n navigate={navigate}\n show={showIndicators && slides.length > 1}\n slides={slides}\n testID={testID}\n />\n <CarouselProgress\n height={progressHeight}\n indicatorColor={progressIndicatorColor ?? theme.colors.primary}\n indicatorStyle={progressIndicatorStyle}\n progress={progress}\n show={showProgress && slides.length > 1}\n testID={testID}\n trackColor={progressTrackColor ?? theme.semantics.neutral.divider}\n trackStyle={progressTrackStyle}\n />\n </View>\n );\n}\n\ninterface CarouselLayerProps {\n readonly enterDurationMs?: CarouselProps['enterDurationMs'];\n readonly exitDurationMs?: CarouselProps['exitDurationMs'];\n readonly imageStyle: CarouselProps['imageStyle'];\n readonly initialScale?: CarouselProps['initialScale'];\n readonly onImageLoad: () => void;\n readonly onTransitionComplete: (slideKey: string) => void;\n readonly renderImage: CarouselProps['renderImage'];\n readonly resizeMode: CarouselProps['resizeMode'];\n readonly slide: CarouselSlide;\n readonly slideIndex: number;\n readonly active: boolean;\n readonly animate: boolean;\n readonly animateOnMount: boolean;\n readonly direction: 1 | -1;\n readonly width: number;\n readonly transition: CarouselTransition;\n readonly reducedMotion: boolean;\n}\n\n/*** Keep departing slides mounted for an animated overlap without unmounting content. */\nfunction CarouselLayer({\n slide,\n slideIndex,\n active,\n animate,\n animateOnMount,\n direction,\n enterDurationMs = 1200,\n exitDurationMs = 800,\n initialScale = 1.06,\n onImageLoad,\n onTransitionComplete,\n reducedMotion,\n renderImage,\n resizeMode,\n imageStyle,\n transition,\n width,\n}: CarouselLayerProps) {\n const [opacity] = React.useState(() => new Animated.Value(active && !animateOnMount ? 1 : 0));\n const [scale] = React.useState(\n () => new Animated.Value(active && animateOnMount ? initialScale : 1),\n );\n const [offset] = React.useState(() => new Animated.Value(0));\n const hasMounted = React.useRef(false);\n const widthRef = React.useRef(width);\n\n React.useEffect(() => {\n widthRef.current = width;\n }, [width]);\n\n React.useEffect(() => {\n const firstRender = !hasMounted.current;\n hasMounted.current = true;\n if (firstRender && !animateOnMount) return;\n opacity.stopAnimation();\n scale.stopAnimation();\n offset.stopAnimation();\n if (!animate || reducedMotion || transition === 'none') {\n opacity.setValue(active ? 1 : 0);\n scale.setValue(1);\n offset.setValue(0);\n if (active) onTransitionComplete(slide.key);\n return;\n }\n if (transition === 'slide') {\n scale.setValue(1);\n if (active) {\n offset.setValue(direction * widthRef.current);\n opacity.setValue(1);\n }\n Animated.parallel([\n Animated.timing(offset, {\n toValue: active ? 0 : -direction * widthRef.current,\n duration: Math.max(0, active ? enterDurationMs : exitDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: active ? 1 : 0,\n duration: Math.max(0, active ? enterDurationMs : exitDurationMs),\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n ]).start(({ finished }) => {\n if (active && finished) onTransitionComplete(slide.key);\n });\n } else if (active) {\n opacity.setValue(0);\n scale.setValue(initialScale);\n Animated.parallel([\n Animated.timing(opacity, {\n toValue: 1,\n duration: Math.max(0, enterDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n Animated.timing(scale, {\n toValue: 1,\n duration: Math.max(0, enterDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }),\n ]).start(({ finished }) => {\n if (finished) onTransitionComplete(slide.key);\n });\n } else {\n Animated.timing(opacity, {\n toValue: 0,\n duration: Math.max(0, exitDurationMs),\n easing: Easing.bezier(0.4, 0, 0.2, 1),\n useNativeDriver: true,\n }).start();\n }\n return () => {\n opacity.stopAnimation();\n scale.stopAnimation();\n offset.stopAnimation();\n };\n }, [\n active,\n animate,\n animateOnMount,\n direction,\n enterDurationMs,\n exitDurationMs,\n initialScale,\n offset,\n opacity,\n reducedMotion,\n scale,\n transition,\n onTransitionComplete,\n slide.key,\n ]);\n\n return (\n <Animated.View\n accessibilityElementsHidden={!active}\n importantForAccessibility={active ? 'auto' : 'no-hide-descendants'}\n pointerEvents={active ? 'auto' : 'none'}\n style={[StyleSheet.absoluteFill, { opacity, transform: [{ scale }, { translateX: offset }] }]}\n >\n {slide.source !== undefined ? (\n renderImage ? (\n renderCarouselImage(renderImage(slide, slideIndex), onImageLoad)\n ) : (\n <Image\n accessibilityLabel={slide.alt}\n accessible={Boolean(slide.alt)}\n resizeMode={resizeMode}\n source={typeof slide.source === 'string' ? { uri: slide.source } : slide.source}\n style={[StyleSheet.absoluteFill, imageStyle]}\n onLoad={onImageLoad}\n />\n )\n ) : null}\n {slide.content}\n </Animated.View>\n );\n}\n\n/*** Retain consumer image behavior while observing readiness for adjacent-slide preloading. */\nfunction renderCarouselImage(image: React.ReactNode, onImageLoad: () => void): React.ReactNode {\n if (!React.isValidElement<{ onLoad?: (event: unknown) => void }>(image)) return image;\n const existingOnLoad = image.props.onLoad;\n return React.cloneElement(image, {\n onLoad: (event: unknown) => {\n existingOnLoad?.(event);\n onImageLoad();\n },\n });\n}\n\n/*** Return an immutable mounted-key set containing one requested slide. */\nfunction ensureMountedSlide(mountedSlideKeys: ReadonlySet<string>, slideKey: string | undefined) {\n if (!slideKey || mountedSlideKeys.has(slideKey)) return mountedSlideKeys;\n return new Set([...mountedSlideKeys, slideKey]);\n}\n\n/*** Return the next slide key only after the active slide image is ready. */\nfunction getPreloadedSlideKey(\n activeSlideKey: string | undefined,\n nextSlideKey: string | undefined,\n readySlideKeys: ReadonlySet<string>,\n) {\n if (!activeSlideKey || !readySlideKeys.has(activeSlideKey)) return undefined;\n return nextSlideKey;\n}\n\n/*** Resolve the slide to preload without wrapping when looping is disabled. */\nfunction getNextSlideIndex(index: number, length: number, loop: boolean): number | undefined {\n if (length < 2 || (!loop && index === length - 1)) return undefined;\n return (index + 1) % length;\n}\n\n/*** Clamp the initial server-rendered slide to the available slide collection. */\nfunction normalizeSlideIndex(index: number, length: number): number {\n if (length === 0) return 0;\n return Math.min(Math.max(Math.trunc(index), 0), length - 1);\n}\n\ninterface CarouselNavigationProps {\n readonly activeIndex: number;\n readonly navigate: (index: number, direction: 1 | -1) => void;\n readonly controlledWithoutHandler: boolean;\n readonly testID: CarouselProps['testID'];\n}\n\ninterface CarouselControlsProps extends CarouselNavigationProps {\n readonly show: boolean;\n readonly canPrevious: boolean;\n readonly canNext: boolean;\n readonly previousLabel: string;\n readonly nextLabel: string;\n readonly controlColor: string;\n readonly controlBackgroundColor: string;\n readonly controlsStyle: CarouselProps['controlsStyle'];\n}\n\n/*** Render optional previous/next buttons without coupling the slide content to navigation. */\nfunction CarouselControls({\n activeIndex,\n canNext,\n canPrevious,\n controlBackgroundColor,\n controlColor,\n controlledWithoutHandler,\n controlsStyle,\n navigate,\n nextLabel,\n previousLabel,\n show,\n testID,\n}: CarouselControlsProps) {\n if (!show) return null;\n const buttonStyle = [styles.control, { backgroundColor: controlBackgroundColor }];\n const labelStyle = { color: controlColor, fontSize: 30 };\n return (\n <View pointerEvents=\"box-none\" style={[styles.controls, controlsStyle]}>\n <Pressable\n accessibilityLabel={previousLabel}\n accessibilityRole=\"button\"\n disabled={!canPrevious || controlledWithoutHandler}\n onPress={() => navigate(activeIndex - 1, -1)}\n style={buttonStyle}\n testID={testID ? `${testID}-previous` : undefined}\n >\n <Text style={labelStyle}>{'‹'}</Text>\n </Pressable>\n <Pressable\n accessibilityLabel={nextLabel}\n accessibilityRole=\"button\"\n disabled={!canNext || controlledWithoutHandler}\n onPress={() => navigate(activeIndex + 1, 1)}\n style={buttonStyle}\n testID={testID ? `${testID}-next` : undefined}\n >\n <Text style={labelStyle}>{'›'}</Text>\n </Pressable>\n </View>\n );\n}\n\ninterface CarouselIndicatorsProps extends CarouselNavigationProps {\n readonly show: boolean;\n readonly slides: CarouselProps['slides'];\n readonly activeColor: string;\n readonly idleColor: string;\n readonly indicatorsStyle: CarouselProps['indicatorsStyle'];\n}\n\n/*** Render accessible selection dots for the currently controlled slide. */\nfunction CarouselIndicators({\n activeIndex,\n activeColor,\n controlledWithoutHandler,\n idleColor,\n indicatorsStyle,\n navigate,\n show,\n slides,\n testID,\n}: CarouselIndicatorsProps) {\n if (!show) return null;\n return (\n <View pointerEvents=\"box-none\" style={[styles.indicators, indicatorsStyle]}>\n {slides.map((slide, slideIndex) => (\n <Pressable\n key={slide.key}\n accessibilityLabel={`Go to slide ${slideIndex + 1} of ${slides.length}`}\n accessibilityRole=\"button\"\n accessibilityState={{ selected: slideIndex === activeIndex }}\n disabled={controlledWithoutHandler}\n onPress={() => navigate(slideIndex, slideIndex < activeIndex ? -1 : 1)}\n style={[\n styles.indicator,\n {\n backgroundColor: slideIndex === activeIndex ? activeColor : idleColor,\n width: slideIndex === activeIndex ? 24 : 8,\n },\n ]}\n testID={testID ? `${testID}-indicator-${slideIndex}` : undefined}\n />\n ))}\n </View>\n );\n}\n\ninterface CarouselProgressProps {\n readonly show: boolean;\n readonly height: number;\n readonly trackColor: string;\n readonly indicatorColor: string;\n readonly trackStyle: CarouselProps['progressTrackStyle'];\n readonly indicatorStyle: CarouselProps['progressIndicatorStyle'];\n readonly progress: Animated.Value;\n readonly testID: CarouselProps['testID'];\n}\n\n/*** Render an optional linear autoplay timer without adding any required UI to slides. */\nfunction CarouselProgress({\n height,\n indicatorColor,\n indicatorStyle,\n progress,\n show,\n testID,\n trackColor,\n trackStyle,\n}: CarouselProgressProps) {\n if (!show) return null;\n return (\n <View\n pointerEvents=\"none\"\n style={[styles.progress, { height, backgroundColor: trackColor }, trackStyle]}\n testID={testID ? `${testID}-progress` : undefined}\n >\n <Animated.View\n style={[\n {\n height: '100%',\n width: '100%',\n transformOrigin: 'left center',\n transform: [{ scaleX: progress }],\n backgroundColor: indicatorColor,\n },\n indicatorStyle,\n ]}\n />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n controls: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 14,\n right: 14,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n control: {\n width: 44,\n height: 44,\n borderRadius: 22,\n justifyContent: 'center',\n alignItems: 'center',\n },\n indicators: {\n position: 'absolute',\n bottom: 24,\n left: 0,\n right: 0,\n flexDirection: 'row',\n gap: 10,\n justifyContent: 'center',\n alignItems: 'center',\n },\n indicator: { height: 8, borderRadius: 8 },\n progress: { position: 'absolute', bottom: 0, left: 0, right: 0, overflow: 'hidden' },\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "28.6.
|
|
4
|
+
"version": "28.6.3",
|
|
5
5
|
"description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@ankhorage/graph": "^0.5.0",
|
|
50
50
|
"@ankhorage/grid-view": "^0.5.0",
|
|
51
51
|
"@ankhorage/reader": "^0.1.3",
|
|
52
|
-
"@ankhorage/runtime": "^5.7.
|
|
52
|
+
"@ankhorage/runtime": "^5.7.7",
|
|
53
53
|
"@ankhorage/surface": "^9.8.6",
|
|
54
54
|
"@ankhorage/utility": "^1.11.0",
|
|
55
55
|
"expo-asset": "~57.0.21",
|
|
@@ -219,6 +219,48 @@ test('keeps outgoing layers mounted through rapid navigation', async () => {
|
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
+
test('keeps a running fade progressing when an image reports readiness', async () => {
|
|
223
|
+
await withBrowserAsync(async (host, browser) => {
|
|
224
|
+
const root = createRoot(host);
|
|
225
|
+
try {
|
|
226
|
+
await renderCarouselAsync(
|
|
227
|
+
root,
|
|
228
|
+
React.createElement(
|
|
229
|
+
ZoraProvider,
|
|
230
|
+
undefined,
|
|
231
|
+
React.createElement(Carousel, {
|
|
232
|
+
slides: imageSlides,
|
|
233
|
+
autoPlay: false,
|
|
234
|
+
animateOnMount: true,
|
|
235
|
+
enterDurationMs: 10_000,
|
|
236
|
+
exitDurationMs: 10_000,
|
|
237
|
+
showArrows: true,
|
|
238
|
+
testID: 'carousel',
|
|
239
|
+
transition: 'fade',
|
|
240
|
+
renderImage,
|
|
241
|
+
}),
|
|
242
|
+
),
|
|
243
|
+
);
|
|
244
|
+
await clickAsync(host, 'carousel-next');
|
|
245
|
+
await act(() => new Promise<void>((resolve) => setTimeout(resolve, 300)));
|
|
246
|
+
const before = layerOpacity(host, '1');
|
|
247
|
+
expect(before).toBeGreaterThan(0);
|
|
248
|
+
|
|
249
|
+
await fireLoadAsync(host, browser, '1');
|
|
250
|
+
|
|
251
|
+
expect(layerOpacity(host, '1')).toBeGreaterThanOrEqual(before);
|
|
252
|
+
} finally {
|
|
253
|
+
await renderCarouselAsync(root, null);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
/*** Read the animated opacity of the layer that owns a consumer image. */
|
|
259
|
+
function layerOpacity(host: HTMLElement, index: string): number {
|
|
260
|
+
const image = host.querySelector<HTMLElement>(`[data-carousel-image="${index}"]`);
|
|
261
|
+
return Number(image?.parentElement?.style.opacity ?? Number.NaN);
|
|
262
|
+
}
|
|
263
|
+
|
|
222
264
|
const imageSlides = [
|
|
223
265
|
{ key: 'one', source: '/one.jpg' },
|
|
224
266
|
{ key: 'two', source: '/two.jpg' },
|
|
@@ -94,26 +94,31 @@ export function Carousel({
|
|
|
94
94
|
[activeSlideKey, nextSlideKey],
|
|
95
95
|
);
|
|
96
96
|
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
const transitionStateRef = React.useRef({ activeSlideKey, nextSlideKey, readySlideKeys });
|
|
98
|
+
React.useLayoutEffect(() => {
|
|
99
|
+
transitionStateRef.current = { activeSlideKey, nextSlideKey, readySlideKeys };
|
|
100
|
+
}, [activeSlideKey, nextSlideKey, readySlideKeys]);
|
|
101
|
+
|
|
102
|
+
// Stable identity: layers run animations from effects, so a changing callback would restart them.
|
|
103
|
+
const completeTransition = React.useCallback((completedSlideKey: string) => {
|
|
104
|
+
const {
|
|
105
|
+
activeSlideKey: currentKey,
|
|
106
|
+
nextSlideKey: currentNextKey,
|
|
107
|
+
readySlideKeys: ready,
|
|
108
|
+
} = transitionStateRef.current;
|
|
109
|
+
if (!currentKey || completedSlideKey !== currentKey) return;
|
|
110
|
+
const transitionRetentionKeys = [currentKey, currentNextKey].filter(
|
|
111
|
+
(slideKey): slideKey is string => slideKey !== undefined,
|
|
112
|
+
);
|
|
113
|
+
setMountedSlideKeys(
|
|
114
|
+
(current) =>
|
|
115
|
+
new Set(
|
|
116
|
+
transitionRetentionKeys.filter(
|
|
117
|
+
(slideKey) => slideKey === currentKey || current.has(slideKey) || ready.has(currentKey),
|
|
112
118
|
),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
}, []);
|
|
117
122
|
|
|
118
123
|
if (slides.length === 0) return null;
|
|
119
124
|
|
|
@@ -171,12 +171,21 @@ function Carousel({
|
|
|
171
171
|
setMountedSlideKeys((current) => ensureMountedSlide(current, nextSlideKey));
|
|
172
172
|
}
|
|
173
173
|
}, [activeSlideKey, nextSlideKey]);
|
|
174
|
+
const transitionStateRef = React2.useRef({ activeSlideKey, nextSlideKey, readySlideKeys });
|
|
175
|
+
React2.useLayoutEffect(() => {
|
|
176
|
+
transitionStateRef.current = { activeSlideKey, nextSlideKey, readySlideKeys };
|
|
177
|
+
}, [activeSlideKey, nextSlideKey, readySlideKeys]);
|
|
174
178
|
const completeTransition = React2.useCallback((completedSlideKey) => {
|
|
175
|
-
|
|
179
|
+
const {
|
|
180
|
+
activeSlideKey: currentKey,
|
|
181
|
+
nextSlideKey: currentNextKey,
|
|
182
|
+
readySlideKeys: ready
|
|
183
|
+
} = transitionStateRef.current;
|
|
184
|
+
if (!currentKey || completedSlideKey !== currentKey)
|
|
176
185
|
return;
|
|
177
|
-
const transitionRetentionKeys = [
|
|
178
|
-
setMountedSlideKeys((current) => new Set(transitionRetentionKeys.filter((slideKey) => slideKey ===
|
|
179
|
-
}, [
|
|
186
|
+
const transitionRetentionKeys = [currentKey, currentNextKey].filter((slideKey) => slideKey !== undefined);
|
|
187
|
+
setMountedSlideKeys((current) => new Set(transitionRetentionKeys.filter((slideKey) => slideKey === currentKey || current.has(slideKey) || ready.has(currentKey))));
|
|
188
|
+
}, []);
|
|
180
189
|
if (slides.length === 0)
|
|
181
190
|
return null;
|
|
182
191
|
const canPrevious = enabledLoop || activeIndex > 0;
|