From b755b9a07817e28e7c34b835771a143a216c46e8 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Fri, 19 Jul 2024 19:32:50 +1000 Subject: [PATCH 1/2] ci: Add autofix.yml --- .github/workflows/autofix.yml | 29 +++++++++++++++++++++++++++++ scripts/config.js | 8 +------- 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/autofix.yml diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 00000000..ab7f2d2b --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,29 @@ +name: autofix.ci # needed to securely identify the workflow + +on: + pull_request: + push: + branches: [main, alpha, beta] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + autofix: + name: autofix + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Fix formatting + run: pnpm prettier:write + - name: Apply fixes + uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a + with: + commit-message: 'ci: apply automated fixes' diff --git a/scripts/config.js b/scripts/config.js index 79ebffdf..b0ca165a 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -42,16 +42,10 @@ export const branchConfigs = { main: { prerelease: false, }, - next: { - prerelease: true, - }, - beta: { - prerelease: true, - }, alpha: { prerelease: true, }, - rc: { + beta: { prerelease: true, }, } From 765e9465cacc46bb2e32bb55b71fa18b756c9522 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:34:02 +0000 Subject: [PATCH 2/2] ci: apply automated fixes --- packages/lit-virtual/README.md | 80 +++++++++++++++++----------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/packages/lit-virtual/README.md b/packages/lit-virtual/README.md index 680e5eea..6420f306 100644 --- a/packages/lit-virtual/README.md +++ b/packages/lit-virtual/README.md @@ -7,34 +7,36 @@ Efficiently virtualize only the visible DOM nodes within massive scrollable elem `@tanstack/lit-virtual` utilizes [Reactive Controllers](https://lit.dev/docs/composition/controllers/) to create the virtualizer and integrate it with the element lifecycle: ```ts -import { LitElement } from 'lit'; -import { VirtualizerController } from '@tanstack/lit-virtual'; -import { Ref, createRef } from 'lit/directives/ref.js'; +import { LitElement } from 'lit' +import { VirtualizerController } from '@tanstack/lit-virtual' +import { Ref, createRef } from 'lit/directives/ref.js' class MyVirtualElement extends LitElement { - private virtualizerController: VirtualizerController; - private scrollElementRef: Ref = createRef(); - - constructor() { - super(); - this.virtualizerController = new VirtualizerController(this, { - getScrollElement: () => this.scrollElementRef.value, - count: 10000, - estimateSize: () => 35, - overscan: 5, - }); - } - - render() { - const virtualizer = this.virtualizerController.getVirtualizer(); - const virtualItems = virtualizer.getVirtualItems(); - - return html` -
- ${virtualItems.map(item => html`
${item.index}
`)} -
- `; - } + private virtualizerController: VirtualizerController + private scrollElementRef: Ref = createRef() + + constructor() { + super() + this.virtualizerController = new VirtualizerController(this, { + getScrollElement: () => this.scrollElementRef.value, + count: 10000, + estimateSize: () => 35, + overscan: 5, + }) + } + + render() { + const virtualizer = this.virtualizerController.getVirtualizer() + const virtualItems = virtualizer.getVirtualItems() + + return html` +
+ ${virtualItems.map( + (item) => html`
${item.index}
`, + )} +
+ ` + } } ``` @@ -45,21 +47,21 @@ Note that a [Ref](https://lit.dev/docs/templates/directives/#ref) is attached to You can also create a virtualizer controller that attaches to the Window: ```ts -import { WindowVirtualizerController } from '@tanstack/lit-virtual'; +import { WindowVirtualizerController } from '@tanstack/lit-virtual' class MyWindowVirtualElement extends LitElement { - private windowVirtualizerController: WindowVirtualizerController; - - constructor() { - super(); - this.windowVirtualizerController = new WindowVirtualizerController(this, { - count: this.data.length, - estimateSize: () => 350, - overscan: 5, - }); - } - - // Implement render and other lifecycle methods as needed + private windowVirtualizerController: WindowVirtualizerController + + constructor() { + super() + this.windowVirtualizerController = new WindowVirtualizerController(this, { + count: this.data.length, + estimateSize: () => 350, + overscan: 5, + }) + } + + // Implement render and other lifecycle methods as needed } ```