Skip to content

Commit fd22c5b

Browse files
authored
Docs improvements (#888)
* Update docs compilation pipelin and rendering components * Replaced custom markdown processor for better formatting * Fix continue links * Fix <ul> formatting
1 parent 4379cd4 commit fd22c5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1258
-549
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ Grid will automatically re-render cells when values in this object change.</p>
238238
</tr>
239239
<tr>
240240
<td>dir</td>
241-
<td><p>Corresponds to the HTML dir attribute:
242-
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir">https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir</a></p>
241+
<td><p>Indicates the directionality of grid cells.</p>
242+
<p>ℹ️ See HTML <code>dir</code> <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir">global attribute</a> for more information.</p>
243243
</td>
244244
</tr>
245245
<tr>
@@ -268,8 +268,7 @@ This value is important for server rendering.</p>
268268
</tr>
269269
<tr>
270270
<td>gridRef</td>
271-
<td><p>Ref used to interact with this component&#39;s imperative API.</p>
272-
<p>This API has imperative methods for scrolling and a getter for the outermost DOM element.</p>
271+
<td><p>Imperative Grid API.</p>
273272
<p>ℹ️ The <code>useGridRef</code> and <code>useGridCallbackRef</code> hooks are exported for convenience use in TypeScript projects.</p>
274273
</td>
275274
</tr>

lib/components/grid/Grid.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import type { Align, TagNames } from "../../types";
1515
import { arePropsEqual } from "../../utils/arePropsEqual";
1616
import type { GridProps } from "./types";
1717

18+
/**
19+
* Renders data with many rows and columns.
20+
*/
1821
export function Grid<
1922
CellProps extends object,
2023
TagName extends TagNames = "div"

lib/components/grid/types.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ export type GridProps<
8585
defaultWidth?: number;
8686

8787
/**
88-
* Corresponds to the HTML dir attribute:
89-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir
88+
* Indicates the directionality of grid cells.
89+
*
90+
* ℹ️ See HTML `dir` [global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir) for more information.
9091
*/
9192
dir?: "ltr" | "rtl";
9293

9394
/**
94-
* Ref used to interact with this component's imperative API.
95-
*
96-
* This API has imperative methods for scrolling and a getter for the outermost DOM element.
95+
* Imperative Grid API.
9796
*
9897
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
9998
*/
@@ -244,7 +243,7 @@ export type CachedBounds = Map<
244243
*
245244
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
246245
*/
247-
export type GridImperativeAPI = {
246+
export interface GridImperativeAPI {
248247
/**
249248
* Outermost HTML element for the grid if mounted and null (if not mounted.
250249
*/
@@ -261,7 +260,7 @@ export type GridImperativeAPI = {
261260
*
262261
* @throws RangeError if an invalid row or column index is provided
263262
*/
264-
scrollToCell({
263+
scrollToCell: ({
265264
behavior,
266265
columnAlign,
267266
columnIndex,
@@ -273,7 +272,7 @@ export type GridImperativeAPI = {
273272
columnIndex: number;
274273
rowAlign?: "auto" | "center" | "end" | "smart" | "start";
275274
rowIndex: number;
276-
}): void;
275+
}) => void;
277276

278277
/**
279278
* Scrolls the grid so that the specified column is visible.
@@ -284,15 +283,15 @@ export type GridImperativeAPI = {
284283
*
285284
* @throws RangeError if an invalid column index is provided
286285
*/
287-
scrollToColumn({
286+
scrollToColumn: ({
288287
align,
289288
behavior,
290289
index
291290
}: {
292291
align?: "auto" | "center" | "end" | "smart" | "start";
293292
behavior?: "auto" | "instant" | "smooth";
294293
index: number;
295-
}): void;
294+
}) => void;
296295

297296
/**
298297
* Scrolls the grid so that the specified row is visible.
@@ -303,13 +302,13 @@ export type GridImperativeAPI = {
303302
*
304303
* @throws RangeError if an invalid row index is provided
305304
*/
306-
scrollToRow({
305+
scrollToRow: ({
307306
align,
308307
behavior,
309308
index
310309
}: {
311310
align?: "auto" | "center" | "end" | "smart" | "start";
312311
behavior?: "auto" | "instant" | "smooth";
313312
index: number;
314-
}): void;
315-
};
313+
}) => void;
314+
}

lib/components/list/List.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import type { ListProps } from "./types";
1818

1919
export const DATA_ATTRIBUTE_LIST_INDEX = "data-react-window-index";
2020

21+
/**
22+
* Renders data with many rows.
23+
*/
2124
export function List<
2225
RowProps extends object,
2326
TagName extends TagNames = "div"

lib/components/list/types.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,11 @@ export type CachedBounds = Map<
174174
>;
175175

176176
/**
177-
* Ref used to interact with this component's imperative API.
178-
*
179-
* This API has imperative methods for scrolling and a getter for the outermost DOM element.
177+
* Imperative List API.
180178
*
181179
* ℹ️ The `useListRef` and `useListCallbackRef` hooks are exported for convenience use in TypeScript projects.
182180
*/
183-
export type ListImperativeAPI = {
181+
export interface ListImperativeAPI {
184182
/**
185183
* Outermost HTML element for the list if mounted and null (if not mounted.
186184
*/
@@ -195,13 +193,13 @@ export type ListImperativeAPI = {
195193
*
196194
* @throws RangeError if an invalid row index is provided
197195
*/
198-
scrollToRow({
196+
scrollToRow: ({
199197
align,
200198
behavior,
201199
index
202200
}: {
203201
align?: "auto" | "center" | "end" | "smart" | "start";
204202
behavior?: "auto" | "instant" | "smooth";
205203
index: number;
206-
}): void;
207-
};
204+
}) => void;
205+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
"@testing-library/jest-dom": "^6.6.4",
6262
"@testing-library/react": "^16.3.0",
6363
"@testing-library/user-event": "^14.6.1",
64+
"@ts-ast-parser/core": "^0.8.0",
65+
"@types/markdown-it": "^14.1.2",
6466
"@types/node": "^24.2.0",
6567
"@types/react": "^19.1.8",
6668
"@types/react-dom": "^19.1.6",
@@ -74,6 +76,7 @@
7476
"husky": "^9.1.7",
7577
"jsdom": "^26.1.0",
7678
"lint-staged": "^16.1.4",
79+
"markdown-it": "^14.1.0",
7780
"marked": "^16.4.1",
7881
"postcss": "^8.5.6",
7982
"prettier": "3.6.2",

0 commit comments

Comments
 (0)