@octane-xplat/pager 0.11.1 → 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 +25 -35
- package/dist/native/Pager.tsrx.js +3 -3
- package/dist/native/cx.mobile.js +6 -5
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/Pager.web.tsrx.js +6 -9
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +3 -3
- package/src/cx.mobile.ts +6 -5
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).
|
|
@@ -138,9 +138,9 @@ var PagerInner = defineUniversalComponent("nativescript", function PagerInner(pr
|
|
|
138
138
|
pageSeeded.current = true;
|
|
139
139
|
}, [
|
|
140
140
|
props,
|
|
141
|
-
__methodDep(props, "items", true),
|
|
142
|
-
__methodDep(props, "page", true),
|
|
143
|
-
__methodDep(props, "defaultPage", true)
|
|
141
|
+
__methodDep(props, "items", true, true),
|
|
142
|
+
__methodDep(props, "page", true, true),
|
|
143
|
+
__methodDep(props, "defaultPage", true, true)
|
|
144
144
|
], _h$5);
|
|
145
145
|
return universalValue(__octaneUniversalPlan1, [universalProps([
|
|
146
146
|
[
|
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
|
}
|
|
@@ -15,10 +15,8 @@ function __item$2(item, __s, __extra) {
|
|
|
15
15
|
const i = __block.itemIndex;
|
|
16
16
|
let _b = __s.slots[0];
|
|
17
17
|
if (_b === void 0) {
|
|
18
|
-
let _m1;
|
|
19
18
|
const _root = clone(_t$0);
|
|
20
|
-
|
|
21
|
-
_b = bag4(__s, _root, void 0, _m1, null, void 0);
|
|
19
|
+
_b = bag4(__s, _root, void 0, _root, null, __s);
|
|
22
20
|
}
|
|
23
21
|
_b.a = setAriaAttributeIfChanged(`${i + 1} of ${props.items.length}`, _b.a, _b.b, "aria-label");
|
|
24
22
|
_b.e = bindSignalChild(__s, _b.e, 1, _b.b, props.renderItem(item, i), "b:a193c343", null, void 0, void 0, void 0, true);
|
|
@@ -33,7 +31,7 @@ function __then$0(__props, __s, __extra) {
|
|
|
33
31
|
const props = __extra[1];
|
|
34
32
|
let _b = __s.slots[0];
|
|
35
33
|
if (_b === void 0) {
|
|
36
|
-
let _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m8, _m9, _m10, _m11, _m12, _m13,
|
|
34
|
+
let _m0, _m1, _m2, _m3, _m4, _m5, _m6, _m7, _m8, _m9, _m10, _m11, _m12, _m13, _m15, _m16;
|
|
37
35
|
const _root = clone(_t$1);
|
|
38
36
|
_m0 = (el) => {
|
|
39
37
|
host.current = el;
|
|
@@ -52,7 +50,6 @@ function __then$0(__props, __s, __extra) {
|
|
|
52
50
|
_m11 = props.accessibilityState?.selected;
|
|
53
51
|
_m12 = props.accessibilityState?.checked;
|
|
54
52
|
_m13 = props.accessibilityLiveRegion === "none" ? "off" : props.accessibilityLiveRegion;
|
|
55
|
-
_m14 = _root;
|
|
56
53
|
_m15 = bindSignalHostPropSources(__s, void 0, _root, [
|
|
57
54
|
[
|
|
58
55
|
false,
|
|
@@ -138,7 +135,7 @@ function __then$0(__props, __s, __extra) {
|
|
|
138
135
|
l: _m11,
|
|
139
136
|
m: _m12,
|
|
140
137
|
n: _m13,
|
|
141
|
-
o:
|
|
138
|
+
o: _root,
|
|
142
139
|
p: _m15,
|
|
143
140
|
q: _m16
|
|
144
141
|
});
|
|
@@ -281,9 +278,9 @@ function __else$6(__props, __s, __extra) {
|
|
|
281
278
|
_m0 = __block.parentNode;
|
|
282
279
|
_m1 = child(_root);
|
|
283
280
|
drainFrag(_root, __block.parentNode, __block.endMarker);
|
|
284
|
-
_b = bag4(__s, null, _m0, _m1, null,
|
|
281
|
+
_b = bag4(__s, null, _m0, _m1, null, __s);
|
|
285
282
|
}
|
|
286
|
-
_b.e = bindSignalChild(__s, _b.e, 1, _b.a, props.renderEmpty?.(), "b:8f0f2972", _b.b, true, void 0, true
|
|
283
|
+
_b.e = bindSignalChild(__s, _b.e, 1, _b.a, props.renderEmpty?.(), "b:8f0f2972", _b.b, true, void 0, true);
|
|
287
284
|
}
|
|
288
285
|
var Pager = function Pager(props, __s, __extra) {
|
|
289
286
|
const __block = __s.block;
|
|
@@ -331,7 +328,7 @@ var Pager = function Pager(props, __s, __extra) {
|
|
|
331
328
|
behavior: "smooth"
|
|
332
329
|
});
|
|
333
330
|
}, [props.page], _hs$ + 7);
|
|
334
|
-
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);
|
|
335
332
|
};
|
|
336
333
|
//#endregion
|
|
337
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",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@nativescript-community/octane": "0.2.4",
|
|
52
|
-
"@nativescript/core": "9.1.
|
|
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
|
}
|