shikijs / shiki-magic-move

Smoothly animated code blocks with Shiki
https://shiki-magic-move.netlify.app/
MIT License
1.11k stars 32 forks source link

Svelte: ReferenceError: derived is not defined #17

Closed azat-io closed 1 month ago

azat-io commented 1 month ago

Hello!

I'm trying to use Svelte component with store by NanoStores.

<script lang="ts">
import { ShikiMagicMove } from 'shiki-magic-move/svelte'

import { shiki } from '../stores/shiki'

// ...
</script>

<div>
  {#if $shiki.highlighter}
    <ShikiMagicMove
      options={{
        animateContainer: false,
        duration: 500,
        stagger: 3,
      }}
      highlighter={$shiki.highlighter}
      theme={$shiki.theme}
      code={'npm install'}
      lang="bash"
    />
  {/if}
</div>

However, all I am currently getting is an error message:

ReferenceError: derived is not defined

Maybe the problem lies here: https://github.com/shikijs/shiki-magic-move/blob/main/src/svelte/ShikiMagicMove.svelte#L22

fyi @mattcroat

mattcroat commented 1 month ago

@azat-io You have to be in runes mode.

azat-io commented 1 month ago

Thanks!