@octane-xplat/pager 0.12.0 → 0.13.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/README.md
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
# `@octane-xplat/pager`
|
|
2
2
|
|
|
3
|
+
A paged horizontal swipe container for Octane Xplat apps — onboarding flows,
|
|
4
|
+
media galleries. Each page fills the host; the user swipes between pages.
|
|
5
|
+
|
|
3
6
|
```sh
|
|
4
7
|
pnpm add @octane-xplat/pager
|
|
5
8
|
```
|
|
6
9
|
|
|
7
|
-
Paged horizontal swipe container for Octane xplat apps — onboarding flows,
|
|
8
|
-
media galleries. iOS/Android run `@nativescript-community/ui-pager`
|
|
9
|
-
(ViewPager2 on Android, a paging `UICollectionView` on iOS); web is a
|
|
10
|
-
scroll-snap scroller; a macOS entry exists.
|
|
11
|
-
|
|
12
10
|
```tsx
|
|
13
11
|
import { useState } from 'octane'
|
|
14
12
|
import { Text } from '@octane-xplat/ui'
|
|
15
13
|
import { Pager } from '@octane-xplat/pager'
|
|
16
14
|
|
|
17
15
|
export function Onboarding() {
|
|
18
|
-
const [
|
|
16
|
+
const [page, setPage] = useState(0)
|
|
19
17
|
return (
|
|
20
18
|
<Pager
|
|
21
19
|
items={['Pack', 'Travel']}
|
|
22
|
-
page={
|
|
23
|
-
onPageChange={
|
|
20
|
+
page={page}
|
|
21
|
+
onPageChange={setPage}
|
|
24
22
|
renderItem={(title) => <Text>{title}</Text>}
|
|
25
23
|
renderEmpty={() => <Text>No pages</Text>}
|
|
26
24
|
/>
|
|
@@ -28,39 +26,31 @@ export function Onboarding() {
|
|
|
28
26
|
}
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
It follows the platform-list contract — `items` + `renderItem`, no
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
It follows the platform-list contract — `items` + `renderItem`, no children;
|
|
30
|
+
each page is a full-host-size cell. `onPageChange` fires on settled user
|
|
31
|
+
swipes; programmatic `page` writes don't echo back. `renderEmpty` covers the
|
|
32
|
+
empty list.
|
|
33
|
+
|
|
34
|
+
There is no built-in page indicator. Compose one from `HStack` + `Text`
|
|
35
|
+
driven by the `page` state:
|
|
36
36
|
|
|
37
37
|
```tsx
|
|
38
|
-
import { useState } from 'octane'
|
|
39
38
|
import { HStack, Text } from '@octane-xplat/ui'
|
|
40
|
-
import { Pager } from '@octane-xplat/pager'
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<Pager
|
|
48
|
-
items={titles}
|
|
49
|
-
page={page}
|
|
50
|
-
onPageChange={setPage}
|
|
51
|
-
renderItem={(title) => <Text>{title}</Text>}
|
|
52
|
-
renderEmpty={() => <Text>No pages</Text>}
|
|
53
|
-
/>
|
|
54
|
-
<HStack>
|
|
55
|
-
{titles.map((title, index) => (
|
|
56
|
-
<Text>{index === page ? '●' : '○'}</Text>
|
|
57
|
-
))}
|
|
58
|
-
</HStack>
|
|
59
|
-
</>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
40
|
+
;<HStack>
|
|
41
|
+
{titles.map((title, index) => (
|
|
42
|
+
<Text>{index === page ? '●' : '○'}</Text>
|
|
43
|
+
))}
|
|
44
|
+
</HStack>
|
|
62
45
|
```
|
|
63
46
|
|
|
47
|
+
## Platform support
|
|
48
|
+
|
|
49
|
+
- **iOS/Android** — `@nativescript-community/ui-pager` (ViewPager2 on Android,
|
|
50
|
+
a paging `UICollectionView` on iOS)
|
|
51
|
+
- **Web** — a scroll-snap scroller
|
|
52
|
+
- **macOS** — an entry exists
|
|
53
|
+
|
|
64
54
|
Per-target limits are recorded in
|
|
65
55
|
[known limits](../../docs/verify/known-limits.md). Exercised by
|
|
66
56
|
[`PagerDemo`](../demos/src/PagerDemo.tsrx).
|
package/dist/native/cx.mobile.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
//#region src/cx.mobile.ts
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* className to an intrinsic
|
|
6
|
-
* so web leaves don't need
|
|
2
|
+
/** Native renderers now normalize the declarative `className` prop, but
|
|
3
|
+
* imperative `view.className` writes still need a pre-joined string — NS
|
|
4
|
+
* splits on ' ' only. Native leaves keep normalizing through cx() before
|
|
5
|
+
* handing className to an intrinsic so both paths accept the same values.
|
|
6
|
+
* (The DOM renderer already flattens arrays, so web leaves don't need
|
|
7
|
+
* this.) */
|
|
7
8
|
function cx(...parts) {
|
|
8
9
|
return parts.flat(Infinity).filter(Boolean).join(" ");
|
|
9
10
|
}
|
|
@@ -328,7 +328,7 @@ var Pager = function Pager(props, __s, __extra) {
|
|
|
328
328
|
behavior: "smooth"
|
|
329
329
|
});
|
|
330
330
|
}, [props.page], _hs$ + 7);
|
|
331
|
-
ifBlock(__s, 0, __block.parentNode, props.items.length > 0, __then$0, __else$6, __block.endMarker, [host, props]);
|
|
331
|
+
ifBlock(__s, 0, __block.parentNode, props.items.length > 0, __then$0, __else$6, __block.endMarker, [host, props], 2);
|
|
332
332
|
};
|
|
333
333
|
//#endregion
|
|
334
334
|
export { Pager };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octane-xplat/pager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Paged swipe container for Octane xplat — web scroll-snap row + @nativescript-community/ui-pager (ViewPager2 / paging UICollectionView)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@nativescript-community/octane": "0.2.4",
|
|
52
52
|
"@nativescript/core": "9.1.3",
|
|
53
53
|
"@octanejs/vite-plugin": "0.1.61",
|
|
54
|
-
"octane": "0.
|
|
54
|
+
"octane": "0.11.0",
|
|
55
55
|
"tsrx-typegen": "0.2.2",
|
|
56
56
|
"typescript": "5.9.3",
|
|
57
57
|
"vite": "8.3.0"
|
package/src/cx.mobile.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* className to an intrinsic
|
|
5
|
-
* so web leaves don't need
|
|
1
|
+
/** Native renderers now normalize the declarative `className` prop, but
|
|
2
|
+
* imperative `view.className` writes still need a pre-joined string — NS
|
|
3
|
+
* splits on ' ' only. Native leaves keep normalizing through cx() before
|
|
4
|
+
* handing className to an intrinsic so both paths accept the same values.
|
|
5
|
+
* (The DOM renderer already flattens arrays, so web leaves don't need
|
|
6
|
+
* this.) */
|
|
6
7
|
export function cx(...parts: any[]): string {
|
|
7
8
|
return parts.flat(Infinity).filter(Boolean).join(' ')
|
|
8
9
|
}
|