Spaces:
Runtime error
Runtime error
polyfill scroll for safari
Browse files
frontend/package.json
CHANGED
|
@@ -41,6 +41,7 @@
|
|
| 41 |
"@fontsource/fira-mono": "^4.5.0",
|
| 42 |
"extract-colors": "^1.1.22",
|
| 43 |
"quantize": "^1.0.2",
|
|
|
|
| 44 |
"uninstall": "^0.0.0"
|
| 45 |
}
|
| 46 |
}
|
|
|
|
| 41 |
"@fontsource/fira-mono": "^4.5.0",
|
| 42 |
"extract-colors": "^1.1.22",
|
| 43 |
"quantize": "^1.0.2",
|
| 44 |
+
"scroll-into-view-if-needed": "^2.2.29",
|
| 45 |
"uninstall": "^0.0.0"
|
| 46 |
}
|
| 47 |
}
|
frontend/src/routes/+page.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { onMount } from 'svelte';
|
|
|
|
| 3 |
|
| 4 |
import type { ColorsPrompt, ColorsImage } from '$lib/types';
|
| 5 |
import { randomSeed, extractPalette, uploadImage } from '$lib/utils';
|
|
@@ -14,7 +15,7 @@
|
|
| 14 |
|
| 15 |
let promptsData: ColorsPrompt[];
|
| 16 |
let prompt: string;
|
| 17 |
-
let
|
| 18 |
|
| 19 |
onMount(() => {
|
| 20 |
fetchData();
|
|
@@ -153,7 +154,7 @@
|
|
| 153 |
}
|
| 154 |
function remix(e: CustomEvent) {
|
| 155 |
prompt = e.detail.prompt;
|
| 156 |
-
|
| 157 |
}
|
| 158 |
</script>
|
| 159 |
|
|
@@ -175,7 +176,7 @@
|
|
| 175 |
<div class="relative top-0 z-50 bg-white dark:bg-black py-3">
|
| 176 |
<form class="grid grid-cols-6" on:submit|preventDefault={() => generatePalette(prompt)}>
|
| 177 |
<input
|
| 178 |
-
bind:this={
|
| 179 |
class="input"
|
| 180 |
placeholder="A photo of a beautiful sunset in San Francisco"
|
| 181 |
title="Input prompt to generate image and obtain palette"
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { onMount } from 'svelte';
|
| 3 |
+
import scrollIntoView from 'scroll-into-view-if-needed'
|
| 4 |
|
| 5 |
import type { ColorsPrompt, ColorsImage } from '$lib/types';
|
| 6 |
import { randomSeed, extractPalette, uploadImage } from '$lib/utils';
|
|
|
|
| 15 |
|
| 16 |
let promptsData: ColorsPrompt[];
|
| 17 |
let prompt: string;
|
| 18 |
+
let promptInputEl: HTMLElement;
|
| 19 |
|
| 20 |
onMount(() => {
|
| 21 |
fetchData();
|
|
|
|
| 154 |
}
|
| 155 |
function remix(e: CustomEvent) {
|
| 156 |
prompt = e.detail.prompt;
|
| 157 |
+
scrollIntoView(promptInputEl, { behavior: 'smooth' });
|
| 158 |
}
|
| 159 |
</script>
|
| 160 |
|
|
|
|
| 176 |
<div class="relative top-0 z-50 bg-white dark:bg-black py-3">
|
| 177 |
<form class="grid grid-cols-6" on:submit|preventDefault={() => generatePalette(prompt)}>
|
| 178 |
<input
|
| 179 |
+
bind:this={promptInputEl}
|
| 180 |
class="input"
|
| 181 |
placeholder="A photo of a beautiful sunset in San Francisco"
|
| 182 |
title="Input prompt to generate image and obtain palette"
|