Spaces:
Running
Running
File size: 1,213 Bytes
b7a4f8b cd932aa b7a4f8b cd932aa b7a4f8b cd932aa b7a4f8b 52ec402 cd932aa 1a96959 cd932aa 52ec402 cd932aa 52ec402 b7a4f8b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<script lang="ts">
export let name: string;
export let value;
export let meta;
export let onChange;
</script>
<label class="param">
<span class="param-name">{name.replace(/_/g, ' ')}</span>
{#if meta?.type?.collapsed}
<button class="collapsed-param form-control form-control-sm">
⋯
</button>
{:else if meta?.type?.enum}
<select class="form-select form-select-sm"
value={value}
on:change={(evt) => onChange(evt.currentTarget.value)}
>
{#each meta.type.enum as option}
<option value={option}>{option}</option>
{/each}
</select>
{:else}
<input class="form-control form-control-sm"
value={value}
on:input={(evt) => onChange(evt.currentTarget.value)}
/>
{/if}
</label>
<style>
.param {
padding: 4px 8px 4px 8px;
display: block;
}
.param-name {
display: block;
font-size: 10px;
letter-spacing: 0.05em;
margin-left: 10px;
background: oklch(50% 0.13 230);
background: oklch(95% 0.2 55);
background:var(--bs-border-color);
width: fit-content;
padding: 2px 8px;
border-radius: 4px 4px 0 0;
}
.collapsed-param {
min-height: 20px;
line-height: 10px;
}
</style>
|