Skip to content

Commit

Permalink
Revert "Remove ipywidgets (#9253)" (#9751)
Browse files Browse the repository at this point in the history
This reverts commit 43d30fd.

For #3429
  • Loading branch information
DonJayamanne committed Jan 29, 2020
1 parent 6e8add6 commit 17f55f5
Show file tree
Hide file tree
Showing 15 changed files with 7,690 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ipywidgets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
out
dist
**/node_modules
.nyc_output
npm-debug.log
bin/**
obj/**
tmp/**
6 changes: 6 additions & 0 deletions src/ipywidgets/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
semi: true,
singleQuote: true,
printWidth: 180,
tabWidth: 4
};
41 changes: 41 additions & 0 deletions src/ipywidgets/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": true,
"**/*.pyc": true,
".nyc_output": true,
"obj": true,
"bin": true,
"**/__pycache__": true,
"**/node_modules": true,
".vscode test": false,
".vscode-test": false,
"**/.mypy_cache/**": true,
"**/.ropeproject/**": true
},
"search.exclude": {
"out": true,
"**/node_modules": true,
"coverage": true,
"languageServer*/**": true,
".vscode-test": true,
".vscode test": true
},
"[python]": {
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true
},
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"typescriptHero.imports.stringQuoteStyle": "'",
"cucumberautocomplete.skipDocStringsFormat": true,
"[javascript]": {
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.tslint": true
}
}
17 changes: 17 additions & 0 deletions src/ipywidgets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This folder is based off the the sample `web3` from https://github.com/jupyter-widgets/ipywidgets/blob/master/examples/web3

* We have built a custom solution based on `web3` sample to host ipywidgets outside of `Jupyter Notebook`.

# Solution for IPywidgets

* IPywidgets traditionally use [requirejs](https://requirejs.org).
* `traditionally` as there seems to be some ongoing work to use `commonjs2`, though unsure how this will work with 3rd party widgets.
* Using 3rd party widgets require:
* [requirejs](https://requirejs.org) to be available in the current browser context (i.e. `window`)
* Base `IPywidgets` to be defined using `define` in [requirejs](https://requirejs.org).
* Rather than bundling using `amd` or `umd` its easier to just import everything using `commonjs2`, then export for `requirejs` using `define` by hand.
* `define('xyz', () => 'a')` is a simple way of declaring a named `xyz` module with the value `a` (using `requirejs`).
* This is generally done using tools, however we'll hand craft this as it works better and easier.
* `amd` is not what we want, as out `react ui` doesn't use `amd`.
* `umd` is does not work as we have multiple `entry points` in `webpack`.
* Heres' the solution `define('@jupyter-widgets/controls', () => widgets);`
Loading

0 comments on commit 17f55f5

Please sign in to comment.