First off, thanks for the awesome Observable Framework!
So far, I was unable to make a 3rd party input reactive (the range slider from jquery-ui). I ressorted to jquery-ui as I need a slider to limit a range from both sides in one widget.
I’ve tried
hooking the element (as returned by jquery’s $("selector")) to Generators.observe, which failed to attachEventListener though
using the slider’s own event handler, which handles doc nodes OK (e. g. changing an <input />'s value) but fails to change a reactive value declared outside the handler
I haven’t played much with jQuery UI, but I was able to get things working like so.
First, here’s how I installed jQuery UI from npm. (They recommend manually configuring and downloading a build, but I prefer to just import the default configuration from npm if possible so that it’s easier to keep up-to-date.)
The tricky part is that jquery and jquery-ui aren’t packaged as modern ES modules, so jquery-ui assumes that there’s a jQuery global. This means you have to use a dynamic import and manually assign self.jQuery before importing jquery-ui. It’d be nice if jQuery adopted modern standards. (The /+esm won’t be necessary once #1174 lands.)
Note that there are two calls to notify here: one happens immediately after the slider is initialized to report the initial value; the other happens on each slide event to report the new value after the user moves the slider.