Skip to content

Commit

Permalink
upgrade to idom 0.32.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Aug 20, 2021
1 parent 204ef6b commit 4a27656
Show file tree
Hide file tree
Showing 25 changed files with 5,338 additions and 12,232 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Created by .ignore support plugin (hsz.mobi)
### VisualStudioCode template
.vscode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"python.pythonPath": "venv/bin/python"
}
"python.formatting.provider": "black"
}
6 changes: 3 additions & 3 deletions R/idomDashComponent.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# AUTO GENERATED FILE - DO NOT EDIT

idomDashComponent <- function(viewId=NULL, clientModuleUrl=NULL) {
idomDashComponent <- function(viewId=NULL) {

props <- list(viewId=viewId, clientModuleUrl=clientModuleUrl)
props <- list(viewId=viewId)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'IdomDashComponent',
namespace = 'idom_dash',
propNames = c('viewId', 'clientModuleUrl'),
propNames = c('viewId'),
package = 'idomDash'
)

Expand Down
32 changes: 8 additions & 24 deletions deps/idom_dash.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions deps/idom_dash.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/
2 changes: 1 addition & 1 deletion deps/idom_dash.min.js.map

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions idom_dash/IdomDashComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
class IdomDashComponent(Component):
"""An IdomDashComponent component.
IdomDashComponent allows integration between Dash and IDOM
Keyword arguments:
- viewId (string; optional): The view ID for this component instance
- clientModuleUrl (string; optional)"""
@_explicitize_args
def __init__(self, viewId=Component.UNDEFINED, clientModuleUrl=Component.UNDEFINED, **kwargs):
self._prop_names = ['viewId', 'clientModuleUrl']
self._type = 'IdomDashComponent'
self._namespace = 'idom_dash'
self._valid_wildcard_attributes = []
self.available_properties = ['viewId', 'clientModuleUrl']
self.available_wildcard_properties = []
Keyword arguments:
- viewId (string; optional):
The view ID for this component instance."""

_explicit_args = kwargs.pop('_explicit_args')
@_explicitize_args
def __init__(self, viewId=Component.UNDEFINED, **kwargs):
self._prop_names = ["viewId"]
self._type = "IdomDashComponent"
self._namespace = "idom_dash"
self._valid_wildcard_attributes = []
self.available_properties = ["viewId"]
self.available_wildcard_properties = []
_explicit_args = kwargs.pop("_explicit_args")
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}

args = {k: _locals[k] for k in _explicit_args if k != "children"}
for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
raise TypeError("Required argument `" + k + "` was not specified.")
super(IdomDashComponent, self).__init__(**args)
53 changes: 25 additions & 28 deletions idom_dash/idom_compat.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
import os
from typing import Any, Callable

from dash import Dash
from flask import Flask, send_from_directory
from idom.widgets.utils import multiview
from idom.client.module import Module
from idom.core.component import AbstractComponent
from idom.config import IDOM_CLIENT_IMPORT_SOURCE_URL, IDOM_CLIENT_BUILD_DIR
from idom.server.flask import PerClientStateServer, Config
from flask import Flask
from idom.config import IDOM_DEBUG_MODE
from idom.widgets import multiview
from idom.core.proto import ComponentType
from idom.server.flask import PerClientStateServer, Config, FlaskServer
from idom import Ref

from .IdomDashComponent import IdomDashComponent


IDOM_DASH_SERVER_BASE_URL = Ref(os.environ.get("IDOM_DASH_SERVER_BASE_URL", ""))
SERVER_CONFIG = Config(
url_prefix="/_idom",
serve_static_files=False,
serve_static_files=True,
redirect_root_to_index=False,
)
IDOM_CLIENT_IMPORT_SOURCE_URL.set("./_idom")
_MOUNT, IdomComponentView = multiview()
_MOUNT_VIEW, IdomComponentView = multiview()


def create_component(__constructor: Callable[[], AbstractComponent], *args: Any, **kwargs: Any) -> IdomDashComponent:
view_id = _MOUNT(lambda: __constructor(*args, **kwargs))
return IdomDashComponent(viewId=view_id, clientModuleUrl=Module("idom-client-react").url)
def create_component(
__constructor: Callable[[], ComponentType], *args: Any, **kwargs: Any
) -> IdomDashComponent:
view_id = _MOUNT_VIEW.add(None, lambda: __constructor(*args, **kwargs))
return IdomDashComponent(viewId=view_id)


def run_server(app: Dash, host: str, port: int, debug: bool = False, *args: Any, **kwargs: Any) -> PerClientStateServer:
if debug:
print(f"Serving at http://{host}:{port}/")
def run_server(
app: Dash, host: str, port: int, *args: Any, **kwargs: Any
) -> PerClientStateServer:
idom_server_extension = _make_render_server(app.server)
idom_server_extension.run(host, port, debug=debug, *args, **kwargs)
idom_server_extension.run(host, port, *args, **kwargs)
return idom_server_extension


def run_daemon_server(app: Dash, host: str, port: int, debug: bool = False, *args: Any, **kwargs: Any) -> PerClientStateServer:
if debug:
print(f"Serving at http://{host}:{port}/")
def run_daemon_server(
app: Dash, host: str, port: int, *args: Any, **kwargs: Any
) -> PerClientStateServer:
idom_server_extension = _make_render_server(app.server)
idom_server_extension.daemon(host, port, debug=debug, *args, **kwargs)
idom_server_extension.run_in_thread(host, port, *args, **kwargs)
return idom_server_extension

def _make_render_server(server: Flask) -> PerClientStateServer:
idom_server_extension = PerClientStateServer(IdomComponentView, SERVER_CONFIG)
idom_server_extension.register(server)

@server.route(f"{SERVER_CONFIG['url_prefix']}/<path:path>")
def serve_web_modules(path: str):
return send_from_directory(str(IDOM_CLIENT_BUILD_DIR.get()), path)

return idom_server_extension
def _make_render_server(server: Flask) -> FlaskServer:
return PerClientStateServer(IdomComponentView, SERVER_CONFIG, app=server)
32 changes: 8 additions & 24 deletions idom_dash/idom_dash.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions idom_dash/idom_dash.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/
2 changes: 1 addition & 1 deletion idom_dash/idom_dash.min.js.map

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions idom_dash/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"src/lib/components/IdomDashComponent.react.js": {
"description": "",
"description": "IdomDashComponent allows integration between Dash and IDOM",
"displayName": "IdomDashComponent",
"methods": [],
"props": {
Expand All @@ -11,13 +11,6 @@
"required": false,
"description": "The view ID for this component instance"
},
"clientModuleUrl": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"setProps": {
"type": {
"name": "func"
Expand Down
9 changes: 4 additions & 5 deletions idom_dash/package-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"author": "Ryan Morshead <ryan.morshead@gmail.com>",
"license": "MIT",
"dependencies": {
"idom-client-react": "^0.7.0",
"idom-client-react": "^0.9.0",
"ramda": "^0.26.1"
},
"devDependencies": {
Expand All @@ -45,13 +45,12 @@
"prettier": "^2.2.1",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-docgen": "^4.1.1",
"react-docgen": "^5.4.0",
"react-dom": "^16.8.6",
"style-loader": "^0.23.1",
"styled-jsx": "^3.2.1",
"webpack": "4.36.1",
"webpack-cli": "3.3.6",
"webpack-serve": "3.1.0"
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0"
},
"engines": {
"node": ">=8.11.0",
Expand Down
32 changes: 8 additions & 24 deletions inst/deps/idom_dash.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions inst/deps/idom_dash.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/
2 changes: 1 addition & 1 deletion inst/deps/idom_dash.min.js.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions man/idomDashComponent.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
\title{IdomDashComponent component}

\description{

IdomDashComponent allows integration between Dash and IDOM
}

\usage{
idomDashComponent(viewId=NULL, clientModuleUrl=NULL)
idomDashComponent(viewId=NULL)
}

\arguments{
\item{viewId}{Character. The view ID for this component instance}

\item{clientModuleUrl}{Character. }
}

\value{named list of JSON elements corresponding to React.js properties and their values}
Expand Down
Loading

0 comments on commit 4a27656

Please sign in to comment.