File tree 12 files changed +35
-22
lines changed
09-transitions/06-deferred-transitions
17-special-elements/00-svelte-self
20-7guis/06-7guis-circles
21-miscellaneous/02-immutable-data 12 files changed +35
-22
lines changed Original file line number Diff line number Diff line change 7
7
}
8
8
</script >
9
9
10
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
10
11
<div on:mousemove ={handleMousemove }>
11
12
The mouse position is {m .x } x {m .y }
12
13
</div >
Original file line number Diff line number Diff line change 2
2
let m = { x: 0 , y: 0 };
3
3
</script >
4
4
5
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
5
6
<div on:mousemove ={(e ) => (m = { x: e .clientX , y: e .clientY })}>
6
7
The mouse position is {m .x } x {m .y }
7
8
</div >
Original file line number Diff line number Diff line change 24
24
</label >
25
25
</div >
26
26
27
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
27
28
<svg
28
29
on:mousemove ={(e ) => coords .set ({ x: e .clientX , y: e .clientY })}
29
30
on:mousedown ={() => size .set (30 )}
Original file line number Diff line number Diff line change 49
49
{#if selected }
50
50
{#await selected then d }
51
51
<div class ="photo" in:receive ={{ key : d .id }} out:send ={{ key : d .id }}>
52
+ <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
52
53
<img alt ={d .alt } src =" {ASSETS }/ {d .id }.jpg" on:click ={() => (selected = null )} />
53
54
54
55
<p class =" credit" >
Original file line number Diff line number Diff line change 28
28
{:else }
29
29
<ul >
30
30
{#each [... eases ] as [name]}
31
- <li class:selected ={name === current_ease } on:click ={() => ( current_ease = name )} >
32
- { name }
31
+ <li class:selected ={name === current_ease }>
32
+ < button on:click ={() => ( current_ease = name )}> { name }</ button >
33
33
</li >
34
34
{/each }
35
35
</ul >
46
46
{:else }
47
47
<ul >
48
48
{#each types as [name, type]}
49
- <li class:selected ={type === current_type } on:click ={() => ( current_type = type )} >
50
- { name }
49
+ <li class:selected ={type === current_type }>
50
+ < button on:click ={() => ( current_type = type )}> { name }</ button >
51
51
</li >
52
52
{/each }
53
53
</ul >
Original file line number Diff line number Diff line change 10
10
}
11
11
</script >
12
12
13
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
13
14
<div on:mouseenter ={enter } on:mouseleave ={leave }>
14
15
<slot {hovering } />
15
16
</div >
Original file line number Diff line number Diff line change 6
6
$: if (dialog && showModal) dialog .showModal ();
7
7
</script >
8
8
9
- <!-- svelte-ignore a11y-click-events-have-key-events -->
9
+ <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions -->
10
10
<dialog
11
11
bind:this ={dialog }
12
12
on:close ={() => (showModal = false )}
13
13
on:click |self ={() => dialog .close ()}
14
14
>
15
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
15
16
<div on:click |stopPropagation >
16
17
<slot name =" header" />
17
18
<hr />
Original file line number Diff line number Diff line change 11
11
}
12
12
</script >
13
13
14
- <span class:expanded on:click ={toggle }>{name }</span >
14
+ <button class:expanded on:click ={toggle }>{name }</button >
15
15
16
16
{#if expanded }
17
17
<ul transition:slide ={{ duration : 300 }}>
28
28
{/if }
29
29
30
30
<style >
31
- span {
31
+ button {
32
32
padding : 0 0 0 1.5em ;
33
33
background : url (/tutorial/icons/folder.svg ) 0 0.1em no-repeat ;
34
34
background-size : 1em 1em ;
35
35
font-weight : bold ;
36
36
cursor : pointer ;
37
+ border :none ;
38
+ font-size :14px ;
37
39
}
38
40
39
41
.expanded {
Original file line number Diff line number Diff line change @@ -69,9 +69,10 @@ radius of the selected circle.
69
69
<button on:click ={() => travel (- 1 )} disabled ={i === 0 }>undo</button >
70
70
<button on:click ={() => travel (+ 1 )} disabled ={i === undoStack .length - 1 }>redo</button >
71
71
</div >
72
-
72
+ <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
73
73
<svg on:click ={handleClick }>
74
74
{#each circles as circle }
75
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
75
76
<circle
76
77
cx ={circle .cx }
77
78
cy ={circle .cy }
Original file line number Diff line number Diff line change 27
27
28
28
<h2 >Immutable</h2 >
29
29
{#each todos as todo }
30
- <ImmutableTodo {todo } on:click ={() => toggle (todo .id )} />
30
+ <ImmutableTodo {todo } on:click ={() => toggle (todo .id )} />< br >
31
31
{/each }
32
32
33
33
<h2 >Mutable</h2 >
34
34
{#each todos as todo }
35
- <MutableTodo {todo } on:click ={() => toggle (todo .id )} />
35
+ <MutableTodo {todo } on:click ={() => toggle (todo .id )} />< br >
36
36
{/each }
Original file line number Diff line number Diff line change 6
6
7
7
export let todo;
8
8
9
- let div ;
9
+ let btn ;
10
10
11
11
afterUpdate (() => {
12
- flash (div );
12
+ flash (btn );
13
13
});
14
14
</script >
15
15
16
16
<!-- the text will flash red whenever
17
17
the `todo` object changes -->
18
- <div bind:this ={div } on:click >
18
+ <button bind:this ={btn } on:click >
19
19
{todo .done ? ' 👍' : ' ' }
20
20
{todo .text }
21
- </div >
21
+ </button >
22
22
23
23
<style >
24
- div {
24
+ button {
25
25
cursor : pointer ;
26
- line-height : 1.5 ;
26
+ border :none ;
27
+ background :none ;
28
+ font-size :14px ;
27
29
}
28
30
</style >
Original file line number Diff line number Diff line change 4
4
5
5
export let todo;
6
6
7
- let div ;
7
+ let btn ;
8
8
9
9
afterUpdate (() => {
10
- flash (div );
10
+ flash (btn );
11
11
});
12
12
</script >
13
13
14
14
<!-- the text will flash red whenever
15
15
the `todo` object changes -->
16
- <div bind:this ={div } on:click >
16
+ <button bind:this ={btn } >
17
17
{todo .done ? ' 👍' : ' ' }
18
18
{todo .text }
19
- </div >
19
+ </button >
20
20
21
21
<style >
22
- div {
22
+ button {
23
23
cursor : pointer ;
24
- line-height : 1.5 ;
24
+ border :none ;
25
+ background :none ;
26
+ font-size :14px ;
25
27
}
26
28
</style >
You can’t perform that action at this time.
0 commit comments