From 7dacddfd72618a9d8c40722b4cbd72d7ede3bf6f Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Thu, 25 Aug 2022 14:37:51 +0100 Subject: [PATCH 1/7] back to dev --- pythreejs/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythreejs/_version.py b/pythreejs/_version.py index 5373fc84..fee7cf15 100644 --- a/pythreejs/_version.py +++ b/pythreejs/_version.py @@ -1,4 +1,4 @@ -version_info = (2, 4, 1, 'final') +version_info = (2, 4, 2, 'dev') _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': '', 'dev': 'dev'} From 0ccaed55062c42afea125df7549344dcae9e573e Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:07:52 +0000 Subject: [PATCH 2/7] Fix lumino message handling (context menu) Without this compatibility shim (https://ipywidgets.readthedocs.io/en/stable/migration_guides.html#phosphor-lumino), we no longer handle `contextmenu` events correctly. --- js/src/_base/Renderable.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/src/_base/Renderable.js b/js/src/_base/Renderable.js index 38e67d02..680d101e 100644 --- a/js/src/_base/Renderable.js +++ b/js/src/_base/Renderable.js @@ -197,8 +197,8 @@ class RenderableView extends widgets.DOMWidgetView { } } - processPhosphorMessage(msg) { - widgets.DOMWidgetView.prototype.processPhosphorMessage.call(this, msg); + _processLuminoMessage(msg, _super) { + _super.call(this, msg); switch (msg.type) { case 'after-attach': this.el.addEventListener('contextmenu', this, true); @@ -209,6 +209,14 @@ class RenderableView extends widgets.DOMWidgetView { } } + processPhosphorMessage(msg) { + this._processLuminoMessage(msg, widgets.DOMWidgetView.prototype.processPhosphorMessage); + } + + processLuminoMessage(msg) { + this._processLuminoMessage(msg, widgets.DOMWidgetView.prototype.processLuminoMessage); + } + handleEvent(event) { switch (event.type) { case 'contextmenu': From 99f9a9a671a131201d120f923450944bb56d0f1a Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:39:53 +0000 Subject: [PATCH 3/7] Put regex flags first in expression --- setupbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setupbase.py b/setupbase.py index 13c926b1..44a02aa2 100644 --- a/setupbase.py +++ b/setupbase.py @@ -659,7 +659,7 @@ def _translate_glob(pat): translated_parts.append(_translate_glob_part(part)) os_sep_class = '[%s]' % re.escape(SEPARATORS) res = _join_translated(translated_parts, os_sep_class) - return '{res}\\Z(?ms)'.format(res=res) + return '(?ms){res}\\Z'.format(res=res) def _join_translated(translated_parts, os_sep_class): From 19765c314d2fd6a86f573e75adf071654d293db7 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Sun, 19 Feb 2023 22:47:46 +0000 Subject: [PATCH 4/7] Update public path logic Following https://ipywidgets.readthedocs.io/en/stable/migration_guides.html#updating-the-webpack-publicpath-configuration --- js/src/amd-public-path.js | 8 ++++++++ js/src/extension.js | 8 -------- js/webpack.config.js | 14 ++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 js/src/amd-public-path.js diff --git a/js/src/amd-public-path.js b/js/src/amd-public-path.js new file mode 100644 index 00000000..e03476a0 --- /dev/null +++ b/js/src/amd-public-path.js @@ -0,0 +1,8 @@ +// In an AMD module, we set the public path using the magic requirejs 'module' dependency +// See https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module +// Since 'module' is a requirejs magic module, we must include 'module' in the webpack externals configuration. +var module = require('module'); +var url = new URL(module.uri, document.location); +// Using lastIndexOf('/')+1 gives us the empty string if there is no '/', so pathname becomes '/' +url.pathname = url.pathname.slice(0,url.pathname.lastIndexOf('/')+1); +__webpack_public_path__ = `${url.origin}${url.pathname}`; diff --git a/js/src/extension.js b/js/src/extension.js index ffcc2e3b..4ddf6199 100644 --- a/js/src/extension.js +++ b/js/src/extension.js @@ -1,12 +1,4 @@ // Entry point for the notebook bundle containing custom model definitions. -// -// Setup notebook base URL -// -// Some static assets may be required by the custom widget javascript. The base -// url for the notebook is not known at build time and is therefore computed -// dynamically. -__webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/jupyter-threejs/'; - // Configure requirejs if (window.requirejs) { diff --git a/js/webpack.config.js b/js/webpack.config.js index b81b6deb..5ee8b912 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -1,6 +1,6 @@ const path = require('path'); -const externals = ['@jupyter-widgets/base', 'three']; +const externals = ['@jupyter-widgets/base', 'three', 'module']; module.exports = [ { @@ -17,11 +17,12 @@ module.exports = [ }, { // jupyter-threejs bundle for the notebook - entry: './src/index.js', + entry: ['./amd-public-path.js', './lib/index.js'], output: { filename: 'index.js', path: path.resolve(__dirname, '..', 'pythreejs', 'static'), - libraryTarget: 'amd' + libraryTarget: 'amd', + publicPath: '', // Set in amd-public-path.js }, devtool: 'source-map', externals: externals, @@ -32,14 +33,15 @@ module.exports = [ }, { // embeddable jupyter-threejs bundle (e.g. for docs) - entry: './src/index.js', + entry: ['./amd-public-path.js', './lib/index.js'], output: { filename: 'index.js', path: path.resolve(__dirname, 'dist'), library: 'jupyter-threejs', - libraryTarget: 'amd' + libraryTarget: 'amd', + publicPath: '', // Set in amd-public-path.js }, - externals: ['@jupyter-widgets/base'], + externals: ['@jupyter-widgets/base', 'module'], resolve: { extensions: [ '.autogen.js', '.js' ] }, From fa869a4441c6240346471e29fee30a308176d467 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Sun, 19 Feb 2023 22:56:57 +0000 Subject: [PATCH 5/7] Fix script locations --- js/{src => }/amd-public-path.js | 0 js/webpack.config.js | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename js/{src => }/amd-public-path.js (100%) diff --git a/js/src/amd-public-path.js b/js/amd-public-path.js similarity index 100% rename from js/src/amd-public-path.js rename to js/amd-public-path.js diff --git a/js/webpack.config.js b/js/webpack.config.js index 5ee8b912..650b16b6 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -17,7 +17,7 @@ module.exports = [ }, { // jupyter-threejs bundle for the notebook - entry: ['./amd-public-path.js', './lib/index.js'], + entry: ['./amd-public-path.js', './src/index.js'], output: { filename: 'index.js', path: path.resolve(__dirname, '..', 'pythreejs', 'static'), @@ -33,7 +33,7 @@ module.exports = [ }, { // embeddable jupyter-threejs bundle (e.g. for docs) - entry: ['./amd-public-path.js', './lib/index.js'], + entry: ['./amd-public-path.js', './src/index.js'], output: { filename: 'index.js', path: path.resolve(__dirname, 'dist'), From fc1b897ef2939711d6a0a909e0c3c49ff8e1cfbd Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Mon, 20 Feb 2023 00:03:52 +0000 Subject: [PATCH 6/7] Release 2.4.2 --- js/package.json | 2 +- pythreejs/_version.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/package.json b/js/package.json index 91917399..310b703f 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "jupyter-threejs", - "version": "2.4.0", + "version": "2.4.1", "description": "jupyter - threejs bridge", "keywords": [ "jupyterlab", diff --git a/pythreejs/_version.py b/pythreejs/_version.py index fee7cf15..6f3719df 100644 --- a/pythreejs/_version.py +++ b/pythreejs/_version.py @@ -1,4 +1,4 @@ -version_info = (2, 4, 2, 'dev') +version_info = (2, 4, 2, 'final') _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': '', 'dev': 'dev'} @@ -20,4 +20,4 @@ # the widget models, or if the serialized format changes. # # The major version needs to match that of the JS package. -EXTENSION_SPEC_VERSION = '^2.1.0' +EXTENSION_SPEC_VERSION = '^2.4.1' From 584fe393ff593319ce33cd53dd94c8625aa01c88 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske <510760+vidartf@users.noreply.github.com> Date: Mon, 20 Feb 2023 00:24:10 +0000 Subject: [PATCH 7/7] back to dev --- pythreejs/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythreejs/_version.py b/pythreejs/_version.py index 6f3719df..64636cdf 100644 --- a/pythreejs/_version.py +++ b/pythreejs/_version.py @@ -1,4 +1,4 @@ -version_info = (2, 4, 2, 'final') +version_info = (2, 4, 3, 'dev') _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': '', 'dev': 'dev'}