@lynx-js/lynx-ui-scroll-coordinator 3.139.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 +29 -0
- package/SKILL.md +40 -0
- package/dist/types/index.docs.d.ts +4 -1
- package/dist/types/index.docs.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/types/index.docs.ts +4 -1
- package/tsconfig.docs.json +0 -7
- package/tsconfig.json +0 -14
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @lynx-js/lynx-ui-scroll-coordinator
|
|
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
|
+
|
|
11
|
+
## 3.142.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 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))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`49cb3c5`](https://github.com/lynx-family/lynx-ui/commit/49cb3c5b20d9346ff0f8b314367b4c8e354d195d)]:
|
|
18
|
+
- @lynx-js/lynx-ui-common@3.142.0
|
|
19
|
+
|
|
20
|
+
## 3.139.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- Add ScrollCoordinator with collapsible headers, persistent toolbars, nested scrolling, and whole-page or per-page refresh using the public native elements. Align refresh configuration, callbacks, and start/finish methods with FeedList while keeping the implementation independent. Include aggregate exports, API documentation, and component guidance. ([#323](https://github.com/lynx-family/lynx-ui/pull/323))
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`1a4ad19`](https://github.com/lynx-family/lynx-ui/commit/1a4ad190993d57425b4c377a7dd63882cc65a8d2)]:
|
|
29
|
+
- @lynx-js/lynx-ui-common@3.139.0
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scroll-coordinator
|
|
3
|
+
description: Coordinate a collapsible header and persistent toolbar with nested lists, vertical scroll views, or paged content, including whole-page and per-page pull-to-refresh.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# lynx-ui-scroll-coordinator
|
|
7
|
+
|
|
8
|
+
Import `ScrollCoordinator` and `ScrollCoordinatorRef` from `@lynx-js/lynx-ui`. Give the component a bounded height and put a vertical `List`, `ScrollView`, or `ViewPager` of lists in `slot`. The component generates `scroll-coordinator`, `scroll-coordinator-header`, `scroll-coordinator-toolbar`, and `scroll-coordinator-slot` native elements.
|
|
9
|
+
|
|
10
|
+
## Composition
|
|
11
|
+
|
|
12
|
+
`headers` contains the collapsible content. `toolbar` stays visible; the collapse distance is header height minus toolbar height. A toolbar can overlay the header, so reserve room for it in your header layout. Use a `scroll-coordinator-slot-drag` with `enable-drag={false}` around tabs when vertical drags on the tabs should not collapse the header.
|
|
13
|
+
|
|
14
|
+
`className` and `style` size and style the outermost element. With a `refreshOptions` object, this is the `refresh` wrapper. Otherwise it is the native coordinator. All structural styles are minimal; style supplied content with your own design system. `.ui-sticky` is applied to the coordinator and its optional outer refresh wrapper at the sticky threshold.
|
|
15
|
+
|
|
16
|
+
## Refresh
|
|
17
|
+
|
|
18
|
+
For whole-page refresh, provide `refreshOptions={{ enableRefresh: true, headerContent, onStartRefresh }}`. Its callback names and payloads match FeedList, with an independent native implementation and no `mode` option. Use `startRefresh()` to trigger a refresh and always call `finishRefresh()` after the operation settles, including failures. Returning a promise does not finish the animation automatically.
|
|
19
|
+
|
|
20
|
+
Disable `bounces` on Lists inside a whole-page refresh coordinator so the outer refresh owns the pull gesture and rebound.
|
|
21
|
+
|
|
22
|
+
Give `headerContent` a nonzero height and keep its dimensions stable while refreshing to avoid resetting the native header position. `onRefreshOffsetChange` receives `{ offset, headerSize, isDragging }` in px, and `onHeaderReleased` receives the last offset and current header size. `onStartRefresh` reports `triggeredBy: 'drag' | 'startRefresh'`. `onRefreshStateChange` forwards the native numeric state; use `isDragging` to track pulling because native refresh does not synthesize the hook implementation's dragging state.
|
|
23
|
+
|
|
24
|
+
Set `enableRefresh: false` to disable new refreshes without remounting nested content. An active operation can still call `finishRefresh()`. Passing `refreshOptions={false}` or omitting it removes the wrapper.
|
|
25
|
+
|
|
26
|
+
For independent page refresh, set `refreshInSlot` and put a FeedList with `refreshOptions={{ ...options, mode: 'native' }}` inside each page. Finish each page's refresh through its own FeedList ref. Enabled outer refresh takes precedence when both are requested.
|
|
27
|
+
|
|
28
|
+
## Navigation and events
|
|
29
|
+
|
|
30
|
+
Use `scrollTo(offset, animated)`, `scrollToTop(animated)`, `scrollToSticky(animated)`, and `scrollIntoView(headerChildId, animated)`. These control the header only; nested lists retain their own offsets. `scrollIntoView` targets an ID inside `headers`; IDs must be unique on the page. Commands use instance-local refs so multiple coordinators do not share a refresh or scroll target.
|
|
31
|
+
|
|
32
|
+
`onOffsetChange` receives `{ offset, height }` in px. `main-thread:onOffsetChange` receives the same payload and requires a `'main thread'` callback. Sticky transitions use `granularity` as their tolerance and fire once per transition. Zero-height headers do not enter the sticky state.
|
|
33
|
+
|
|
34
|
+
Pass raw native properties explicitly through `coordinatorProps`. Component-managed properties take precedence. `popupOptions` applies only to native hosts supporting popup expansion; normal pages do not need it.
|
|
35
|
+
|
|
36
|
+
The native host must register the public `scroll-coordinator*` and `refresh*` elements. Hosts using legacy registrations can enable the Lynx 4.0+ `syncXElementRegistry` page configuration. Renaming JSX tags alone cannot add missing native implementations.
|
|
37
|
+
|
|
38
|
+
## Prompt formula
|
|
39
|
+
|
|
40
|
+
“Build a bounded ScrollCoordinator with [header], [persistent toolbar], and [vertical list or paged content]. Use [outer refresh or per-page refresh], finish every refresh, preserve nested scroll positions, and use LUNA styles with enough safe-area padding.”
|
|
@@ -44,7 +44,10 @@ export interface ScrollCoordinatorRef {
|
|
|
44
44
|
scrollIntoView: (id: string, animated: boolean, success?: (result: unknown) => void, fail?: (result: unknown) => void) => void;
|
|
45
45
|
}
|
|
46
46
|
export interface ScrollCoordinatorUIVariants {
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Applied to the coordinator and outer refresh wrapper while the header is collapsed.
|
|
49
|
+
* @zh 头部折叠时,应用于协调器和外层刷新容器。
|
|
50
|
+
*/
|
|
48
51
|
'ui-sticky'?: boolean;
|
|
49
52
|
}
|
|
50
53
|
/** Native refresh options with the same callback shapes as FeedList. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.docs.d.ts","sourceRoot":"","sources":["../../src/types/index.docs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EACV,sBAAsB,IAAI,4BAA4B,EACtD,uBAAuB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EAAE,uBAAuB,EAAE,CAAA;AAEvC,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB;;;;OAIG;IACH,WAAW,EAAE,CACX,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,EACnC,IAAI,CA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C,CAAA;IACD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,WAAW,CAAA;IACnC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,IAAI,CACrB,4BAA4B,EAC5B,KAAK,GAAG,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,WAAW,CAClD,CAAA;IACD;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACzD;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACvE;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;CAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/lynx-ui-scroll-coordinator",
|
|
3
|
-
"version": "3.
|
|
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
|
"@lynx-js/gesture-runtime": "2.1.1",
|
|
28
30
|
"clsx": "^2.1.1",
|
|
29
|
-
"@lynx-js/lynx-ui-common": "3.
|
|
31
|
+
"@lynx-js/lynx-ui-common": "3.143.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"@lynx-js/react": "0.123.1",
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
"peerDependencies": {
|
|
40
42
|
"@lynx-js/react": ">=0.100.0",
|
|
41
43
|
"@lynx-js/types": "*",
|
|
42
|
-
"@types/react": "
|
|
44
|
+
"@types/react": ">=18"
|
|
43
45
|
},
|
|
44
46
|
"publishConfig": {
|
|
45
47
|
"access": "public"
|
package/src/types/index.docs.ts
CHANGED
|
@@ -73,7 +73,10 @@ export interface ScrollCoordinatorRef {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export interface ScrollCoordinatorUIVariants {
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Applied to the coordinator and outer refresh wrapper while the header is collapsed.
|
|
78
|
+
* @zh 头部折叠时,应用于协调器和外层刷新容器。
|
|
79
|
+
*/
|
|
77
80
|
'ui-sticky'?: boolean
|
|
78
81
|
}
|
|
79
82
|
|
package/tsconfig.docs.json
DELETED