Add svelte as a view engine to swaf #33

Merged
ashpie merged 97 commits from svelte into develop 2021-11-09 19:31:22 +01:00
Showing only changes of commit 6cd98929d3 - Show all commits

View File

@ -74,6 +74,8 @@
function handleFileInput() { function handleFileInput() {
files = input.files; files = input.files;
} }
let focused = false;
</script> </script>
<style lang="scss"> <style lang="scss">
@ -139,7 +141,7 @@
outline-offset: 0; outline-offset: 0;
} }
&:not(.empty), select ~, [type="file"] ~, [type="color"] ~, :focus ~ { &:not(.empty), select ~, [type="file"] ~, [type="color"] ~, .focused ~, :focus ~ {
.sections label { .sections label {
top: 8px; top: 8px;
font-size: 14px; font-size: 14px;
@ -393,9 +395,11 @@
</select> </select>
<Icon name="chevron-down"/> <Icon name="chevron-down"/>
{:else if type === 'textarea'} {:else if type === 'textarea'}
<div class="textarea-growing-wrapper" data-value={value}> <div class="textarea-growing-wrapper" class:focused={focused} data-value={value}>
<textarea {name} id={fieldId} {value} {...$$restProps} bind:this={input} <textarea {name} id={fieldId} {value} {...$$restProps} bind:this={input}
on:input={handleInput}></textarea> on:input={handleInput}
on:focusin={() => focused = true}
on:focusout={() => focused = false}></textarea>
</div> </div>
{:else if type === 'checkbox'} {:else if type === 'checkbox'}
<input {type} {name} id={fieldId} checked={value === 'on'} {...$$restProps} bind:this={input}> <input {type} {name} id={fieldId} checked={value === 'on'} {...$$restProps} bind:this={input}>