dotdata_widgets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +27 -0
- package/README.md +83 -0
- package/css/widget.css +4 -0
- package/dist/index.js +2 -0
- package/lib/extension.js +27 -0
- package/lib/index.js +17 -0
- package/lib/plugin.js +50 -0
- package/lib/version.js +21 -0
- package/lib/widget.js +34 -0
- package/package.json +95 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2023 dotdata
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
# dotdata_widgets
|
|
3
|
+
|
|
4
|
+
[](https://travis-ci.org/dotdata/dotdata_widgets)
|
|
5
|
+
[](https://codecov.io/gh/dotdata/dotdata_widgets)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
A Custom Jupyter Widget Library
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
You can install using `pip`:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install dotdata_widgets
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable
|
|
19
|
+
the nbextension:
|
|
20
|
+
```bash
|
|
21
|
+
jupyter nbextension enable --py [--sys-prefix|--user|--system] dotdata_widgets
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Development Installation
|
|
25
|
+
|
|
26
|
+
Create a dev environment:
|
|
27
|
+
```bash
|
|
28
|
+
conda create -n dotdata_widgets-dev -c conda-forge nodejs yarn python jupyterlab
|
|
29
|
+
conda activate dotdata_widgets-dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Install the python. This will also build the TS package.
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e ".[test, examples]"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
When developing your extensions, you need to manually enable your extensions with the
|
|
38
|
+
notebook / lab frontend. For lab, this is done by the command:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
jupyter labextension develop --overwrite .
|
|
42
|
+
yarn run build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For classic notebook, you need to run:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
jupyter nbextension install --sys-prefix --symlink --overwrite --py dotdata_widgets
|
|
49
|
+
jupyter nbextension enable --sys-prefix --py dotdata_widgets
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Note that the `--symlink` flag doesn't work on Windows, so you will here have to run
|
|
53
|
+
the `install` command every time that you rebuild your extension. For certain installations
|
|
54
|
+
you might also need another flag instead of `--sys-prefix`, but we won't cover the meaning
|
|
55
|
+
of those flags here.
|
|
56
|
+
|
|
57
|
+
### How to see your changes
|
|
58
|
+
#### Typescript:
|
|
59
|
+
If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different
|
|
60
|
+
terminals to watch for changes in the extension's source and automatically rebuild the widget.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Watch the source directory in one terminal, automatically rebuilding when needed
|
|
64
|
+
yarn run watch
|
|
65
|
+
# Run JupyterLab in another terminal
|
|
66
|
+
jupyter lab
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
After a change wait for the build to finish and then refresh your browser and the changes should take effect.
|
|
70
|
+
|
|
71
|
+
#### Python:
|
|
72
|
+
If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.
|
|
73
|
+
|
|
74
|
+
## Updating the version
|
|
75
|
+
|
|
76
|
+
To update the version, install tbump and use it to bump the version.
|
|
77
|
+
By default it will also create a tag.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install tbump
|
|
81
|
+
tbump <new-version>
|
|
82
|
+
```
|
|
83
|
+
|
package/css/widget.css
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define("dotdata_widgets",["@jupyter-widgets/base"],(e=>(()=>{var t={889:(e,t,n)=>{(t=n(352)(!1)).push([e.id,".custom-widget {\n background-color: lightseagreen;\n padding: 0px 2px;\n}\n",""]),e.exports=t},352:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,i,r,a=e[1]||"",o=e[3];if(!o)return a;if(t&&"function"==typeof btoa){var s=(n=o,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(r," */")),l=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[a].concat(l).concat([s]).join("\n")}return[a].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,i){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(i)for(var a=0;a<this.length;a++){var o=this[a][0];null!=o&&(r[o]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);i&&r[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},204:(e,t,n)=>{var i=n(379),r=n(889);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.id,r,""]]);i(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},379:(e,t,n)=>{"use strict";var i,r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function o(e){for(var t=-1,n=0;n<a.length;n++)if(a[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},i=[],r=0;r<e.length;r++){var s=e[r],l=t.base?s[0]+t.base:s[0],d=n[l]||0,c="".concat(l," ").concat(d);n[l]=d+1;var u=o(c),p={css:s[1],media:s[2],sourceMap:s[3]};-1!==u?(a[u].references++,a[u].updater(p)):a.push({identifier:c,updater:m(p,t),references:1}),i.push(c)}return i}function l(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var a=n.nc;a&&(i.nonce=a)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=r(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var d,c=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function u(e,t,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=c(t,r);else{var a=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function p(e,t,n){var i=n.css,r=n.media,a=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var b=null,f=0;function m(e,t){var n,i,r;if(t.singleton){var a=f++;n=b||(b=l(t)),i=u.bind(null,n,a,!1),r=u.bind(null,n,a,!0)}else n=l(t),i=p.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<n.length;i++){var r=o(n[i]);a[r].references--}for(var l=s(e,t),d=0;d<n.length;d++){var c=o(n[d]);0===a[c].references&&(a[c].updater(),a.splice(c,1))}n=l}}}},607:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(412),t),r(n(891),t)},412:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MODULE_NAME=t.MODULE_VERSION=void 0;const i=n(147);t.MODULE_VERSION=i.version,t.MODULE_NAME=i.name},891:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExampleView=t.ExampleModel=void 0;const i=n(146),r=n(412);n(204);class a extends i.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:a.model_name,_model_module:a.model_module,_model_module_version:a.model_module_version,_view_name:a.view_name,_view_module:a.view_module,_view_module_version:a.view_module_version,value:"Hello World"})}}t.ExampleModel=a,a.serializers=Object.assign({},i.DOMWidgetModel.serializers),a.model_name="ExampleModel",a.model_module=r.MODULE_NAME,a.model_module_version=r.MODULE_VERSION,a.view_name="ExampleView",a.view_module=r.MODULE_NAME,a.view_module_version=r.MODULE_VERSION;class o extends i.DOMWidgetView{render(){this.el.classList.add("custom-widget"),this.value_changed(),this.model.on("change:value",this.value_changed,this)}value_changed(){this.el.textContent=this.model.get("value")}}t.ExampleView=o},146:t=>{"use strict";t.exports=e},147:e=>{"use strict";e.exports=JSON.parse('{"name":"dotdata_widgets","version":"0.1.0","description":"A Custom Jupyter Widget Library","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["lib/**/*.js","dist/*.js","css/*.css"],"homepage":"https://github.com/dotdata/dotdata_widgets","bugs":{"url":"https://github.com/dotdata/dotdata_widgets/issues"},"license":"BSD-3-Clause","author":{"name":"dotdata","email":"dotdata@dotdata.com"},"main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/dotdata/dotdata_widgets"},"scripts":{"build":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev","build:prod":"yarn run build:lib && yarn run build:nbextension && yarn run build:labextension","build:labextension":"jupyter labextension build .","build:labextension:dev":"jupyter labextension build --development True .","build:lib":"tsc","build:nbextension":"webpack","clean":"yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension","clean:lib":"rimraf lib","clean:labextension":"rimraf dotdata_widgets/labextension","clean:nbextension":"rimraf dotdata_widgets/nbextension/static/index.js","lint":"eslint . --ext .ts,.tsx --fix","lint:check":"eslint . --ext .ts,.tsx","prepack":"yarn run build:lib","test":"jest","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch --mode=development","watch:labextension":"jupyter labextension watch ."},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6"},"devDependencies":{"@babel/core":"^7.5.0","@babel/preset-env":"^7.5.0","@jupyter-widgets/base-manager":"^1.0.2","@jupyterlab/builder":"^3.0.0","@lumino/application":"^1.6.0","@lumino/widgets":"^1.6.0","@types/jest":"^26.0.0","@types/webpack-env":"^1.13.6","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","acorn":"^7.2.0","css-loader":"^3.2.0","eslint":"^7.4.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","fs-extra":"^7.0.0","identity-obj-proxy":"^3.0.0","jest":"^26.0.0","mkdirp":"^0.5.1","npm-run-all":"^4.1.3","prettier":"^2.0.5","rimraf":"^2.6.2","source-map-loader":"^1.1.3","style-loader":"^1.0.0","ts-jest":"^26.0.0","ts-loader":"^8.0.0","typescript":"~4.1.3","webpack":"^5.61.0","webpack-cli":"^4.0.0"},"jupyterlab":{"extension":"lib/plugin","outputDir":"dotdata_widgets/labextension/","sharedPackages":{"@jupyter-widgets/base":{"bundled":false,"singleton":true}}}}')}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={id:e,exports:{}};return t[e].call(a.exports,a,a.exports,i),a.exports}return i.nc=void 0,i(607)})()));
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/lib/extension.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Jupyter Development Team.
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
+
}) : (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
o[k2] = m[k];
|
|
10
|
+
}));
|
|
11
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
// Entry point for the notebook bundle containing custom model definitions.
|
|
16
|
+
//
|
|
17
|
+
// Setup notebook base URL
|
|
18
|
+
//
|
|
19
|
+
// Some static assets may be required by the custom widget javascript. The base
|
|
20
|
+
// url for the notebook is not known at build time and is therefore computed
|
|
21
|
+
// dynamically.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
window.__webpack_public_path__ =
|
|
24
|
+
document.querySelector('body').getAttribute('data-base-url') +
|
|
25
|
+
'nbextensions/dotdata_widgets';
|
|
26
|
+
__exportStar(require("./index"), exports);
|
|
27
|
+
//# sourceMappingURL=extension.js.map
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) dotdata
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
+
}) : (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
o[k2] = m[k];
|
|
10
|
+
}));
|
|
11
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
__exportStar(require("./version"), exports);
|
|
16
|
+
__exportStar(require("./widget"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
package/lib/plugin.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) dotdata
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
7
|
+
}) : (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
o[k2] = m[k];
|
|
10
|
+
}));
|
|
11
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
12
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
13
|
+
}) : function(o, v) {
|
|
14
|
+
o["default"] = v;
|
|
15
|
+
});
|
|
16
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17
|
+
if (mod && mod.__esModule) return mod;
|
|
18
|
+
var result = {};
|
|
19
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
20
|
+
__setModuleDefault(result, mod);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const base_1 = require("@jupyter-widgets/base");
|
|
25
|
+
const widgetExports = __importStar(require("./widget"));
|
|
26
|
+
const version_1 = require("./version");
|
|
27
|
+
const EXTENSION_ID = 'dotdata_widgets:plugin';
|
|
28
|
+
/**
|
|
29
|
+
* The example plugin.
|
|
30
|
+
*/
|
|
31
|
+
const examplePlugin = {
|
|
32
|
+
id: EXTENSION_ID,
|
|
33
|
+
requires: [base_1.IJupyterWidgetRegistry],
|
|
34
|
+
activate: activateWidgetExtension,
|
|
35
|
+
autoStart: true,
|
|
36
|
+
};
|
|
37
|
+
// the "as unknown as ..." typecast above is solely to support JupyterLab 1
|
|
38
|
+
// and 2 in the same codebase and should be removed when we migrate to Lumino.
|
|
39
|
+
exports.default = examplePlugin;
|
|
40
|
+
/**
|
|
41
|
+
* Activate the widget extension.
|
|
42
|
+
*/
|
|
43
|
+
function activateWidgetExtension(app, registry) {
|
|
44
|
+
registry.registerWidget({
|
|
45
|
+
name: version_1.MODULE_NAME,
|
|
46
|
+
version: version_1.MODULE_VERSION,
|
|
47
|
+
exports: widgetExports,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=plugin.js.map
|
package/lib/version.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) dotdata
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MODULE_NAME = exports.MODULE_VERSION = void 0;
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
const data = require('../package.json');
|
|
10
|
+
/**
|
|
11
|
+
* The _model_module_version/_view_module_version this package implements.
|
|
12
|
+
*
|
|
13
|
+
* The html widget manager assumes that this is the same as the npm package
|
|
14
|
+
* version number.
|
|
15
|
+
*/
|
|
16
|
+
exports.MODULE_VERSION = data.version;
|
|
17
|
+
/*
|
|
18
|
+
* The current package name.
|
|
19
|
+
*/
|
|
20
|
+
exports.MODULE_NAME = data.name;
|
|
21
|
+
//# sourceMappingURL=version.js.map
|
package/lib/widget.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) dotdata
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ExampleView = exports.ExampleModel = void 0;
|
|
6
|
+
const base_1 = require("@jupyter-widgets/base");
|
|
7
|
+
const version_1 = require("./version");
|
|
8
|
+
// Import the CSS
|
|
9
|
+
require("../css/widget.css");
|
|
10
|
+
class ExampleModel extends base_1.DOMWidgetModel {
|
|
11
|
+
defaults() {
|
|
12
|
+
return Object.assign(Object.assign({}, super.defaults()), { _model_name: ExampleModel.model_name, _model_module: ExampleModel.model_module, _model_module_version: ExampleModel.model_module_version, _view_name: ExampleModel.view_name, _view_module: ExampleModel.view_module, _view_module_version: ExampleModel.view_module_version, value: 'Hello World' });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ExampleModel = ExampleModel;
|
|
16
|
+
ExampleModel.serializers = Object.assign({}, base_1.DOMWidgetModel.serializers);
|
|
17
|
+
ExampleModel.model_name = 'ExampleModel';
|
|
18
|
+
ExampleModel.model_module = version_1.MODULE_NAME;
|
|
19
|
+
ExampleModel.model_module_version = version_1.MODULE_VERSION;
|
|
20
|
+
ExampleModel.view_name = 'ExampleView'; // Set to null if no view
|
|
21
|
+
ExampleModel.view_module = version_1.MODULE_NAME; // Set to null if no view
|
|
22
|
+
ExampleModel.view_module_version = version_1.MODULE_VERSION;
|
|
23
|
+
class ExampleView extends base_1.DOMWidgetView {
|
|
24
|
+
render() {
|
|
25
|
+
this.el.classList.add('custom-widget');
|
|
26
|
+
this.value_changed();
|
|
27
|
+
this.model.on('change:value', this.value_changed, this);
|
|
28
|
+
}
|
|
29
|
+
value_changed() {
|
|
30
|
+
this.el.textContent = this.model.get('value');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ExampleView = ExampleView;
|
|
34
|
+
//# sourceMappingURL=widget.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dotdata_widgets",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A Custom Jupyter Widget Library",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jupyter",
|
|
7
|
+
"jupyterlab",
|
|
8
|
+
"jupyterlab-extension",
|
|
9
|
+
"widgets"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"lib/**/*.js",
|
|
13
|
+
"dist/*.js",
|
|
14
|
+
"css/*.css"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/dotdata/dotdata_widgets",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/dotdata/dotdata_widgets/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "BSD-3-Clause",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "dotdata",
|
|
23
|
+
"email": "dotdata@dotdata.com"
|
|
24
|
+
},
|
|
25
|
+
"main": "lib/index.js",
|
|
26
|
+
"types": "./lib/index.d.ts",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/dotdata/dotdata_widgets"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension:dev",
|
|
33
|
+
"build:prod": "yarn run build:lib && yarn run build:nbextension && yarn run build:labextension",
|
|
34
|
+
"build:labextension": "jupyter labextension build .",
|
|
35
|
+
"build:labextension:dev": "jupyter labextension build --development True .",
|
|
36
|
+
"build:lib": "tsc",
|
|
37
|
+
"build:nbextension": "webpack",
|
|
38
|
+
"clean": "yarn run clean:lib && yarn run clean:nbextension && yarn run clean:labextension",
|
|
39
|
+
"clean:lib": "rimraf lib",
|
|
40
|
+
"clean:labextension": "rimraf dotdata_widgets/labextension",
|
|
41
|
+
"clean:nbextension": "rimraf dotdata_widgets/nbextension/static/index.js",
|
|
42
|
+
"lint": "eslint . --ext .ts,.tsx --fix",
|
|
43
|
+
"lint:check": "eslint . --ext .ts,.tsx",
|
|
44
|
+
"prepack": "yarn run build:lib",
|
|
45
|
+
"test": "jest",
|
|
46
|
+
"watch": "npm-run-all -p watch:*",
|
|
47
|
+
"watch:lib": "tsc -w",
|
|
48
|
+
"watch:nbextension": "webpack --watch --mode=development",
|
|
49
|
+
"watch:labextension": "jupyter labextension watch ."
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@babel/core": "^7.5.0",
|
|
56
|
+
"@babel/preset-env": "^7.5.0",
|
|
57
|
+
"@jupyter-widgets/base-manager": "^1.0.2",
|
|
58
|
+
"@jupyterlab/builder": "^3.0.0",
|
|
59
|
+
"@lumino/application": "^1.6.0",
|
|
60
|
+
"@lumino/widgets": "^1.6.0",
|
|
61
|
+
"@types/jest": "^26.0.0",
|
|
62
|
+
"@types/webpack-env": "^1.13.6",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
|
64
|
+
"@typescript-eslint/parser": "^3.6.0",
|
|
65
|
+
"acorn": "^7.2.0",
|
|
66
|
+
"css-loader": "^3.2.0",
|
|
67
|
+
"eslint": "^7.4.0",
|
|
68
|
+
"eslint-config-prettier": "^6.11.0",
|
|
69
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
70
|
+
"fs-extra": "^7.0.0",
|
|
71
|
+
"identity-obj-proxy": "^3.0.0",
|
|
72
|
+
"jest": "^26.0.0",
|
|
73
|
+
"mkdirp": "^0.5.1",
|
|
74
|
+
"npm-run-all": "^4.1.3",
|
|
75
|
+
"prettier": "^2.0.5",
|
|
76
|
+
"rimraf": "^2.6.2",
|
|
77
|
+
"source-map-loader": "^1.1.3",
|
|
78
|
+
"style-loader": "^1.0.0",
|
|
79
|
+
"ts-jest": "^26.0.0",
|
|
80
|
+
"ts-loader": "^8.0.0",
|
|
81
|
+
"typescript": "~4.1.3",
|
|
82
|
+
"webpack": "^5.61.0",
|
|
83
|
+
"webpack-cli": "^4.0.0"
|
|
84
|
+
},
|
|
85
|
+
"jupyterlab": {
|
|
86
|
+
"extension": "lib/plugin",
|
|
87
|
+
"outputDir": "dotdata_widgets/labextension/",
|
|
88
|
+
"sharedPackages": {
|
|
89
|
+
"@jupyter-widgets/base": {
|
|
90
|
+
"bundled": false,
|
|
91
|
+
"singleton": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|