pulse-framework 0.1.74__py3-none-any.whl → 0.1.76__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.
@@ -0,0 +1,66 @@
1
+ """
2
+ JavaScript TextEncoder/TextDecoder builtins.
3
+
4
+ Usage:
5
+
6
+ ```python
7
+ from pulse.js import TextEncoder, TextDecoder
8
+
9
+ @ps.javascript
10
+ def example(text: str, data):
11
+ encoder = TextEncoder()
12
+ encoded = encoder.encode(text)
13
+ decoder = TextDecoder("utf-8")
14
+ return decoder.decode(encoded)
15
+ ```
16
+ """
17
+
18
+ from typing import Any as _Any
19
+ from typing import TypedDict as _TypedDict
20
+
21
+ from pulse.transpiler.js_module import JsModule
22
+
23
+
24
+ class TextDecoderOptions(_TypedDict, total=False):
25
+ fatal: bool
26
+ ignoreBOM: bool
27
+
28
+
29
+ class TextDecodeOptions(_TypedDict, total=False):
30
+ stream: bool
31
+
32
+
33
+ class TextEncoder:
34
+ """UTF-8 encoder."""
35
+
36
+ @property
37
+ def encoding(self) -> str: ...
38
+
39
+ def encode(self, string: str = "", /) -> _Any: ...
40
+
41
+ def encodeInto(self, string: str, destination: _Any, /) -> _Any: ...
42
+
43
+
44
+ class TextDecoder:
45
+ """Text decoder for byte streams."""
46
+
47
+ def __init__(
48
+ self, label: str | None = None, options: TextDecoderOptions | None = None, /
49
+ ) -> None: ...
50
+
51
+ @property
52
+ def encoding(self) -> str: ...
53
+
54
+ @property
55
+ def fatal(self) -> bool: ...
56
+
57
+ @property
58
+ def ignoreBOM(self) -> bool: ...
59
+
60
+ def decode(
61
+ self, input: _Any | None = None, options: TextDecodeOptions | None = None, /
62
+ ) -> str: ...
63
+
64
+
65
+ # Self-register this module as a JS builtin (global identifiers)
66
+ JsModule.register(name=None)
pulse/js/url.py ADDED
@@ -0,0 +1,114 @@
1
+ """
2
+ JavaScript URL and URLSearchParams builtins.
3
+
4
+ Usage:
5
+
6
+ ```python
7
+ from pulse.js import URL, URLSearchParams
8
+
9
+ @ps.javascript
10
+ def example():
11
+ url = URL("https://example.com?foo=1")
12
+ params = URLSearchParams(url.search)
13
+ params.append("bar", "2")
14
+ return url.toString(), params.toString()
15
+ ```
16
+ """
17
+
18
+ from collections.abc import Callable as _Callable
19
+ from collections.abc import Iterable as _Iterable
20
+ from typing import Any as _Any
21
+
22
+ from pulse.transpiler.js_module import JsModule
23
+
24
+
25
+ class URLSearchParams:
26
+ """Query string utility object."""
27
+
28
+ def __init__(
29
+ self,
30
+ init: str | _Iterable[tuple[str, str]] | dict[str, str] | None = None,
31
+ /,
32
+ ) -> None: ...
33
+
34
+ @property
35
+ def size(self) -> int: ...
36
+
37
+ def append(self, name: str, value: str, /) -> None: ...
38
+
39
+ def delete(self, name: str, value: str | None = None, /) -> None: ...
40
+
41
+ def entries(self) -> _Iterable[tuple[str, str]]: ...
42
+
43
+ def forEach(
44
+ self,
45
+ callback: _Callable[[str, str, "URLSearchParams"], None],
46
+ thisArg: _Any | None = None,
47
+ /,
48
+ ) -> None: ...
49
+
50
+ def get(self, name: str, /) -> str | None: ...
51
+
52
+ def getAll(self, name: str, /) -> list[str]: ...
53
+
54
+ def has(self, name: str, value: str | None = None, /) -> bool: ...
55
+
56
+ def keys(self) -> _Iterable[str]: ...
57
+
58
+ def set(self, name: str, value: str, /) -> None: ...
59
+
60
+ def sort(self) -> None: ...
61
+
62
+ def toString(self) -> str: ...
63
+
64
+ def values(self) -> _Iterable[str]: ...
65
+
66
+
67
+ class URL:
68
+ """URL parser and serializer."""
69
+
70
+ def __init__(self, url: str, base: str | None = None, /) -> None: ...
71
+
72
+ @property
73
+ def href(self) -> str: ...
74
+
75
+ @property
76
+ def origin(self) -> str: ...
77
+
78
+ @property
79
+ def protocol(self) -> str: ...
80
+
81
+ @property
82
+ def username(self) -> str: ...
83
+
84
+ @property
85
+ def password(self) -> str: ...
86
+
87
+ @property
88
+ def host(self) -> str: ...
89
+
90
+ @property
91
+ def hostname(self) -> str: ...
92
+
93
+ @property
94
+ def port(self) -> str: ...
95
+
96
+ @property
97
+ def pathname(self) -> str: ...
98
+
99
+ @property
100
+ def search(self) -> str: ...
101
+
102
+ @property
103
+ def hash(self) -> str: ...
104
+
105
+ @property
106
+ def searchParams(self) -> URLSearchParams: ...
107
+
108
+ def toString(self) -> str: ...
109
+
110
+ def toJSON(self) -> str: ...
111
+
112
+
113
+ # Self-register this module as a JS builtin (global identifiers)
114
+ JsModule.register(name=None)