summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/rouge-4.7.0/lib/rouge/demos/svelte
blob: 8b3bb5c557ebe65e1788e6060402cf5be4f90326 (plain)
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
<!-- This file is made up from several examples on https://svelte.dev/examples and is not expected to function. -->
<script lang="ts">
    import Image from './Image.svelte';

    let src: string = '/tutorial/image.gif';
    let count: number = 1;
    $: doubled = count * 2;  // the `$:` is special in svelte
</script>

<Image {src} bind:alt="{name.capitalize()} dancing" user={name.toUpperCase(false, 42, {key: 'value'})}
       tooltip="I'm helping" false text=asdf on:message={handleMessage} />

{#await loadSrc(src)}
    loading...
{:then data}
    {#each cats as { name }, i}
        <li>{name}</li>
    {/each}

    <!-- Keyed Each Block -->
    {#each cats as cat (cat.id)}
        <li>{cat.name}</li>
    {/each}
{:catch err}
    {@debug err}
    {#await solveErr(err, {x: 'asdf'}) then reason}{@html reason}{/await}
{/await}

<style>p {font-family: 'Comic Sans MS', cursive;}</style>