feat: create @zag-js/lit (WIP)#2698
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Amazing job @nikparo… I hope that this can be merged soon ❤️ |
|
This is awesome! Thank you, @nikparo, for putting this together. What is needed to push this across the line—reviews, more direct contributions, or something else altogether? |
|
any progress with this? |
|
@gperdomor @irontitan76 Thanks for the interest. This did fall on the backburner for a while due to more pressing matters taking priority, though I've been working on it a bit here and there. The main thing I've been working on is to verify that shadow-dom was working properly by refactoring the examples / e2e tests so that the shadow-dom boundaries are more realistically placed. It has been a bit challenging tbh - shadow-dom blocks things like I'm still fairly optimistic that shadow-dom support is doable though - I've recently gotten the menu-nested example working pretty well using 3 separate One open question though is whether we should even try to support shadow-dom for the initial PR. It would certainly be much quicker to get the initial framework ready to be merged if we forgo that. Lit examples + e2e tests could then be updated on a component by component basis to use shadow-dom until all do. Side note: Lit supports light-dom use, but doesn't recommend it, as slots and dom/style scoping isn't available. |
|
@nikparo I'm not an expert and I don't know how can I help you but I think that having an initial framework in place, even without the shadow-dom support, would be great... Then all the missing things can be improved with other small MRs... |
|
Hey @nikparo, heads up — I'm closing #2695 since the For all currently supported frameworks, I'd suggest providing a custom // packages/frameworks/lit/src/merge-props.ts
import { mergeProps as coreMergeProps } from "@zag-js/core"
export function mergeProps<T extends Record<string, any>>(
...args: Array<T | undefined>
): T {
// Convert @-prefixed event handlers to on- prefix
// so core mergeProps chains them correctly, then convert back.
const normalized = args.map((props) => {
if (!props) return props
const result: Record<string, any> = {}
for (const key in props) {
if (key.startsWith("@")) {
result[`on${key.slice(1)}`] = props[key]
} else {
result[key] = props[key]
}
}
return result as T
})
const merged = coreMergeProps(...normalized)
// Convert back to @-prefixed
const result: Record<string, any> = {}
for (const key in merged) {
if (key.startsWith("on") && typeof merged[key] === "function") {
result[`@${key.slice(2).toLowerCase()}`] = merged[key]
} else {
result[key] = merged[key]
}
}
return result as T
}This keeps the framework-specific concern in the adapter layer. Every other framework re-exports |
Closes #
📝 Description
WIP work on creating a
@zag-js/litframework. Addspackages/frameworks/litandexamples/lit-ts, and adaptse2e/testing suite to optionally work with shadow-dom.This PR is only open for visibility and comments, it's not ready to be merged.
NOTE: Video is from my
dev/litbranch that combines several other branches, including:#2694
#2697
#2695
⛳️ Current behavior (updates)
🚀 New behavior
Screen.Recording.2025-09-09.at.12.46.26.mov
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Related discussion threads:
#2681
#1210
Thank you @gperdomor for your work on #2608