@ng-native/components 0.27.0 → 0.28.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.
Files changed (57) hide show
  1. package/android/src/main/java/dev/ngnative/components/ContextMenuPopup.kt +61 -19
  2. package/android/src/main/java/dev/ngnative/components/MenusModule.kt +22 -0
  3. package/android/src/main/java/dev/ngnative/components/Shortcut.kt +13 -4
  4. package/dist/context-menu.d.ts +14 -6
  5. package/dist/context-menu.js +30 -28
  6. package/dist/context-menu.js.map +1 -1
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +3 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/menu.d.ts +7 -4
  11. package/dist/menu.js +10 -4
  12. package/dist/menu.js.map +1 -1
  13. package/dist/modal.d.ts +6 -2
  14. package/dist/modal.js.map +1 -1
  15. package/dist/native-button.d.ts +8 -1
  16. package/dist/native-button.js +5 -1
  17. package/dist/native-button.js.map +1 -1
  18. package/dist/press-menu.d.ts +39 -0
  19. package/dist/press-menu.js +76 -0
  20. package/dist/press-menu.js.map +1 -0
  21. package/dist/pressable.d.ts +3 -0
  22. package/dist/pressable.js +6 -1
  23. package/dist/pressable.js.map +1 -1
  24. package/dist/reanimated.js +27 -3
  25. package/dist/reanimated.js.map +1 -1
  26. package/dist/settled-updates.d.ts +55 -0
  27. package/dist/settled-updates.js +77 -0
  28. package/dist/settled-updates.js.map +1 -0
  29. package/dist/sidebar-item.d.ts +18 -3
  30. package/dist/sidebar-item.js +29 -3
  31. package/dist/sidebar-item.js.map +1 -1
  32. package/dist/stand-ins/reanimated.d.ts +5 -0
  33. package/dist/stand-ins/reanimated.js +7 -0
  34. package/dist/stand-ins/reanimated.js.map +1 -1
  35. package/dist/sticky-rows.d.ts +120 -25
  36. package/dist/sticky-rows.js +265 -65
  37. package/dist/sticky-rows.js.map +1 -1
  38. package/dist/svg-icon.d.ts +9 -0
  39. package/dist/svg-icon.js +37 -0
  40. package/dist/svg-icon.js.map +1 -0
  41. package/dist/virtual-list-sticky-level.d.ts +39 -0
  42. package/dist/virtual-list-sticky-level.js +82 -0
  43. package/dist/virtual-list-sticky-level.js.map +1 -0
  44. package/dist/virtual-list-sticky.d.ts +19 -0
  45. package/dist/virtual-list-sticky.js +13 -0
  46. package/dist/virtual-list-sticky.js.map +1 -0
  47. package/dist/virtual-list.d.ts +6 -2
  48. package/dist/virtual-list.js +60 -43
  49. package/dist/virtual-list.js.map +1 -1
  50. package/dist/worklet-style.d.ts +11 -0
  51. package/dist/worklet-style.js +15 -1
  52. package/dist/worklet-style.js.map +1 -1
  53. package/dist/worklets.d.ts +5 -1
  54. package/dist/worklets.js.map +1 -1
  55. package/dist/written-props.js +1 -0
  56. package/dist/written-props.js.map +1 -1
  57. package/package.json +3 -3
@@ -1,9 +1,13 @@
1
1
  import { type Signal } from '@angular/core';
2
2
  import { type HostEngine, type HostNode, type StaticTransform } from '@ng-native/fabric';
3
+ import type { VirtualListSticky } from './virtual-list-sticky.ts';
3
4
  /** What `StickyRows` needs of the list whose rows it pins. */
4
5
  export interface StickyRowsList {
5
6
  /** The sticky rows' indices, as `stickyIndices` gives them. */
6
7
  readonly indices: Signal<readonly number[]>;
8
+ /** The rows' levels, when a directive on the list gives them, read from the items. */
9
+ readonly levels: VirtualListSticky | null;
10
+ readonly items: Signal<readonly unknown[]>;
7
11
  /** Whether the list header is pinned too, as `stickyHeader` says. */
8
12
  readonly header: Signal<boolean>;
9
13
  readonly headerHeight: Signal<number>;
@@ -25,34 +29,59 @@ interface Row {
25
29
  readonly index: number;
26
30
  readonly parked?: boolean;
27
31
  }
32
+ /** A sticky row: how deep it is, the rows it pins under, and the row that pushes it off. */
33
+ interface StickyRow {
34
+ /** 0 for the outermost. The rows of `stickyIndices` are all at 0. */
35
+ readonly level: number;
36
+ /** The nearest row before it of each level further out, outermost first. */
37
+ readonly above: readonly number[];
38
+ /** The next row at its level or further out, if there is one. */
39
+ next: number | undefined;
40
+ }
28
41
  /**
29
- * `<virtual-list>`'s sticky rows: which one holds the leading edge, the style that pins it, the
42
+ * `<virtual-list>`'s sticky rows: which hold the leading edge, the style that pins each, the
30
43
  * header's pinned style, and, where the host moves views by the scroll on the native side, what
31
44
  * native is moving. The list's own share of `stickyIndices` and `stickyHeader`, as `StickyHeaders`
32
45
  * is `<scroll-view>`'s.
33
46
  *
47
+ * Rows pin at levels, when `virtualListStickyLevel` gives them: a row holds the edge under the
48
+ * rows of the levels further out than its own, and the next row at its level or further out pushes
49
+ * it off. Without levels every sticky row is at level 0, each pushed off by the next.
50
+ *
34
51
  * Pinning is not native: RN's `ScrollView.js` translates a sticky child against the scroll offset
35
52
  * in JavaScript, and a row here follows the offset the same way while it is the current one, by
36
53
  * its `top` when absolutely positioned and by a transform when in flow. Where native can move a
37
- * view by the scroll, each sticky row instead stays at its own place in the list and native
38
- * translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader` does; a
39
- * translate committed from each scroll event lands a frame or more late, and on a fast fling the
40
- * row shudders and comes away from the edge.
54
+ * view by the scroll, each sticky row, and a pinned header, instead stays at its own place in the
55
+ * list and native translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader`
56
+ * does; a translate committed from each scroll event lands a frame or more late, and on a fast
57
+ * fling the row shudders and comes away from the edge.
41
58
  */
42
59
  export declare class StickyRows {
43
- /** Whether native moves sticky rows. */
60
+ /** Whether native moves sticky rows and the pinned header. */
44
61
  readonly native: boolean;
45
- /** The leading edge of the viewport in content space, kept only while anything is pinned. */
46
- private readonly leading;
62
+ /**
63
+ * Where the scroll view is along its axis, header and all: 0 until native says otherwise, since
64
+ * Android sends no scroll event until the list moves.
65
+ */
66
+ private readonly along;
67
+ /** The leading edge of the viewport in content space, past the header at its current size. */
47
68
  readonly offset: Signal<number>;
48
69
  private readonly engine;
49
70
  private readonly node;
50
71
  private readonly list;
51
- /** The offset once scrolling pauses, which the settled translate of a native-moved row is from. */
72
+ /**
73
+ * Where the scroll view is once scrolling pauses, header and all, which the settled translate of
74
+ * a native-moved row is from.
75
+ */
52
76
  private readonly settled;
53
77
  private settleTimer;
54
78
  /** What native is moving, by row view, with the transform kept beside the translate. */
55
79
  private readonly drives;
80
+ /**
81
+ * What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no
82
+ * longer is: native goes on drawing a translate it set after its drive is gone.
83
+ */
84
+ private headerDrive;
56
85
  /** The list scrolled itself, and native has not drawn its sticky rows there yet. */
57
86
  private jumped;
58
87
  /** Native has reported reaching the target, so this pass's drives are the last to need telling. */
@@ -65,6 +94,10 @@ export declare class StickyRows {
65
94
  private reported;
66
95
  /** Where native's latest event of all said it was, header and all. */
67
96
  private nativeAt;
97
+ /** The axis the list scrolled along when native said so, until then none. */
98
+ private nativeAxis;
99
+ /** No scroll event has come for `STICKY_SETTLE_MS`, so none is on its way to draw a new graph. */
100
+ private resting;
68
101
  /**
69
102
  * Scroll end events still to come, one for each jump that moved native, as iOS sends one. Kept
70
103
  * across jumps: one that landed has its end still to come, and must not be taken for the next's.
@@ -76,16 +109,31 @@ export declare class StickyRows {
76
109
  constructor(engine: HostEngine, node: HostNode, list: StickyRowsList);
77
110
  /** Whether the scroll offset is needed as a signal, which only pinning needs. */
78
111
  private readonly pinning;
79
- /** Each sticky row, and the one after it, which pushes it off. */
80
- readonly next: Signal<Map<number, number>>;
81
112
  /**
82
- * The sticky row currently holding the leading edge: the last one at or before the offset.
83
- * Null when the list has scrolled back above the first of them.
113
+ * Each sticky row's level, in list order: the rows of `stickyIndices` at level 0, and with a
114
+ * level function every row it gives one. Rows that size themselves take level 0 alone: where a
115
+ * deeper row pins depends on the heights of the rows over it. A sticky index given for rows not
116
+ * there yet pins nothing and pushes nothing off until its row arrives.
117
+ */
118
+ private readonly levels;
119
+ /** Each sticky row, with the rows it pins under and the one that pushes it off. */
120
+ readonly rows: Signal<Map<number, StickyRow>>;
121
+ /**
122
+ * For each sticky row in list order, the least offset that reaches it or a row after it. Where a
123
+ * row starts to hold never comes before where the row before it does, unless a negative `rowGap`
124
+ * overlaps the rows, and this stays in order either way, so `pinned` can halve over it.
84
125
  */
85
- readonly pinned: Signal<number | null>;
126
+ private readonly reach;
127
+ /**
128
+ * The sticky rows currently holding the leading edge, outermost first: the last one the offset
129
+ * has reached, under the rows it pins under. Empty when the list has scrolled back above the
130
+ * first of them.
131
+ */
132
+ readonly pinned: Signal<readonly number[]>;
86
133
  /**
87
134
  * The header's translation while it is pinned: the scroll position, held back at zero by an
88
- * overscroll and at the first sticky row, which pushes it off.
135
+ * overscroll and at the first sticky row, which pushes it off. Where native moves it, the
136
+ * translate native had reached when scrolling paused, as for a sticky row.
89
137
  */
90
138
  readonly headerStyle: Signal<{
91
139
  transform: string;
@@ -97,8 +145,16 @@ export declare class StickyRows {
97
145
  zIndex: number;
98
146
  transform?: undefined;
99
147
  } | undefined>;
100
- /** A pinned row in flow, moved from where flow put it to the leading edge by a transform. */
101
- flowStyle(at: number): Record<string, unknown>;
148
+ /**
149
+ * The pinned row `index` in flow, moved by a transform from `at`, where flow put it, to the leading
150
+ * edge, until the next sticky row reaches it there and pushes it off.
151
+ */
152
+ flowStyle(index: number, at: number): Record<string, unknown>;
153
+ /**
154
+ * A pinned row placed by its `top`: under the rows it pins under, until the next row at its
155
+ * level or further out reaches it there and pushes it off.
156
+ */
157
+ slotStyle(index: number): Record<string, unknown>;
102
158
  /**
103
159
  * A sticky row native moves: at its own place, with the translate native had reached when
104
160
  * scrolling paused, so the props agree with what is on screen.
@@ -112,8 +168,8 @@ export declare class StickyRows {
112
168
  recyclingType(index: number, kind: unknown): unknown;
113
169
  /** Whether a recycling type is a sticky row's. */
114
170
  isType(type: unknown): boolean;
115
- /** The list scrolled, to `offset` in content space and `along` in the scroll view. */
116
- scrolled(offset: number, along: number): void;
171
+ /** The list scrolled, to `along` in the scroll view. */
172
+ scrolled(along: number): void;
117
173
  /** The list is scrolling itself, to `to` in the scroll view, where native has not drawn yet. */
118
174
  jumping(to: number, animated: boolean): void;
119
175
  /** The user took the scroll over: native's own events move the rows from here. */
@@ -125,17 +181,56 @@ export declare class StickyRows {
125
181
  */
126
182
  rested(): void;
127
183
  /**
128
- * Hand each rendered sticky row's view to native to move, and let go of the rest. `views` are
129
- * the rendered rows' views in the same order as `rows`. Each is only asked for where there is a
130
- * drive to make or let go.
184
+ * Hand each rendered sticky row's view to native to move, and let go of the rest, and the
185
+ * header's view, `header`, while it is pinned. `views` are the rendered rows' views in the same
186
+ * order as `rows`. Each is only asked for where there is a drive to make or let go.
187
+ */
188
+ drive(rows: () => readonly Row[], views: () => readonly HostNode[], header: () => HostNode): void;
189
+ /**
190
+ * Hand the header to native to move while it is pinned, by the scroll view's offset until the
191
+ * first sticky row pushes it off. Unpinned, it is moved nowhere.
192
+ */
193
+ private driveHeader;
194
+ /**
195
+ * Where native is told the scroll view is for the header's drive, `pinned` and moved by the range
196
+ * `moved`. Pinned, let go, or moved by a new range at rest, native has no new scroll event to draw
197
+ * it from: it is told where it last said it was. Mid-scroll the next event draws it, and what
198
+ * native last said trails it, and what it said along the other axis says nothing of `axis`. After a
199
+ * jump, `from`, where the list scrolled itself.
131
200
  */
132
- drive(rows: () => readonly Row[], views: () => readonly HostNode[]): void;
201
+ private headerFrom;
202
+ /**
203
+ * Where native is told the scroll view is for a drive made again along `axis`, as for a flip. The
204
+ * one it replaces may have been the last to read the offset, so the new one starts from nothing,
205
+ * and at rest no scroll event comes to draw it: it is told where native last said it was, unless
206
+ * that was along the other axis. After a jump, `from`.
207
+ */
208
+ private remadeFrom;
209
+ /** How native moves the pinned header. A first sticky row at the very top holds it in place. */
210
+ private headerRange;
211
+ /** How far the header moves before the first sticky row pushes it off: to that row's top. */
212
+ private headerLimit;
133
213
  destroy(): void;
134
- /** Where a sticky row stops, pushed off by the next: that row's top, less this row's size. */
214
+ /** The size of the rows a sticky row pins under, which is how far from the edge it holds. */
215
+ private above;
216
+ /**
217
+ * A deeper row is drawn under the rows it pins under, and every sticky row over the rest. See
218
+ * `FRONT`. Without levels a sticky row's zIndex is 1, as it was before there were any.
219
+ */
220
+ private zIndexOf;
221
+ /** The offset a sticky row starts to hold from: where its top meets the rows it pins under. */
222
+ private startOf;
223
+ /**
224
+ * The offset a sticky row stops holding at, pushed off by the next: where that row's top meets
225
+ * this row's far edge.
226
+ */
135
227
  private stopOf;
136
228
  /**
137
229
  * How native moves a rendered row, or null when it does not: along the scroll view's own
138
- * offset, which counts the header, from the row's top until the next sticky row pushes it off.
230
+ * offset, which counts the header, from where the row meets the rows it pins under until the
231
+ * next sticky row pushes it off. A row the next one follows with no space between them holds
232
+ * nowhere, so native moves it nowhere: it is not let go, since native keeps the translate it
233
+ * had moved a row by.
139
234
  */
140
235
  private driveOf;
141
236
  }