-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
193 additions
and
184 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,71 @@ | ||
<script lang="ts"> | ||
import { createSlider, melt } from '@melt-ui/svelte'; | ||
import type { ChangeFn } from '@melt-ui/svelte/internal/helpers'; | ||
import Button from './Button.svelte'; | ||
import Spacing from './Spacing.svelte'; | ||
import { createSlider, melt } from "@melt-ui/svelte"; | ||
import type { ChangeFn } from "@melt-ui/svelte/internal/helpers"; | ||
import Button from "./Button.svelte"; | ||
import Spacing from "./Spacing.svelte"; | ||
export let defaultValue: number | undefined = undefined; | ||
export let min: number | undefined = undefined; | ||
export let max: number | undefined = undefined; | ||
export let step: number | undefined = undefined; | ||
export let onValueChange: ((value: number[]) => void) | undefined = undefined; | ||
export let defaultValue: number | undefined = undefined; | ||
export let min: number | undefined = undefined; | ||
export let max: number | undefined = undefined; | ||
export let step: number | undefined = undefined; | ||
export let onValueChange: ((value: number[]) => void) | undefined = undefined; | ||
const internalValueChange: ChangeFn<number[]> = (value) => { | ||
if(onValueChange) { | ||
onValueChange(value.next); | ||
} | ||
return value.next; | ||
} | ||
const internalValueChange: ChangeFn<number[]> = (value) => { | ||
if (onValueChange) { | ||
onValueChange(value.next); | ||
} | ||
return value.next; | ||
}; | ||
const { | ||
elements: { root, range, thumbs }, | ||
} = createSlider({ | ||
defaultValue: defaultValue ? [defaultValue] : undefined, | ||
min, | ||
max, | ||
step: step ?? 1, | ||
onValueChange: internalValueChange, | ||
}); | ||
const { | ||
elements: { root, range, thumbs } | ||
} = createSlider({ | ||
defaultValue: defaultValue ? [defaultValue] : undefined, | ||
min, | ||
max, | ||
step: step ?? 1, | ||
onValueChange: internalValueChange | ||
}); | ||
</script> | ||
|
||
<span use:melt={$root} class="slider"> | ||
<span class="range"> | ||
<span use:melt={$range} /> | ||
</span> | ||
<span | ||
use:melt={$thumbs[0]} | ||
class="thumb" | ||
/> | ||
<span class="range"> | ||
<span use:melt={$range} /> | ||
</span> | ||
<span use:melt={$thumbs[0]} class="thumb" /> | ||
</span> | ||
|
||
<style> | ||
.slider { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
height: var(--spacing-6); | ||
width: 100%; | ||
} | ||
.slider { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
height: var(--spacing-6); | ||
width: 100%; | ||
} | ||
.range { | ||
height: var(--spacing-2); | ||
width: 100%; | ||
background: var(--text-color); | ||
border-radius: var(--spacing-1); | ||
} | ||
.range { | ||
height: var(--spacing-2); | ||
width: 100%; | ||
background: var(--text-color); | ||
border-radius: var(--spacing-1); | ||
} | ||
.range > span { | ||
height: var(--spacing-2); | ||
background: var(--text-color); | ||
border-radius: var(--spacing-1); | ||
} | ||
.range > span { | ||
height: var(--spacing-2); | ||
background: var(--text-color); | ||
border-radius: var(--spacing-1); | ||
} | ||
.thumb { | ||
height: var(--spacing-6); | ||
width: var(--spacing-6); | ||
border-radius: 50%; | ||
background: var(--background-color); | ||
border: 1px solid var(--border-color); | ||
cursor: pointer; | ||
} | ||
.thumb:focus { | ||
outline: 2px solid var(--focus-color); | ||
} | ||
.thumb { | ||
height: var(--spacing-6); | ||
width: var(--spacing-6); | ||
border-radius: 50%; | ||
background: var(--background-color); | ||
border: 1px solid var(--border-color); | ||
cursor: pointer; | ||
} | ||
.thumb:focus { | ||
outline: 2px solid var(--focus-color); | ||
} | ||
</style> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const description = "Intl Explorer is an interactive tool for experimenting and trying out the ECMAScript Internationalization API."; | ||
export const description = | ||
"Intl Explorer is an interactive tool for experimenting and trying out the ECMAScript Internationalization API."; | ||
export const title = "Intl Explorer"; | ||
export const imageUrl = "static/social.png"; | ||
export const author = "Jesper Orb"; | ||
export const tags = ["Inlt", "i18n", "Internationalization", "JavaScript", "TypeScript", "Svelte"]; | ||
export const tags = ["Inlt", "i18n", "Internationalization", "JavaScript", "TypeScript", "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
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
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
Oops, something went wrong.