Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Vue3 support #82

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f49d62b
feat: Vue3 support
mariobuikhuizen Oct 31, 2023
9d8a21e
feat: backward compatibility for templates using 'modules.export'
mariobuikhuizen Oct 31, 2023
0ec320e
docs: fix examples
mariobuikhuizen Nov 1, 2023
cfa3568
chore: bump version 1.10.1 -> 3.0.0-dev.0
mariobuikhuizen Nov 1, 2023
599429d
fix: convert python to js version when prerelease
maartenbreddels Nov 1, 2023
0e8c50e
temp: install solara from branch
maartenbreddels Nov 1, 2023
30e9613
ci: install vuetify3
maartenbreddels Nov 1, 2023
356320c
fix: prevent warnings about resolving default HTML tags like 'div`
mariobuikhuizen Nov 8, 2023
d8b125e
chore: add package-lock with new version
mariobuikhuizen Nov 15, 2023
fec057b
feat: make it possible to add modules for use in templates
mariobuikhuizen Nov 15, 2023
77f5fcc
feat: add more extension points to VueView
mariobuikhuizen Nov 15, 2023
d7bae3e
fix: embed the es-module-shims script
mariobuikhuizen Nov 16, 2023
429abcc
feat: remove unused traits css, methods and data
mariobuikhuizen Nov 17, 2023
28ef04f
chore: remove comments and console.log
mariobuikhuizen Nov 17, 2023
8143302
chore: release v3.0.0.alpha1
mariobuikhuizen Nov 17, 2023
d5fe12e
fix: templates not rendering in Voila
mariobuikhuizen Nov 28, 2023
daa98c3
chore:release v3.0.0.alpha2
mariobuikhuizen Nov 28, 2023
aa6fa5b
fix: make setup() and <script setup> work
mariobuikhuizen Sep 26, 2024
58ddcdd
ci: fix outdated action
mariobuikhuizen Sep 26, 2024
c4dd38e
chore: release v3.0.0.alpha3
mariobuikhuizen Sep 26, 2024
725ebfd
fix: don't fail if there is no template part in the SFC
mariobuikhuizen Sep 30, 2024
403c6ce
feat: typescript support
mariobuikhuizen Oct 1, 2024
db673cf
chore: release v3.0.0.alpha4
mariobuikhuizen Oct 1, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: "14.x"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Install Python
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Install vuetify and test deps
run: |
wheel=(dist/*.whl)
pip install ${wheel}[test] "jupyter_server<2"
pip install ${wheel} https://github.com/widgetti/ipyvuetify/archive/refs/heads/vuetify3.zip ${wheel}[test] "jupyter_server<2"

- name: Install playwright browsers
run: playwright install chromium
Expand All @@ -127,7 +127,7 @@ jobs:

- name: Upload Test artifacts
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ipyvue-test-results
path: test-results
Expand All @@ -144,7 +144,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: "14.x"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Install Python
Expand Down
8 changes: 8 additions & 0 deletions class_components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
" input = Unicode().tag(sync=True)\n",
" something = Unicode('defaultvalue').tag(sync=True)\n",
" template = Unicode('''\n",
" <template>\n",
" <div style=\"border: 1px solid green; margin: 2px\" @click=\"append_one()\">\n",
" [{{ something }}] input: {{ input }} \n",
" </div>\n",
" </template> \n",
" ''').tag(sync=True)\n",
" \n",
" def vue_append_one(self, *args):\n",
Expand All @@ -44,6 +46,7 @@
" texts = List(['xxxx', 'yyyy']).tag(sync=True)\n",
" direct = Unicode('aaa').tag(sync=True)\n",
" template = Unicode('''\n",
" <template>\n",
" <div>\n",
" <div style=\"border: 1px solid black\">\n",
" <sub-component v-for=\"t in texts\" :input=\"t\" :key=\"t\" />\n",
Expand All @@ -52,6 +55,7 @@
" <w-button v-for=\"t in texts\" :description=\"t\" :key=\"t\" />\n",
" <w-button description=\"no v-for\"/>\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" components=Dict({\n",
Expand Down Expand Up @@ -113,9 +117,11 @@
" label = Unicode().tag(sync=True)\n",
" \n",
" template = Unicode('''\n",
" <template>\n",
" <div style=\"border: 1px solid green; margin: 2px\">\n",
" [{{ label }}] Db URL: {{ info }}\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" @observe('db')\n",
Expand All @@ -135,6 +141,7 @@
" supplier_db_collection = Dict().tag(sync_ref=True)\n",
" \n",
" template = Unicode('''\n",
" <template>\n",
" <div>\n",
" <database-info label=\"customers\" :db=\"customer_db\" />\n",
" \n",
Expand All @@ -146,6 +153,7 @@
" \n",
" <database-info label=\"function\" :db=\"{functionRef: 'db_factory', args: ['localhost/function1']}\" />\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" components = Dict({\n",
Expand Down
2 changes: 2 additions & 0 deletions examples/DeepWatch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
" deep_array = traitlets.List(['array']).tag(sync=True)\n",
" deep_array2 = traitlets.List([{'prop': 'array2'}]).tag(sync=True)\n",
" template = traitlets.Unicode('''\n",
" <template>\n",
" <div>\n",
" <v-text-field v-model=\"deep.prop\" />\n",
" <v-text-field v-model=\"deep.deeper.prop\" />\n",
Expand All @@ -27,6 +28,7 @@
" {{ deep_array[0] }} |\n",
" {{ deep_array2[0].prop }}\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
"md = MyDeep()\n",
Expand Down
12 changes: 7 additions & 5 deletions examples/EmbeddingJupyterWidgetsInVueTemplate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
"\n",
"\n",
" template=Unicode(\"\"\"\n",
" <div>\n",
" <div v-for=\"item in items\" :key=\"item.title + item.content\">\n",
" {{ item.title }}: <jupyter-widget :widget=\"item.content\" />\n",
" <template>\n",
" <div>\n",
" <div v-for=\"item in items\" :key=\"item.title + item.content\">\n",
" {{ item.title }}: <jupyter-widget :widget=\"item.content\" />\n",
" </div>\n",
" Single widget: <jupyter-widget :widget=\"single_widget\" />\n",
" </div>\n",
" Single widget: <jupyter-widget :widget=\"single_widget\" />\n",
" </div>\n",
" </template>\n",
" \"\"\").tag(sync=True)\n",
"\n",
"my_component = MyComponent()\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/fullVueComponent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"class Testing(v.VuetifyTemplate):\n",
" template = Unicode(\"\"\"\n",
" <template>\n",
" <test-comp :viewer=\"some_widget\"></test_comp>\n",
" <test-comp :viewer=\"some_widget\"></test-comp>\n",
" </template>\n",
" \"\"\").tag(sync=True)\n",
" \n",
Expand Down
2 changes: 1 addition & 1 deletion examples/hot-reload/my_component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
</template>
<script>
module.exports = {
export default {
props: ['my-data']
}
</script>
2 changes: 1 addition & 1 deletion examples/hot-reload/my_sub_component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
</template>
<script>
module.exports = {
export default {
props: ['label']
}
</script>
2 changes: 1 addition & 1 deletion examples/hot-reload/my_widget_template.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<h1>My Widget template</h1>
<my-component :my-data="some_data"></my-component>
<my-component :my-data="some_data"/>
</div>
</template>
27 changes: 24 additions & 3 deletions ipyvue/VueTemplateWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def to_ref_structure(obj, path):
return to_ref_structure(data, [])


class TraitNotAvailable(Any):
def __init__(self, on_use_msg):
self.on_use_msg = on_use_msg
super().__init__()

def get(self, *ignored):
raise AttributeError(self.on_use_msg(self.name))

def set(self, *ignored):
raise AttributeError(AttributeError(self.on_use_msg(self.name)))


class VueTemplate(DOMWidget, Events):

class_component_serialization = {
Expand Down Expand Up @@ -116,11 +128,20 @@ class VueTemplate(DOMWidget, Events):
sync=True, **widget_serialization
)

css = Unicode(None, allow_none=True).tag(sync=True)
css = TraitNotAvailable(
lambda name: "The css trait is no longer available in v3, please use the \
template <style> tag instead"
)

methods = Unicode(None, allow_none=True).tag(sync=True)
methods = TraitNotAvailable(
lambda name: "The methods trait is no longer available in v3, please use \
{ methods: ...} in the template <script> tag instead"
)

data = Unicode(None, allow_none=True).tag(sync=True)
data = TraitNotAvailable(
lambda name: "The data trait is no longer available in v3, please use \
{ data(): ...} in the template <script> tag instead"
)

events = List(Unicode(), allow_none=True).tag(sync=True)

Expand Down
4 changes: 2 additions & 2 deletions ipyvue/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.10.1"
semver = "^" + __version__
__version__ = "3.0.0.alpha4"
semver = "3.0.0-alpha.4"
Loading
Loading