[fix] fixed input lag, bugs

This commit is contained in:
kwaroran
2023-07-19 04:02:13 +09:00
parent 11a9de522e
commit 5a42fe9b6b
9 changed files with 85 additions and 83 deletions

View File

@@ -1,5 +1,5 @@
<button
on:click={onClick}
on:click
class="{selected ? 'bg-borderc' : 'bg-gray-700'} border border-gray-600 text-white rounded-md shadow-sm hover:bg-borderc focus:outline-none focus:ring-2 focus:ring-borderc transition-colors duration-200{className ? (" " + className) : ""}"
class:px-4 = {size == "md"}
class:px-2 = {size == "sm"}
@@ -14,7 +14,6 @@
</button>
<script lang="ts">
export let selected = false
export let onClick = () => {}
export let className = ""
export let size: "sm" | "md" | "lg" = "md"
</script>

View File

@@ -11,6 +11,7 @@
class:px-6={size === 'lg'}
class:py-3={size === 'lg'}
bind:value
on:change
>
<slot></slot>
</select>

View File

@@ -1,54 +1,66 @@
<!-- <textarea
class={"bg-transparent input-text mt-2 mb-2 text-gray-200 resize-none focus:bg-selected w-full" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}
class:text-md={size === 'md'}
class:text-lg={size === 'lg'}
class:text-xl={size === 'xl'}
class:text-xs={size === 'xs'}
class:p-2={padding}
class:mb-4={margin === 'bottom'}
class:mb-2={margin === 'both'}
class:mt-4={margin === 'top'}
class:mt-2={margin === 'both'}
class:w-full={fullwidth}
class:h-20={height === '20'}
class:h-32={height === '32'}
class:h-full={height === 'full'}
class:min-h-20={height === '20'}
class:min-h-32={height === '32'}
{autocomplete}
{placeholder}
id={id}
bind:value
on:input={onInput}
/> -->
<textarea
class={"border border-gray-600 focus:border-borderc resize-none rounded-md shadow-sm text-white bg-transparent focus:ring-borderc focus:ring-2 focus:outline-none transition-colors duration-200" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}
class:text-md={size === 'md'}
class:text-lg={size === 'lg'}
class:text-xl={size === 'xl'}
class:text-xs={size === 'xs'}
class:px-4={padding}
class:py-2={padding}
class:mb-4={margin === 'bottom'}
class:mb-2={margin === 'both'}
class:mt-4={margin === 'top'}
class:mt-2={margin === 'both'}
class:w-full={fullwidth}
class:h-20={height === '20'}
class:h-32={height === '32'}
class:h-full={height === 'full'}
class:min-h-20={height === '20'}
class:min-h-32={height === '32'}
{autocomplete}
{placeholder}
id={id}
bind:value
on:input={onInput}
/>
{#if optimaizedInput}
<textarea
class={"border border-gray-600 focus:border-borderc resize-none rounded-md shadow-sm text-white bg-transparent focus:ring-borderc focus:ring-2 focus:outline-none transition-colors duration-200" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}
class:text-md={size === 'md'}
class:text-lg={size === 'lg'}
class:text-xl={size === 'xl'}
class:text-xs={size === 'xs'}
class:px-4={padding}
class:py-2={padding}
class:mb-4={margin === 'bottom'}
class:mb-2={margin === 'both'}
class:mt-4={margin === 'top'}
class:mt-2={margin === 'both'}
class:w-full={fullwidth}
class:h-20={height === '20'}
class:h-32={height === '32'}
class:h-full={height === 'full'}
class:min-h-20={height === '20'}
class:min-h-32={height === '32'}
{autocomplete}
{placeholder}
id={id}
bind:value={value}
on:input={(e) => {
if(inpa++ > 10){
value = e.currentTarget.value
inpa = 0
onInput()
}
}}
on:change={(e) => {
value = e.currentTarget.value
onInput()
}}
/>
{:else}
<textarea
class={"border border-gray-600 focus:border-borderc resize-none rounded-md shadow-sm text-white bg-transparent focus:ring-borderc focus:ring-2 focus:outline-none transition-colors duration-200" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}
class:text-md={size === 'md'}
class:text-lg={size === 'lg'}
class:text-xl={size === 'xl'}
class:text-xs={size === 'xs'}
class:px-4={padding}
class:py-2={padding}
class:mb-4={margin === 'bottom'}
class:mb-2={margin === 'both'}
class:mt-4={margin === 'top'}
class:mt-2={margin === 'both'}
class:w-full={fullwidth}
class:h-20={height === '20'}
class:h-32={height === '32'}
class:h-full={height === 'full'}
class:min-h-20={height === '20'}
class:min-h-32={height === '32'}
{autocomplete}
{placeholder}
id={id}
bind:value
on:input={onInput}
/>
{/if}
<script lang="ts">
export let size: 'xs'|'sm'|'md'|'lg'|'xl' = 'xs'
export let autocomplete: 'on'|'off' = 'off'
@@ -61,4 +73,11 @@
export let fullwidth = false
export let height:'20'|'32'|'full' = '20'
export let additionalClass = ''
export let optimaizedInput = true
let inpa = 0
let optiValue = value
$: optiValue = value
</script>

View File

@@ -1,23 +1,3 @@
<!-- <input
class={"text-neutral-200 bg-transparent input-text focus:bg-selected" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}
class:text-md={size === 'md'}
class:text-lg={size === 'lg'}
class:text-xl={size === 'xl'}
class:p-2={padding}
class:mb-4={marginBottom}
class:w-full={fullwidth}
class:h-full={fullh}
{autocomplete}
{placeholder}
id={id}
type="text"
bind:value
on:input={onInput}
> -->
<input
class={"border border-gray-600 focus:border-borderc rounded-md shadow-sm text-white bg-transparent focus:ring-borderc focus:ring-2 focus:outline-none transition-colors duration-200" + ((additionalClass) ? (' ' + additionalClass) : '')}
class:text-sm={size === 'sm'}

View File

@@ -42,7 +42,7 @@
{#if privateMode}
<span class="text-gray-400 text-sm">Private characters can be removed from the server if there is only a few downloads.</span>
{/if}
<Button onClick={async () => {
<Button on:click={async () => {
if(char.creatorNotes.length < 20){
alertError("Creator Notes must be longer than 20 characters")
}