@lynx-js/lynx-ui-swiper 3.135.4 → 3.137.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/CHANGELOG.md +18 -0
- package/dist/Swiper/index.d.ts +1 -1
- package/dist/Swiper/index.jsx +2 -2
- package/dist/Swiper/index.jsx.map +1 -1
- package/dist/Swiper/styles.css +6 -6
- package/dist/Swiper/styles.css.map +1 -1
- package/dist/SwiperItem/index.d.ts +1 -1
- package/dist/SwiperItem/index.jsx +1 -1
- package/dist/SwiperItem/index.jsx.map +1 -1
- package/dist/hooks/useAxisLock.d.ts +1 -1
- package/dist/hooks/useBounceConfig.d.ts +3 -3
- package/dist/hooks/useBounceView.d.ts +1 -1
- package/dist/hooks/useBounceView.d.ts.map +1 -1
- package/dist/hooks/useBounceView.jsx +2 -2
- package/dist/hooks/useBounceView.jsx.map +1 -1
- package/dist/hooks/useChange.d.ts +2 -2
- package/dist/hooks/useDirection.d.ts +2 -2
- package/dist/hooks/useFirstScreenStyle.d.ts +1 -1
- package/dist/hooks/useModeConfig.d.ts +1 -1
- package/dist/hooks/useOffset.d.ts +2 -2
- package/dist/hooks/useOffsetLimit.d.ts +1 -1
- package/dist/hooks/useReset.d.ts +1 -1
- package/dist/hooks/useVelocity.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.docs.d.ts +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/Swiper/index.tsx +2 -2
- package/src/Swiper/styles.css +6 -6
- package/src/SwiperItem/index.tsx +2 -2
- package/src/hooks/useBounceView.tsx +10 -2
- package/src/types/index.docs.ts +3 -3
- package/tsconfig.json +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @lynx-js/lynx-ui-swiper
|
|
2
2
|
|
|
3
|
+
## 3.137.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Emit declaration imports with explicit ESM-compatible paths. ([#280](https://github.com/lynx-family/lynx-ui/pull/280))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`064ea4e`](https://github.com/lynx-family/lynx-ui/commit/064ea4e49cd3d0ac5754519cbee43d8ab3040024)]:
|
|
10
|
+
- @lynx-js/lynx-ui-common@3.137.0
|
|
11
|
+
|
|
12
|
+
## 3.136.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Namespace built-in CSS class names to prevent collisions with application styles. ([#254](https://github.com/lynx-family/lynx-ui/pull/254))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`0257f8b`](https://github.com/lynx-family/lynx-ui/commit/0257f8bc9fbe6b8a51df00663c7860827ce468b2)]:
|
|
19
|
+
- @lynx-js/lynx-ui-common@3.136.0
|
|
20
|
+
|
|
3
21
|
## 3.135.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/Swiper/index.d.ts
CHANGED
package/dist/Swiper/index.jsx
CHANGED
|
@@ -224,13 +224,13 @@ const Swiper = forwardRef(({ data = [], itemWidth, containerWidth = lynx.__globa
|
|
|
224
224
|
containerWidth
|
|
225
225
|
});
|
|
226
226
|
return <SwiperContext.Provider value={contextValue}>
|
|
227
|
-
<view class='
|
|
227
|
+
<view class='lynx-ui-swiper__root' style={{
|
|
228
228
|
...style,
|
|
229
229
|
width: `${containerWidth}px`,
|
|
230
230
|
height: `${itemHeight}px`,
|
|
231
231
|
direction: 'lynx-rtl' === RTL ? 'lynx-rtl' : RTL ? 'rtl' : 'ltr'
|
|
232
232
|
}} {...touchHandlers} consume-slide-event={consumeSlideEvent} block-native-event={blockNativeEvent}>
|
|
233
|
-
<view class='
|
|
233
|
+
<view class='lynx-ui-swiper__track' style={containerStyle} ref={setContainerRef} main-thread:ref={containerRef} implicit-animation='false'>
|
|
234
234
|
{bounceStartView}
|
|
235
235
|
{loop ? <>
|
|
236
236
|
{Array.from({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Swiper/index.jsx","sources":["../../src/Swiper/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport {\n forwardRef,\n memo,\n useImperativeHandle,\n useMainThreadRef,\n useMemo,\n} from '@lynx-js/react'\nimport type { ForwardedRef } from '@lynx-js/react'\n\nimport { useTouchEmulation } from '@lynx-js/react-use'\nimport type { MainThread } from '@lynx-js/types'\n\nimport { LOOP_COUNT } from '../const'\nimport { useBounceConfig } from '../hooks/useBounceConfig'\nimport { useBounceView } from '../hooks/useBounceView'\nimport { useChange } from '../hooks/useChange'\nimport useFirstScreenStyle, {\n getInnerContainerWidthMT,\n} from '../hooks/useFirstScreenStyle'\nimport { useModeConfig } from '../hooks/useModeConfig'\nimport { useOffset } from '../hooks/useOffset'\nimport { useOffsetLimit } from '../hooks/useOffsetLimit'\nimport { useReset } from '../hooks/useReset'\nimport { SwiperContext, SwiperItemContext } from '../store'\nimport type {\n SwipeDirection,\n SwiperProps,\n SwiperRef,\n UpdateSwiperInnerContainerOptions,\n} from '../types'\nimport { easeOut } from '../utils'\nimport { comparePropsWithObject } from '../utils/compareProps'\n\nimport './styles.css'\n\n/**\n * Swiper Component\n */\nconst Swiper = forwardRef(\n <T,>(\n {\n data = [],\n itemWidth,\n containerWidth = lynx.__globalProps.screenWidth\n ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio,\n loop = false,\n mode,\n autoPlay = false,\n autoPlayInterval = 2000,\n duration = 500,\n itemHeight = 'auto',\n initialIndex = 0,\n onChange,\n onSwipeStart,\n onSwipeStop,\n modeConfig: _modeConfig,\n offsetLimit: _offsetLimit,\n bounceConfig,\n children,\n 'main-thread:easing': easing = easeOut,\n 'main-thread:customAnimation': customAnimation,\n 'main-thread:onOffsetChange': onOffsetChange,\n customAnimationFirstScreen,\n swiperKey,\n resetOnReuse,\n trackStyle = {},\n style = {},\n loopDuplicateCount: rawLoopDuplicateCount = LOOP_COUNT,\n experimentalHorizontalSwipeOnly = false,\n consumeSlideEvent = [\n [-180, -135],\n [-45, 45],\n [135, 180],\n ],\n blockNativeEvent = false,\n RTL = false,\n }: SwiperProps<T> & { experimentalHorizontalSwipeOnly?: boolean },\n ref: ForwardedRef<SwiperRef>,\n ) => {\n const dataCount = data.length\n\n const loopDuplicateCount = Math.min(rawLoopDuplicateCount, dataCount)\n\n const containerRef = useMainThreadRef<MainThread.Element>(null)\n const childrenMapRef = useMainThreadRef<Record<number, MainThread.Element>>(\n {},\n )\n const { modeConfig, spaceBetween } = useModeConfig({\n mode,\n modeConfig: _modeConfig,\n })\n const offsetLimit = useOffsetLimit({\n offsetLimit: _offsetLimit,\n loop,\n itemWidth,\n containerWidth,\n modeConfig,\n dataCount,\n spaceBetween,\n })\n\n const {\n enableBounce,\n startBounceItem,\n endBounceItem,\n startBounceItemWidth,\n endBounceItemWidth,\n onStartBounceItemBounce,\n onEndBounceItemBounce,\n } = useBounceConfig(bounceConfig)\n\n function setChildrenRef(refI: MainThread.Element, key: number) {\n 'main thread'\n childrenMapRef.current[key] = refI\n }\n\n const contextValue = useMemo(\n () => ({\n loop,\n itemWidth,\n itemHeight,\n setChildrenRef,\n modeConfig,\n initialIndex,\n customAnimationFirstScreen,\n spaceBetween,\n RTL,\n }),\n [loop, itemWidth, itemHeight, spaceBetween, RTL],\n )\n\n const { setChangeOffset, setChangeSwipeStartMT, setChangeSwipeStopMT } =\n useChange({\n onChange,\n size: itemWidth,\n spaceBetween,\n containerWidth,\n dataCount,\n modeConfig,\n offsetLimit,\n onSwipeStart,\n onSwipeStop,\n 'main-thread:onOffsetChange': onOffsetChange,\n })\n\n function setOffset(offset: number) {\n 'main thread'\n const container = containerRef.current\n if (container) {\n container.setStyleProperties({\n transform: `translate(${offset}px, 0)`,\n transition: 'none',\n })\n }\n }\n\n function updateSwiperInnerContainerSizeMT(\n updateOptions: UpdateSwiperInnerContainerOptions,\n ) {\n 'main thread'\n const container = containerRef.current\n if (container) {\n const width = getInnerContainerWidthMT(updateOptions)\n // These values should get from function params, instead of closure, to make it is updated\n const {\n loop: _loop,\n loopDuplicateCount: _loopDuplicateCount,\n itemWidth: _itemWidth,\n spaceBetween: _spaceBetween,\n itemHeight: _itemHeight,\n } = updateOptions\n\n if (updateOptions.mode === 'custom') {\n // @ts-expect-error CSS types accepting number\n container.setStyleProperties({\n ...trackStyle,\n height: `${_itemHeight}px`,\n })\n } else {\n const insetInlineStartKey = RTL ? 'inset-inline-start' : 'left'\n // @ts-expect-error CSS types accepting number\n container.setStyleProperties({\n ...trackStyle,\n [insetInlineStartKey]: _loop\n ? `${-_loopDuplicateCount * (_itemWidth + _spaceBetween)}px`\n : '0px',\n width,\n height: `${_itemHeight}px`,\n })\n }\n }\n }\n\n function onChildrenOffsetUpdate(offset: number) {\n 'main thread'\n const startCount = loop ? -loopDuplicateCount : 0\n const endCount = loop ? dataCount + loopDuplicateCount : dataCount\n for (let i = startCount; i < endCount; i++) {\n const child = childrenMapRef.current[i]\n const childOffset = offset + i * (itemWidth + spaceBetween)\n if (!customAnimation || !child) {\n return\n }\n const childStyles =\n customAnimation(childOffset / (itemWidth + spaceBetween), i)\n || {}\n child.setStyleProperties(childStyles as Record<string, string>)\n }\n }\n\n function onOffsetUpdate(offset: number, direction: SwipeDirection) {\n 'main thread'\n if (modeConfig.mode === 'normal') {\n let effectiveOffset = offset\n if (modeConfig.align === 'center') {\n effectiveOffset = offset + (containerWidth - itemWidth) / 2\n } else if (modeConfig.align === 'end') {\n effectiveOffset = offset + containerWidth - itemWidth\n }\n setOffset(RTL ? -effectiveOffset : effectiveOffset)\n onChildrenOffsetUpdate(offset)\n } else {\n onChildrenOffsetUpdate(offset)\n }\n setChangeOffset(offset, direction)\n }\n\n function onSwipeStartMT() {\n 'main thread'\n setChangeSwipeStartMT()\n }\n\n function onSwipeStopMT() {\n 'main thread'\n setChangeSwipeStopMT()\n }\n\n // `containerStyle` is only used at firstScreen\n // After that, we use MTS to update styles imperatively\n const { containerStyle } = useFirstScreenStyle({\n itemWidth,\n containerWidth,\n loop,\n initialIndex,\n dataCount,\n modeConfig,\n itemHeight,\n offsetLimit,\n loopDuplicateCount,\n RTL,\n spaceBetween,\n swiperKey,\n trackStyle,\n })\n\n const {\n handleTouchMove,\n handleTouchStart,\n handleTouchEnd,\n swipeNext,\n swipePrev,\n swipeTo,\n resetOffsetMT,\n cancelAnimationJS,\n startAutoPlayMT,\n } = useOffset(\n {\n autoPlay,\n autoPlayInterval,\n loop,\n size: itemWidth,\n spaceBetween,\n dataCount,\n duration,\n easing,\n offsetLimit,\n initialIndex,\n modeConfig,\n containerWidth,\n enableBounce,\n startBounceItemWidth,\n endBounceItemWidth,\n onStartBounceItemBounce,\n onEndBounceItemBounce,\n experimentalHorizontalSwipeOnly,\n onSwipeStartMT,\n onSwipeStopMT,\n consumeSlideEvent,\n RTL,\n },\n onOffsetUpdate,\n )\n\n const { setContainerRef } = useReset({\n swiperKey,\n itemHeight,\n itemWidth,\n containerWidth,\n loop,\n dataCount,\n modeConfig,\n resetOffsetMT,\n resetOnReuse,\n initialIndex,\n loopDuplicateCount,\n updateSwiperInnerContainerSizeMT,\n startAutoPlayMT,\n spaceBetween,\n })\n\n const touchHandlers = useTouchEmulation({\n onTouchCancelMT: handleTouchEnd,\n onTouchEndMT: handleTouchEnd,\n onTouchMoveMT: handleTouchMove,\n onTouchStartMT: handleTouchStart,\n })\n\n useImperativeHandle(ref, () => ({\n swipeNext,\n swipePrev,\n swipeTo,\n cancelAnimation: cancelAnimationJS,\n }))\n\n function renderSwiperItem(props: {\n item: T\n index: number\n realIndex: number\n }) {\n return (\n <SwiperItemContext.Provider\n key={props.realIndex}\n value={{\n index: props.index,\n realIndex: props.realIndex,\n }}\n >\n {children(props)}\n </SwiperItemContext.Provider>\n )\n }\n\n const { bounceStartView, bounceEndView } = useBounceView({\n startBounceItem,\n endBounceItem,\n loop,\n mode: modeConfig.mode,\n itemWidth,\n count: dataCount,\n RTL,\n containerWidth,\n })\n\n return (\n <SwiperContext.Provider value={contextValue}>\n <view\n class='swiper-root'\n style={{\n ...style,\n width: `${containerWidth}px`,\n height: `${itemHeight}px`,\n direction: RTL === 'lynx-rtl' ? 'lynx-rtl' : (RTL ? 'rtl' : 'ltr'),\n }}\n {...touchHandlers}\n consume-slide-event={consumeSlideEvent}\n block-native-event={blockNativeEvent}\n >\n <view\n class='swiper-track'\n style={containerStyle}\n ref={setContainerRef}\n main-thread:ref={containerRef}\n implicit-animation='false'\n >\n {bounceStartView}\n {loop\n ? (\n <>\n {Array.from(\n { length: loopDuplicateCount },\n (_, i) => loopDuplicateCount - i - 1,\n ).map((i) =>\n renderSwiperItem({\n index: data.length - i - 1,\n item: data[data.length - i - 1],\n realIndex: -i - 1,\n })\n )}\n </>\n )\n : null}\n {data.map((item: T, index: number) =>\n renderSwiperItem({\n index,\n item,\n realIndex: index,\n })\n )}\n {loop\n ? (\n <>\n {Array.from({ length: loopDuplicateCount }, (_, i) => i).map((\n i,\n ) =>\n renderSwiperItem({\n index: i,\n item: data[i],\n realIndex: data.length + i,\n })\n )}\n </>\n )\n : null}\n {bounceEndView}\n </view>\n </view>\n </SwiperContext.Provider>\n )\n },\n)\n\nconst MemoizedSwiper = memo(\n Swiper,\n (prevProps, nextProps) =>\n comparePropsWithObject(prevProps, nextProps, ['modeConfig', 'bounces']),\n) as typeof Swiper\n\nexport { MemoizedSwiper as Swiper }\n"],"names":["Swiper","forwardRef","data","itemWidth","containerWidth","lynx","SystemInfo","loop","mode","autoPlay","autoPlayInterval","duration","itemHeight","initialIndex","onChange","onSwipeStart","onSwipeStop","_modeConfig","_offsetLimit","bounceConfig","children","easing","easeOut","customAnimation","onOffsetChange","customAnimationFirstScreen","swiperKey","resetOnReuse","trackStyle","style","rawLoopDuplicateCount","LOOP_COUNT","experimentalHorizontalSwipeOnly","consumeSlideEvent","blockNativeEvent","RTL","ref","dataCount","loopDuplicateCount","Math","containerRef","useMainThreadRef","childrenMapRef","modeConfig","spaceBetween","useModeConfig","offsetLimit","useOffsetLimit","enableBounce","startBounceItem","endBounceItem","startBounceItemWidth","endBounceItemWidth","onStartBounceItemBounce","onEndBounceItemBounce","useBounceConfig","setChildrenRef","refI","key","contextValue","useMemo","setChangeOffset","setChangeSwipeStartMT","setChangeSwipeStopMT","useChange","setOffset","offset","container","updateSwiperInnerContainerSizeMT","updateOptions","width","getInnerContainerWidthMT","_loop","_loopDuplicateCount","_itemWidth","_spaceBetween","_itemHeight","insetInlineStartKey","onChildrenOffsetUpdate","startCount","endCount","i","child","childOffset","childStyles","onOffsetUpdate","direction","effectiveOffset","onSwipeStartMT","onSwipeStopMT","containerStyle","useFirstScreenStyle","handleTouchMove","handleTouchStart","handleTouchEnd","swipeNext","swipePrev","swipeTo","resetOffsetMT","cancelAnimationJS","startAutoPlayMT","useOffset","setContainerRef","useReset","touchHandlers","useTouchEmulation","useImperativeHandle","renderSwiperItem","props","SwiperItemContext","bounceStartView","bounceEndView","useBounceView","SwiperContext","view","Array","_","item","index","MemoizedSwiper","memo","prevProps","nextProps","comparePropsWithObject"],"mappings":";;;;;;;;;;;;;;;AA0CA,MAAMA,SAASC,WACb,CACE,EACEC,OAAO,EAAE,EACTC,SAAS,EACTC,iBAAiBC,KAAK,aAAa,CAAC,WAAW,IAC1CC,WAAW,UAAU,GAAGA,WAAW,UAAU,EAClDC,OAAO,KAAK,EACZC,IAAI,EACJC,WAAW,KAAK,EAChBC,mBAAmB,IAAI,EACvBC,WAAW,GAAG,EACdC,aAAa,MAAM,EACnBC,eAAe,CAAC,EAChBC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACX,YAAYC,WAAW,EACvB,aAAaC,YAAY,EACzBC,YAAY,EACZC,QAAQ,EACR,sBAAsBC,SAASC,OAAO,EACtC,+BAA+BC,eAAe,EAC9C,8BAA8BC,cAAc,EAC5CC,0BAA0B,EA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,GAAG,CAAC,CAC3DA,IAEA0B,iBAAiB;YACf,OAAO1B;YACP,MAAM/E,IAAI,CAAC+E,EAAE;YACb,WAAW/E,KAAK,MAAM,GAAG+E;QAC3B,IACA;gBACJ,MAEA,KAAK;YACT,CAAC8B,cAAc;UACjB,EAAEG,KAAK;QACT,EAAEA,KAAK;MACT,EAAED,cAAc;AAEpB;AAGF,MAAMM,iBAAiBC,KACrBxH,QACA,CAACyH,WAAWC,YACVC,uBAAuBF,WAAWC,WAAW;QAAC;QAAc;KAAU"}
|
|
1
|
+
{"version":3,"file":"Swiper/index.jsx","sources":["../../src/Swiper/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport {\n forwardRef,\n memo,\n useImperativeHandle,\n useMainThreadRef,\n useMemo,\n} from '@lynx-js/react'\nimport type { ForwardedRef } from '@lynx-js/react'\n\nimport { useTouchEmulation } from '@lynx-js/react-use'\nimport type { MainThread } from '@lynx-js/types'\n\nimport { LOOP_COUNT } from '../const'\nimport { useBounceConfig } from '../hooks/useBounceConfig'\nimport { useBounceView } from '../hooks/useBounceView'\nimport { useChange } from '../hooks/useChange'\nimport useFirstScreenStyle, {\n getInnerContainerWidthMT,\n} from '../hooks/useFirstScreenStyle'\nimport { useModeConfig } from '../hooks/useModeConfig'\nimport { useOffset } from '../hooks/useOffset'\nimport { useOffsetLimit } from '../hooks/useOffsetLimit'\nimport { useReset } from '../hooks/useReset'\nimport { SwiperContext, SwiperItemContext } from '../store'\nimport type {\n SwipeDirection,\n SwiperProps,\n SwiperRef,\n UpdateSwiperInnerContainerOptions,\n} from '../types'\nimport { easeOut } from '../utils'\nimport { comparePropsWithObject } from '../utils/compareProps'\n\nimport './styles.css'\n\n/**\n * Swiper Component\n */\nconst Swiper = forwardRef(\n <T,>(\n {\n data = [],\n itemWidth,\n containerWidth = lynx.__globalProps.screenWidth\n ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio,\n loop = false,\n mode,\n autoPlay = false,\n autoPlayInterval = 2000,\n duration = 500,\n itemHeight = 'auto',\n initialIndex = 0,\n onChange,\n onSwipeStart,\n onSwipeStop,\n modeConfig: _modeConfig,\n offsetLimit: _offsetLimit,\n bounceConfig,\n children,\n 'main-thread:easing': easing = easeOut,\n 'main-thread:customAnimation': customAnimation,\n 'main-thread:onOffsetChange': onOffsetChange,\n customAnimationFirstScreen,\n swiperKey,\n resetOnReuse,\n trackStyle = {},\n style = {},\n loopDuplicateCount: rawLoopDuplicateCount = LOOP_COUNT,\n experimentalHorizontalSwipeOnly = false,\n consumeSlideEvent = [\n [-180, -135],\n [-45, 45],\n [135, 180],\n ],\n blockNativeEvent = false,\n RTL = false,\n }: SwiperProps<T> & { experimentalHorizontalSwipeOnly?: boolean },\n ref: ForwardedRef<SwiperRef>,\n ) => {\n const dataCount = data.length\n\n const loopDuplicateCount = Math.min(rawLoopDuplicateCount, dataCount)\n\n const containerRef = useMainThreadRef<MainThread.Element>(null)\n const childrenMapRef = useMainThreadRef<Record<number, MainThread.Element>>(\n {},\n )\n const { modeConfig, spaceBetween } = useModeConfig({\n mode,\n modeConfig: _modeConfig,\n })\n const offsetLimit = useOffsetLimit({\n offsetLimit: _offsetLimit,\n loop,\n itemWidth,\n containerWidth,\n modeConfig,\n dataCount,\n spaceBetween,\n })\n\n const {\n enableBounce,\n startBounceItem,\n endBounceItem,\n startBounceItemWidth,\n endBounceItemWidth,\n onStartBounceItemBounce,\n onEndBounceItemBounce,\n } = useBounceConfig(bounceConfig)\n\n function setChildrenRef(refI: MainThread.Element, key: number) {\n 'main thread'\n childrenMapRef.current[key] = refI\n }\n\n const contextValue = useMemo(\n () => ({\n loop,\n itemWidth,\n itemHeight,\n setChildrenRef,\n modeConfig,\n initialIndex,\n customAnimationFirstScreen,\n spaceBetween,\n RTL,\n }),\n [loop, itemWidth, itemHeight, spaceBetween, RTL],\n )\n\n const { setChangeOffset, setChangeSwipeStartMT, setChangeSwipeStopMT } =\n useChange({\n onChange,\n size: itemWidth,\n spaceBetween,\n containerWidth,\n dataCount,\n modeConfig,\n offsetLimit,\n onSwipeStart,\n onSwipeStop,\n 'main-thread:onOffsetChange': onOffsetChange,\n })\n\n function setOffset(offset: number) {\n 'main thread'\n const container = containerRef.current\n if (container) {\n container.setStyleProperties({\n transform: `translate(${offset}px, 0)`,\n transition: 'none',\n })\n }\n }\n\n function updateSwiperInnerContainerSizeMT(\n updateOptions: UpdateSwiperInnerContainerOptions,\n ) {\n 'main thread'\n const container = containerRef.current\n if (container) {\n const width = getInnerContainerWidthMT(updateOptions)\n // These values should get from function params, instead of closure, to make it is updated\n const {\n loop: _loop,\n loopDuplicateCount: _loopDuplicateCount,\n itemWidth: _itemWidth,\n spaceBetween: _spaceBetween,\n itemHeight: _itemHeight,\n } = updateOptions\n\n if (updateOptions.mode === 'custom') {\n // @ts-expect-error CSS types accepting number\n container.setStyleProperties({\n ...trackStyle,\n height: `${_itemHeight}px`,\n })\n } else {\n const insetInlineStartKey = RTL ? 'inset-inline-start' : 'left'\n // @ts-expect-error CSS types accepting number\n container.setStyleProperties({\n ...trackStyle,\n [insetInlineStartKey]: _loop\n ? `${-_loopDuplicateCount * (_itemWidth + _spaceBetween)}px`\n : '0px',\n width,\n height: `${_itemHeight}px`,\n })\n }\n }\n }\n\n function onChildrenOffsetUpdate(offset: number) {\n 'main thread'\n const startCount = loop ? -loopDuplicateCount : 0\n const endCount = loop ? dataCount + loopDuplicateCount : dataCount\n for (let i = startCount; i < endCount; i++) {\n const child = childrenMapRef.current[i]\n const childOffset = offset + i * (itemWidth + spaceBetween)\n if (!customAnimation || !child) {\n return\n }\n const childStyles =\n customAnimation(childOffset / (itemWidth + spaceBetween), i)\n || {}\n child.setStyleProperties(childStyles as Record<string, string>)\n }\n }\n\n function onOffsetUpdate(offset: number, direction: SwipeDirection) {\n 'main thread'\n if (modeConfig.mode === 'normal') {\n let effectiveOffset = offset\n if (modeConfig.align === 'center') {\n effectiveOffset = offset + (containerWidth - itemWidth) / 2\n } else if (modeConfig.align === 'end') {\n effectiveOffset = offset + containerWidth - itemWidth\n }\n setOffset(RTL ? -effectiveOffset : effectiveOffset)\n onChildrenOffsetUpdate(offset)\n } else {\n onChildrenOffsetUpdate(offset)\n }\n setChangeOffset(offset, direction)\n }\n\n function onSwipeStartMT() {\n 'main thread'\n setChangeSwipeStartMT()\n }\n\n function onSwipeStopMT() {\n 'main thread'\n setChangeSwipeStopMT()\n }\n\n // `containerStyle` is only used at firstScreen\n // After that, we use MTS to update styles imperatively\n const { containerStyle } = useFirstScreenStyle({\n itemWidth,\n containerWidth,\n loop,\n initialIndex,\n dataCount,\n modeConfig,\n itemHeight,\n offsetLimit,\n loopDuplicateCount,\n RTL,\n spaceBetween,\n swiperKey,\n trackStyle,\n })\n\n const {\n handleTouchMove,\n handleTouchStart,\n handleTouchEnd,\n swipeNext,\n swipePrev,\n swipeTo,\n resetOffsetMT,\n cancelAnimationJS,\n startAutoPlayMT,\n } = useOffset(\n {\n autoPlay,\n autoPlayInterval,\n loop,\n size: itemWidth,\n spaceBetween,\n dataCount,\n duration,\n easing,\n offsetLimit,\n initialIndex,\n modeConfig,\n containerWidth,\n enableBounce,\n startBounceItemWidth,\n endBounceItemWidth,\n onStartBounceItemBounce,\n onEndBounceItemBounce,\n experimentalHorizontalSwipeOnly,\n onSwipeStartMT,\n onSwipeStopMT,\n consumeSlideEvent,\n RTL,\n },\n onOffsetUpdate,\n )\n\n const { setContainerRef } = useReset({\n swiperKey,\n itemHeight,\n itemWidth,\n containerWidth,\n loop,\n dataCount,\n modeConfig,\n resetOffsetMT,\n resetOnReuse,\n initialIndex,\n loopDuplicateCount,\n updateSwiperInnerContainerSizeMT,\n startAutoPlayMT,\n spaceBetween,\n })\n\n const touchHandlers = useTouchEmulation({\n onTouchCancelMT: handleTouchEnd,\n onTouchEndMT: handleTouchEnd,\n onTouchMoveMT: handleTouchMove,\n onTouchStartMT: handleTouchStart,\n })\n\n useImperativeHandle(ref, () => ({\n swipeNext,\n swipePrev,\n swipeTo,\n cancelAnimation: cancelAnimationJS,\n }))\n\n function renderSwiperItem(props: {\n item: T\n index: number\n realIndex: number\n }) {\n return (\n <SwiperItemContext.Provider\n key={props.realIndex}\n value={{\n index: props.index,\n realIndex: props.realIndex,\n }}\n >\n {children(props)}\n </SwiperItemContext.Provider>\n )\n }\n\n const { bounceStartView, bounceEndView } = useBounceView({\n startBounceItem,\n endBounceItem,\n loop,\n mode: modeConfig.mode,\n itemWidth,\n count: dataCount,\n RTL,\n containerWidth,\n })\n\n return (\n <SwiperContext.Provider value={contextValue}>\n <view\n class='lynx-ui-swiper__root'\n style={{\n ...style,\n width: `${containerWidth}px`,\n height: `${itemHeight}px`,\n direction: RTL === 'lynx-rtl' ? 'lynx-rtl' : (RTL ? 'rtl' : 'ltr'),\n }}\n {...touchHandlers}\n consume-slide-event={consumeSlideEvent}\n block-native-event={blockNativeEvent}\n >\n <view\n class='lynx-ui-swiper__track'\n style={containerStyle}\n ref={setContainerRef}\n main-thread:ref={containerRef}\n implicit-animation='false'\n >\n {bounceStartView}\n {loop\n ? (\n <>\n {Array.from(\n { length: loopDuplicateCount },\n (_, i) => loopDuplicateCount - i - 1,\n ).map((i) =>\n renderSwiperItem({\n index: data.length - i - 1,\n item: data[data.length - i - 1],\n realIndex: -i - 1,\n })\n )}\n </>\n )\n : null}\n {data.map((item: T, index: number) =>\n renderSwiperItem({\n index,\n item,\n realIndex: index,\n })\n )}\n {loop\n ? (\n <>\n {Array.from({ length: loopDuplicateCount }, (_, i) => i).map((\n i,\n ) =>\n renderSwiperItem({\n index: i,\n item: data[i],\n realIndex: data.length + i,\n })\n )}\n </>\n )\n : null}\n {bounceEndView}\n </view>\n </view>\n </SwiperContext.Provider>\n )\n },\n)\n\nconst MemoizedSwiper = memo(\n Swiper,\n (prevProps, nextProps) =>\n comparePropsWithObject(prevProps, nextProps, ['modeConfig', 'bounces']),\n) as typeof Swiper\n\nexport { MemoizedSwiper as Swiper }\n"],"names":["Swiper","forwardRef","data","itemWidth","containerWidth","lynx","SystemInfo","loop","mode","autoPlay","autoPlayInterval","duration","itemHeight","initialIndex","onChange","onSwipeStart","onSwipeStop","_modeConfig","_offsetLimit","bounceConfig","children","easing","easeOut","customAnimation","onOffsetChange","customAnimationFirstScreen","swiperKey","resetOnReuse","trackStyle","style","rawLoopDuplicateCount","LOOP_COUNT","experimentalHorizontalSwipeOnly","consumeSlideEvent","blockNativeEvent","RTL","ref","dataCount","loopDuplicateCount","Math","containerRef","useMainThreadRef","childrenMapRef","modeConfig","spaceBetween","useModeConfig","offsetLimit","useOffsetLimit","enableBounce","startBounceItem","endBounceItem","startBounceItemWidth","endBounceItemWidth","onStartBounceItemBounce","onEndBounceItemBounce","useBounceConfig","setChildrenRef","refI","key","contextValue","useMemo","setChangeOffset","setChangeSwipeStartMT","setChangeSwipeStopMT","useChange","setOffset","offset","container","updateSwiperInnerContainerSizeMT","updateOptions","width","getInnerContainerWidthMT","_loop","_loopDuplicateCount","_itemWidth","_spaceBetween","_itemHeight","insetInlineStartKey","onChildrenOffsetUpdate","startCount","endCount","i","child","childOffset","childStyles","onOffsetUpdate","direction","effectiveOffset","onSwipeStartMT","onSwipeStopMT","containerStyle","useFirstScreenStyle","handleTouchMove","handleTouchStart","handleTouchEnd","swipeNext","swipePrev","swipeTo","resetOffsetMT","cancelAnimationJS","startAutoPlayMT","useOffset","setContainerRef","useReset","touchHandlers","useTouchEmulation","useImperativeHandle","renderSwiperItem","props","SwiperItemContext","bounceStartView","bounceEndView","useBounceView","SwiperContext","view","Array","_","item","index","MemoizedSwiper","memo","prevProps","nextProps","comparePropsWithObject"],"mappings":";;;;;;;;;;;;;;;AA0CA,MAAMA,SAASC,WACb,CACE,EACEC,OAAO,EAAE,EACTC,SAAS,EACTC,iBAAiBC,KAAK,aAAa,CAAC,WAAW,IAC1CC,WAAW,UAAU,GAAGA,WAAW,UAAU,EAClDC,OAAO,KAAK,EACZC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,CAACA,KAAK,MAAM,GAAG+E,IAAI,EAAE;YAC/B,WAAW,CAACA,IAAI;QAClB,IACA;gBACJ,MAEA,KAAK;YACT,CAAC/E,KAAK,GAAG,CAAC,CAACmH,MAASC,QAClBX,iBAAiB;YACfW;YACAD;YACA,WAAWC;QACb,IACA;YACF,CAAC/G,SAEK;kBACA,CAAC4G,MAAM,IAAI,CAAC;QAAE,QAAQ7E;IAAmB,GAAG,CAAC8E,GAAGnC,IAAMA,GAAG,GAAG,CAAC,CAC3DA,IAEA0B,iBAAiB;YACf,OAAO1B;YACP,MAAM/E,IAAI,CAAC+E,EAAE;YACb,WAAW/E,KAAK,MAAM,GAAG+E;QAC3B,IACA;gBACJ,MAEA,KAAK;YACT,CAAC8B,cAAc;UACjB,EAAEG,KAAK;QACT,EAAEA,KAAK;MACT,EAAED,cAAc;AAEpB;AAGF,MAAMM,iBAAiBC,KACrBxH,QACA,CAACyH,WAAWC,YACVC,uBAAuBF,WAAWC,WAAW;QAAC;QAAc;KAAU"}
|
package/dist/Swiper/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.lynx-ui-swiper__root {
|
|
2
2
|
display: linear;
|
|
3
3
|
linear-orientation: horizontal;
|
|
4
4
|
width: 100%;
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
overflow: hidden;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.lynx-ui-swiper__track {
|
|
10
10
|
display: linear;
|
|
11
11
|
linear-orientation: horizontal;
|
|
12
12
|
width: 100%;
|
|
13
13
|
height: 100%;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.lynx-ui-swiper__bounce-start {
|
|
17
17
|
width: max-content;
|
|
18
18
|
height: 100%;
|
|
19
19
|
position: absolute;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
transform: translate(-100%);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.lynx-ui-swiper__bounce-start-rtl {
|
|
25
25
|
width: max-content;
|
|
26
26
|
height: 100%;
|
|
27
27
|
position: absolute;
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
transform: translate(100%);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
32
|
+
.lynx-ui-swiper__bounce-end {
|
|
33
33
|
width: max-content;
|
|
34
34
|
height: 100%;
|
|
35
35
|
position: absolute;
|
|
36
36
|
left: 100%;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
39
|
+
.lynx-ui-swiper__bounce-end-rtl {
|
|
40
40
|
width: max-content;
|
|
41
41
|
height: 100%;
|
|
42
42
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/Swiper/styles.css"],"names":[],"mappings":"AAAA;EACE,eAAe;EACf,8BAA8B;EAC9B,WAAW;EACX,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,eAAe;EACf,8BAA8B;EAC9B,WAAW;EACX,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,OAAO;EACP,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,qBAAqB;EACrB,0BAA0B;AAC5B;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,wBAAwB;AAC1B","sourcesContent":[".
|
|
1
|
+
{"version":3,"sources":["webpack://./src/Swiper/styles.css"],"names":[],"mappings":"AAAA;EACE,eAAe;EACf,8BAA8B;EAC9B,WAAW;EACX,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,eAAe;EACf,8BAA8B;EAC9B,WAAW;EACX,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,OAAO;EACP,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,qBAAqB;EACrB,0BAA0B;AAC5B;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,wBAAwB;AAC1B","sourcesContent":[".lynx-ui-swiper__root {\n display: linear;\n linear-orientation: horizontal;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.lynx-ui-swiper__track {\n display: linear;\n linear-orientation: horizontal;\n width: 100%;\n height: 100%;\n}\n\n.lynx-ui-swiper__bounce-start {\n position: absolute;\n left: 0;\n transform: translate(-100%);\n height: 100%;\n width: max-content;\n}\n\n.lynx-ui-swiper__bounce-start-rtl {\n position: absolute;\n inset-inline-start: 0;\n transform: translate(100%);\n height: 100%;\n width: max-content;\n}\n\n.lynx-ui-swiper__bounce-end {\n position: absolute;\n left: 100%;\n height: 100%;\n width: max-content;\n}\n\n.lynx-ui-swiper__bounce-end-rtl {\n position: absolute;\n inset-inline-start: 100%;\n height: 100%;\n width: max-content;\n}\n"],"sourceRoot":""}
|
|
@@ -34,7 +34,7 @@ export interface SwiperItemProps {
|
|
|
34
34
|
/**
|
|
35
35
|
* `overlap` attribute passed to SwiperItem's direct child.
|
|
36
36
|
* This property is used only when opacity has issues.
|
|
37
|
-
* Refer to {@link https://lynxjs.org/
|
|
37
|
+
* Refer to {@link https://lynxjs.org/api/css/properties/opacity#opacity}
|
|
38
38
|
* @Android
|
|
39
39
|
* @iOS
|
|
40
40
|
* @Harmony
|
|
@@ -82,7 +82,7 @@ const SwiperItem = ({ index, realIndex, children, overlap })=>{
|
|
|
82
82
|
swiperItemRef.current = ref;
|
|
83
83
|
setChildrenRef(ref, effectiveRealIndex);
|
|
84
84
|
}
|
|
85
|
-
return <view class='
|
|
85
|
+
return <view class='lynx-ui-swiper__item' style={containerStyle} main-thread:ref={setRef} overlap={overlap}>
|
|
86
86
|
{children}
|
|
87
87
|
</view>;
|
|
88
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwiperItem/index.jsx","sources":["../../src/SwiperItem/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport {\n memo,\n runOnMainThread,\n useContext,\n useEffect,\n useMainThreadRef,\n useMemo,\n} from '@lynx-js/react'\nimport type { ReactElement, RefObject } from '@lynx-js/react'\n\nimport type { CSSProperties, MainThread } from '@lynx-js/types'\n\nimport { SwiperContext, SwiperItemContext } from '../store'\nimport type { CompoundModeConfig, SwiperContextProps } from '../types'\n\nexport interface SwiperItemProps {\n /**\n * Index of current SwiperItem, out of Swiper's data.\n * @Android\n * @iOS\n * @Harmony\n */\n index?: number\n /**\n * Children of SwiperItem\n * @Android\n * @iOS\n * @Harmony\n */\n children: ReactElement | ReactElement[]\n /**\n * Style of SwiperItem\n * @Android\n * @iOS\n * @Harmony\n */\n style?: CSSProperties\n /**\n * Physical index of current SwiperItem.\n * Kept for compatibility with existing manual usage. This is resolved\n * automatically when SwiperItem is rendered inside Swiper's children function.\n * @Android\n * @iOS\n * @Harmony\n */\n realIndex?: number\n /**\n * `overlap` attribute passed to SwiperItem's direct child.\n * This property is used only when opacity has issues.\n * Refer to {@link https://lynxjs.org/
|
|
1
|
+
{"version":3,"file":"SwiperItem/index.jsx","sources":["../../src/SwiperItem/index.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport {\n memo,\n runOnMainThread,\n useContext,\n useEffect,\n useMainThreadRef,\n useMemo,\n} from '@lynx-js/react'\nimport type { ReactElement, RefObject } from '@lynx-js/react'\n\nimport type { CSSProperties, MainThread } from '@lynx-js/types'\n\nimport { SwiperContext, SwiperItemContext } from '../store'\nimport type { CompoundModeConfig, SwiperContextProps } from '../types'\n\nexport interface SwiperItemProps {\n /**\n * Index of current SwiperItem, out of Swiper's data.\n * @Android\n * @iOS\n * @Harmony\n */\n index?: number\n /**\n * Children of SwiperItem\n * @Android\n * @iOS\n * @Harmony\n */\n children: ReactElement | ReactElement[]\n /**\n * Style of SwiperItem\n * @Android\n * @iOS\n * @Harmony\n */\n style?: CSSProperties\n /**\n * Physical index of current SwiperItem.\n * Kept for compatibility with existing manual usage. This is resolved\n * automatically when SwiperItem is rendered inside Swiper's children function.\n * @Android\n * @iOS\n * @Harmony\n */\n realIndex?: number\n /**\n * `overlap` attribute passed to SwiperItem's direct child.\n * This property is used only when opacity has issues.\n * Refer to {@link https://lynxjs.org/api/css/properties/opacity#opacity}\n * @Android\n * @iOS\n * @Harmony\n */\n overlap?: boolean\n}\n\ninterface IFirstScreenStyle extends\n Pick<\n SwiperContextProps,\n | 'itemWidth'\n | 'itemHeight'\n | 'initialIndex'\n | 'customAnimationFirstScreen'\n | 'RTL'\n >\n{\n itemRef: RefObject<MainThread.Element | undefined>\n spaceBetween: number\n realIndex: number\n modeConfig: CompoundModeConfig\n}\n\nfunction useFirstScreenStyle(props: IFirstScreenStyle) {\n const {\n itemWidth,\n spaceBetween,\n itemHeight,\n itemRef,\n customAnimationFirstScreen,\n realIndex,\n modeConfig,\n initialIndex,\n RTL,\n } = props\n\n const containerStyle = useMemo(() => {\n if (modeConfig.mode === 'normal') {\n let style: CSSProperties = {\n width: `${itemWidth}px`,\n height: `${itemHeight}px`,\n [RTL === true ? 'marginLeft' : 'marginRight']: `${spaceBetween}px`,\n }\n if (customAnimationFirstScreen) {\n const customStyle = customAnimationFirstScreen(\n -initialIndex + realIndex,\n realIndex,\n )\n style = {\n ...style,\n ...customStyle,\n }\n }\n\n return style\n } else if (modeConfig.mode === 'custom') {\n let style: CSSProperties = {\n width: `${itemWidth}px`,\n height: `${itemHeight}px`,\n position: 'absolute',\n }\n if (customAnimationFirstScreen) {\n const customStyle = customAnimationFirstScreen(\n -initialIndex + realIndex,\n realIndex,\n )\n style = {\n ...style,\n ...customStyle,\n }\n }\n\n return style\n }\n }, [])\n\n function updateMainThreadR(propsFromJS: {\n itemWidth: number\n itemHeight: SwiperContextProps['itemHeight']\n spaceBetween: number\n }) {\n 'main thread'\n if (itemRef.current) {\n itemRef.current.setStyleProperties({\n width: `${propsFromJS.itemWidth}px`,\n height: `${propsFromJS.itemHeight}px`,\n marginInlineEnd: `${propsFromJS.spaceBetween}px`,\n })\n }\n }\n\n useEffect(() => {\n runOnMainThread(updateMainThreadR)({\n itemWidth,\n itemHeight,\n spaceBetween,\n })\n }, [itemWidth, itemHeight, spaceBetween])\n\n return {\n containerStyle,\n }\n}\n\nconst SwiperItem = (\n { index, realIndex, children, overlap }: SwiperItemProps,\n) => {\n const {\n itemWidth,\n itemHeight,\n setChildrenRef,\n modeConfig,\n customAnimationFirstScreen,\n initialIndex = 0,\n spaceBetween,\n RTL,\n } = useContext(SwiperContext)\n const itemContext = useContext(SwiperItemContext)\n const resolvedIndex = index ?? itemContext?.index\n const resolvedRealIndex = realIndex ?? itemContext?.realIndex ?? resolvedIndex\n const hasResolvedIndex = resolvedIndex !== undefined\n const effectiveRealIndex = resolvedRealIndex ?? 0\n const swiperItemRef = useMainThreadRef<MainThread.Element>()\n\n const { containerStyle } = useFirstScreenStyle({\n itemWidth,\n itemHeight,\n spaceBetween,\n itemRef: swiperItemRef,\n modeConfig,\n realIndex: effectiveRealIndex,\n initialIndex,\n customAnimationFirstScreen,\n RTL,\n })\n\n if (!hasResolvedIndex) {\n throw new Error(\n 'SwiperItem must be rendered inside Swiper children or receive an index prop.',\n )\n }\n\n function setRef(ref: MainThread.Element) {\n 'main thread'\n swiperItemRef.current = ref\n setChildrenRef(ref, effectiveRealIndex)\n }\n\n return (\n <view\n class='lynx-ui-swiper__item'\n style={containerStyle}\n main-thread:ref={setRef}\n overlap={overlap}\n >\n {children}\n </view>\n )\n}\n\nconst MemoSwiperItem = memo(SwiperItem) as typeof SwiperItem\n\nexport { MemoSwiperItem as SwiperItem }\n"],"names":["useFirstScreenStyle","props","itemWidth","spaceBetween","itemHeight","itemRef","customAnimationFirstScreen","realIndex","modeConfig","initialIndex","RTL","containerStyle","useMemo","style","customStyle","updateMainThreadR","propsFromJS","useEffect","runOnMainThread","SwiperItem","index","children","overlap","setChildrenRef","useContext","SwiperContext","itemContext","SwiperItemContext","resolvedIndex","resolvedRealIndex","hasResolvedIndex","undefined","effectiveRealIndex","swiperItemRef","useMainThreadRef","Error","setRef","ref","view","MemoSwiperItem","memo"],"mappings":";;AA6EA,SAASA,oBAAoBC,KAAwB;IACnD,MAAM,EACJC,SAAS,EACTC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,0BAA0B,EAC1BC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,GAAG,EACJ,GAAGT;IAEJ,MAAMU,iBAAiBC,QAAQ;QAC7B,IAAIJ,AAAoB,aAApBA,WAAW,IAAI,EAAe;YAChC,IAAIK,QAAuB;gBACzB,OAAO,GAAGX,UAAU,EAAE,CAAC;gBACvB,QAAQ,GAAGE,WAAW,EAAE,CAAC;gBACzB,CAACM,AAAQ,SAARA,MAAe,eAAe,cAAc,EAAE,GAAGP,aAAa,EAAE,CAAC;YACpE;YACA,IAAIG,4BAA4B;gBAC9B,MAAMQ,cAAcR,2BAClB,CAACG,eAAeF,WAChBA;gBAEFM,QAAQ;oBACN,GAAGA,KAAK;oBACR,GAAGC,WAAW;gBAChB;YACF;YAEA,OAAOD;QACT;QAAO,IAAIL,AAAoB,aAApBA,WAAW,IAAI,EAAe;YACvC,IAAIK,QAAuB;gBACzB,OAAO,GAAGX,UAAU,EAAE,CAAC;gBACvB,QAAQ,GAAGE,WAAW,EAAE,CAAC;gBACzB,UAAU;YACZ;YACA,IAAIE,4BAA4B;gBAC9B,MAAMQ,cAAcR,2BAClB,CAACG,eAAeF,WAChBA;gBAEFM,QAAQ;oBACN,GAAGA,KAAK;oBAC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AS;IACZ,EAAEiB;AAEN;AAEA,MAAMC,iBAAiBC,KAAKrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MainThread } from '@lynx-js/types';
|
|
2
|
-
import type { SwiperProps } from '../types';
|
|
2
|
+
import type { SwiperProps } from '../types/index.js';
|
|
3
3
|
export declare function useAxisLock({ consumeSlideEvent, experimentalHorizontalSwipeOnly, }: {
|
|
4
4
|
consumeSlideEvent: NonNullable<SwiperProps<unknown>['consumeSlideEvent']>;
|
|
5
5
|
experimentalHorizontalSwipeOnly: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BounceConfig } from '../types';
|
|
1
|
+
import type { BounceConfig } from '../types/index.js';
|
|
2
2
|
declare function useBounceConfig(bounceConfig?: BounceConfig): {
|
|
3
3
|
enableBounce: boolean;
|
|
4
4
|
startBounceItem: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
5
5
|
endBounceItem: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
6
6
|
startBounceItemWidth: number;
|
|
7
7
|
endBounceItemWidth: number;
|
|
8
|
-
onStartBounceItemBounce: ((bounceParams: import("../types").onBounceParams) => void) | undefined;
|
|
9
|
-
onEndBounceItemBounce: ((bounceParams: import("../types").onBounceParams) => void) | undefined;
|
|
8
|
+
onStartBounceItemBounce: ((bounceParams: import("../types/index.js").onBounceParams) => void) | undefined;
|
|
9
|
+
onEndBounceItemBounce: ((bounceParams: import("../types/index.js").onBounceParams) => void) | undefined;
|
|
10
10
|
};
|
|
11
11
|
export { useBounceConfig };
|
|
12
12
|
//# sourceMappingURL=useBounceConfig.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement } from '@lynx-js/react';
|
|
2
|
-
import type { CompoundModeConfig, SwiperProps } from '../types';
|
|
2
|
+
import type { CompoundModeConfig, SwiperProps } from '../types/index.js';
|
|
3
3
|
declare function useBounceView({ startBounceItem, endBounceItem, RTL, itemWidth, count, containerWidth, mode, loop, }: {
|
|
4
4
|
startBounceItem?: ReactElement;
|
|
5
5
|
endBounceItem?: ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBounceView.d.ts","sourceRoot":"","sources":["../../src/hooks/useBounceView.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE/D,iBAAS,aAAa,CAAC,EACrB,eAAe,EACf,aAAa,EACb,GAAG,EACH,SAAS,EACT,KAAK,EACL,cAAc,EACd,IAAI,EACJ,IAAI,GACL,EAAE;IACD,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,aAAa,CAAC,EAAE,YAAY,CAAA;IAC5B,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAChC,IAAI,EAAE,OAAO,CAAA;CACd;;;
|
|
1
|
+
{"version":3,"file":"useBounceView.d.ts","sourceRoot":"","sources":["../../src/hooks/useBounceView.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE/D,iBAAS,aAAa,CAAC,EACrB,eAAe,EACf,aAAa,EACb,GAAG,EACH,SAAS,EACT,KAAK,EACL,cAAc,EACd,IAAI,EACJ,IAAI,GACL,EAAE;IACD,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,aAAa,CAAC,EAAE,YAAY,CAAA;IAC5B,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAChC,IAAI,EAAE,OAAO,CAAA;CACd;;;EA6BA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function useBounceView({ startBounceItem, endBounceItem, RTL, itemWidth, count, containerWidth, mode, loop }) {
|
|
2
|
-
const bounceStartView = startBounceItem ? <view class={RTL ? '
|
|
2
|
+
const bounceStartView = startBounceItem ? <view class={RTL ? 'lynx-ui-swiper__bounce-start-rtl' : 'lynx-ui-swiper__bounce-start'}>
|
|
3
3
|
{startBounceItem}
|
|
4
4
|
</view> : null;
|
|
5
5
|
const shouldShowEndBounce = 'normal' === mode && false === loop && count * itemWidth >= containerWidth;
|
|
6
|
-
const bounceEndView = endBounceItem && shouldShowEndBounce ? <view class={RTL ? '
|
|
6
|
+
const bounceEndView = endBounceItem && shouldShowEndBounce ? <view class={RTL ? 'lynx-ui-swiper__bounce-end-rtl' : 'lynx-ui-swiper__bounce-end'}>
|
|
7
7
|
{endBounceItem}
|
|
8
8
|
</view> : null;
|
|
9
9
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks/useBounceView.jsx","sources":["../../src/hooks/useBounceView.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement } from '@lynx-js/react'\n\nimport type { CompoundModeConfig, SwiperProps } from '../types'\n\nfunction useBounceView({\n startBounceItem,\n endBounceItem,\n RTL,\n itemWidth,\n count,\n containerWidth,\n mode,\n loop,\n}: {\n startBounceItem?: ReactElement\n endBounceItem?: ReactElement\n RTL: SwiperProps<unknown>['RTL']\n itemWidth: number\n containerWidth: number\n count: number\n mode: CompoundModeConfig['mode']\n loop: boolean\n}) {\n const bounceStartView = startBounceItem\n ? (\n <view
|
|
1
|
+
{"version":3,"file":"hooks/useBounceView.jsx","sources":["../../src/hooks/useBounceView.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement } from '@lynx-js/react'\n\nimport type { CompoundModeConfig, SwiperProps } from '../types'\n\nfunction useBounceView({\n startBounceItem,\n endBounceItem,\n RTL,\n itemWidth,\n count,\n containerWidth,\n mode,\n loop,\n}: {\n startBounceItem?: ReactElement\n endBounceItem?: ReactElement\n RTL: SwiperProps<unknown>['RTL']\n itemWidth: number\n containerWidth: number\n count: number\n mode: CompoundModeConfig['mode']\n loop: boolean\n}) {\n const bounceStartView = startBounceItem\n ? (\n <view\n class={RTL\n ? 'lynx-ui-swiper__bounce-start-rtl'\n : 'lynx-ui-swiper__bounce-start'}\n >\n {startBounceItem}\n </view>\n )\n : null\n\n const shouldShowEndBounce = mode === 'normal' && loop === false\n && count * itemWidth >= containerWidth\n\n const bounceEndView = endBounceItem && shouldShowEndBounce\n ? (\n <view\n class={RTL\n ? 'lynx-ui-swiper__bounce-end-rtl'\n : 'lynx-ui-swiper__bounce-end'}\n >\n {endBounceItem}\n </view>\n )\n : null\n\n return { bounceStartView, bounceEndView }\n}\n\nexport { useBounceView }\n"],"names":["useBounceView","startBounceItem","endBounceItem","RTL","itemWidth","count","containerWidth","mode","loop","bounceStartView","view","shouldShowEndBounce","bounceEndView"],"mappings":"AAQA,SAASA,cAAc,EACrBC,eAAe,EACfC,aAAa,EACbC,GAAG,EACHC,SAAS,EACTC,KAAK,EACLC,cAAc,EACdC,IAAI,EACJC,IAAI,EAUL;IACC,MAAMC,kBAAkBR,mBAEnBS,KACC,OAAOP,MACH,qCACA,gCACL;QACC,CAACF,gBAAgB;MACnB,EAAES,QAEF;IAEJ,MAAMC,sBAAsBJ,AAAS,aAATA,QAAqBC,AAAS,UAATA,QAC5CH,QAAQD,aAAaE;IAE1B,MAAMM,gBAAgBV,iBAAiBS,uBAElCD,KACC,OAAOP,MACH,mCACA,8BACL;QACC,CAACD,cAAc;MACjB,EAAEQ,QAEF;IAEJ,OAAO;QAAED;QAAiBG;IAAc;AAC1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SwipeDirection } from '../types';
|
|
2
|
-
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types';
|
|
1
|
+
import { SwipeDirection } from '../types/index.js';
|
|
2
|
+
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types/index.js';
|
|
3
3
|
interface UseChangeOpts extends Pick<SwiperProps<unknown>, 'containerWidth' | 'onSwipeStart' | 'onSwipeStop'> {
|
|
4
4
|
onChange?: (offset: number) => void;
|
|
5
5
|
size: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MainThread } from '@lynx-js/types';
|
|
2
|
-
import { SwipeDirection } from '../types';
|
|
3
|
-
import type { SwiperProps } from '../types';
|
|
2
|
+
import { SwipeDirection } from '../types/index.js';
|
|
3
|
+
import type { SwiperProps } from '../types/index.js';
|
|
4
4
|
export declare function useDirection({ RTL }: {
|
|
5
5
|
RTL: SwiperProps<unknown>['RTL'];
|
|
6
6
|
}): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
-
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types';
|
|
2
|
+
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types/index.js';
|
|
3
3
|
interface LayoutSwiperPropsType extends Pick<SwiperProps<unknown>, 'itemWidth' | 'initialIndex' | 'itemHeight' | 'trackStyle'>, Required<Pick<SwiperProps<unknown>, 'containerWidth' | 'loop' | 'loopDuplicateCount' | 'RTL' | 'swiperKey'>> {
|
|
4
4
|
spaceBetween: number;
|
|
5
5
|
dataCount: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MainThread } from '@lynx-js/types';
|
|
2
|
-
import { SwipeDirection } from '../types';
|
|
3
|
-
import type { BounceConfig, CompoundModeConfig, OffsetLimitResult, ResetOptions, SwipeToOptions, SwiperProps } from '../types';
|
|
2
|
+
import { SwipeDirection } from '../types/index.js';
|
|
3
|
+
import type { BounceConfig, CompoundModeConfig, OffsetLimitResult, ResetOptions, SwipeToOptions, SwiperProps } from '../types/index.js';
|
|
4
4
|
interface UseOffsetOpts extends Required<Pick<SwiperProps<unknown>, 'loop' | 'duration' | 'initialIndex' | 'containerWidth' | 'autoPlay' | 'autoPlayInterval' | 'consumeSlideEvent' | 'RTL'>> {
|
|
5
5
|
dataCount: number;
|
|
6
6
|
size: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types';
|
|
1
|
+
import type { CompoundModeConfig, OffsetLimitResult, SwiperProps } from '../types/index.js';
|
|
2
2
|
interface IOffsetLimit extends Required<Pick<SwiperProps<unknown>, 'loop' | 'itemWidth' | 'containerWidth'>> {
|
|
3
3
|
offsetLimit: SwiperProps<unknown>['offsetLimit'];
|
|
4
4
|
modeConfig: CompoundModeConfig;
|
package/dist/hooks/useReset.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodesRef } from '@lynx-js/types';
|
|
2
|
-
import type { CompoundModeConfig, ResetOptions, SwiperProps, UpdateSwiperInnerContainerOptions } from '../types';
|
|
2
|
+
import type { CompoundModeConfig, ResetOptions, SwiperProps, UpdateSwiperInnerContainerOptions } from '../types/index.js';
|
|
3
3
|
interface UseResetOpts extends Required<Pick<SwiperProps<unknown>, 'swiperKey' | 'loop' | 'itemWidth' | 'itemHeight' | 'containerWidth' | 'initialIndex' | 'loopDuplicateCount'>> {
|
|
4
4
|
resetOnReuse: SwiperProps<unknown>['resetOnReuse'];
|
|
5
5
|
dataCount: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MainThread } from '@lynx-js/types';
|
|
2
|
-
import { SwipeDirection } from '../types';
|
|
3
|
-
import type { SwiperProps } from '../types';
|
|
2
|
+
import { SwipeDirection } from '../types/index.js';
|
|
3
|
+
import type { SwiperProps } from '../types/index.js';
|
|
4
4
|
export declare function useVelocity({ RTL }: {
|
|
5
5
|
RTL: SwiperProps<unknown>['RTL'];
|
|
6
6
|
}): {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Swiper } from './Swiper';
|
|
2
|
-
export { SwiperItem } from './SwiperItem';
|
|
3
|
-
export type { SwiperItemProps } from './SwiperItem';
|
|
4
|
-
export type { SwiperProps, SwiperRef } from './types';
|
|
1
|
+
export { Swiper } from './Swiper/index.js';
|
|
2
|
+
export { SwiperItem } from './SwiperItem/index.js';
|
|
3
|
+
export type { SwiperItemProps } from './SwiperItem/index.js';
|
|
4
|
+
export type { SwiperProps, SwiperRef } from './types/index.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/store/index.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, MainThread } from '@lynx-js/types';
|
|
2
|
-
import type { BounceConfig, SwipeToOptions, SwiperPropsReal as SwiperProps, SwiperRef, onBounceParams } from './index.docs';
|
|
2
|
+
import type { BounceConfig, SwipeToOptions, SwiperPropsReal as SwiperProps, SwiperRef, onBounceParams } from './index.docs.js';
|
|
3
3
|
export interface SwiperContextProps extends Pick<SwiperProps<unknown>, 'itemWidth' | 'itemHeight' | 'customAnimationFirstScreen' | 'RTL'>, Required<Pick<SwiperProps<unknown>, 'initialIndex' | 'loop'>> {
|
|
4
4
|
setChildrenRef: (ref: MainThread.Element, index: number) => void;
|
|
5
5
|
spaceBetween: number;
|
|
@@ -235,7 +235,7 @@ export interface SwiperProps<T> {
|
|
|
235
235
|
/**
|
|
236
236
|
* Determines how swiper respond to touch in different angle.
|
|
237
237
|
* By default, swiper will only respond to horizontal touches.
|
|
238
|
-
* Refer to https://lynxjs.org/
|
|
238
|
+
* Refer to https://lynxjs.org/api/elements/built-in/view.html#consume-slide-event for more
|
|
239
239
|
* @defaultValue [[-180, -135], [-45, 45], [135, 180]]
|
|
240
240
|
* @Android
|
|
241
241
|
* @iOS
|
|
@@ -382,7 +382,7 @@ export interface BounceConfig {
|
|
|
382
382
|
/**
|
|
383
383
|
* Width of bounceItem.
|
|
384
384
|
* When overscroll the bounces, you will have larger and larger resistance, to make overscroll not exceed bounceItemWidth
|
|
385
|
-
* @defaultValue
|
|
385
|
+
* @defaultValue 50
|
|
386
386
|
* @Android
|
|
387
387
|
* @iOS
|
|
388
388
|
* @Harmony
|
|
@@ -392,7 +392,7 @@ export interface BounceConfig {
|
|
|
392
392
|
/**
|
|
393
393
|
* Width of bounceItem.
|
|
394
394
|
* When overscroll the bounces, you will have larger and larger resistance, to make overscroll not exceed bounceItemWidth
|
|
395
|
-
* @defaultValue
|
|
395
|
+
* @defaultValue 50
|
|
396
396
|
* @Android
|
|
397
397
|
* @iOS
|
|
398
398
|
* @Harmony
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OffsetLimitResult } from '../types';
|
|
1
|
+
import type { OffsetLimitResult } from '../types/index.js';
|
|
2
2
|
declare function easeOut(progress: number): number;
|
|
3
3
|
declare function limiter(offset: number, dataCount: number, size: number, spaceBetween: number, loop: boolean, offsetLimit: OffsetLimitResult): number;
|
|
4
4
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/lynx-ui-swiper",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.137.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/lynx-family/lynx-ui.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@lynx-js/react-use": "0.2.2",
|
|
29
|
-
"@lynx-js/lynx-ui-common": "3.
|
|
29
|
+
"@lynx-js/lynx-ui-common": "3.137.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@lynx-js/react": "0.123.1",
|
package/src/Swiper/index.tsx
CHANGED
|
@@ -358,7 +358,7 @@ const Swiper = forwardRef(
|
|
|
358
358
|
return (
|
|
359
359
|
<SwiperContext.Provider value={contextValue}>
|
|
360
360
|
<view
|
|
361
|
-
class='
|
|
361
|
+
class='lynx-ui-swiper__root'
|
|
362
362
|
style={{
|
|
363
363
|
...style,
|
|
364
364
|
width: `${containerWidth}px`,
|
|
@@ -370,7 +370,7 @@ const Swiper = forwardRef(
|
|
|
370
370
|
block-native-event={blockNativeEvent}
|
|
371
371
|
>
|
|
372
372
|
<view
|
|
373
|
-
class='
|
|
373
|
+
class='lynx-ui-swiper__track'
|
|
374
374
|
style={containerStyle}
|
|
375
375
|
ref={setContainerRef}
|
|
376
376
|
main-thread:ref={containerRef}
|
package/src/Swiper/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.lynx-ui-swiper__root {
|
|
2
2
|
display: linear;
|
|
3
3
|
linear-orientation: horizontal;
|
|
4
4
|
width: 100%;
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
overflow: hidden;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.
|
|
9
|
+
.lynx-ui-swiper__track {
|
|
10
10
|
display: linear;
|
|
11
11
|
linear-orientation: horizontal;
|
|
12
12
|
width: 100%;
|
|
13
13
|
height: 100%;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.lynx-ui-swiper__bounce-start {
|
|
17
17
|
position: absolute;
|
|
18
18
|
left: 0;
|
|
19
19
|
transform: translate(-100%);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
width: max-content;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.lynx-ui-swiper__bounce-start-rtl {
|
|
25
25
|
position: absolute;
|
|
26
26
|
inset-inline-start: 0;
|
|
27
27
|
transform: translate(100%);
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
width: max-content;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
32
|
+
.lynx-ui-swiper__bounce-end {
|
|
33
33
|
position: absolute;
|
|
34
34
|
left: 100%;
|
|
35
35
|
height: 100%;
|
|
36
36
|
width: max-content;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
39
|
+
.lynx-ui-swiper__bounce-end-rtl {
|
|
40
40
|
position: absolute;
|
|
41
41
|
inset-inline-start: 100%;
|
|
42
42
|
height: 100%;
|
package/src/SwiperItem/index.tsx
CHANGED
|
@@ -51,7 +51,7 @@ export interface SwiperItemProps {
|
|
|
51
51
|
/**
|
|
52
52
|
* `overlap` attribute passed to SwiperItem's direct child.
|
|
53
53
|
* This property is used only when opacity has issues.
|
|
54
|
-
* Refer to {@link https://lynxjs.org/
|
|
54
|
+
* Refer to {@link https://lynxjs.org/api/css/properties/opacity#opacity}
|
|
55
55
|
* @Android
|
|
56
56
|
* @iOS
|
|
57
57
|
* @Harmony
|
|
@@ -202,7 +202,7 @@ const SwiperItem = (
|
|
|
202
202
|
|
|
203
203
|
return (
|
|
204
204
|
<view
|
|
205
|
-
class='
|
|
205
|
+
class='lynx-ui-swiper__item'
|
|
206
206
|
style={containerStyle}
|
|
207
207
|
main-thread:ref={setRef}
|
|
208
208
|
overlap={overlap}
|
|
@@ -27,7 +27,11 @@ function useBounceView({
|
|
|
27
27
|
}) {
|
|
28
28
|
const bounceStartView = startBounceItem
|
|
29
29
|
? (
|
|
30
|
-
<view
|
|
30
|
+
<view
|
|
31
|
+
class={RTL
|
|
32
|
+
? 'lynx-ui-swiper__bounce-start-rtl'
|
|
33
|
+
: 'lynx-ui-swiper__bounce-start'}
|
|
34
|
+
>
|
|
31
35
|
{startBounceItem}
|
|
32
36
|
</view>
|
|
33
37
|
)
|
|
@@ -38,7 +42,11 @@ function useBounceView({
|
|
|
38
42
|
|
|
39
43
|
const bounceEndView = endBounceItem && shouldShowEndBounce
|
|
40
44
|
? (
|
|
41
|
-
<view
|
|
45
|
+
<view
|
|
46
|
+
class={RTL
|
|
47
|
+
? 'lynx-ui-swiper__bounce-end-rtl'
|
|
48
|
+
: 'lynx-ui-swiper__bounce-end'}
|
|
49
|
+
>
|
|
42
50
|
{endBounceItem}
|
|
43
51
|
</view>
|
|
44
52
|
)
|
package/src/types/index.docs.ts
CHANGED
|
@@ -245,7 +245,7 @@ export interface SwiperProps<T> {
|
|
|
245
245
|
/**
|
|
246
246
|
* Determines how swiper respond to touch in different angle.
|
|
247
247
|
* By default, swiper will only respond to horizontal touches.
|
|
248
|
-
* Refer to https://lynxjs.org/
|
|
248
|
+
* Refer to https://lynxjs.org/api/elements/built-in/view.html#consume-slide-event for more
|
|
249
249
|
* @defaultValue [[-180, -135], [-45, 45], [135, 180]]
|
|
250
250
|
* @Android
|
|
251
251
|
* @iOS
|
|
@@ -397,7 +397,7 @@ export interface BounceConfig {
|
|
|
397
397
|
/**
|
|
398
398
|
* Width of bounceItem.
|
|
399
399
|
* When overscroll the bounces, you will have larger and larger resistance, to make overscroll not exceed bounceItemWidth
|
|
400
|
-
* @defaultValue
|
|
400
|
+
* @defaultValue 50
|
|
401
401
|
* @Android
|
|
402
402
|
* @iOS
|
|
403
403
|
* @Harmony
|
|
@@ -407,7 +407,7 @@ export interface BounceConfig {
|
|
|
407
407
|
/**
|
|
408
408
|
* Width of bounceItem.
|
|
409
409
|
* When overscroll the bounces, you will have larger and larger resistance, to make overscroll not exceed bounceItemWidth
|
|
410
|
-
* @defaultValue
|
|
410
|
+
* @defaultValue 50
|
|
411
411
|
* @Android
|
|
412
412
|
* @iOS
|
|
413
413
|
* @Harmony
|