instaui 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. instaui/components/component.py +1 -1
  2. instaui/components/element.py +37 -17
  3. instaui/components/html/checkbox.py +0 -7
  4. instaui/components/slot.py +2 -3
  5. instaui/components/vfor.py +1 -1
  6. instaui/dependencies/component_dependency.py +16 -0
  7. instaui/dependencies/plugin_dependency.py +28 -0
  8. instaui/fastapi_server/debug_mode_router.py +0 -1
  9. instaui/fastapi_server/dependency_router.py +21 -0
  10. instaui/fastapi_server/resource.py +35 -0
  11. instaui/fastapi_server/server.py +124 -100
  12. instaui/html_tools.py +12 -106
  13. instaui/page_info.py +1 -11
  14. instaui/runtime/_app.py +9 -20
  15. instaui/runtime/resource.py +11 -46
  16. instaui/spa_router/_file_base_utils.py +47 -42
  17. instaui/spa_router/_route_model.py +3 -25
  18. instaui/spa_router/templates/page_routes +1 -0
  19. instaui/static/insta-ui.esm-browser.prod.js +3663 -3663
  20. instaui/static/insta-ui.iife.js +29 -29
  21. instaui/static/templates/web.html +32 -76
  22. instaui/static/templates/zero.html +48 -32
  23. instaui/systems/file_system.py +0 -9
  24. instaui/template/web_template.py +40 -46
  25. instaui/template/zero_template.py +100 -15
  26. instaui/ui/__init__.py +2 -5
  27. instaui/ui_functions/ui_page.py +3 -18
  28. instaui/vars/path_var.py +2 -1
  29. instaui/zero/func.py +111 -0
  30. instaui/zero/scope.py +12 -1
  31. {instaui-0.1.0.dist-info → instaui-0.1.2.dist-info}/METADATA +1 -1
  32. {instaui-0.1.0.dist-info → instaui-0.1.2.dist-info}/RECORD +34 -33
  33. instaui/dependencies/__init__.py +0 -15
  34. instaui/dependencies/component_registrar.py +0 -82
  35. instaui/dependencies/installer.py +0 -5
  36. instaui/fastapi_server/config_router.py +0 -60
  37. {instaui-0.1.0.dist-info → instaui-0.1.2.dist-info}/LICENSE +0 -0
  38. {instaui-0.1.0.dist-info → instaui-0.1.2.dist-info}/WHEEL +0 -0
instaui/html_tools.py CHANGED
@@ -1,50 +1,39 @@
1
1
  from __future__ import annotations
2
2
  from pathlib import Path
3
- from typing import Dict, Literal, Optional, Union
4
- import instaui.consts as consts
3
+ from typing import Any, Dict, Literal, Optional, Union
5
4
  from instaui.common.jsonable import dumps, dumps2dict
6
- from instaui.runtime import get_app_slot, HtmlResource
7
- from instaui.template import render_zero_html
5
+ from instaui.runtime._app import get_app_slot
8
6
 
9
7
 
10
- def add_css_link(href: Union[str, Path], *, shared: bool = False):
11
- if shared:
12
- HtmlResource.default_css_link(href)
13
-
8
+ def add_css_link(href: Union[str, Path]):
14
9
  get_app_slot()._html_resource.add_css_link(href)
15
10
 
16
11
 
17
12
  def add_js_link(
18
13
  link: Union[str, Path],
19
14
  *,
20
- shared: bool = False,
21
- type: Optional[Literal["module", "importmap"]] = None,
15
+ type: Optional[Literal["module"]] = None,
22
16
  ):
23
17
  attrs = {
24
18
  "type": type,
25
19
  }
26
20
 
27
- if shared:
28
- HtmlResource.default_js_link(link, attrs=attrs)
29
-
30
21
  get_app_slot()._html_resource.add_js_link(link, attrs=attrs)
31
22
 
32
23
 
33
- def add_style(content: str, *, shared: bool = False):
34
- if shared:
35
- HtmlResource.default_style_tag(content)
24
+ def add_style(content: str):
36
25
  get_app_slot()._html_resource.add_style_tag(content)
37
26
 
38
27
 
39
- def add_js_code(code: str, *, shared: bool = False):
40
- if shared:
41
- HtmlResource.default_script_tag(code)
42
- get_app_slot()._html_resource.add_script_tag(code)
28
+ def use_tailwind(value=True):
29
+ get_app_slot()._html_resource.use_tailwind = value
30
+
31
+
32
+ def add_js_code(code: str, *, script_attrs: Optional[Dict[str, Any]] = None):
33
+ get_app_slot()._html_resource.add_script_tag(code, script_attrs=script_attrs)
43
34
 
44
35
 
45
- def add_vue_app_use(name: str, *, shared: bool = False):
46
- if shared:
47
- HtmlResource.default_vue_app_use(name)
36
+ def add_vue_app_use(name: str):
48
37
  get_app_slot()._html_resource.add_vue_app_use(name)
49
38
 
50
39
 
@@ -54,86 +43,3 @@ def to_config_data() -> Dict:
54
43
 
55
44
  def to_json(indent=False):
56
45
  return dumps(get_app_slot(), indent=indent)
57
-
58
-
59
- def to_html(file: Union[str, Path]):
60
- if isinstance(file, str):
61
- import inspect
62
-
63
- frame = inspect.currentframe().f_back # type: ignore
64
- assert frame is not None
65
- script_file = inspect.getfile(frame)
66
- file = Path(script_file).parent.joinpath(file)
67
-
68
- file = Path(file)
69
- system_slot = get_app_slot()
70
- html_resource = system_slot._html_resource
71
-
72
- if html_resource.use_tailwind:
73
- html_resource.add_js_link(consts.TAILWIND_JS_PATH, insert_before=0)
74
- html_resource.add_js_link(consts.APP_IIFE_JS_PATH, insert_before=0)
75
- html_resource.add_js_link(consts.VUE_IIFE_JS_PATH, insert_before=0)
76
- html_resource.add_css_link(consts.APP_CSS_PATH)
77
-
78
- # register custom components
79
- for component in system_slot._js_components:
80
- if not component.iife:
81
- continue
82
-
83
- html_resource.add_js_link(component.iife)
84
-
85
- if component.css:
86
- for css_link in component.css:
87
- html_resource.add_css_link(css_link)
88
-
89
- html_resource.add_vue_app_use(component.name)
90
-
91
- for plugin in system_slot._plugins:
92
- if not plugin.iife:
93
- continue
94
-
95
- html_resource.add_js_link(plugin.iife)
96
-
97
- if plugin.css:
98
- for css_link in plugin.css:
99
- html_resource.add_css_link(css_link)
100
-
101
- html_resource.add_vue_app_use(plugin.name)
102
-
103
- _css_file_link_to_style_code(html_resource)
104
- _js_file_link_to_script_code(html_resource)
105
-
106
- raw = render_zero_html(to_json())
107
- file.write_text(raw, "utf8")
108
-
109
- return file.resolve().absolute()
110
-
111
-
112
- def _css_file_link_to_style_code(html_resource: HtmlResource):
113
- files = [link for link in html_resource._css_links.keys() if isinstance(link, Path)]
114
-
115
- for file in files:
116
- content = file.read_text(encoding="utf-8")
117
- html_resource.add_style_tag(content)
118
-
119
- # remove file links
120
- html_resource._css_links = {
121
- link: None
122
- for link in html_resource._css_links.keys()
123
- if not isinstance(link, Path)
124
- }
125
-
126
-
127
- def _js_file_link_to_script_code(html_resource: HtmlResource):
128
- files = (
129
- info.link for info in html_resource._js_links if isinstance(info.link, Path)
130
- )
131
-
132
- for file in files:
133
- content = file.read_text(encoding="utf-8")
134
- html_resource.add_script_tag(content)
135
-
136
- # remove file links
137
- html_resource._js_links = [
138
- info for info in html_resource._js_links if not isinstance(info.link, Path)
139
- ]
instaui/page_info.py CHANGED
@@ -1,23 +1,13 @@
1
1
  from __future__ import annotations
2
- from typing import Callable, Optional, TYPE_CHECKING
2
+ from typing import Callable
3
3
  from dataclasses import dataclass
4
4
  from urllib.parse import quote
5
5
 
6
6
 
7
- if TYPE_CHECKING:
8
- from instaui.runtime.resource import HtmlResource
9
-
10
-
11
7
  @dataclass
12
8
  class PageInfo:
13
9
  path: str
14
10
  func: Callable
15
- page_loading: Optional[Callable] = None
16
- use_tailwind: Optional[bool] = None
17
11
 
18
12
  def create_key(self) -> str:
19
13
  return quote(self.path)
20
-
21
- def apply_settings(self, html_resource: HtmlResource):
22
- if self.use_tailwind is not None:
23
- html_resource.use_tailwind = self.use_tailwind
instaui/runtime/_app.py CHANGED
@@ -5,7 +5,6 @@ from instaui.common.jsonable import Jsonable
5
5
  from .resource import HtmlResource
6
6
  from instaui.consts import _T_App_Mode
7
7
  from contextvars import ContextVar, Token
8
- from copy import copy
9
8
  from contextlib import contextmanager
10
9
  from instaui.runtime.scope import Scope, GlobalScope
11
10
  from types import MappingProxyType
@@ -13,14 +12,14 @@ from types import MappingProxyType
13
12
  if TYPE_CHECKING:
14
13
  from instaui.components.component import Component
15
14
  from instaui.components.slot import Slot
16
- from instaui.dependencies import ComponentRegistrationInfo, PluginRegistrationInfo
15
+
16
+ from instaui.dependencies.component_dependency import ComponentDependencyInfo
17
+ from instaui.dependencies.plugin_dependency import PluginDependencyInfo
17
18
  from instaui.spa_router._route_model import RouteCollector
18
19
 
19
20
 
20
21
  class App(Jsonable):
21
22
  _default_app_slot: ClassVar[Optional[App]] = None
22
- _default_js_components: ClassVar[Set[ComponentRegistrationInfo]] = set()
23
- _default_plugins: ClassVar[Set[PluginRegistrationInfo]] = set()
24
23
 
25
24
  def __init__(self, *, mode: _T_App_Mode) -> None:
26
25
  super().__init__()
@@ -35,11 +34,9 @@ class App(Jsonable):
35
34
  self._scope_stack: List[Scope] = [defalut_scope]
36
35
  self._scopes: List[Scope] = [defalut_scope]
37
36
  self._html_resource = HtmlResource()
38
- self._js_components: Set[ComponentRegistrationInfo] = copy(
39
- self._default_js_components
40
- )
37
+ self._component_dependencies: Set[ComponentDependencyInfo] = set()
38
+ self._plugin_dependencies: Set[PluginDependencyInfo] = set()
41
39
 
42
- self._plugins: Set[PluginRegistrationInfo] = copy(self._default_plugins)
43
40
  self._page_path: Optional[str] = None
44
41
  self._page_params: Dict[str, Any] = {}
45
42
  self._query_params: Dict[str, Any] = {}
@@ -74,11 +71,11 @@ class App(Jsonable):
74
71
  def reset_html_resource(self):
75
72
  self._html_resource = HtmlResource()
76
73
 
77
- def register_component(self, component: ComponentRegistrationInfo) -> None:
78
- self._js_components.add(component)
74
+ def use_component_dependency(self, dependency: ComponentDependencyInfo) -> None:
75
+ self._component_dependencies.add(dependency)
79
76
 
80
- def register_plugin(self, plugin: PluginRegistrationInfo) -> None:
81
- self._plugins.add(plugin)
77
+ def use_plugin_dependency(self, dependency: PluginDependencyInfo) -> None:
78
+ self._plugin_dependencies.add(dependency)
82
79
 
83
80
  def register_router(self, collector: RouteCollector) -> None:
84
81
  self._route_collector = collector
@@ -115,14 +112,6 @@ class App(Jsonable):
115
112
  cls._default_app_slot = DefaultApp(mode="web")
116
113
  return cls._default_app_slot
117
114
 
118
- @classmethod
119
- def default_js_components(cls, component: ComponentRegistrationInfo):
120
- cls._default_js_components.add(component)
121
-
122
- @classmethod
123
- def default_plugins(cls, plugin: PluginRegistrationInfo):
124
- cls._default_plugins.add(plugin)
125
-
126
115
 
127
116
  class DefaultApp(App):
128
117
  _instance = None
@@ -1,28 +1,20 @@
1
1
  from __future__ import annotations
2
2
  from pathlib import Path
3
- from typing import Any, ClassVar, Dict, List, Optional, Set, Union
3
+ from typing import Any, Dict, List, Optional, Set, Union
4
4
  from .dataclass import JsLink, VueAppUse, VueAppComponent
5
5
 
6
6
 
7
7
  class HtmlResource:
8
- _default_css_links: ClassVar[Dict[Union[str, Path], Any]] = {}
9
- _default_style_tags: ClassVar[List[str]] = []
10
- _default_js_links: ClassVar[List[JsLink]] = []
11
- _default_script_tags: ClassVar[List[str]] = []
12
- _default_vue_app_use: ClassVar[Set[VueAppUse]] = set()
13
- _default_vue_app_components: ClassVar[Set[VueAppComponent]] = set()
14
- use_tailwind: bool = False
8
+ use_tailwind: Optional[bool] = None
15
9
  _title: str = ""
16
10
 
17
11
  def __init__(self) -> None:
18
- self._css_links: Dict[Union[str, Path], Any] = self._default_css_links.copy()
19
- self._style_tags: List[str] = self._default_style_tags.copy()
20
- self._js_links: List[JsLink] = self._default_js_links.copy()
21
- self._script_tags: List[str] = self._default_script_tags.copy()
22
- self._vue_app_use: Set[VueAppUse] = self._default_vue_app_use.copy()
23
- self._vue_app_components: Set[VueAppComponent] = (
24
- self._default_vue_app_components.copy()
25
- )
12
+ self._css_links: Dict[Union[str, Path], Any] = {}
13
+ self._style_tags: List[str] = []
14
+ self._js_links: List[JsLink] = []
15
+ self._script_tags: List[str] = []
16
+ self._vue_app_use: Set[VueAppUse] = set()
17
+ self._vue_app_components: Set[VueAppComponent] = set()
26
18
  self._import_maps: Dict[str, str] = {}
27
19
  self.title: str = self._title
28
20
  self._appConfig = "{}"
@@ -45,7 +37,9 @@ class HtmlResource:
45
37
  return
46
38
  self._js_links.insert(insert_before, JsLink(link, attrs or {}))
47
39
 
48
- def add_script_tag(self, content: str):
40
+ def add_script_tag(
41
+ self, content: str, script_attrs: Optional[Dict[str, Any]] = None
42
+ ):
49
43
  self._script_tags.append(content)
50
44
 
51
45
  def add_vue_app_use(self, name: str):
@@ -56,32 +50,3 @@ class HtmlResource:
56
50
 
57
51
  def add_import_map(self, name: str, link: str):
58
52
  self._import_maps[name] = link
59
-
60
- @classmethod
61
- def default_css_link(cls, link: Union[str, Path]):
62
- cls._default_css_links[link] = None
63
-
64
- @classmethod
65
- def default_style_tag(cls, content: str):
66
- cls._default_style_tags.append(content)
67
-
68
- @classmethod
69
- def default_js_link(
70
- cls,
71
- link: Union[str, Path],
72
- *,
73
- attrs: Optional[Dict[str, Any]] = None,
74
- insert_before: int = -1,
75
- ):
76
- if insert_before == -1:
77
- cls._default_js_links.append(JsLink(link, attrs or {}))
78
- return
79
- cls._default_js_links.insert(insert_before, JsLink(link, attrs or {}))
80
-
81
- @classmethod
82
- def default_script_tag(cls, content: str):
83
- cls._default_script_tags.append(content)
84
-
85
- @classmethod
86
- def default_vue_app_use(cls, name: str):
87
- cls._default_vue_app_use.add(VueAppUse(name))
@@ -3,7 +3,6 @@ from collections import deque
3
3
  from datetime import datetime
4
4
  import importlib.util
5
5
  from pathlib import Path
6
- import sys
7
6
  import typing
8
7
  from pydantic import BaseModel, Field
9
8
  import jinja2
@@ -13,29 +12,42 @@ import inspect
13
12
  def build_routes_from_files(
14
13
  folder_path: typing.Union[str, Path] = "pages",
15
14
  module_name: str = "_routes",
15
+ route_config_var_name: str = "_route_config",
16
16
  ):
17
- folder_path = _utils.get_caller_path().parent / Path(folder_path)
18
- root = _model_utils.create_root(folder_path, module_name)
17
+ global_args = _GlobalArgs(
18
+ base_folder_path=_utils.get_caller_path().parent / Path(folder_path),
19
+ module_name=module_name,
20
+ route_config_var_name=route_config_var_name,
21
+ )
22
+
23
+ root = _model_utils.create_root(global_args)
19
24
  _code_gen.generate_router_file(root)
20
25
 
21
- print(f"Build _routes from files in {folder_path}...")
22
- # _module_utils.reload_module_from_folder(folder_path, module_name)
26
+ print(f"Build _routes from files in {global_args.base_folder_path}...")
27
+
28
+
29
+ class _GlobalArgs(BaseModel):
30
+ base_folder_path: Path
31
+ module_name: str
32
+ route_config_var_name: str
23
33
 
24
34
 
25
35
  class _model_utils:
26
36
  class FileRouteInfo(BaseModel):
27
37
  file: Path
28
38
  base_folder: Path
39
+ global_args: _GlobalArgs
29
40
  children: typing.List[_model_utils.FileRouteInfo] = []
30
-
31
41
  path: str = Field(init=False, default="")
32
42
  name: str = Field(init=False, default="")
33
43
  fn_path: typing.Optional[str] = Field(init=False, default=None)
34
44
 
35
45
  params: str = Field(init=False, default="")
46
+ meta: typing.Dict = Field(init=False, default={})
36
47
 
37
48
  def model_post_init(self, __context) -> None:
38
49
  self.params = self._extract_params()
50
+ self.meta = self._extract_meta()
39
51
  self.path, self.name = self._extra_path_name()
40
52
 
41
53
  if self.file.is_file():
@@ -46,14 +58,15 @@ class _model_utils:
46
58
  def is_index_file(self):
47
59
  return self.file.is_file() and self.file.stem == "index"
48
60
 
49
- def change_index(self, index_info: _model_utils.FileRouteInfo):
61
+ def change_sync_index_info(self, index_info: _model_utils.FileRouteInfo):
50
62
  self.fn_path = index_info.fn_path
51
63
  self.path = self.path + index_info.params
64
+ self.meta = index_info.meta
52
65
 
53
66
  def _extract_params(self):
54
67
  if self.file.is_file():
55
68
  route_config = _module_utils.get_module_getter(self.file)(
56
- "_route_config"
69
+ self.global_args.route_config_var_name
57
70
  )
58
71
  if route_config:
59
72
  if "params" in route_config:
@@ -61,6 +74,18 @@ class _model_utils:
61
74
 
62
75
  return ""
63
76
 
77
+ def _extract_meta(self):
78
+ if self.file.is_file():
79
+ route_config = _module_utils.get_module_getter(self.file)(
80
+ self.global_args.route_config_var_name
81
+ )
82
+
83
+ if route_config:
84
+ if "meta" in route_config:
85
+ return route_config["meta"]
86
+
87
+ return {}
88
+
64
89
  def _extra_path_name(self):
65
90
  name_parts = list(
66
91
  self.file.relative_to(self.base_folder).with_suffix("").parts
@@ -86,12 +111,12 @@ class _model_utils:
86
111
  if not self.fn_path:
87
112
  return ""
88
113
 
89
- return f"from .{self.fn_path} import main as {self.main_fn_name()}"
114
+ return f"from .{self.fn_path.replace(' ','_')} import main as {self.main_fn_name()}"
90
115
 
91
116
  def main_fn_name(self):
92
117
  if not self.fn_path:
93
118
  return ""
94
- return self.name.replace(".", "_")
119
+ return self.name.replace(".", "_").replace(" ", "_")
95
120
 
96
121
  class FileRouteRoot(BaseModel):
97
122
  folder: str
@@ -99,15 +124,17 @@ class _model_utils:
99
124
  infos: list[_model_utils.FileRouteInfo] = []
100
125
 
101
126
  @staticmethod
102
- def create_root(folder: Path, module_name: str) -> FileRouteRoot:
103
- base_folder = Path(folder)
104
- infos = _model_utils._create_route_info(base_folder)
127
+ def create_root(global_args: _GlobalArgs) -> FileRouteRoot:
128
+ base_folder = Path(global_args.base_folder_path)
129
+ infos = _model_utils._create_route_info(base_folder, global_args)
105
130
  return _model_utils.FileRouteRoot(
106
- folder=str(base_folder), module_name=module_name, infos=infos
131
+ folder=str(base_folder), module_name=global_args.module_name, infos=infos
107
132
  )
108
133
 
109
134
  @staticmethod
110
- def _create_route_info(base_folder: Path) -> typing.List[FileRouteInfo]:
135
+ def _create_route_info(
136
+ base_folder: Path, global_args: _GlobalArgs
137
+ ) -> typing.List[FileRouteInfo]:
111
138
  result: typing.List[_model_utils.FileRouteInfo] = []
112
139
 
113
140
  stack: deque[
@@ -124,7 +151,7 @@ class _model_utils:
124
151
 
125
152
  if is_dir:
126
153
  folder_info = _model_utils.FileRouteInfo(
127
- file=item, base_folder=base_folder
154
+ file=item, base_folder=base_folder, global_args=global_args
128
155
  )
129
156
  infos = ((folder_info, path) for path in item.iterdir())
130
157
  stack.extendleft(infos)
@@ -138,13 +165,15 @@ class _model_utils:
138
165
  if item.suffix != ".py":
139
166
  continue
140
167
 
141
- file_info = _model_utils.FileRouteInfo(file=item, base_folder=base_folder)
168
+ file_info = _model_utils.FileRouteInfo(
169
+ file=item, base_folder=base_folder, global_args=global_args
170
+ )
142
171
 
143
172
  if parent_info is None:
144
173
  result.append(file_info)
145
174
  else:
146
175
  if file_info.is_index_file():
147
- parent_info.change_index(file_info)
176
+ parent_info.change_sync_index_info(file_info)
148
177
 
149
178
  else:
150
179
  parent_info.children.append(file_info)
@@ -200,30 +229,6 @@ class _code_gen:
200
229
 
201
230
 
202
231
  class _module_utils:
203
- @staticmethod
204
- def reload_module_from_folder(folder: Path, module_name: str):
205
- module_file_path = folder / f"{module_name}.py"
206
-
207
- if not module_file_path.exists():
208
- raise FileNotFoundError(f"No such file: '{module_file_path}'")
209
-
210
- package_name = module_file_path.parent.name
211
- spec = importlib.util.spec_from_file_location(
212
- module_name, str(module_file_path)
213
- )
214
- if spec is None:
215
- raise ImportError(f"Failed to load module: '{module_name}'")
216
-
217
- module = importlib.util.module_from_spec(spec)
218
- module.__package__ = package_name
219
-
220
- if module_name in sys.modules:
221
- sys.modules[module_name] = module
222
- importlib.reload(module)
223
- return
224
-
225
- spec.loader.exec_module(module) # type: ignore
226
-
227
232
  @staticmethod
228
233
  def get_module_getter(path: Path):
229
234
  if not isinstance(path, Path):
@@ -17,31 +17,7 @@ class RouteItem(BaseModel):
17
17
  component_fn: typing.Optional[typing.Callable] = Field(exclude=True)
18
18
  scope: typing.Optional[Scope] = None
19
19
  vue_route_item: VueRouteItem = Field(serialization_alias="vueItem")
20
-
21
- # def model_post_init(self, __context: typing.Any) -> None:
22
- # if self.component_fn is None and (not self.vue_route_item.path):
23
- # raise ValueError("Either component_fn or vue_route_item.path must be set")
24
-
25
- # if self.component_fn is None:
26
- # return None
27
-
28
- # if self.vue_route_item.path is None:
29
- # self.vue_route_item.path = f"/{'' if self.component_fn.__name__=='index' else self.component_fn.__name__}"
30
-
31
- # app = get_app_slot()
32
-
33
- # with new_scope(append_to_app=False) as scope:
34
- # with Div() as div:
35
- # self.component_fn()
36
-
37
- # app.items.pop()
38
-
39
- # self.scope = scope
40
- # self.vue_route_item.component = div._slot_manager.default._children
41
-
42
- # @field_serializer("scope")
43
- # def serialize_scope(self, value: Scope):
44
- # return dumps2dict(value)
20
+ meta: typing.Optional[typing.Dict] = None
45
21
 
46
22
  @model_serializer
47
23
  def model_ser(self):
@@ -80,6 +56,7 @@ class RouteItem(BaseModel):
80
56
  name: typing.Optional[str] = None,
81
57
  params: typing.Optional[typing.Dict[str, str]] = None,
82
58
  children: typing.Optional[typing.List[RouteItem]] = None,
59
+ meta: typing.Optional[typing.Dict] = None,
83
60
  ):
84
61
  """Create a new RouteItem
85
62
 
@@ -103,6 +80,7 @@ class RouteItem(BaseModel):
103
80
 
104
81
  return cls(
105
82
  component_fn=component_fn,
83
+ meta=meta,
106
84
  vue_route_item=VueRouteItem(
107
85
  path=path,
108
86
  name=name,
@@ -21,6 +21,7 @@
21
21
  router.RouteItem.create(
22
22
  path="{{route.path}}",
23
23
  name="{{route.name}}",
24
+ meta = {{route.meta}},
24
25
  {{ render_fn_arg(route.main_fn_name()) |trim}}
25
26
  {{ render_children_arg(route.children) |trim}}
26
27
  ),