-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance(clickoutside): broaden node type HTMLElement -> Element (cove…
…r SVG)
- Loading branch information
1 parent
83d1745
commit 022cc1f
Showing
13 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@svelte-put/clickoutside': patch | ||
--- | ||
|
||
broaden node type from `HTMLElement` to `Element` to satisfy type checker with usage on SVG elements (#246) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...cs/src/routes/(main)/docs/(pkg)/lockscroll/_page/codes/js.generated/events.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
import { lockscroll } from '@svelte-put/lockscroll'; | ||
let locked = false; | ||
function toggleLockScroll() { | ||
locked = !locked; | ||
} | ||
function onToggleLockScroll(e) { | ||
console.log('New scroll lock state:', e.detail.locked); | ||
} | ||
</script> | ||
|
||
<!-- event should be automatically typed if used in Typescript --> | ||
<svelte:body use:lockscroll={locked} on:lockscroll:toggle={onToggleLockScroll} /> | ||
<button class="c-btn-primary" on:click={toggleLockScroll}>Toggle lock scroll</button> |
11 changes: 11 additions & 0 deletions
11
...rc/routes/(main)/docs/(pkg)/lockscroll/_page/codes/js.generated/quickStart.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
import { lockscroll } from '@svelte-put/lockscroll'; | ||
let locked = false; | ||
function toggleLockScroll() { | ||
locked = !locked; | ||
} | ||
</script> | ||
|
||
<svelte:body use:lockscroll={locked} /> | ||
<button class="c-btn-primary" on:click={toggleLockScroll}>Toggle lock scroll on body</button> |
21 changes: 21 additions & 0 deletions
21
...utes/(main)/docs/(pkg)/lockscroll/_page/codes/js.generated/scrollContainer.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script> | ||
import { lockscroll } from '@svelte-put/lockscroll'; | ||
let locked = false; | ||
</script> | ||
|
||
<button class="c-btn-primary" on:click={() => (locked = !locked)} | ||
>Toggle lock scroll for below section</button | ||
> | ||
<section class="mt-4 max-h-[400px] overflow-auto rounded bg-bg-soft px-6" use:lockscroll={locked}> | ||
{#each new Array(10) as _} | ||
<p> | ||
What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when | ||
an unknown printer took a galley of type and scrambled it to make a type specimen book. It has | ||
survived not only five centuries, but also the leap into electronic typesetting, remaining | ||
essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets | ||
containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus | ||
PageMaker including versions of Lorem Ipsum. | ||
</p> | ||
{/each} | ||
</section> |
13 changes: 13 additions & 0 deletions
13
.../routes/(main)/docs/(pkg)/lockscroll/_page/codes/js.generated/store-helper.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
import { lockscroll, createLockScrollStore } from '@svelte-put/lockscroll'; | ||
let locked = createLockScrollStore(); | ||
</script> | ||
|
||
<svelte:body use:lockscroll={locked} /> | ||
<div class="flex gap-4"> | ||
<button class="c-btn-primary" on:click={() => locked.toggle()}>Toggle lock scroll</button> | ||
<button class="c-btn-primary-outline" on:click={() => locked.toggle(true)}>Force locked</button> | ||
<button class="c-btn-primary-outline" on:click={() => locked.toggle(false)}>Force unlocked</button | ||
> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...docs/src/routes/(main)/docs/(pkg)/tooltip/_page/codes/js.generated/prepare.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
import { helloTip } from './prepare.code'; | ||
</script> | ||
|
||
<button use:helloTip class="c-btn-primary relative">Hello Button</button> |
22 changes: 22 additions & 0 deletions
22
...s/src/routes/(main)/docs/(pkg)/tooltip/_page/codes/js.generated/quickStart.code.js.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script> | ||
import { computePosition } from '@floating-ui/dom'; | ||
import { tooltip } from '@svelte-put/tooltip'; | ||
</script> | ||
|
||
<button | ||
class="c-btn-primary relative" | ||
use:tooltip={{ | ||
content: 'An example tooltip', | ||
class: 'c-tooltip', | ||
compute: async ({ node, tooltip, content }) => { | ||
console.log(content); | ||
const { x, y } = await computePosition(node, tooltip, { | ||
placement: 'top', | ||
}); | ||
tooltip.style.left = `${x}px`; | ||
tooltip.style.top = `${y}px`; | ||
}, | ||
}} | ||
> | ||
A button with tooltip | ||
</button> |