Skip to content

Commit

Permalink
fix: make touch events passive to improve scroll performance
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Feb 27, 2024
1 parent 56281dd commit 280c485
Show file tree
Hide file tree
Showing 21 changed files with 357 additions and 335 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "drab",
"description": "A headless custom element library",
"version": "5.3.0",
"version": "5.3.1",
"homepage": "https://drab.robino.dev",
"license": "MIT",
"author": {
Expand Down
35 changes: 18 additions & 17 deletions src/lib/docs/classes/animate.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Animations `options` can be set:

#### Defined in

[src/package/animate/index.ts:39](https://github.com/rossrobino/components/blob/78ddbac/src/package/animate/index.ts#L39)
[src/package/animate/index.ts:39](https://github.com/rossrobino/components/blob/56281dd/src/package/animate/index.ts#L39)

---

Expand All @@ -75,7 +75,7 @@ To clean up event listeners added to `document` when the element is removed.

#### Defined in

[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L17)

---

Expand All @@ -93,7 +93,7 @@ An object containing the values of each `animation-option` attribute

#### Defined in

[src/package/animate/index.ts:46](https://github.com/rossrobino/components/blob/78ddbac/src/package/animate/index.ts#L46)
[src/package/animate/index.ts:46](https://github.com/rossrobino/components/blob/56281dd/src/package/animate/index.ts#L46)

### event

Expand All @@ -119,7 +119,7 @@ Base.event

#### Defined in

[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L30)

`set` **event**(`value`): `void`

Expand All @@ -139,7 +139,7 @@ Base.event

#### Defined in

[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L34)

### keyframes

Expand All @@ -151,7 +151,7 @@ Base.event

#### Defined in

[src/package/animate/index.ts:128](https://github.com/rossrobino/components/blob/78ddbac/src/package/animate/index.ts#L128)
[src/package/animate/index.ts:128](https://github.com/rossrobino/components/blob/56281dd/src/package/animate/index.ts#L128)

---

Expand Down Expand Up @@ -185,7 +185,7 @@ Animates a particular element using the web animations API.

#### Defined in

[src/package/animate/index.ts:76](https://github.com/rossrobino/components/blob/78ddbac/src/package/animate/index.ts#L76)
[src/package/animate/index.ts:76](https://github.com/rossrobino/components/blob/56281dd/src/package/animate/index.ts#L76)

### connectedCallback

Expand All @@ -201,7 +201,7 @@ Animates a particular element using the web animations API.

#### Defined in

[src/package/base/index.ts:151](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L151)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L152)

### destroy

Expand All @@ -219,7 +219,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:158](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L158)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L159)

### disconnectedCallback

Expand All @@ -235,7 +235,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:160](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L160)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L161)

### getContent

Expand Down Expand Up @@ -271,7 +271,7 @@ this.querySelector("[data-content]");

#### Defined in

[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L55)

### getTrigger

Expand Down Expand Up @@ -301,7 +301,7 @@ this.querySelectorAll("[data-trigger]");

#### Defined in

[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L42)

### mount

Expand All @@ -321,7 +321,7 @@ The reason for this is to make these elements work better with frameworks like S

#### Defined in

[src/package/base/index.ts:149](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L149)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L150)

### safeListener

Expand Down Expand Up @@ -356,7 +356,7 @@ element is removed from the DOM, these event listeners are cleaned up.

#### Defined in

[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L118)

### swapContent

Expand All @@ -382,11 +382,11 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L72)

### triggerListener

**triggerListener**\<`T`, `K`\>(`listener`, `type?`): `void`
**triggerListener**\<`T`, `K`\>(`listener`, `type?`, `options?`): `void`

#### Type parameters

Expand All @@ -401,6 +401,7 @@ swaps `this.content()` with the content of the element found.
| :--------- | :------------------------------------------------------ | :--------------------------------------------------- |
| `listener` | (`this`: `T`, `e`: `HTMLElementEventMap`[`K`]) => `any` | Listener to attach to all of the `trigger` elements. |
| `type` | `K` | - |
| `options?` | `AddEventListenerOptions` | - |

#### Returns

Expand All @@ -412,4 +413,4 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L135)
29 changes: 15 additions & 14 deletions src/lib/docs/classes/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ HTMLElement.constructor

#### Defined in

[src/package/base/index.ts:19](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L19)
[src/package/base/index.ts:19](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L19)

---

Expand All @@ -67,7 +67,7 @@ To clean up event listeners added to `document` when the element is removed.

#### Defined in

[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L17)

---

Expand All @@ -93,7 +93,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L30)

`set` **event**(`value`): `void`

Expand All @@ -109,7 +109,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L34)

---

Expand All @@ -125,7 +125,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:151](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L151)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L152)

### destroy

Expand All @@ -139,7 +139,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:158](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L158)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L159)

### disconnectedCallback

Expand All @@ -151,7 +151,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:160](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L160)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L161)

### getContent

Expand Down Expand Up @@ -183,7 +183,7 @@ this.querySelector("[data-content]");

#### Defined in

[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L55)

### getTrigger

Expand All @@ -209,7 +209,7 @@ this.querySelectorAll("[data-trigger]");

#### Defined in

[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L42)

### mount

Expand All @@ -225,7 +225,7 @@ The reason for this is to make these elements work better with frameworks like S

#### Defined in

[src/package/base/index.ts:149](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L149)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L150)

### safeListener

Expand Down Expand Up @@ -256,7 +256,7 @@ element is removed from the DOM, these event listeners are cleaned up.

#### Defined in

[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L118)

### swapContent

Expand All @@ -278,11 +278,11 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L72)

### triggerListener

**triggerListener**\<`T`, `K`\>(`listener`, `type?`): `void`
**triggerListener**\<`T`, `K`\>(`listener`, `type?`, `options?`): `void`

#### Type parameters

Expand All @@ -297,11 +297,12 @@ swaps `this.content()` with the content of the element found.
| :--------- | :------------------------------------------------------ | :--------------------------------------------------- |
| `listener` | (`this`: `T`, `e`: `HTMLElementEventMap`[`K`]) => `any` | Listener to attach to all of the `trigger` elements. |
| `type` | `K` | - |
| `options?` | `AddEventListenerOptions` | - |

#### Returns

`void`

#### Defined in

[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/78ddbac/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/56281dd/src/package/base/index.ts#L135)
Loading

0 comments on commit 280c485

Please sign in to comment.