diff --git a/panel/_templates/autoload_panel_js.js b/panel/_templates/autoload_panel_js.js index 0618559b00..01d9ade156 100644 --- a/panel/_templates/autoload_panel_js.js +++ b/panel/_templates/autoload_panel_js.js @@ -119,7 +119,7 @@ calls it with the rendered model. } {%- for lib, urls in skip_imports.items() %} - if (((window['{{ lib }}'] !== undefined) && (!(window['{{ lib }}'] instanceof HTMLElement))) || window.requirejs) { + if (((window.{{ lib }} !== undefined) && (!(window.{{ lib }} instanceof HTMLElement))) || window.requirejs) { var urls = {{ urls }}; for (var i = 0; i < urls.length; i++) { skip.push(urls[i]) diff --git a/panel/_templates/doc_nb_js.js b/panel/_templates/doc_nb_js.js index 1c675c0d03..3d33b517f7 100644 --- a/panel/_templates/doc_nb_js.js +++ b/panel/_templates/doc_nb_js.js @@ -34,7 +34,7 @@ } function is_loaded(root) { var Bokeh = get_bokeh(root) - return (Bokeh != null && Bokeh.Panel !== undefined{% for reqs in requirements %} && ({% for req in reqs %}{% if loop.index0 > 0 %}||{% endif %} root['{{ req }}'] !== undefined{% endfor %}){% endfor %}{% if ipywidget %}&& Bokeh.Models._known_models.has("ipywidgets_bokeh.widget.IPyWidget") {% endif %}) + return (Bokeh != null && Bokeh.Panel !== undefined{% for reqs in requirements %} && ({% for req in reqs %}{% if loop.index0 > 0 %}||{% endif %} root.{{ req }} !== undefined{% endfor %}){% endfor %}{% if ipywidget %}&& Bokeh.Models._known_models.has("ipywidgets_bokeh.widget.IPyWidget") {% endif %}) } if (is_loaded(root)) { embed_document(root); diff --git a/panel/config.py b/panel/config.py index eb16b63b31..485aafdd9b 100644 --- a/panel/config.py +++ b/panel/config.py @@ -32,7 +32,11 @@ __version__ = str(param.version.Version( fpath=__file__, archive_commit="$Format:%h$", reponame="panel")) -_LOCAL_DEV_VERSION = any(v in __version__ for v in ('post', 'dirty')) and not state._is_pyodide +_LOCAL_DEV_VERSION = ( + any(v in __version__ for v in ('post', 'dirty')) + and not state._is_pyodide + and 'PANEL_DOC_BUILD' not in os.environ +) #--------------------------------------------------------------------- # Public API @@ -683,7 +687,7 @@ class panel_extension(_pyviz_extension): 'gridstack': ['GridStack'], 'katex': ['katex'], 'mathjax': ['MathJax'], - 'perspective': ['perspective.worker'], + 'perspective': ["customElements.get('perspective-viewer')"], 'plotly': ['Plotly'], 'tabulator': ['Tabulator'], 'terminal': ['Terminal', 'xtermjs'], diff --git a/panel/models/perspective.py b/panel/models/perspective.py index 597f2936c7..1a3720c890 100644 --- a/panel/models/perspective.py +++ b/panel/models/perspective.py @@ -101,12 +101,13 @@ def __javascript_modules__(cls): @classproperty def __js_skip__(cls): return { - "perspective": cls.__javascript_modules__ + "customElements.get('perspective-viewer')": cls.__javascript_modules__ } __js_require__ = { "paths": { "perspective": f"{config.npm_cdn}/@finos/perspective@{PERSPECTIVE_VERSION}/dist/cdn/perspective", + "perspective-worker": f"{config.npm_cdn}/@finos/perspective@{PERSPECTIVE_VERSION}/dist/cdn/perspective.worker", "perspective-viewer": f"{config.npm_cdn}/@finos/perspective-viewer@{PERSPECTIVE_VERSION}/dist/cdn/perspective-viewer", "perspective-viewer-datagrid": f"{config.npm_cdn}/@finos/perspective-viewer-datagrid@{PERSPECTIVE_VERSION}/dist/cdn/perspective-viewer-datagrid", "perspective-viewer-d3fc": f"{config.npm_cdn}/@finos/perspective-viewer-d3fc@{PERSPECTIVE_VERSION}/dist/cdn/perspective-viewer-d3fc",