import { createWindowManager, createDesktopBinder } from './chunk-YCHJXSTC.js'; import { createSignal, getOwner, onCleanup } from 'solid-js'; function disposeWithOwner(dispose) { if (getOwner()) onCleanup(dispose); } function useWindowManager(options) { const wm = createWindowManager(options); disposeWithOwner(() => wm.destroy()); return wm; } function useWmState(wm) { const [state, setState] = createSignal(wm.getState()); disposeWithOwner(wm.subscribe((next) => setState(next))); return state; } function useWmWindow(wm, id) { const state = useWmState(wm); return () => state().windows[typeof id === "function" ? id() : id]; } function createDesktop(wm, options) { const binder = createDesktopBinder(wm, options); return { binder, desktop(element) { const unbind = binder.bindDesktop(element); disposeWithOwner(unbind); }, window(id, options2) { return (element) => { const unbind = binder.bindWindow(id, element, options2); disposeWithOwner(unbind); }; } }; } export { createDesktop, useWindowManager, useWmState, useWmWindow }; //# sourceMappingURL=solid.js.map //# sourceMappingURL=solid.js.map