open-source-labs / Svelvet

🎛 A Svelte library for building dynamic, infinitely customizable node-based user interfaces and flowcharts
https://svelvet.io
2.58k stars 166 forks source link

Custom Edge Path is not working in svelte recent version from above 4.0.0 to till now #444

Open IamMathankumar opened 1 year ago

IamMathankumar commented 1 year ago

First of all thanks for this library it works great. In recent times am facing an issue with custom Edge that not drawn as expected

Here is the Node function:

            <Node let:selected id={"abc"}>
                <div class:selected class="flex space-x-11">
                  <div class="input-anchors flex  flex-col space-y-11" >
                    <Anchor bgColor="red" id="data-connection" input />
                    <Anchor id="test" multiple input nodeConnect/>
                  </div>
                  <div class="output-anchors flex  flex-col space-y-11">
                    <Anchor let:linked let:hovering let:connecting output  edge={EdgePath}  >
                    </Anchor>
                  </div>
                </div>
              </Node>
        </Svelvet>

Used same EdgePath component from sample.

<script>
    import { Edge } from 'svelvet';
</script>

<Edge let:path let:destroy edgeClick="{() => alert('Edge clicked')}" step>
    <path d={path} />
    <button on:click={destroy} slot="label">
        <p>Custom Label</p>
    </button>
</Edge>

<style>
    path {
        stroke: rgb(246, 231, 20);
        stroke-width: 4px;
    }
</style>

Above code is working with Svelte version : 3.54.0 "svelte": "^3.54.0",

Not working after I updgraded to 4.0.0 "svelte": "^4.0.0", Svelvet version: 8.1.0 "svelvet": "^8.1.0",

rohanrajpal commented 1 year ago

+1, facing the same issue

rohanrajpal commented 1 year ago

Hey @briangregoryholmes do you have any idea why this might be happening? I can open a PR if the fix doesnt involve a big refactor. This is blocking us from upgrading to svelte 4 so would be happy to contribute.

rohanrajpal commented 1 year ago

Heyo @briangregoryholmes @rathna-git is there any new team working on the next version of svelte or existing issues? Curious to know the direction of this project now

nj-vs-vh commented 1 year ago

Hey, I faced the same issue and managed to solve it locally. It seems to be caused by this Svelte update. I have created a draft PR (https://github.com/open-source-labs/Svelvet/pull/474) but will need help from maintainers to prepare it for production.

rohanrajpal commented 1 year ago

thanks to @nj-vs-vh , we have a fix, as a temporary solution until this is merged, folks can use

{
"svelvet": "npm:meetspur-svelvet@^8.1.1"
}

instead