-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export output widget in embed bundle #1410
Export output widget in embed bundle #1410
Conversation
ffda808
to
049d035
Compare
@jasongrout I'm about to start work on letting users override renderers in the HTML Manager. How were you thinking users would hook into this? One way would be to define a top-level method in Alternatively, we could just expose the options as an extra argument to I think I'm mildly in favour of the second option, since it exposes less magic. |
IIRC, a top-level method won't work since you might have multiple instances of the widget manager on a single page - I think this may happen in some of the documentation scenarios. Since your rendermime instance is exposed as a public attribute on the manager (i.e., the manager's rendermime is what is passed to the output widget), I think that may be enough - people can access the rendermime directly and add other renderers as needed. |
@@ -45,11 +54,11 @@ class HTMLManager extends widgets.ManagerBase<HTMLElement> { | |||
*/ | |||
protected loadClass(className: string, moduleName: string, moduleVersion: string) { | |||
return new Promise(function(resolve, reject) { | |||
if (moduleName === '@jupyter-widgets/controls') { | |||
if (coreWidgetModules.indexOf(moduleName) >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @jupyter-widgets/base
base classes (like DOMWidgetView, WidgetModel, etc.) shouldn't be exported in @jupyter-widgets/controls
- I think you'll need two checks here, one for each of your coreWidgetModules
. See
if (moduleName === "@jupyter-widgets/controls") { |
new RenderMime({ | ||
items: [ | ||
{ mimeType: WIDGET_MIMETYPE, renderer: new WidgetRenderer(this) }, | ||
... RenderMime.getDefaultItems() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please delete the space after ...
Embedding widgets does not work against the versions of jupyter-widgets/{base,controls} deployed on NPM (which still refer to the old 'jupyter-js-widgets' module name.
This is the first step towards allowing customisation of renderers.
Also, I changed a bit how testing is done and how the repos are built. There's only a few conflicts, but perhaps resolve those and rebasing or merging master in will help isolate the failures. |
@pbugnion - I was looking into updating this. Are you working on it too? |
@jasongrout I definitely won't be working on this today, and probably won't be able to over the weekend, so go ahead! Thanks. |
c4f34ce
to
e2afc49
Compare
1. The codemirror module uses tildes to denote packages, but postcss does not recognize that, so we strip tildes. 2. Many packages use global variables in their CSS, so we import those definitions for each CSS file we compile.
462a8ff
to
b3e0c81
Compare
@pbugnion - I think it should work, but I haven't tested it to see if it actually does yet. |
1046670
to
cff5f5a
Compare
I just tested by hand (modified the example with some state of an output widget), and the text and an embedded widget worked fine. I'll clean up one last thing with the model_id rename and merge when tests pass. |
Actually, let's make the model_id rename a different PR, since it's really a different issue. It came up here because the widgetsnbextension output widget is broken without it. |
cff5f5a
to
b3e0c81
Compare
Ah this is great -- thanks for your help! |
Prior to this PR, the output widget could not be embedded. Addresses issue #986 .
This is a rewrite of PR #1380, which had become out of date after the htmlmanager was moved to a stand-alone package.
I think this still needs: