@lynx-js/lynx-ui-swiper 3.140.1 → 3.142.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 +15 -0
- package/README.md +1 -5
- package/dist/SwiperItem/index.d.ts +2 -1
- package/dist/SwiperItem/index.d.ts.map +1 -1
- package/dist/SwiperItem/index.jsx.map +1 -1
- package/dist/types/index.docs.d.ts +11 -5
- package/dist/types/index.docs.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/SwiperItem/index.tsx +2 -1
- package/src/types/index.docs.ts +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @lynx-js/lynx-ui-swiper
|
|
2
2
|
|
|
3
|
+
## 3.142.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Accept React 18 and newer types. ReactLynx still defines the compatible versions for each app. ([#383](https://github.com/lynx-family/lynx-ui/pull/383))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`49cb3c5`](https://github.com/lynx-family/lynx-ui/commit/49cb3c5b20d9346ff0f8b314367b4c8e354d195d)]:
|
|
10
|
+
- @lynx-js/lynx-ui-common@3.142.0
|
|
11
|
+
|
|
12
|
+
## 3.141.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Clarify Swiper viewport sizing and styling guidance, and use consistent dimensions in skill examples and custom animations. ([#380](https://github.com/lynx-family/lynx-ui/pull/380))
|
|
17
|
+
|
|
3
18
|
## 3.140.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -32,12 +32,13 @@ export interface SwiperItemProps {
|
|
|
32
32
|
*/
|
|
33
33
|
realIndex?: number;
|
|
34
34
|
/**
|
|
35
|
-
* `overlap` attribute
|
|
35
|
+
* `overlap` attribute applied to the view rendered by SwiperItem.
|
|
36
36
|
* This property is used only when opacity has issues.
|
|
37
37
|
* Refer to {@link https://lynxjs.org/api/css/properties/opacity#opacity}
|
|
38
38
|
* @Android
|
|
39
39
|
* @iOS
|
|
40
40
|
* @Harmony
|
|
41
|
+
* @zh 应用到SwiperItem自身渲染的view上的overlap属性,用于处理透明度渲染问题。
|
|
41
42
|
*/
|
|
42
43
|
overlap?: boolean;
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SwiperItem/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,gBAAgB,CAAA;AAK/D,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;IACvC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SwiperItem/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,gBAAgB,CAAA;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,gBAAgB,CAAA;AAK/D,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;IACvC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAmGD,QAAA,MAAM,UAAU,GACd,yCAAyC,eAAe,gCAqDzD,CAAA;AAED,QAAA,MAAM,cAAc,EAAuB,OAAO,UAAU,CAAA;AAE5D,OAAO,EAAE,cAAc,IAAI,UAAU,EAAE,CAAA"}
|
|
@@ -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
|
|
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 applied to the view rendered by SwiperItem.\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 * @zh 应用到SwiperItem自身渲染的view上的overlap属性,用于处理透明度渲染问题。\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":";;AA8EA,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,c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,MAAM,uBACN,OAAO3B,gBACP,YAAY,KAAKyB,QACjB,SAASd,SACV;MACC,CAACD,SAAS;IACZ,EAAEiB;AAEN;AAEA,MAAMC,iBAAiBC,KAAKrB"}
|
|
@@ -37,6 +37,7 @@ export interface SwiperProps<T> {
|
|
|
37
37
|
* <Swiper
|
|
38
38
|
* data={items}
|
|
39
39
|
* itemWidth={350}
|
|
40
|
+
* containerWidth={375}
|
|
40
41
|
* >
|
|
41
42
|
* {({ index, item }) => (
|
|
42
43
|
* <SwiperItem>
|
|
@@ -50,12 +51,15 @@ export interface SwiperProps<T> {
|
|
|
50
51
|
*/
|
|
51
52
|
children: (prop: RenderFunctionProps<T>) => ReactElement;
|
|
52
53
|
/**
|
|
53
|
-
* Width of
|
|
54
|
-
*
|
|
54
|
+
* Width of the Swiper viewport in px. Always pass this prop explicitly.
|
|
55
|
+
* Use the width available inside the parent.
|
|
56
|
+
* For example, inside a screen-width parent with 16px padding on each side,
|
|
57
|
+
* set containerWidth to screenWidth - 32.
|
|
58
|
+
* @defaultValue lynx.__globalProps.screenWidth ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio
|
|
55
59
|
* @Android
|
|
56
60
|
* @iOS
|
|
57
61
|
* @Harmony
|
|
58
|
-
* @zh
|
|
62
|
+
* @zh 轮播图视口的宽度,单位为px。使用时必须显式传入父容器内的可用宽度。例如,父容器与屏幕等宽且左右各有16px内边距时,将containerWidth设置为screenWidth - 32。
|
|
59
63
|
*/
|
|
60
64
|
containerWidth?: number;
|
|
61
65
|
/**
|
|
@@ -218,11 +222,13 @@ export interface SwiperProps<T> {
|
|
|
218
222
|
/**
|
|
219
223
|
* Style for the root element of the Swiper component.
|
|
220
224
|
* This controls the visible viewport/frame that contains the swiper.
|
|
221
|
-
* Use this for
|
|
225
|
+
* Use this for background, borders, border radius, and overflow.
|
|
226
|
+
* Configure dimensions through containerWidth and itemHeight, and direction through RTL.
|
|
227
|
+
* Apply outer padding and CSS classes to a surrounding view.
|
|
222
228
|
* @Android
|
|
223
229
|
* @iOS
|
|
224
230
|
* @Harmony
|
|
225
|
-
* @zh Swiper
|
|
231
|
+
* @zh Swiper组件根元素的样式,用于背景、边框、圆角和溢出等。尺寸通过containerWidth和itemHeight配置,方向通过RTL配置。外层内边距和CSS类放在包裹view上。
|
|
226
232
|
*/
|
|
227
233
|
style?: CSSProperties;
|
|
228
234
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.docs.d.ts","sourceRoot":"","sources":["../../src/types/index.docs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,EAAE,CAAC,EAAE,CAAA;IACT;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B
|
|
1
|
+
{"version":3,"file":"index.docs.d.ts","sourceRoot":"","sources":["../../src/types/index.docs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,EAAE,CAAC,EAAE,CAAA;IACT;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,EAAE,CAAC,IAAI,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"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.142.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@lynx-js/react": "0.123.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@lynx-js/react": ">=0.100.0",
|
|
40
40
|
"@lynx-js/types": "*",
|
|
41
|
-
"@types/react": "
|
|
41
|
+
"@types/react": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
package/src/SwiperItem/index.tsx
CHANGED
|
@@ -49,12 +49,13 @@ export interface SwiperItemProps {
|
|
|
49
49
|
*/
|
|
50
50
|
realIndex?: number
|
|
51
51
|
/**
|
|
52
|
-
* `overlap` attribute
|
|
52
|
+
* `overlap` attribute applied to the view rendered by SwiperItem.
|
|
53
53
|
* This property is used only when opacity has issues.
|
|
54
54
|
* Refer to {@link https://lynxjs.org/api/css/properties/opacity#opacity}
|
|
55
55
|
* @Android
|
|
56
56
|
* @iOS
|
|
57
57
|
* @Harmony
|
|
58
|
+
* @zh 应用到SwiperItem自身渲染的view上的overlap属性,用于处理透明度渲染问题。
|
|
58
59
|
*/
|
|
59
60
|
overlap?: boolean
|
|
60
61
|
}
|
package/src/types/index.docs.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface SwiperProps<T> {
|
|
|
44
44
|
* <Swiper
|
|
45
45
|
* data={items}
|
|
46
46
|
* itemWidth={350}
|
|
47
|
+
* containerWidth={375}
|
|
47
48
|
* >
|
|
48
49
|
* {({ index, item }) => (
|
|
49
50
|
* <SwiperItem>
|
|
@@ -57,12 +58,15 @@ export interface SwiperProps<T> {
|
|
|
57
58
|
*/
|
|
58
59
|
children: (prop: RenderFunctionProps<T>) => ReactElement
|
|
59
60
|
/**
|
|
60
|
-
* Width of
|
|
61
|
-
*
|
|
61
|
+
* Width of the Swiper viewport in px. Always pass this prop explicitly.
|
|
62
|
+
* Use the width available inside the parent.
|
|
63
|
+
* For example, inside a screen-width parent with 16px padding on each side,
|
|
64
|
+
* set containerWidth to screenWidth - 32.
|
|
65
|
+
* @defaultValue lynx.__globalProps.screenWidth ?? SystemInfo.pixelWidth / SystemInfo.pixelRatio
|
|
62
66
|
* @Android
|
|
63
67
|
* @iOS
|
|
64
68
|
* @Harmony
|
|
65
|
-
* @zh
|
|
69
|
+
* @zh 轮播图视口的宽度,单位为px。使用时必须显式传入父容器内的可用宽度。例如,父容器与屏幕等宽且左右各有16px内边距时,将containerWidth设置为screenWidth - 32。
|
|
66
70
|
*/
|
|
67
71
|
containerWidth?: number
|
|
68
72
|
/**
|
|
@@ -228,11 +232,13 @@ export interface SwiperProps<T> {
|
|
|
228
232
|
/**
|
|
229
233
|
* Style for the root element of the Swiper component.
|
|
230
234
|
* This controls the visible viewport/frame that contains the swiper.
|
|
231
|
-
* Use this for
|
|
235
|
+
* Use this for background, borders, border radius, and overflow.
|
|
236
|
+
* Configure dimensions through containerWidth and itemHeight, and direction through RTL.
|
|
237
|
+
* Apply outer padding and CSS classes to a surrounding view.
|
|
232
238
|
* @Android
|
|
233
239
|
* @iOS
|
|
234
240
|
* @Harmony
|
|
235
|
-
* @zh Swiper
|
|
241
|
+
* @zh Swiper组件根元素的样式,用于背景、边框、圆角和溢出等。尺寸通过containerWidth和itemHeight配置,方向通过RTL配置。外层内边距和CSS类放在包裹view上。
|
|
236
242
|
*/
|
|
237
243
|
style?: CSSProperties
|
|
238
244
|
|