Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "ESLint"
on: [pull_request]
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive
- name: Run ESLint
run: pnpm lint
16 changes: 16 additions & 0 deletions .github/workflows/pending-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Pending changes"
on: [pull_request]
jobs:
pending-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive
- uses: nickcharlton/diff-check@main
with:
command: pnpm run compile
37 changes: 37 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Playwright Tests"
on: [pull_request]
jobs:
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive

- name: Cache Playwright browser binaries
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright # Default Linux path
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Install Playwright browsers and dependencies (on cache miss)
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm e2e:install

- name: Build library
run: pnpm prerelease
- name: Run Playwright tests
run: pnpm dev:integrations & pnpm e2e:test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: integrations/vite/test-results/
retention-days: 14
15 changes: 15 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Prettier"
on: [pull_request]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive
- name: Run Prettier
run: pnpm run prettier:ci
17 changes: 17 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "TypeScript"
on: [pull_request]
jobs:
typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive
- name: Build NPM package
run: pnpm build
- name: Run TypeScript
run: pnpm tsc
17 changes: 17 additions & 0 deletions .github/workflows/vitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Vitest"
on: [pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile --recursive
- name: Build NPM packages
run: pnpm run build
- name: Run tests
run: pnpm run test:ci
28 changes: 23 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
dist
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
/dist
/docs
*.local

integrations/vite/test-results

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
.cache
*.log
.parcel-cache
.pnp.*
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 5 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist
node_modules
.trunk
/dist
/docs
/generated
/public
/src/routes/examples
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
# Changelog

# 2.0.0

Version 2 simplifies the API and improves TypeScript support.

## Migrating from 1.x to 2.x

Refer to [the docs](https://react-virtualized-auto-sizer.vercel.app/) for a complete list of props and API methods. Below are some examples of migrating from version 1 to 2, but first a couple of potential questions:

<dl>
<dt>Q: Why were the <code>defaultHeight</code> and <code>defaultWidth</code> props removed?</dt>
<dd>A: The more idiomatic way of setting default width and height is to use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default parameters</a>; see below for examples.</dd>
<dt>Q: Why were the <code>disableHeight</code> and <code>disableWidth</code> props removed?</dt>
<dd>A: These props interfered with the TypeScript inference (see issue <a href="https://github.com/bvaughn/react-virtualized-auto-sizer/issues/100">#100</a>). `React.memo` can be used to achieve this behavior instead; see below for examples.</dd>
<dt>Q: Why was the <code>doNotBailOutOnEmptyChildren</code> prop removed?</dt>
<dd>A: This component no longer bails out on empty children; this decision is left up to the child component.</dd>
<dt>Q: Does <code>AutoSizer</code> support CSS transitions/animations?</dt>
<dd>A: To an extent, but as with <code>ResizeObserver</code>, there is no event dispatched when a CSS transition is complete (see issue <a href="https://github.com/bvaughn/react-virtualized-auto-sizer/issues/99">#99</a>). As a potential workaround, the <code>box</code> property can be used to report unscaled size; see below for examples.</dd>
</dl>

### Basic usage
```tsx
// Version 1
<AutoSizer>
{({ height, width }) => {
// ...
}}
</AutoSizer>

// Version 2
<AutoSizer
Child={({ height, width }) => {
// ...
}}
/>
```

### Default width/height for server rendered content
```tsx
// Version 1
<AutoSizer defaultWidth={800} defaultHeight={600} {...rest} />

// Version 2
<AutoSizer
Child={({ height = 600, width = 800 }) => {
// ...
}}
/>
```

### Width only (or height only)
```tsx
// Version 1
<AutoSizer disableWidth {...rest} />

// Version 2
<AutoSizer Child={MemoizedChild} />

const MemoizedChild = memo(
Child,
function arePropsEqual(oldProps, newProps) {
return oldProps.height === newProps.height;
}
);
```

## 1.0.26

- Changed `width` and `height` values to be based om `getBoundingClientRect` rather than `offsetWidth` and `offsetHeight` ([which are integers](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth#value) and can cause rounding/flickering problems in some cases).
Expand Down
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing

Thanks for your interest in contributing to this project!

Here are a couple of guidelines to keep in mind before opening a Pull Request:

- Please open a GitHub issue for discussion _before_ submitting any significant changes to this API (including new features or functionality).
- Please don't submit code that has been written by code-generation tools such as Copilot or Claude. (There's nothing wrong with these tools, but I'd prefer them not be a part of this project.)

## Local development

To get started:
```sh
pnpm install
```

### Running the documentation site locally

The documentation site is a great place to test pending changes. It runs on localhost port 3000 and can be started by running:
```sh
pnpm dev
```

### Running tests locally

To run unit tests locally:
```sh
pnpm test
```

To run end to end tests locally:
```sh
pnpm prerelease
pnpm dev:integrations & pnpm e2e:test
```

### Updating assets

Before subtmitting, also make sure to update generated docs/examples:
```
pnpm compile
pnpm prettier
pnpm lint
```

> [!NOTE]
> If you forget this step, CI will remind you!
Loading
Loading