Skip to content

Commit f8f9b86

Browse files
committed
Revert "Remove ipywidgets (#9253)" (#9751)
This reverts commit 43d30fd. For #3429
1 parent 324824a commit f8f9b86

File tree

15 files changed

+7690
-0
lines changed

15 files changed

+7690
-0
lines changed

src/ipywidgets/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DS_Store
2+
out
3+
dist
4+
**/node_modules
5+
.nyc_output
6+
npm-debug.log
7+
bin/**
8+
obj/**
9+
tmp/**

src/ipywidgets/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
semi: true,
3+
singleQuote: true,
4+
printWidth: 180,
5+
tabWidth: 4
6+
};

src/ipywidgets/.vscode/settings.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": true,
5+
"**/*.pyc": true,
6+
".nyc_output": true,
7+
"obj": true,
8+
"bin": true,
9+
"**/__pycache__": true,
10+
"**/node_modules": true,
11+
".vscode test": false,
12+
".vscode-test": false,
13+
"**/.mypy_cache/**": true,
14+
"**/.ropeproject/**": true
15+
},
16+
"search.exclude": {
17+
"out": true,
18+
"**/node_modules": true,
19+
"coverage": true,
20+
"languageServer*/**": true,
21+
".vscode-test": true,
22+
".vscode test": true
23+
},
24+
"[python]": {
25+
"editor.formatOnSave": true
26+
},
27+
"[typescript]": {
28+
"editor.formatOnSave": true
29+
},
30+
"typescript.preferences.quoteStyle": "single",
31+
"javascript.preferences.quoteStyle": "single",
32+
"typescriptHero.imports.stringQuoteStyle": "'",
33+
"cucumberautocomplete.skipDocStringsFormat": true,
34+
"[javascript]": {
35+
"editor.formatOnSave": true
36+
},
37+
"editor.codeActionsOnSave": {
38+
"source.fixAll": true,
39+
"source.fixAll.tslint": true
40+
}
41+
}

src/ipywidgets/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This folder is based off the the sample `web3` from https://github.com/jupyter-widgets/ipywidgets/blob/master/examples/web3
2+
3+
* We have built a custom solution based on `web3` sample to host ipywidgets outside of `Jupyter Notebook`.
4+
5+
# Solution for IPywidgets
6+
7+
* IPywidgets traditionally use [requirejs](https://requirejs.org).
8+
* `traditionally` as there seems to be some ongoing work to use `commonjs2`, though unsure how this will work with 3rd party widgets.
9+
* Using 3rd party widgets require:
10+
* [requirejs](https://requirejs.org) to be available in the current browser context (i.e. `window`)
11+
* Base `IPywidgets` to be defined using `define` in [requirejs](https://requirejs.org).
12+
* Rather than bundling using `amd` or `umd` its easier to just import everything using `commonjs2`, then export for `requirejs` using `define` by hand.
13+
* `define('xyz', () => 'a')` is a simple way of declaring a named `xyz` module with the value `a` (using `requirejs`).
14+
* This is generally done using tools, however we'll hand craft this as it works better and easier.
15+
* `amd` is not what we want, as out `react ui` doesn't use `amd`.
16+
* `umd` is does not work as we have multiple `entry points` in `webpack`.
17+
* Heres' the solution `define('@jupyter-widgets/controls', () => widgets);`

0 commit comments

Comments
 (0)