@rs-x/cli 2.0.0-next.19 → 2.0.0-next.20
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/bin/rsx.cjs +370 -188
- package/package.json +4 -1
- package/{rs-x-vscode-extension-2.0.0-next.19.vsix → rs-x-vscode-extension-2.0.0-next.20.vsix} +0 -0
- package/scripts/prepare-local-rsx-packages.sh +20 -0
- package/scripts/verify-rsx-cli-mutations.sh +258 -0
- package/scripts/verify-rsx-projects.sh +134 -0
- package/scripts/verify-rsx-setup.sh +186 -0
- package/templates/next-demo/components/demo-app.tsx +5 -5
- package/templates/next-demo/components/virtual-table-shell.tsx +2 -2
- package/templates/next-demo/lib/row-model.ts +1 -1
- package/templates/next-demo/lib/virtual-table-controller.ts +17 -5
- package/templates/next-demo/lib/virtual-table-data.service.ts +8 -2
- package/templates/react-demo/src/app/app.tsx +3 -3
- package/templates/react-demo/src/app/virtual-table/row-model.ts +1 -1
- package/templates/react-demo/src/app/virtual-table/virtual-table-controller.ts +17 -5
- package/templates/react-demo/src/app/virtual-table/virtual-table-data.service.ts +8 -2
- package/templates/react-demo/src/app/virtual-table/virtual-table-shell.tsx +1 -0
- package/templates/react-demo/src/main.tsx +1 -0
- package/templates/react-demo/vite.config.ts +1 -1
- package/templates/vue-demo/src/App.vue +5 -5
- package/templates/vue-demo/src/components/VirtualTableShell.vue +19 -6
- package/templates/vue-demo/src/composables/use-virtual-table-controller.ts +1 -1
- package/templates/vue-demo/src/env.d.ts +5 -1
- package/templates/vue-demo/src/lib/row-model.ts +1 -1
- package/templates/vue-demo/src/lib/virtual-table-controller.ts +17 -5
- package/templates/vue-demo/src/lib/virtual-table-data.service.ts +8 -2
- package/templates/vue-demo/src/main.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RowData, type SortDirection, type SortKey } from '@/lib/row-data';
|
|
2
|
-
import { createRowModel,
|
|
2
|
+
import { createRowModel, type RowModel, updateRowModel } from '@/lib/row-model';
|
|
3
3
|
import { VirtualTableDataService } from '@/lib/virtual-table-data.service';
|
|
4
4
|
|
|
5
5
|
export type RowView = {
|
|
@@ -36,7 +36,10 @@ export class VirtualTableController {
|
|
|
36
36
|
private sortKey: SortKey = 'id';
|
|
37
37
|
private sortDirection: SortDirection = 'asc';
|
|
38
38
|
private spacerHeight: number;
|
|
39
|
-
private rowsInView = Math.max(
|
|
39
|
+
private rowsInView = Math.max(
|
|
40
|
+
1,
|
|
41
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
42
|
+
);
|
|
40
43
|
private visibleRows: RowView[] = [];
|
|
41
44
|
private snapshot: VirtualTableSnapshot;
|
|
42
45
|
|
|
@@ -78,7 +81,10 @@ export class VirtualTableController {
|
|
|
78
81
|
|
|
79
82
|
public setViewportHeight(height: number): void {
|
|
80
83
|
this.viewportHeight = height;
|
|
81
|
-
this.rowsInView = Math.max(
|
|
84
|
+
this.rowsInView = Math.max(
|
|
85
|
+
1,
|
|
86
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
87
|
+
);
|
|
82
88
|
this.refresh();
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -89,7 +95,10 @@ export class VirtualTableController {
|
|
|
89
95
|
|
|
90
96
|
this.rowHeight = height;
|
|
91
97
|
this.spacerHeight = this.totalRows * this.rowHeight;
|
|
92
|
-
this.rowsInView = Math.max(
|
|
98
|
+
this.rowsInView = Math.max(
|
|
99
|
+
1,
|
|
100
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
101
|
+
);
|
|
93
102
|
this.refresh();
|
|
94
103
|
}
|
|
95
104
|
|
|
@@ -112,7 +121,10 @@ export class VirtualTableController {
|
|
|
112
121
|
|
|
113
122
|
private refresh(): void {
|
|
114
123
|
const scrollIndex = Math.floor(this.scrollTop / this.rowHeight);
|
|
115
|
-
const bufferTop = Math.max(
|
|
124
|
+
const bufferTop = Math.max(
|
|
125
|
+
0,
|
|
126
|
+
Math.floor((this.poolSize - this.rowsInView) / 2),
|
|
127
|
+
);
|
|
116
128
|
const maxStart = Math.max(0, this.totalRows - this.poolSize);
|
|
117
129
|
const startIndex = Math.min(Math.max(scrollIndex - bufferTop, 0), maxStart);
|
|
118
130
|
const endIndex = Math.min(startIndex + this.poolSize, this.totalRows);
|
|
@@ -42,7 +42,11 @@ export class VirtualTableDataService {
|
|
|
42
42
|
const items: RowData[] = [];
|
|
43
43
|
const endIndex = Math.min(startIndex + pageSize, TOTAL_ROWS);
|
|
44
44
|
|
|
45
|
-
for (
|
|
45
|
+
for (
|
|
46
|
+
let visualIndex = startIndex;
|
|
47
|
+
visualIndex < endIndex;
|
|
48
|
+
visualIndex += 1
|
|
49
|
+
) {
|
|
46
50
|
const id = this.getIdAtVisualIndex(visualIndex, sortKey, sortDirection);
|
|
47
51
|
items.push(createRowData(id));
|
|
48
52
|
}
|
|
@@ -116,7 +120,9 @@ export class VirtualTableDataService {
|
|
|
116
120
|
|
|
117
121
|
private trimCache(): void {
|
|
118
122
|
while (this.pageCache.size > MAX_CACHED_PAGES) {
|
|
119
|
-
const oldestKey = this.pageCache.keys().next().value as
|
|
123
|
+
const oldestKey = this.pageCache.keys().next().value as
|
|
124
|
+
| string
|
|
125
|
+
| undefined;
|
|
120
126
|
if (!oldestKey) {
|
|
121
127
|
return;
|
|
122
128
|
}
|
|
@@ -34,9 +34,9 @@ export const App: FC = () => {
|
|
|
34
34
|
Million-row scrolling with a fixed RS-X expression pool.
|
|
35
35
|
</p>
|
|
36
36
|
<p className="hSub">
|
|
37
|
-
This demo keeps rendering bounded while streaming pages on
|
|
38
|
-
so scrolling stays smooth without growing expression
|
|
39
|
-
dataset.
|
|
37
|
+
This demo keeps rendering bounded while streaming pages on
|
|
38
|
+
demand, so scrolling stays smooth without growing expression
|
|
39
|
+
memory with the dataset.
|
|
40
40
|
</p>
|
|
41
41
|
|
|
42
42
|
<div className="heroActions">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RowData, type SortDirection, type SortKey } from './row-data';
|
|
2
|
-
import { createRowModel,
|
|
2
|
+
import { createRowModel, type RowModel, updateRowModel } from './row-model';
|
|
3
3
|
import { VirtualTableDataService } from './virtual-table-data.service';
|
|
4
4
|
|
|
5
5
|
export type RowView = {
|
|
@@ -36,7 +36,10 @@ export class VirtualTableController {
|
|
|
36
36
|
private sortKey: SortKey = 'id';
|
|
37
37
|
private sortDirection: SortDirection = 'asc';
|
|
38
38
|
private spacerHeight: number;
|
|
39
|
-
private rowsInView = Math.max(
|
|
39
|
+
private rowsInView = Math.max(
|
|
40
|
+
1,
|
|
41
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
42
|
+
);
|
|
40
43
|
private visibleRows: RowView[] = [];
|
|
41
44
|
private snapshot: VirtualTableSnapshot;
|
|
42
45
|
|
|
@@ -78,7 +81,10 @@ export class VirtualTableController {
|
|
|
78
81
|
|
|
79
82
|
public setViewportHeight(height: number): void {
|
|
80
83
|
this.viewportHeight = height;
|
|
81
|
-
this.rowsInView = Math.max(
|
|
84
|
+
this.rowsInView = Math.max(
|
|
85
|
+
1,
|
|
86
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
87
|
+
);
|
|
82
88
|
this.refresh();
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -89,7 +95,10 @@ export class VirtualTableController {
|
|
|
89
95
|
|
|
90
96
|
this.rowHeight = height;
|
|
91
97
|
this.spacerHeight = this.totalRows * this.rowHeight;
|
|
92
|
-
this.rowsInView = Math.max(
|
|
98
|
+
this.rowsInView = Math.max(
|
|
99
|
+
1,
|
|
100
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
101
|
+
);
|
|
93
102
|
this.refresh();
|
|
94
103
|
}
|
|
95
104
|
|
|
@@ -112,7 +121,10 @@ export class VirtualTableController {
|
|
|
112
121
|
|
|
113
122
|
private refresh(): void {
|
|
114
123
|
const scrollIndex = Math.floor(this.scrollTop / this.rowHeight);
|
|
115
|
-
const bufferTop = Math.max(
|
|
124
|
+
const bufferTop = Math.max(
|
|
125
|
+
0,
|
|
126
|
+
Math.floor((this.poolSize - this.rowsInView) / 2),
|
|
127
|
+
);
|
|
116
128
|
const maxStart = Math.max(0, this.totalRows - this.poolSize);
|
|
117
129
|
const startIndex = Math.min(Math.max(scrollIndex - bufferTop, 0), maxStart);
|
|
118
130
|
const endIndex = Math.min(startIndex + this.poolSize, this.totalRows);
|
|
@@ -42,7 +42,11 @@ export class VirtualTableDataService {
|
|
|
42
42
|
const items: RowData[] = [];
|
|
43
43
|
const endIndex = Math.min(startIndex + pageSize, TOTAL_ROWS);
|
|
44
44
|
|
|
45
|
-
for (
|
|
45
|
+
for (
|
|
46
|
+
let visualIndex = startIndex;
|
|
47
|
+
visualIndex < endIndex;
|
|
48
|
+
visualIndex += 1
|
|
49
|
+
) {
|
|
46
50
|
const id = this.getIdAtVisualIndex(visualIndex, sortKey, sortDirection);
|
|
47
51
|
items.push(createRowData(id));
|
|
48
52
|
}
|
|
@@ -116,7 +120,9 @@ export class VirtualTableDataService {
|
|
|
116
120
|
|
|
117
121
|
private trimCache(): void {
|
|
118
122
|
while (this.pageCache.size > MAX_CACHED_PAGES) {
|
|
119
|
-
const oldestKey = this.pageCache.keys().next().value as
|
|
123
|
+
const oldestKey = this.pageCache.keys().next().value as
|
|
124
|
+
| string
|
|
125
|
+
| undefined;
|
|
120
126
|
if (!oldestKey) {
|
|
121
127
|
return;
|
|
122
128
|
}
|
|
@@ -2,6 +2,7 @@ import { type FC } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useVirtualTableController } from '../hooks/use-virtual-table-controller';
|
|
4
4
|
import { useVirtualTableViewport } from '../hooks/use-virtual-table-viewport';
|
|
5
|
+
|
|
5
6
|
import { VirtualTableRow } from './virtual-table-row';
|
|
6
7
|
|
|
7
8
|
export const VirtualTableShell: FC = () => {
|
|
@@ -42,8 +42,8 @@ function toggleTheme(): void {
|
|
|
42
42
|
</p>
|
|
43
43
|
<p class="hSub">
|
|
44
44
|
This demo keeps rendering bounded while streaming pages on demand,
|
|
45
|
-
so scrolling stays smooth without growing expression memory with
|
|
46
|
-
dataset.
|
|
45
|
+
so scrolling stays smooth without growing expression memory with
|
|
46
|
+
the dataset.
|
|
47
47
|
</p>
|
|
48
48
|
|
|
49
49
|
<div class="heroActions">
|
|
@@ -69,9 +69,9 @@ function toggleTheme(): void {
|
|
|
69
69
|
<aside class="card heroNote">
|
|
70
70
|
<h2 class="cardTitle">What This Shows</h2>
|
|
71
71
|
<p class="cardText">
|
|
72
|
-
Only a small row-model pool stays alive while pages stream in
|
|
73
|
-
the viewport. That means one million logical rows without
|
|
74
|
-
live bindings.
|
|
72
|
+
Only a small row-model pool stays alive while pages stream in
|
|
73
|
+
around the viewport. That means one million logical rows without
|
|
74
|
+
one million live bindings.
|
|
75
75
|
</p>
|
|
76
76
|
</aside>
|
|
77
77
|
</div>
|
|
@@ -16,12 +16,20 @@ const visibleRows = computed(() => snapshot.value.visibleRows);
|
|
|
16
16
|
<section class="table-toolbar">
|
|
17
17
|
<div class="toolbar-left">
|
|
18
18
|
<h2>Inventory Snapshot</h2>
|
|
19
|
-
<p>
|
|
19
|
+
<p>
|
|
20
|
+
{{ snapshot.totalRows }} rows • {{ snapshot.poolSize }} pre-wired models
|
|
21
|
+
</p>
|
|
20
22
|
</div>
|
|
21
23
|
<div class="toolbar-right">
|
|
22
|
-
<button type="button" @click="controller.toggleSort('price')">
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
<button type="button" @click="controller.toggleSort('price')">
|
|
25
|
+
Sort by price
|
|
26
|
+
</button>
|
|
27
|
+
<button type="button" @click="controller.toggleSort('quantity')">
|
|
28
|
+
Sort by stock
|
|
29
|
+
</button>
|
|
30
|
+
<button type="button" @click="controller.toggleSort('name')">
|
|
31
|
+
Sort by name
|
|
32
|
+
</button>
|
|
25
33
|
</div>
|
|
26
34
|
</section>
|
|
27
35
|
|
|
@@ -38,9 +46,14 @@ const visibleRows = computed(() => snapshot.value.visibleRows);
|
|
|
38
46
|
<div
|
|
39
47
|
ref="viewport"
|
|
40
48
|
class="table-viewport"
|
|
41
|
-
@scroll="
|
|
49
|
+
@scroll="
|
|
50
|
+
controller.setScrollTop(($event.target as HTMLDivElement).scrollTop)
|
|
51
|
+
"
|
|
42
52
|
>
|
|
43
|
-
<div
|
|
53
|
+
<div
|
|
54
|
+
class="table-spacer"
|
|
55
|
+
:style="{ height: `${snapshot.spacerHeight}px` }"
|
|
56
|
+
/>
|
|
44
57
|
<VirtualTableRow
|
|
45
58
|
v-for="item in visibleRows"
|
|
46
59
|
:key="item.index"
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
declare module '*.vue' {
|
|
2
2
|
import type { DefineComponent } from 'vue';
|
|
3
3
|
|
|
4
|
-
const component: DefineComponent<
|
|
4
|
+
const component: DefineComponent<
|
|
5
|
+
Record<string, never>,
|
|
6
|
+
Record<string, never>,
|
|
7
|
+
unknown
|
|
8
|
+
>;
|
|
5
9
|
export default component;
|
|
6
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RowData, type SortDirection, type SortKey } from './row-data';
|
|
2
|
-
import { createRowModel,
|
|
2
|
+
import { createRowModel, type RowModel, updateRowModel } from './row-model';
|
|
3
3
|
import { VirtualTableDataService } from './virtual-table-data.service';
|
|
4
4
|
|
|
5
5
|
export type RowView = {
|
|
@@ -36,7 +36,10 @@ export class VirtualTableController {
|
|
|
36
36
|
private sortKey: SortKey = 'id';
|
|
37
37
|
private sortDirection: SortDirection = 'asc';
|
|
38
38
|
private spacerHeight: number;
|
|
39
|
-
private rowsInView = Math.max(
|
|
39
|
+
private rowsInView = Math.max(
|
|
40
|
+
1,
|
|
41
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
42
|
+
);
|
|
40
43
|
private visibleRows: RowView[] = [];
|
|
41
44
|
private snapshot: VirtualTableSnapshot;
|
|
42
45
|
|
|
@@ -78,7 +81,10 @@ export class VirtualTableController {
|
|
|
78
81
|
|
|
79
82
|
public setViewportHeight(height: number): void {
|
|
80
83
|
this.viewportHeight = height;
|
|
81
|
-
this.rowsInView = Math.max(
|
|
84
|
+
this.rowsInView = Math.max(
|
|
85
|
+
1,
|
|
86
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
87
|
+
);
|
|
82
88
|
this.refresh();
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -89,7 +95,10 @@ export class VirtualTableController {
|
|
|
89
95
|
|
|
90
96
|
this.rowHeight = height;
|
|
91
97
|
this.spacerHeight = this.totalRows * this.rowHeight;
|
|
92
|
-
this.rowsInView = Math.max(
|
|
98
|
+
this.rowsInView = Math.max(
|
|
99
|
+
1,
|
|
100
|
+
Math.ceil(this.viewportHeight / this.rowHeight),
|
|
101
|
+
);
|
|
93
102
|
this.refresh();
|
|
94
103
|
}
|
|
95
104
|
|
|
@@ -112,7 +121,10 @@ export class VirtualTableController {
|
|
|
112
121
|
|
|
113
122
|
private refresh(): void {
|
|
114
123
|
const scrollIndex = Math.floor(this.scrollTop / this.rowHeight);
|
|
115
|
-
const bufferTop = Math.max(
|
|
124
|
+
const bufferTop = Math.max(
|
|
125
|
+
0,
|
|
126
|
+
Math.floor((this.poolSize - this.rowsInView) / 2),
|
|
127
|
+
);
|
|
116
128
|
const maxStart = Math.max(0, this.totalRows - this.poolSize);
|
|
117
129
|
const startIndex = Math.min(Math.max(scrollIndex - bufferTop, 0), maxStart);
|
|
118
130
|
const endIndex = Math.min(startIndex + this.poolSize, this.totalRows);
|
|
@@ -42,7 +42,11 @@ export class VirtualTableDataService {
|
|
|
42
42
|
const items: RowData[] = [];
|
|
43
43
|
const endIndex = Math.min(startIndex + pageSize, TOTAL_ROWS);
|
|
44
44
|
|
|
45
|
-
for (
|
|
45
|
+
for (
|
|
46
|
+
let visualIndex = startIndex;
|
|
47
|
+
visualIndex < endIndex;
|
|
48
|
+
visualIndex += 1
|
|
49
|
+
) {
|
|
46
50
|
const id = this.getIdAtVisualIndex(visualIndex, sortKey, sortDirection);
|
|
47
51
|
items.push(createRowData(id));
|
|
48
52
|
}
|
|
@@ -116,7 +120,9 @@ export class VirtualTableDataService {
|
|
|
116
120
|
|
|
117
121
|
private trimCache(): void {
|
|
118
122
|
while (this.pageCache.size > MAX_CACHED_PAGES) {
|
|
119
|
-
const oldestKey = this.pageCache.keys().next().value as
|
|
123
|
+
const oldestKey = this.pageCache.keys().next().value as
|
|
124
|
+
| string
|
|
125
|
+
| undefined;
|
|
120
126
|
if (!oldestKey) {
|
|
121
127
|
return;
|
|
122
128
|
}
|