Skip to content

Commit 965f634

Browse files
committed
rename proto modules to types
1 parent d73b79f commit 965f634

24 files changed

+83
-53
lines changed

docs/examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Callable, Iterator
77

88
import idom
9-
from idom import ComponentType
9+
from idom.types import ComponentType
1010

1111

1212
HERE = Path(__file__)

src/idom/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from . import config, html, log, web
1+
from . import config, html, log, types, web
22
from .core import hooks
3-
from .core.component import Component, component
3+
from .core.component import component
44
from .core.dispatcher import Stop
5-
from .core.events import EventHandler, event
5+
from .core.events import event
66
from .core.hooks import (
77
create_context,
88
use_callback,
@@ -14,7 +14,6 @@
1414
use_state,
1515
)
1616
from .core.layout import Layout
17-
from .core.proto import ComponentType, VdomDict
1817
from .core.vdom import vdom
1918
from .sample import run_sample_app
2019
from .server.prefab import run
@@ -27,12 +26,9 @@
2726

2827
__all__ = [
2928
"component",
30-
"Component",
31-
"ComponentType",
3229
"config",
3330
"create_context",
3431
"event",
35-
"EventHandler",
3632
"hooks",
3733
"hotswap",
3834
"html_to_vdom",
@@ -44,6 +40,7 @@
4440
"run_sample_app",
4541
"run",
4642
"Stop",
43+
"types",
4744
"use_callback",
4845
"use_context",
4946
"use_effect",
@@ -52,6 +49,5 @@
5249
"use_ref",
5350
"use_state",
5451
"vdom",
55-
"VdomDict",
5652
"web",
5753
]

src/idom/core/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from functools import wraps
55
from typing import Any, Callable, Dict, Optional, Tuple, Union
66

7-
from .proto import ComponentType, VdomDict
7+
from .types import ComponentType, VdomDict
88

99

1010
def component(

src/idom/core/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from ._fixed_jsonpatch import apply_patch, make_patch # type: ignore
2626
from .layout import LayoutEvent, LayoutUpdate
27-
from .proto import LayoutType, VdomJson
27+
from .types import LayoutType, VdomJson
2828

2929

3030
logger = getLogger(__name__)

src/idom/core/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from anyio import create_task_group
77
from typing_extensions import Literal
88

9-
from idom.core.proto import EventHandlerFunc, EventHandlerType
9+
from idom.core.types import EventHandlerFunc, EventHandlerType
1010

1111

1212
@overload

src/idom/core/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from idom.utils import Ref
2828

2929
from ._thread_local import ThreadLocal
30-
from .proto import Key, VdomDict
30+
from .types import Key, VdomDict
3131
from .vdom import vdom
3232

3333

src/idom/core/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from ._event_proxy import _wrap_in_warning_event_proxies
3434
from .hooks import LifeCycleHook
35-
from .proto import ComponentType, EventHandlerDict, VdomDict, VdomJson
35+
from .types import ComponentType, EventHandlerDict, VdomDict, VdomJson
3636
from .vdom import validate_vdom_json
3737

3838

src/idom/core/proto.py renamed to src/idom/core/types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,15 @@ class EventHandlerType(Protocol):
180180
181181
When ``None``, it is left to a :class:`LayoutType` to auto generate a unique ID.
182182
"""
183+
184+
185+
class VdomDictConstructor(Protocol):
186+
"""Standard function for constructing a :class:`VdomDict`"""
187+
188+
def __call__(
189+
self,
190+
*attributes_and_children: VdomAttributesAndChildren,
191+
key: str = ...,
192+
event_handlers: Optional[EventHandlerMapping] = ...,
193+
) -> VdomDict:
194+
...

src/idom/core/vdom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
merge_event_handlers,
1414
to_event_handler_function,
1515
)
16-
from idom.core.proto import (
16+
from idom.core.types import (
1717
EventHandlerDict,
1818
EventHandlerMapping,
1919
EventHandlerType,
@@ -320,7 +320,7 @@ def _is_single_child(value: Any) -> bool:
320320
if _debug_is_single_child(value):
321321
return True
322322

323-
from .proto import ComponentType
323+
from .types import ComponentType
324324

325325
if hasattr(value, "__iter__") and not hasattr(value, "__len__"):
326326
logger.error(

src/idom/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160

161161
from typing import Any, Mapping
162162

163-
from .core.proto import Key, VdomDict
163+
from .core.types import Key, VdomDict
164164
from .core.vdom import coalesce_attributes_and_children, make_vdom_constructor
165165

166166

0 commit comments

Comments
 (0)