Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Component.Item> support #46

Closed
bfanger opened this issue Nov 17, 2024 · 0 comments
Closed

<Component.Item> support #46

bfanger opened this issue Nov 17, 2024 · 0 comments

Comments

@bfanger
Copy link
Owner

bfanger commented Nov 17, 2024

Desired

<script lang="ts">
  import { Excalidraw, WelcomeScreen, MainMenu } from "@excalidraw/excalidraw";

  const react = sveltify({ Excalidraw, WelcomeScreen, MainMenu });
</script>

<div style="height: 100vh">
  <react.Excalidraw theme="dark">
    <react.WelcomeScreen />
    <react.MainMenu>
      <react.MainMenu.DefaultItems.LoadScene />
      <react.MainMenu.DefaultItems.Export />
      <react.MainMenu.DefaultItems.SaveAsImage />
    </react.MainMenu>
  </react.Excalidraw>
</div>

Current

The static properties are ignored so the sveltified MainMenu doesn't have a DefaultItems property.
To get the LoadScene, Export & SaveAsImage components sveltified, you'd write:

<script lang="ts">
  import { Excalidraw, WelcomeScreen, MainMenu } from "@excalidraw/excalidraw";

  const react = sveltify({
    Excalidraw,
    WelcomeScreen,
    MainMenu,
    LoadScene: MainMenu.DefaultItems.LoadScene,
    Export: MainMenu.DefaultItems.Export,
    SaveAsImage: MainMenu.DefaultItems.SaveAsImage,
  });
</script>

<div style="height: 100vh">
  <react.Excalidraw theme="dark">
    <react.WelcomeScreen />
    <react.MainMenu>
      <react.LoadScene />
      <react.Export />
      <react.SaveAsImage />
    </react.MainMenu>
  </react.Excalidraw>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant