DFlex – JavaScript framework for drag and drop apps
github.com
github.com
I had to build something for my employer's website maybe 12-15 years ago. jQuery was the hot, new thing at the time. So was customizing UI. All available solutions used a combination of absolute positioning & coordinates to determine the interactivity of the elements. As you can imagine, it was a finicky, buggy mess.
I found myself wishing I could just use the DOM's own mouseover event -- but that didn't work, because the cursor was only over the element being dragged. My epiphany was this: When an element was picked up (drag start), I could duplicate every element in the set and set their opacities to zero (I called them "ghosts"). If I gave them a higher z-index than the element being dragged, mouseover events would be triggered on the ghost elements and I wouldn't have to do anything with coordinates, ever. It was also, by far, the most efficient solution at a time when browsers kinda sucked.
(I finally had a reason to share this anecdote.)
Anyway, thanks for this library, I'll be taking a look!
To be clear, though: In my old example, there would only be DOM manipulation on drag start and drag end. All interactions between are handled with JS and CSS.
Cheers.
Thanks for this lib, it looks very nice so far.
I was wondering if DFlex supports nesting containers inside items in infinite depth. I saw you had nested example but I couldn't drag on item on the other container.
None the less promising, you say it's still in development, is there some aspects you are more specifically working on?
Edit: I'd like also to hear back from the community, I welcome any suggestions about the roadmap and what's necessary to be shipped soon.
[1]- https://github.com/dflex-js/dflex/blob/cbda61af185100a3afb39...
It calls jQuery UI sortable() with a "grid" of [50, 1], to mimic Python indentability. Here's their documentation for grid: https://api.jqueryui.com/sortable/#option-grid
(The rest of the font-feature-settings declaration also doesn’t make much sense: "case" 1, "rlig" 1,"calt" 0: rlig is for other scripts, and calt is a weird thing to turn off. I’d remove the entire declaration.)
I came across Shopify's recently which has an amazing website: https://shopify.github.io/draggable/
In Firefox I noticed some flickering when dragging a lower item to the top edge of the black box on this page: https://www.dflex.dev/demo/lists/asymmetric/ it might need some debouncing or something since it appears to be repeatedly redordering when it's in right on the edge/border (might not be a standard usecase but it was noticeable).
I thought that was the whole point. Are we using different definitions of interactivity?
This looks worth checking out. Appears to work well on desktops and mobile.
[1] https://github.com/dflex-js/dflex/actions/runs/3025464183
The "Infinite DOM transformation instead of reconstructing the DOM tree with every interaction" bullet, with the "has its own scheduler and reconciler" sentence made it sound like you've purposely implemented your own "lifecycle" system, and I didn't see any mention of React on the readme so I wasn't sure how it'd work together. I don't know what a scheduler or reconciler is, so I wasn't sure what that meant in the context of frameworks. (And edit: And oh, wait, only on a close second reading do I see "compatible with any modern JS framework"... sorry, I ctrl-f'ed the first time).
I appreciate the response.
I'm not sure this is the only library doing this. It's in fact a popular approach for drag and drop on the browser. I believe dndkit also does this.
Maybe a better approach would be to consider how you'd try to convey the same information to a reader 50 years in the future, when "modern" may mean something very different to them. What does that actually mean, specifically? What are the good and desirable qualities the term's intended to express to the reader? It's not a good word for communication because it's both vague to begin with, and heavily abused in marketing, so people's ideas of what it might mean vary wildly—it's so lacking in specificity that it may as well be a made-up nonsense word, as far as how much information it carries.
I haven't used DFlex or what it intends to replace so I can't comment on what would be a good replacement for the word 'modern', but I doubt you meant to say any of the words I listed above.
So the use case is adding drag & drop interaction to sites, which is evidently extremely desirable.