@lynx-js/lynx-ui-view-pager 3.142.0 → 3.143.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 ADDED
@@ -0,0 +1,39 @@
1
+ # @lynx-js/lynx-ui-view-pager
2
+
3
+ ## 3.143.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Include missing README/CHANGELOG/SKILL/LICENSE files in published tarballs and exclude test and workspace-only config files. ([#404](https://github.com/lynx-family/lynx-ui/pull/404))
8
+ - Updated dependencies [[`29beec7`](https://github.com/lynx-family/lynx-ui/commit/29beec7b241026010b83c417f7e1d1c961cd4f09)]:
9
+ - @lynx-js/lynx-ui-common@3.143.0
10
+ - @lynx-js/lynx-ui-lazy-component@3.143.0
11
+
12
+ ## 3.142.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 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))
17
+
18
+ - Updated dependencies [[`49cb3c5`](https://github.com/lynx-family/lynx-ui/commit/49cb3c5b20d9346ff0f8b314367b4c8e354d195d)]:
19
+ - @lynx-js/lynx-ui-common@3.142.0
20
+ - @lynx-js/lynx-ui-lazy-component@3.142.0
21
+
22
+ ## 3.140.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`20f5316`](https://github.com/lynx-family/lynx-ui/commit/20f531645f7c0e6766269d15129de93f53d9c8ea)]:
27
+ - @lynx-js/lynx-ui-lazy-component@3.140.1
28
+
29
+ ## 3.139.0
30
+
31
+ ### Minor Changes
32
+
33
+ - Add a data-driven ViewPager with generated native page items, exposure-driven lazy rendering, native-ref imperative selection, shared and per-item native props, and a root `id`. ([#277](https://github.com/lynx-family/lynx-ui/pull/277))
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`1a4ad19`](https://github.com/lynx-family/lynx-ui/commit/1a4ad190993d57425b4c377a7dd63882cc65a8d2)]:
38
+ - @lynx-js/lynx-ui-common@3.139.0
39
+ - @lynx-js/lynx-ui-lazy-component@3.139.0
package/SKILL.md ADDED
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: view-pager
3
+ description: Build data-driven, horizontally swipeable page navigation with stable page identity, generated native page containers, optional exposure-based lazy rendering, and imperative navigation.
4
+ ---
5
+
6
+ # lynx-ui-view-pager
7
+
8
+ Use `ViewPager` when a collection of data should render as horizontally swipeable pages. The component generates the required direct native `viewpager-item` children.
9
+
10
+ ```tsx
11
+ import { useRef } from '@lynx-js/react'
12
+ import { ViewPager } from '@lynx-js/lynx-ui'
13
+ import type { ViewPagerRef } from '@lynx-js/lynx-ui'
14
+
15
+ const pages = [
16
+ { id: 'first', title: 'First page' },
17
+ { id: 'second', title: 'Second page' },
18
+ ]
19
+
20
+ export function Pages() {
21
+ const pager = useRef<ViewPagerRef>(null)
22
+ return (
23
+ <ViewPager
24
+ ref={pager}
25
+ data={pages}
26
+ getItemKey={page => page.id}
27
+ itemStyle={{ width: '100%', height: '100%' }}
28
+ style={{ height: '400px' }}
29
+ >
30
+ {page => <text>{page.title}</text>}
31
+ </ViewPager>
32
+ )
33
+ }
34
+ ```
35
+
36
+ `getItemKey` defaults to the item index. Provide stable, unique values when pages can be inserted, removed, or reordered so page state remains attached to the correct data item. Use `itemClassName` and `itemStyle` to style every generated native item. Use `getItemProps` for per-item native class names, styles, accessibility attributes, and other native properties. Per-item styles override shared item styles; ViewPager manages item keys, refs, and children.
37
+
38
+ `initialSelectIndex` applies only at mount. Navigate later with `ref.current?.scrollToPage(index, smooth)`. `onPageChange`, `onPageWillChange`, and `onOffsetChange` receive native events; read payload fields such as the selected index from `event.detail`.
39
+
40
+ Use `main-thread:onPageChange`, `main-thread:onPageWillChange`, or `main-thread:onOffsetChange` with a `'main thread'` function when the handler must run on the main thread. These props receive the same event shapes as their regular-thread counterparts.
41
+
42
+ Pages render eagerly unless `lazyOptions.enableLazy` is true. Lazy mode renders the initial page immediately and uses Lynx exposure placeholders for the rest. Give each pager a page-unique `scene`; use `exposureLeft` and `exposureRight` to control how early neighboring pages render. Once rendered, a page stays mounted while its keyed data item remains.
43
+
44
+ The page renderer receives only `(item, index)`, not selection state. Keep selection-dependent UI outside page content or update it explicitly from `onPageChange`; native swipes do not otherwise require React to rerender the pager's page content.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/lynx-ui-view-pager",
3
- "version": "3.142.0",
3
+ "version": "3.143.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-family/lynx-ui.git",
@@ -16,17 +16,19 @@
16
16
  "module": "./dist/index.jsx",
17
17
  "types": "./dist/index.d.ts",
18
18
  "files": [
19
- "src/**",
19
+ "src",
20
+ "!src/**/__tests__/**",
21
+ "!src/**/*.test.*",
20
22
  "README.md",
23
+ "SKILL.md",
24
+ "CHANGELOG.md",
21
25
  "LICENSE",
22
- "tsconfig.docs.json",
23
- "tsconfig.json",
24
26
  "dist/**"
25
27
  ],
26
28
  "dependencies": {
27
29
  "clsx": "^2.1.1",
28
- "@lynx-js/lynx-ui-common": "3.142.0",
29
- "@lynx-js/lynx-ui-lazy-component": "3.142.0"
30
+ "@lynx-js/lynx-ui-common": "3.143.0",
31
+ "@lynx-js/lynx-ui-lazy-component": "3.143.0"
30
32
  },
31
33
  "devDependencies": {
32
34
  "@lynx-js/react": "0.123.1",
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tools/configs/tsconfig.docs.json",
3
- "include": [
4
- "src",
5
- "dist/types/index.docs.d.ts"
6
- ]
7
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../../tools/configs/tsconfig.lib.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- },
6
- "include": [
7
- "src",
8
- ],
9
- "exclude": [
10
- "**/*.test.ts",
11
- "**/*.test.tsx",
12
- "**/__tests__/**",
13
- ],
14
- }