lit / lit-element

LEGACY REPO. This repository is for maintenance of the legacy LitElement library. The LitElement base class is now part of the Lit library, which is developed in the lit monorepo.
https://lit-element.polymer-project.org
BSD 3-Clause "New" or "Revised" License
4.49k stars 319 forks source link

Graph/Network/Node visual/textual support #1076

Closed EAzari closed 4 years ago

EAzari commented 4 years ago

Does lit-element have web components to build a node editor similar to litegraph.js? especially widget nodes? and subgraphs?

node_graph_example

Christian24 commented 4 years ago

Not sure if I understand you correctly, but LitElement itself does not provide any components. You can use LitElement to build pretty much any component you can imagine though. From the looks of it, litegraph.js renders to a HTMLCanvasElement. So, you could define a LitElement component which contains a canvas and litegraph.js.

EAzari commented 4 years ago

@Christian24 for instance for drag & drop it seems that there are some native components ? like:

<div draggable="true"></div>
<div draggable=${true}></div>
<div draggable=${'true'}></div>

So, do we have such native ones for nodes too?

I checked litegraph.js before, so it's based on some old ideas, for instance, canvas grids are based on repetitive png tile. And as you mentioned it's based on HTMLCanvas, which just renders "one" DOM, but I'm looking for a solution that supports "explicit DOMs"

Christian24 commented 4 years ago

As far as I see, draggable is only an attribute, not a component: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable

I am sorry, but I do not understand what you mean here: Your example defines three separate div elements or nodes. litegraph.js only seems to render to canvas by design. LitElement renders the templates you define. There are no builtin components in LitElement. You can only use LitElement to implement your own components. How you define these is your design decision.

EAzari commented 4 years ago

@Christian24 So, web components' goal is to build "ready-to-use" components, am I wrong? If no, why not have some components to build nodes/networks/graphs "templates or components" natively?

What is a template? A structure What is a component? Some properties/attributes together

sorvell commented 4 years ago

why not have some components to build nodes/networks/graphs "templates or components" natively?

Such a library of components could be built using LitElement or lit-html, but providing these types of components is out of the scope of Lit itself.

Perhaps someone in the community knows of a project that might be helpful.

EAzari commented 4 years ago

@sorvell OK, thank you, I close the issue Hope in the near future we build such a library