@lynx-js/lynx-ui-swiper 3.133.0 → 3.135.1
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 +16 -0
- package/dist/hooks/useAutoPlay.jsx.map +1 -1
- package/dist/hooks/useModeConfig.d.ts.map +1 -1
- package/dist/hooks/useModeConfig.jsx.map +1 -1
- package/dist/hooks/useOffsetLimit.d.ts.map +1 -1
- package/dist/hooks/useOffsetLimit.jsx +1 -1
- package/dist/hooks/useOffsetLimit.jsx.map +1 -1
- package/dist/utils/compareProps.jsx.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useAutoPlay.ts +1 -1
- package/src/hooks/useModeConfig.ts +1 -2
- package/src/hooks/useOffsetLimit.ts +4 -1
- package/src/utils/compareProps.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lynx-js/lynx-ui-swiper
|
|
2
2
|
|
|
3
|
+
## 3.135.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Keep custom-mode swiper navigation from being locked when item content does not fill the container. ([#223](https://github.com/lynx-family/lynx-ui/pull/223))
|
|
8
|
+
|
|
9
|
+
## 3.133.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Improve Web and desktop touch compatibility by routing `onTouchStart`, ([#200](https://github.com/lynx-family/lynx-ui/pull/200))
|
|
14
|
+
`onTouchMove`, `onTouchEnd`, and `onTouchCancel` through shared touch
|
|
15
|
+
emulation.
|
|
16
|
+
- Updated dependencies [[`3932070`](https://github.com/lynx-family/lynx-ui/commit/393207073522e221a79e65c643df2afb329ec931)]:
|
|
17
|
+
- @lynx-js/lynx-ui-common@3.133.1
|
|
18
|
+
|
|
3
19
|
## 3.133.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks/useAutoPlay.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useAutoPlay.ts"],"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 runOnMainThread,\n useEffect,\n useMainThreadRef,\n useRef,\n} from '@lynx-js/react'\n\nimport { useMemoizedFn } from '@lynx-js/lynx-ui-common'\n\ninterface IAutoPlay {\n autoPlay: boolean\n duration: number\n dataCount: number\n autoPlayInterval: number\n prevMT: () => void\n nextMT: () => void\n}\n\nexport function useAutoplay({\n autoPlay,\n autoPlayInterval,\n nextMT,\n duration,\n}: IAutoPlay) {\n const stoppedRef = useRef<boolean>(false)\n const timerMTRef = useMainThreadRef<number>(0)\n const stoppedMTRef = useMainThreadRef<boolean>(false)\n const autoPlayMTRef = useMainThreadRef<boolean>(autoPlay)\n\n function playMT() {\n 'main thread'\n if (stoppedRef.current || !autoPlayMTRef.current) {\n return\n }\n\n timerMTRef.current && clearTimeout(timerMTRef.current)\n timerMTRef.current = setTimeout(() => {\n nextMT()\n playMT()\n }, autoPlayInterval + duration)
|
|
1
|
+
{"version":3,"file":"hooks/useAutoPlay.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useAutoPlay.ts"],"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 runOnMainThread,\n useEffect,\n useMainThreadRef,\n useRef,\n} from '@lynx-js/react'\n\nimport { useMemoizedFn } from '@lynx-js/lynx-ui-common'\n\ninterface IAutoPlay {\n autoPlay: boolean\n duration: number\n dataCount: number\n autoPlayInterval: number\n prevMT: () => void\n nextMT: () => void\n}\n\nexport function useAutoplay({\n autoPlay,\n autoPlayInterval,\n nextMT,\n duration,\n}: IAutoPlay) {\n const stoppedRef = useRef<boolean>(false)\n const timerMTRef = useMainThreadRef<number>(0)\n const stoppedMTRef = useMainThreadRef<boolean>(false)\n const autoPlayMTRef = useMainThreadRef<boolean>(autoPlay)\n\n function playMT() {\n 'main thread'\n if (stoppedRef.current || !autoPlayMTRef.current) {\n return\n }\n\n timerMTRef.current && clearTimeout(timerMTRef.current)\n timerMTRef.current = setTimeout(() => {\n nextMT()\n playMT()\n }, autoPlayInterval + duration)\n }\n\n function pauseMT() {\n 'main thread'\n if (!autoPlayMTRef.current) {\n return\n }\n timerMTRef.current && clearTimeout(timerMTRef.current)\n stoppedMTRef.current = true\n }\n\n function startMT() {\n 'main thread'\n if (!autoPlayMTRef.current) {\n return\n }\n stoppedMTRef.current = false\n playMT()\n }\n\n function setAutoPlayRef(autoPlayValue: boolean) {\n 'main thread'\n autoPlayMTRef.current = autoPlayValue\n }\n\n const start = useMemoizedFn(() => {\n runOnMainThread(startMT)()\n })\n\n const pause = useMemoizedFn(() => {\n runOnMainThread(pauseMT)()\n })\n\n useEffect(() => {\n runOnMainThread(setAutoPlayRef)(autoPlay)\n if (autoPlay) {\n start()\n } else {\n pause()\n }\n\n return pause\n }, [start, pause, autoPlay])\n\n return {\n pause,\n start,\n pauseMT,\n startMT,\n }\n}\n"],"names":["useAutoplay","autoPlay","autoPlayInterval","nextMT","duration","stoppedRef","useRef","timerMTRef","useMainThreadRef","stoppedMTRef","autoPlayMTRef","playMT","clearTimeout","setTimeout","pauseMT","startMT","setAutoPlayRef","autoPlayValue","start","useMemoizedFn","runOnMainThread","pause","useEffect"],"mappings":";;AAsBO,SAASA,YAAY,EAC1BC,QAAQ,EACRC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACE;IACV,MAAMC,aAAaC,OAAgB;IACnC,MAAMC,aAAaC,iBAAyB;IAC5C,MAAMC,eAAeD,iBAA0B;IAC/C,MAAME,gBAAgBF,iBAA0BP;IAEhD,SAASU;QACP;QACA,IAAIN,WAAW,OAAO,IAAI,CAACK,cAAc,OAAO,EAC9C;QAGFH,WAAW,OAAO,IAAIK,aAAaL,WAAW,OAAO;QACrDA,WAAW,OAAO,GAAGM,WAAW;YAC9BV;YACAQ;QACF,GAAGT,mBAAmBE;IACxB;IAEA,SAASU;QACP;QACA,IAAI,CAACJ,cAAc,OAAO,EACxB;QAEFH,WAAW,OAAO,IAAIK,aAAaL,WAAW,OAAO;QACrDE,aAAa,OAAO,GAAG;IACzB;IAEA,SAASM;QACP;QACA,IAAI,CAACL,cAAc,OAAO,EACxB;QAEFD,aAAa,OAAO,GAAG;QACvBE;IACF;IAEA,SAASK,eAAeC,aAAsB;QAC5C;QACAP,cAAc,OAAO,GAAGO;IAC1B;IAEA,MAAMC,QAAQC,cAAc;QAC1BC,gBAAgBL;IAClB;IAEA,MAAMM,QAAQF,cAAc;QAC1BC,gBAAgBN;IAClB;IAEAQ,UAAU;QACRF,gBAAgBJ,gBAAgBf;QAChC,IAAIA,UACFiB;aAEAG;QAGF,OAAOA;IACT,GAAG;QAACH;QAAOG;QAAOpB;KAAS;IAE3B,OAAO;QACLoB;QACAH;QACAJ;QACAC;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModeConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useModeConfig.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useModeConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useModeConfig.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAElB,WAAW,EACZ,MAAM,UAAU,CAAA;AAGjB;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAe,EACf,UAGC,GACF,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;;;EA2BnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks/useModeConfig.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useModeConfig.ts"],"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 { useMemo, useRef } from '@lynx-js/react'\n\nimport type {\n
|
|
1
|
+
{"version":3,"file":"hooks/useModeConfig.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useModeConfig.ts"],"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 { useMemo, useRef } from '@lynx-js/react'\n\nimport type {\n CompoundModeConfig,\n CompoundNormalModeConfig,\n SwiperProps,\n} from '../types'\nimport { comparePropsWithObject } from '../utils/compareProps'\n\n/**\n * Handle mode and modeConfig\n * Only update reference when mode or content of modeConfig changes\n * This can prevent usage like this causing reRender every time.\n * ```\n * <Swiper mode=\"normal\" modeConfig={{ align: 'center' }}></Swiper>\n * ```\n */\nexport function useModeConfig({\n mode = 'normal',\n modeConfig = {\n align: 'start',\n spaceBetween: 0,\n },\n}: Pick<SwiperProps<unknown>, 'mode' | 'modeConfig'>) {\n const prevModeConfigRef = useRef<CompoundModeConfig | null>(null)\n\n const normalizedModeConfig = useMemo(() => {\n const newConfig: CompoundModeConfig = mode === 'custom'\n ? { mode, ...(modeConfig ?? {}) }\n : {\n mode,\n ...(modeConfig ?? { align: 'start' }),\n } as CompoundNormalModeConfig\n\n // If previous config exists and is equal to new config, return cached version\n if (\n prevModeConfigRef.current\n && comparePropsWithObject(prevModeConfigRef.current, newConfig)\n ) {\n return prevModeConfigRef.current\n }\n\n // Update cache and return new config\n prevModeConfigRef.current = newConfig\n return newConfig\n }, [mode, modeConfig])\n\n const spaceBetween = (modeConfig.spaceBetween as number) ?? 0\n\n return { modeConfig: normalizedModeConfig, spaceBetween }\n}\n"],"names":["useModeConfig","mode","modeConfig","prevModeConfigRef","useRef","normalizedModeConfig","useMemo","newConfig","comparePropsWithObject","spaceBetween"],"mappings":";;AAqBO,SAASA,cAAc,EAC5BC,OAAO,QAAQ,EACfC,aAAa;IACX,OAAO;IACP,cAAc;AAChB,CAAC,EACiD;IAClD,MAAMC,oBAAoBC,OAAkC;IAE5D,MAAMC,uBAAuBC,QAAQ;QACnC,MAAMC,YAAgCN,AAAS,aAATA,OAClC;YAAEA;YAAM,GAAIC,cAAc,CAAC,CAAC;QAAE,IAC9B;YACAD;YACA,GAAIC,cAAc;gBAAE,OAAO;YAAQ,CAAC;QACtC;QAGF,IACEC,kBAAkB,OAAO,IACtBK,uBAAuBL,kBAAkB,OAAO,EAAEI,YAErD,OAAOJ,kBAAkB,OAAO;QAIlCA,kBAAkB,OAAO,GAAGI;QAC5B,OAAOA;IACT,GAAG;QAACN;QAAMC;KAAW;IAErB,MAAMO,eAAgBP,WAAW,YAAY,IAAe;IAE5D,OAAO;QAAE,YAAYG;QAAsBI;IAAa;AAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOffsetLimit.d.ts","sourceRoot":"","sources":["../../src/hooks/useOffsetLimit.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACZ,MAAM,UAAU,CAAA;AAEjB,UAAU,YAAa,SACrB,QAAQ,CACN,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,gBAAgB,CAAC,CACpE;IAED,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IAChD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,IAAI,EACJ,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,GACV,EAAE,YAAY,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useOffsetLimit.d.ts","sourceRoot":"","sources":["../../src/hooks/useOffsetLimit.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACZ,MAAM,UAAU,CAAA;AAEjB,UAAU,YAAa,SACrB,QAAQ,CACN,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,gBAAgB,CAAC,CACpE;IAED,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IAChD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,IAAI,EACJ,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,GACV,EAAE,YAAY,GAAG,iBAAiB,CA+DlC"}
|
|
@@ -14,7 +14,7 @@ function useOffsetLimit({ offsetLimit, loop, modeConfig, itemWidth, containerWid
|
|
|
14
14
|
endLimit: offsetLimit[1],
|
|
15
15
|
isNotEnoughForScreen: false
|
|
16
16
|
};
|
|
17
|
-
if (totalContentWidth <= containerWidth + epsilon) return {
|
|
17
|
+
if ('normal' === modeConfig.mode && totalContentWidth <= containerWidth + epsilon) return {
|
|
18
18
|
startLimit: 0,
|
|
19
19
|
endLimit: Math.max(fullSize * (dataCount - 1), 0),
|
|
20
20
|
isNotEnoughForScreen: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks/useOffsetLimit.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useOffsetLimit.ts"],"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 { useMemo } from '@lynx-js/react'\n\nimport type {\n CompoundModeConfig,\n OffsetLimitResult,\n SwiperProps,\n} from '../types'\n\ninterface IOffsetLimit extends\n Required<\n Pick<SwiperProps<unknown>, 'loop' | 'itemWidth' | 'containerWidth'>\n >\n{\n offsetLimit: SwiperProps<unknown>['offsetLimit']\n modeConfig: CompoundModeConfig\n dataCount: number\n spaceBetween: number\n}\n\n/**\n * `offsetLimit` is used to limit the range of offset. Useful for when setting `align='start'`,\n * the last item should align with right edge, instead of align to the left.\n * This can achieved by setting offsetLimit to `[0, containerWidth - itemWidth]`, which basically\n * prevent further scroll if the last item is bond to right edge.\n */\nexport function useOffsetLimit({\n offsetLimit,\n loop,\n modeConfig,\n itemWidth,\n containerWidth,\n spaceBetween,\n dataCount,\n}: IOffsetLimit): OffsetLimitResult {\n const finalOffsetLimit = useMemo<OffsetLimitResult>(() => {\n const epsilon = 0.000001\n const fullSize = itemWidth + spaceBetween\n const totalContentWidth = fullSize * dataCount - spaceBetween\n\n if (loop) {\n return {\n startLimit: 0,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n } else if (offsetLimit) {\n return {\n startLimit: offsetLimit[0],\n endLimit: offsetLimit[1],\n isNotEnoughForScreen: false,\n }\n } else {\n // If SwiperItem can not occupy the screen, do not apply offsetLimit.\n if (totalContentWidth <= containerWidth + epsilon) {\n return {\n startLimit: 0,\n // Lock both start/end to the same offset to disable scroll.\n endLimit: Math.max(fullSize * (dataCount - 1), 0),\n isNotEnoughForScreen: true,\n }\n }\n\n if (modeConfig.mode === 'normal' && modeConfig.align === 'start') {\n return {\n startLimit: 0,\n endLimit: containerWidth - itemWidth,\n isNotEnoughForScreen: false,\n }\n } else if (modeConfig.mode === 'normal' && modeConfig.align === 'end') {\n return {\n startLimit: containerWidth - itemWidth,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n }\n return {\n startLimit: 0,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n }\n }, [\n dataCount,\n offsetLimit?.[0],\n offsetLimit?.[1],\n modeConfig,\n loop,\n itemWidth,\n spaceBetween,\n containerWidth,\n ])\n\n return finalOffsetLimit\n}\n"],"names":["useOffsetLimit","offsetLimit","loop","modeConfig","itemWidth","containerWidth","spaceBetween","dataCount","finalOffsetLimit","useMemo","epsilon","fullSize","totalContentWidth","Math"],"mappings":";AA6BO,SAASA,eAAe,EAC7BC,WAAW,EACXC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,YAAY,EACZC,SAAS,EACI;IACb,MAAMC,mBAAmBC,QAA2B;QAClD,MAAMC,UAAU;QAChB,MAAMC,WAAWP,YAAYE;QAC7B,MAAMM,oBAAoBD,WAAWJ,YAAYD;QAEjD,IAAIJ,MACF,OAAO;YACL,YAAY;YACZ,UAAU;YACV,sBAAsB;QACxB;QACK,IAAID,aACT,OAAO;YACL,YAAYA,WAAW,CAAC,EAAE;YAC1B,UAAUA,WAAW,CAAC,EAAE;YACxB,sBAAsB;QACxB;QAGA,
|
|
1
|
+
{"version":3,"file":"hooks/useOffsetLimit.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/hooks/useOffsetLimit.ts"],"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 { useMemo } from '@lynx-js/react'\n\nimport type {\n CompoundModeConfig,\n OffsetLimitResult,\n SwiperProps,\n} from '../types'\n\ninterface IOffsetLimit extends\n Required<\n Pick<SwiperProps<unknown>, 'loop' | 'itemWidth' | 'containerWidth'>\n >\n{\n offsetLimit: SwiperProps<unknown>['offsetLimit']\n modeConfig: CompoundModeConfig\n dataCount: number\n spaceBetween: number\n}\n\n/**\n * `offsetLimit` is used to limit the range of offset. Useful for when setting `align='start'`,\n * the last item should align with right edge, instead of align to the left.\n * This can achieved by setting offsetLimit to `[0, containerWidth - itemWidth]`, which basically\n * prevent further scroll if the last item is bond to right edge.\n */\nexport function useOffsetLimit({\n offsetLimit,\n loop,\n modeConfig,\n itemWidth,\n containerWidth,\n spaceBetween,\n dataCount,\n}: IOffsetLimit): OffsetLimitResult {\n const finalOffsetLimit = useMemo<OffsetLimitResult>(() => {\n const epsilon = 0.000001\n const fullSize = itemWidth + spaceBetween\n const totalContentWidth = fullSize * dataCount - spaceBetween\n\n if (loop) {\n return {\n startLimit: 0,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n } else if (offsetLimit) {\n return {\n startLimit: offsetLimit[0],\n endLimit: offsetLimit[1],\n isNotEnoughForScreen: false,\n }\n } else {\n // If SwiperItem can not occupy the screen, do not apply offsetLimit.\n if (\n modeConfig.mode === 'normal'\n && totalContentWidth <= containerWidth + epsilon\n ) {\n return {\n startLimit: 0,\n // Lock both start/end to the same offset to disable scroll.\n endLimit: Math.max(fullSize * (dataCount - 1), 0),\n isNotEnoughForScreen: true,\n }\n }\n\n if (modeConfig.mode === 'normal' && modeConfig.align === 'start') {\n return {\n startLimit: 0,\n endLimit: containerWidth - itemWidth,\n isNotEnoughForScreen: false,\n }\n } else if (modeConfig.mode === 'normal' && modeConfig.align === 'end') {\n return {\n startLimit: containerWidth - itemWidth,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n }\n return {\n startLimit: 0,\n endLimit: 0,\n isNotEnoughForScreen: false,\n }\n }\n }, [\n dataCount,\n offsetLimit?.[0],\n offsetLimit?.[1],\n modeConfig,\n loop,\n itemWidth,\n spaceBetween,\n containerWidth,\n ])\n\n return finalOffsetLimit\n}\n"],"names":["useOffsetLimit","offsetLimit","loop","modeConfig","itemWidth","containerWidth","spaceBetween","dataCount","finalOffsetLimit","useMemo","epsilon","fullSize","totalContentWidth","Math"],"mappings":";AA6BO,SAASA,eAAe,EAC7BC,WAAW,EACXC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,YAAY,EACZC,SAAS,EACI;IACb,MAAMC,mBAAmBC,QAA2B;QAClD,MAAMC,UAAU;QAChB,MAAMC,WAAWP,YAAYE;QAC7B,MAAMM,oBAAoBD,WAAWJ,YAAYD;QAEjD,IAAIJ,MACF,OAAO;YACL,YAAY;YACZ,UAAU;YACV,sBAAsB;QACxB;QACK,IAAID,aACT,OAAO;YACL,YAAYA,WAAW,CAAC,EAAE;YAC1B,UAAUA,WAAW,CAAC,EAAE;YACxB,sBAAsB;QACxB;QAGA,IACEE,AAAoB,aAApBA,WAAW,IAAI,IACZS,qBAAqBP,iBAAiBK,SAEzC,OAAO;YACL,YAAY;YAEZ,UAAUG,KAAK,GAAG,CAACF,WAAYJ,CAAAA,YAAY,IAAI;YAC/C,sBAAsB;QACxB;QAGF,IAAIJ,AAAoB,aAApBA,WAAW,IAAI,IAAiBA,AAAqB,YAArBA,WAAW,KAAK,EAClD,OAAO;YACL,YAAY;YACZ,UAAUE,iBAAiBD;YAC3B,sBAAsB;QACxB;QACK,IAAID,AAAoB,aAApBA,WAAW,IAAI,IAAiBA,AAAqB,UAArBA,WAAW,KAAK,EACzD,OAAO;YACL,YAAYE,iBAAiBD;YAC7B,UAAU;YACV,sBAAsB;QACxB;QAEF,OAAO;YACL,YAAY;YACZ,UAAU;YACV,sBAAsB;QACxB;IAEJ,GAAG;QACDG;QACAN,aAAa,CAAC,EAAE;QAChBA,aAAa,CAAC,EAAE;QAChBE;QACAD;QACAE;QACAE;QACAD;KACD;IAED,OAAOG;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/compareProps.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/utils/compareProps.ts"],"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\ntype DeepObject = Record<string, unknown>\n\nexport function comparePropsWithObject(\n prev: unknown,\n next: unknown,\n objectKeys?: string[],\n): boolean {\n if (prev === next) {\n return true\n }\n\n if (\n typeof prev !== 'object' || typeof next !== 'object' || prev === null\n || next === null\n ) {\n return false\n }\n\n const prevKeys = Object.keys(prev
|
|
1
|
+
{"version":3,"file":"utils/compareProps.jsx","sources":["webpack://@lynx-js/lynx-ui-swiper/./src/utils/compareProps.ts"],"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\ntype DeepObject = Record<string, unknown>\n\nexport function comparePropsWithObject(\n prev: unknown,\n next: unknown,\n objectKeys?: string[],\n): boolean {\n if (prev === next) {\n return true\n }\n\n if (\n typeof prev !== 'object' || typeof next !== 'object' || prev === null\n || next === null\n ) {\n return false\n }\n\n const prevKeys = Object.keys(prev)\n const nextKeys = Object.keys(next)\n\n if (prevKeys.length !== nextKeys.length) {\n return false\n }\n\n for (const key of prevKeys) {\n if (objectKeys?.includes(key)) {\n if (\n !comparePropsWithObject(\n (prev as DeepObject)[key],\n (next as DeepObject)[key],\n [],\n )\n ) {\n return false\n }\n } else {\n if (\n !Object.is(\n (prev as DeepObject)[key],\n (next as DeepObject)[key],\n )\n ) {\n return false\n }\n }\n }\n\n return true\n}\n"],"names":["comparePropsWithObject","prev","next","objectKeys","prevKeys","Object","nextKeys","key"],"mappings":"AAMO,SAASA,uBACdC,IAAa,EACbC,IAAa,EACbC,UAAqB;IAErB,IAAIF,SAASC,MACX,OAAO;IAGT,IACE,AAAgB,YAAhB,OAAOD,QAAqB,AAAgB,YAAhB,OAAOC,QAAqBD,AAAS,SAATA,QACrDC,AAAS,SAATA,MAEH,OAAO;IAGT,MAAME,WAAWC,OAAO,IAAI,CAACJ;IAC7B,MAAMK,WAAWD,OAAO,IAAI,CAACH;IAE7B,IAAIE,SAAS,MAAM,KAAKE,SAAS,MAAM,EACrC,OAAO;IAGT,KAAK,MAAMC,OAAOH,SAChB,IAAID,YAAY,SAASI,MACvB;QAAA,IACE,CAACP,uBACEC,IAAmB,CAACM,IAAI,EACxBL,IAAmB,CAACK,IAAI,EACzB,EAAE,GAGJ,OAAO;IACT,OAEA,IACE,CAACF,OAAO,EAAE,CACPJ,IAAmB,CAACM,IAAI,EACxBL,IAAmB,CAACK,IAAI,GAG3B,OAAO;IAKb,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/lynx-ui-swiper",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.135.1",
|
|
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.1.3",
|
|
29
|
-
"@lynx-js/lynx-ui-common": "3.133.
|
|
29
|
+
"@lynx-js/lynx-ui-common": "3.133.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@lynx-js/react": "0.114.0",
|
package/src/hooks/useAutoPlay.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { useMemo, useRef } from '@lynx-js/react'
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
|
-
CompoundCustomModeConfig,
|
|
9
8
|
CompoundModeConfig,
|
|
10
9
|
CompoundNormalModeConfig,
|
|
11
10
|
SwiperProps,
|
|
@@ -31,7 +30,7 @@ export function useModeConfig({
|
|
|
31
30
|
|
|
32
31
|
const normalizedModeConfig = useMemo(() => {
|
|
33
32
|
const newConfig: CompoundModeConfig = mode === 'custom'
|
|
34
|
-
? { mode, ...(modeConfig ?? {}) }
|
|
33
|
+
? { mode, ...(modeConfig ?? {}) }
|
|
35
34
|
: {
|
|
36
35
|
mode,
|
|
37
36
|
...(modeConfig ?? { align: 'start' }),
|
|
@@ -55,7 +55,10 @@ export function useOffsetLimit({
|
|
|
55
55
|
}
|
|
56
56
|
} else {
|
|
57
57
|
// If SwiperItem can not occupy the screen, do not apply offsetLimit.
|
|
58
|
-
if (
|
|
58
|
+
if (
|
|
59
|
+
modeConfig.mode === 'normal'
|
|
60
|
+
&& totalContentWidth <= containerWidth + epsilon
|
|
61
|
+
) {
|
|
59
62
|
return {
|
|
60
63
|
startLimit: 0,
|
|
61
64
|
// Lock both start/end to the same offset to disable scroll.
|
|
@@ -20,8 +20,8 @@ export function comparePropsWithObject(
|
|
|
20
20
|
return false
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const prevKeys = Object.keys(prev
|
|
24
|
-
const nextKeys = Object.keys(next
|
|
23
|
+
const prevKeys = Object.keys(prev)
|
|
24
|
+
const nextKeys = Object.keys(next)
|
|
25
25
|
|
|
26
26
|
if (prevKeys.length !== nextKeys.length) {
|
|
27
27
|
return false
|