Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions altair/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
*.py[cod]
__pycache__/
dist/
.states
*.db
.idea
.idea/**/*
.web
/venv/
assets/external/
8 changes: 0 additions & 8 deletions altair/altair_demo/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion altair/altair_demo/altair_demo/altair/us_airport.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SPEC = {'$schema': 'https://vega.github.io/schema/vega-lite/v5.json',
SPEC = {'$schema': 'https://vega.github.io/schema/vega-lite/v6.1.json',
'description': 'An interactive visualization of connections among major U.S. '
'airports in 2008. Based on a U.S. airports example by Mike '
'Bostock.',
Expand Down
7 changes: 3 additions & 4 deletions altair/altair_demo/altair_demo/altair_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def monaco_edit(self, value):
def json_spec_2(self) -> str:
return json.dumps(self.spec_airport, indent=2)

@rx.event(background=True)
async def test_log(self, value):
@rx.event
async def test_log(self, value: List[Any]) -> rx.Component:
print(value)
return rx.toast(value)
return rx.toast(str(value))


def theme_dropdown() -> rx.Component:
Expand Down Expand Up @@ -110,6 +110,5 @@ def index() -> rx.Component:
)



app = rx.App()
app.add_page(index)
2 changes: 1 addition & 1 deletion altair/altair_demo/reflex_altair/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
SIGNAL_PROPS = {"onNewView" + e.title(): e for e in AltairSignal.__args__}


class AltairChart(rx.Component):
class AltairChart(rx.NoSSRComponent):
library = "react-vega"
tag = "Vega"
alias = "Altair"
Expand Down
9 changes: 3 additions & 6 deletions altair/altair_demo/reflex_altair/type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union, Literal, Optional, Dict
from typing import Union, Literal, Mapping
import altair as alt

AltairChartType = Union[
Expand Down Expand Up @@ -61,8 +61,5 @@
'none'
]

AltairAction = Union[
bool,
Dict[Literal['export', 'source', 'compiled', 'editor'], bool],
Dict[Literal['export'], Dict[Literal['svg', 'png'], Optional[bool]]]
]
AltairAction = Mapping[str, Union[Mapping[str, bool], bool]]

2 changes: 1 addition & 1 deletion altair/custom_components/reflex_altair/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
SIGNAL_PROPS = {"onNewView" + e.title(): e for e in AltairSignal.__args__}


class AltairChart(rx.Component):
class AltairChart(rx.NoSSRComponent):
library = "react-vega"
tag = "Vega"
alias = "Altair"
Expand Down
9 changes: 3 additions & 6 deletions altair/custom_components/reflex_altair/type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union, Literal, Optional, Dict
from typing import Union, Literal, Mapping
import altair as alt

AltairChartType = Union[
Expand Down Expand Up @@ -61,8 +61,5 @@
'none'
]

AltairAction = Union[
bool,
Dict[Literal['export', 'source', 'compiled', 'editor'], bool],
Dict[Literal['export'], Dict[Literal['svg', 'png'], Optional[bool]]]
]
AltairAction = Mapping[str, Union[Mapping[str, bool], bool]]

9 changes: 4 additions & 5 deletions altair/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta"

name = "reflex-altair"

version = "0.1.1"
version = "0.1.2"

description = "Reflex custom component to render altair/vega"

Expand All @@ -32,11 +32,11 @@ license = { text = "Apache-2.0" }



requires-python = ">=3.9"
requires-python = ">=3.12"



authors = [{ name = "L�opold Grosjean", email = "[email protected]" }]
authors = [{ name = "Léopold Grosjean", email = "[email protected]" }]



Expand All @@ -56,7 +56,7 @@ keywords = [

dependencies = [

"reflex>=0.6.0"
"reflex>=0.7.9"

]

Expand Down Expand Up @@ -88,4 +88,3 @@ dev = ["build", "twine"]
[tool.setuptools.packages.find]

where = ["custom_components"]