pythonx-compose 0.1.0a1__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.
- pythonx/compose/__init__.py +4 -0
- pythonx/compose/__init__.pyi +1 -0
- pythonx/compose/_reexport.py +512 -0
- pythonx/compose/foundation/__init__.py +5 -0
- pythonx/compose/foundation/__init__.pyi +17 -0
- pythonx/compose/foundation/layout/__init__.py +5 -0
- pythonx/compose/foundation/layout/__init__.pyi +2 -0
- pythonx/compose/foundation/text/__init__.py +5 -0
- pythonx/compose/foundation/text/input/__init__.py +5 -0
- pythonx/compose/foundation/text/input/__init__.pyi +78 -0
- pythonx/compose/layout/__init__.py +25 -0
- pythonx/compose/layout/__init__.pyi +878 -0
- pythonx/compose/layout/arrangement.py +34 -0
- pythonx/compose/material/__init__.py +8 -0
- pythonx/compose/material/__init__.pyi +1 -0
- pythonx/compose/material/icons/__init__.py +9 -0
- pythonx/compose/material/icons/__init__.pyi +1159 -0
- pythonx/compose/material3/__init__.py +24 -0
- pythonx/compose/material3/__init__.pyi +3305 -0
- pythonx/compose/py.typed +0 -0
- pythonx/compose/pythonx-map.toml +73 -0
- pythonx/compose/runtime/__init__.py +128 -0
- pythonx/compose/runtime/__init__.pyi +180 -0
- pythonx/compose/ui/__init__.py +21 -0
- pythonx/compose/ui/__init__.pyi +975 -0
- pythonx/compose/ui/alignment.py +47 -0
- pythonx/compose/ui/graphics/__init__.py +5 -0
- pythonx/compose/ui/graphics/__init__.pyi +795 -0
- pythonx/compose/ui/graphics/vector/__init__.py +5 -0
- pythonx/compose/ui/graphics/vector/__init__.pyi +221 -0
- pythonx/compose/ui/modifier.py +110 -0
- pythonx/compose/ui/text/__init__.py +5 -0
- pythonx/compose/ui/text/__init__.pyi +703 -0
- pythonx/compose/ui/unit/__init__.py +19 -0
- pythonx/compose/ui/unit/__init__.pyi +348 -0
- pythonx_compose-0.1.0a1.dist-info/METADATA +228 -0
- pythonx_compose-0.1.0a1.dist-info/RECORD +40 -0
- pythonx_compose-0.1.0a1.dist-info/WHEEL +5 -0
- pythonx_compose-0.1.0a1.dist-info/licenses/LICENSE +21 -0
- pythonx_compose-0.1.0a1.dist-info/top_level.txt +1 -0
pythonx/compose/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Which Kotlin package each `pythonx.compose.*` module wraps, and which value classes may be
|
|
2
|
+
# written as their raw primitive.
|
|
3
|
+
#
|
|
4
|
+
# **This file is the reason the binder does not have to know Compose exists.**
|
|
5
|
+
# `python-multiplatform` used to carry `register_package('pythonx.compose', 'androidx.compose')` in
|
|
6
|
+
# its own `commonMain`, which made the language boundary know a UI library by name and put every
|
|
7
|
+
# other library one core edit away. It carries nothing now: an embedder installs this map, and the
|
|
8
|
+
# `.pyi` generator reads the same file, so the name an IDE completes and the name the interpreter
|
|
9
|
+
# resolves cannot drift apart.
|
|
10
|
+
#
|
|
11
|
+
# The mapping is not inferable from any artefact, which is why it is written down rather than
|
|
12
|
+
# derived: `pythonx.compose.layout` wraps `androidx.compose.foundation.layout` and drops
|
|
13
|
+
# `foundation.`, and nothing in the jar says so. `UI.ipynb` -- this project's user-facing
|
|
14
|
+
# specification -- is what settles the spelling; every module below is one it imports, or a package
|
|
15
|
+
# those imports resolve through.
|
|
16
|
+
|
|
17
|
+
[modules]
|
|
18
|
+
# The four `UI.ipynb` imports by name.
|
|
19
|
+
"pythonx.compose.layout" = "androidx.compose.foundation.layout"
|
|
20
|
+
"pythonx.compose.material3" = "androidx.compose.material3"
|
|
21
|
+
"pythonx.compose.runtime" = "androidx.compose.runtime"
|
|
22
|
+
"pythonx.compose.ui" = "androidx.compose.ui"
|
|
23
|
+
|
|
24
|
+
# `DefaultIcons` (INTENT section 5.7) is `Icons.Default`, which lives here: `Icons` is an object of
|
|
25
|
+
# `material-icons-core`, and `Icons.Default.Add` is an extension property read on `Icons.Filled`.
|
|
26
|
+
"pythonx.compose.material" = "androidx.compose.material"
|
|
27
|
+
"pythonx.compose.material.icons" = "androidx.compose.material.icons"
|
|
28
|
+
|
|
29
|
+
# Reached through the four above rather than imported directly: a `Modifier` chain returns into
|
|
30
|
+
# `ui.unit` and `ui.graphics`, and `ui.text` is where `TextStyle` lives.
|
|
31
|
+
"pythonx.compose.ui.unit" = "androidx.compose.ui.unit"
|
|
32
|
+
"pythonx.compose.ui.text" = "androidx.compose.ui.text"
|
|
33
|
+
"pythonx.compose.ui.graphics" = "androidx.compose.ui.graphics"
|
|
34
|
+
# `ImageVector`, what an icon is (`Icons.Default.Add`): without this row its stub types it `Any`.
|
|
35
|
+
"pythonx.compose.ui.graphics.vector" = "androidx.compose.ui.graphics.vector"
|
|
36
|
+
|
|
37
|
+
# `TextFieldState` and `rememberTextFieldState`, what `TextField(state=...)` takes (INTENT section
|
|
38
|
+
# 5.8). The state-based overload keeps the buffer and the IME composing region inside Compose, so
|
|
39
|
+
# nothing crosses into Python per keystroke; Python makes the state and reads or writes it on demand.
|
|
40
|
+
"pythonx.compose.foundation.text.input" = "androidx.compose.foundation.text.input"
|
|
41
|
+
|
|
42
|
+
# The long spelling, kept beside the short one because both are real: the generated stubs use
|
|
43
|
+
# `pythonx.compose.layout`, and the render fixtures in `python-multiplatform` were written against
|
|
44
|
+
# the fully-qualified form. Mapping both means neither is wrong while the spelling settles.
|
|
45
|
+
"pythonx.compose.foundation.layout" = "androidx.compose.foundation.layout"
|
|
46
|
+
"pythonx.compose.foundation" = "androidx.compose.foundation"
|
|
47
|
+
"pythonx.compose" = "androidx.compose"
|
|
48
|
+
|
|
49
|
+
[value-classes]
|
|
50
|
+
# A value class here may be written as the primitive it wraps: `padding(16)` for `padding(Dp(16f))`.
|
|
51
|
+
#
|
|
52
|
+
# `Dp`'s public constructor is the identity on its float, so the two spellings mean the same thing.
|
|
53
|
+
# `Color` and `TextUnit` are deliberately absent even though they look like numbers: both pack
|
|
54
|
+
# several fields into one `packedValue`, so a raw number decodes as something else entirely rather
|
|
55
|
+
# than as the value the caller meant. Adding one here is this package's decision to make, which is
|
|
56
|
+
# the point of the section being in this file rather than in the binder.
|
|
57
|
+
raw-primitive-allowed = [
|
|
58
|
+
"androidx.compose.ui.unit.Dp",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[aliases."pythonx.compose.material3"]
|
|
62
|
+
# Names a module also answers for, because the notebook imports them from there (INTENT section 5.2):
|
|
63
|
+
# `from pythonx.compose.material3 import Column, Row, Spacer`, while Kotlin declares them in
|
|
64
|
+
# `androidx.compose.foundation.layout`. Each is the same object as in its home module; this is data,
|
|
65
|
+
# not a wrapper, and the rule that serves it is the one in `_reexport.py`.
|
|
66
|
+
"pythonx.compose.layout" = ["Column", "Row", "Spacer"]
|
|
67
|
+
#
|
|
68
|
+
# An entry is a list of names lent under the SAME name, or a table `{ lent name = "Path.To.Attr" }`
|
|
69
|
+
# that lends an attribute path of the source under a DIFFERENT name: the notebook's `DefaultIcons`
|
|
70
|
+
# is Kotlin's `Icons.Default` (INTENT section 5.7). The first segment is a name of the source module,
|
|
71
|
+
# each further one an attribute read. A path with a dot is read afresh on every access and never kept,
|
|
72
|
+
# the way the binder serves `Icons.Default` (a live property); a plain name is resolved once.
|
|
73
|
+
"pythonx.compose.material.icons" = { DefaultIcons = "Icons.Default" }
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""`pythonx/compose/runtime/__init__.py` -- the 2024 `Composable` class, gone, and what is left.
|
|
2
|
+
|
|
3
|
+
## What used to be here, and why it never ran
|
|
4
|
+
|
|
5
|
+
A decorator class (`Composable`) holding one `__composer`, plus `ComposeApp`, `KotlinComposable`,
|
|
6
|
+
`KotlinWidget` and a `CoroutineScope` family, all built on `jclass` --
|
|
7
|
+
`_runtime = jclass("io.github.thisisthepy.pycomposeui.RuntimeKt")` -- chaquopy's name-based
|
|
8
|
+
Java/Kotlin class lookup. `jclass` was never imported in this module, in any commit where the module
|
|
9
|
+
had content (`git log -p` on this file shows no `import jclass` anywhere), so every one of those five
|
|
10
|
+
module-level statements raised `NameError` before a single class body executed:
|
|
11
|
+
|
|
12
|
+
>>> from pythonx.compose.runtime import Composable
|
|
13
|
+
NameError: name 'jclass' is not defined
|
|
14
|
+
|
|
15
|
+
That is not incidental breakage, it is a different technology than this repository now targets.
|
|
16
|
+
`jclass` is chaquopy's global; `PythonMultiplatform`'s binder is a different bridge
|
|
17
|
+
(`docs/pythonx-adapter-design.md` §5.1, in `PythonMultiplatform`, reads the same class as "the 2024
|
|
18
|
+
`Composable` class", and `agent-rules.md` §12 retires name-based JVM lookup by name). The other half
|
|
19
|
+
of what `Composable.__call__` did -- inspecting `self.compose.__code__.co_varnames` to find where
|
|
20
|
+
`content` sat, so it could be popped out and wrapped specially -- is retired for the same reason
|
|
21
|
+
`modifier.py`'s mangled-suffix search was: `docs/pythonx-adapter-design.md` §5.6/§7 record that
|
|
22
|
+
composer threading, `$changed` and `$default` are now arithmetic the binder's `_bind_composable` (`python_multiplatform.binding`) does from
|
|
23
|
+
a slot's *declared type*, uniformly, for a `content` lambda exactly as for any other parameter. There
|
|
24
|
+
is nothing left for a Python-side base class to detect or thread by hand.
|
|
25
|
+
|
|
26
|
+
## What is left
|
|
27
|
+
|
|
28
|
+
One identity decorator, `Composable`, kept because `UI.ipynb` writes `@Composable` on every
|
|
29
|
+
screen-defining function and that surface is one an application author should keep being able to
|
|
30
|
+
write. Nothing needs to happen to the decorated function for it to work: the composer any nested
|
|
31
|
+
`pythonx.compose.*` call needs comes from the one hand-written Kotlin `@Composable`
|
|
32
|
+
(`PythonComposition`, in `PythonMultiplatform`) pushing it once per composition pass, and from the
|
|
33
|
+
*callee's* slot type deciding whether and how to thread it -- never from anything the caller does.
|
|
34
|
+
A plain `def Screen(): Button(...)` already works with no wrapper, no base class and no `content=`
|
|
35
|
+
slot detection; `@Composable` changes nothing about that and exists only so the notebook's own
|
|
36
|
+
spelling keeps working.
|
|
37
|
+
|
|
38
|
+
## The app root and `state`
|
|
39
|
+
|
|
40
|
+
`@app` declares the screen the host draws; `state(initial)` makes a value Compose observes. The host
|
|
41
|
+
is configured once with `PythonContent("pythonx.compose.runtime", "app_root")`: it reads the module
|
|
42
|
+
attribute `app_root`, a Compose `MutableState` whose `.value` is a zero-argument callable or `None`
|
|
43
|
+
(nothing is drawn). `app(fn)` writes `app_root.value = fn` and returns `fn` unchanged, so declaring
|
|
44
|
+
the root again -- in a notebook cell, say -- replaces the screen. There is deliberately no update or
|
|
45
|
+
refresh function (`docs/INTENT.md` section 5.1).
|
|
46
|
+
|
|
47
|
+
Both states come from `_new_state`, the one place that asks the binder for
|
|
48
|
+
`androidx.compose.runtime.mutableStateOf`. `app_root` is created on first read, because the binder may
|
|
49
|
+
be installed after `pythonx` is imported. A Python object with a `.value` would not make Compose
|
|
50
|
+
recompose, so when the binder cannot supply `mutableStateOf` (python-multiplatform #38) `_new_state`
|
|
51
|
+
raises instead of falling back to one.
|
|
52
|
+
|
|
53
|
+
## How it is reached
|
|
54
|
+
|
|
55
|
+
By its own dotted name: `import pythonx.compose.runtime` loads this file. The binder used to put a
|
|
56
|
+
synthetic `pythonx` with `__path__ = []` into `sys.modules`, which made every file under
|
|
57
|
+
`pythonx/compose/` unreachable; PythonMultiplatform `d00f413f` moved its layer to
|
|
58
|
+
`python_multiplatform.binding` and leaves `pythonx` to this package (AGENTS.md section 12).
|
|
59
|
+
`tests/test_runtime_module.py::TheModuleIsTheFileOnDisk` checks that against the binder's real source.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
from __future__ import annotations
|
|
63
|
+
|
|
64
|
+
import sys
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def Composable(target):
|
|
68
|
+
"""Identity. `UI.ipynb` writes `@Composable def Screen(): ...`; nothing needs to happen to
|
|
69
|
+
`Screen` for that to work, because the composer every nested `pythonx.compose.*` call needs is
|
|
70
|
+
threaded by `PythonComposition`/`python_multiplatform.binding._bind_composable` from the *callee's* declared slot
|
|
71
|
+
type, not from anything the caller -- decorated or not -- does. See the module docstring for
|
|
72
|
+
what used to be here and why it is gone.
|
|
73
|
+
"""
|
|
74
|
+
return target
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
app_root: State
|
|
79
|
+
"""The state the host reads (`PythonContent("pythonx.compose.runtime", "app_root")`); annotated
|
|
80
|
+
only, created on first read by `__getattr__` below."""
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _new_state(initial):
|
|
84
|
+
"""A Compose `MutableState` holding `initial`, from the binder's `mutableStateOf`.
|
|
85
|
+
|
|
86
|
+
Never a Python stand-in: only a state Compose created is observed by composition.
|
|
87
|
+
"""
|
|
88
|
+
try:
|
|
89
|
+
import androidx.compose.runtime as kotlin_runtime
|
|
90
|
+
|
|
91
|
+
make = kotlin_runtime.mutableStateOf
|
|
92
|
+
except (ImportError, AttributeError) as missing:
|
|
93
|
+
raise RuntimeError(
|
|
94
|
+
"androidx.compose.runtime.mutableStateOf is not available from the binder: "
|
|
95
|
+
"calling it from Python needs python-multiplatform #38"
|
|
96
|
+
) from missing
|
|
97
|
+
return make(initial)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def state(initial):
|
|
101
|
+
"""A Compose state holding `initial`; read and write it through `.value`."""
|
|
102
|
+
return _new_state(initial)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def app(root):
|
|
106
|
+
"""Declare `root`, a zero-argument function, as the screen the host draws; returns it unchanged.
|
|
107
|
+
|
|
108
|
+
Declaring again replaces the screen; there is no update call.
|
|
109
|
+
"""
|
|
110
|
+
sys.modules[__name__].app_root.value = root
|
|
111
|
+
return root
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
from pythonx.compose._reexport import reexport
|
|
115
|
+
|
|
116
|
+
_reexported_getattr, _reexported_dir = reexport(__name__)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def __getattr__(name):
|
|
120
|
+
if name == "app_root":
|
|
121
|
+
created = _new_state(None)
|
|
122
|
+
globals()["app_root"] = created
|
|
123
|
+
return created
|
|
124
|
+
return _reexported_getattr(name)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def __dir__():
|
|
128
|
+
return sorted(set(_reexported_dir()) | {"app_root"})
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# GENERATED by scripts/gen_stubs.py from python-multiplatform's Kotlin-named stubs (artifact kotlin-stubs, workflow run 37103737430, commit a5028618, Compose 1.11.1). Do not edit.
|
|
2
|
+
import typing as _t
|
|
3
|
+
import pythonx.compose.ui
|
|
4
|
+
|
|
5
|
+
class _Composer_materialize(_t.Protocol):
|
|
6
|
+
def __call__(self, modifier: pythonx.compose.ui.Modifier) -> pythonx.compose.ui.Modifier: ...
|
|
7
|
+
|
|
8
|
+
class _CompositionLocalAccessorScope_mediaQuery(_t.Protocol):
|
|
9
|
+
def __call__(self, query: _t.Callable[[pythonx.compose.ui.UiMediaScope], bool]) -> bool: ...
|
|
10
|
+
|
|
11
|
+
class _CompositionLocalAccessorScope_mediaQuery__CompositionLocalAccessorScope_Boolean(_t.Protocol):
|
|
12
|
+
def __call__(self, query: _t.Callable[[pythonx.compose.ui.UiMediaScope], bool]) -> bool: ...
|
|
13
|
+
|
|
14
|
+
class _MutableState_setValue(_t.Protocol):
|
|
15
|
+
def __call__(self, this_obj: _t.Any | None, property: _t.Any, value: _t.Any | None) -> None: ...
|
|
16
|
+
|
|
17
|
+
class _State_getValue(_t.Protocol):
|
|
18
|
+
def __call__(self, this_obj: _t.Any | None, property: _t.Any) -> _t.Any | None: ...
|
|
19
|
+
|
|
20
|
+
class AbstractApplier:
|
|
21
|
+
"""Kotlin: androidx.compose.runtime.AbstractApplier"""
|
|
22
|
+
|
|
23
|
+
class Applier:
|
|
24
|
+
"""Kotlin: androidx.compose.runtime.Applier"""
|
|
25
|
+
|
|
26
|
+
class Composer:
|
|
27
|
+
"""Kotlin: androidx.compose.runtime.Composer"""
|
|
28
|
+
materialize: _t.ClassVar[_Composer_materialize]
|
|
29
|
+
|
|
30
|
+
class CompositionLocal:
|
|
31
|
+
"""Kotlin: androidx.compose.runtime.CompositionLocal"""
|
|
32
|
+
|
|
33
|
+
class CompositionLocalAccessorScope:
|
|
34
|
+
"""Kotlin: androidx.compose.runtime.CompositionLocalAccessorScope"""
|
|
35
|
+
media_query: _t.ClassVar[_CompositionLocalAccessorScope_mediaQuery]
|
|
36
|
+
media_query__CompositionLocalAccessorScope_Boolean: _t.ClassVar[_CompositionLocalAccessorScope_mediaQuery__CompositionLocalAccessorScope_Boolean]
|
|
37
|
+
|
|
38
|
+
class CompositionLocalContext:
|
|
39
|
+
"""Kotlin: androidx.compose.runtime.CompositionLocalContext"""
|
|
40
|
+
|
|
41
|
+
class MutableState(State):
|
|
42
|
+
"""Kotlin: androidx.compose.runtime.MutableState"""
|
|
43
|
+
set_value: _t.ClassVar[_MutableState_setValue]
|
|
44
|
+
@property
|
|
45
|
+
def value(self) -> _t.Any | None:
|
|
46
|
+
"""Kotlin property: androidx.compose.runtime.MutableState.value (androidx.compose.runtime.MutableState.value: kotlin.Any?)"""
|
|
47
|
+
...
|
|
48
|
+
@value.setter
|
|
49
|
+
def value(self, value: _t.Any | None) -> None:
|
|
50
|
+
"""Kotlin property: androidx.compose.runtime.MutableState.value="""
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
class ProduceStateScope:
|
|
54
|
+
"""Kotlin: androidx.compose.runtime.ProduceStateScope"""
|
|
55
|
+
|
|
56
|
+
class SnapshotFlowManager:
|
|
57
|
+
"""Kotlin: androidx.compose.runtime.SnapshotFlowManager"""
|
|
58
|
+
|
|
59
|
+
class SnapshotMutationPolicy:
|
|
60
|
+
"""Kotlin: androidx.compose.runtime.SnapshotMutationPolicy"""
|
|
61
|
+
|
|
62
|
+
class State:
|
|
63
|
+
"""Kotlin: androidx.compose.runtime.State"""
|
|
64
|
+
get_value: _t.ClassVar[_State_getValue]
|
|
65
|
+
@property
|
|
66
|
+
def value(self) -> _t.Any | None:
|
|
67
|
+
"""Kotlin property: androidx.compose.runtime.State.value (androidx.compose.runtime.State.value: kotlin.Any?)"""
|
|
68
|
+
...
|
|
69
|
+
|
|
70
|
+
def collect_as_state(receiver: _t.Any, /, context: _t.Any = ...) -> State:
|
|
71
|
+
"""Kotlin: kotlinx.coroutines.flow.StateFlow.collectAsState(context: kotlin.coroutines.CoroutineContext): androidx.compose.runtime.State"""
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
def derived_state_of__Any(calculation: _t.Callable[[], _t.Any | None]) -> State:
|
|
75
|
+
"""Kotlin: androidx.compose.runtime.derivedStateOf(calculation: kotlin.Function0): androidx.compose.runtime.State"""
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
def derived_state_of__SnapshotMutationPolicy_Any(policy: SnapshotMutationPolicy, calculation: _t.Callable[[], _t.Any | None]) -> State:
|
|
79
|
+
"""Kotlin: androidx.compose.runtime.derivedStateOf(policy: androidx.compose.runtime.SnapshotMutationPolicy, calculation: kotlin.Function0): androidx.compose.runtime.State"""
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
def get_value(receiver: State, /, this_obj: _t.Any | None, property: _t.Any) -> _t.Any | None:
|
|
83
|
+
"""Kotlin: androidx.compose.runtime.State.getValue(thisObj: kotlin.Any?, property: kotlin.reflect.KProperty): kotlin.Any"""
|
|
84
|
+
...
|
|
85
|
+
|
|
86
|
+
def mutable_state_list_of() -> _t.Any:
|
|
87
|
+
"""Kotlin: androidx.compose.runtime.mutableStateListOf(): androidx.compose.runtime.snapshots.SnapshotStateList"""
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
def mutable_state_map_of() -> _t.Any:
|
|
91
|
+
"""Kotlin: androidx.compose.runtime.mutableStateMapOf(): androidx.compose.runtime.snapshots.SnapshotStateMap"""
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
def mutable_state_of(value: _t.Any | None, policy: SnapshotMutationPolicy = ...) -> MutableState:
|
|
95
|
+
"""Kotlin: androidx.compose.runtime.mutableStateOf(value: kotlin.Any?, policy: androidx.compose.runtime.SnapshotMutationPolicy): androidx.compose.runtime.MutableState"""
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
def mutable_state_set_of() -> _t.Any:
|
|
99
|
+
"""Kotlin: androidx.compose.runtime.mutableStateSetOf(): androidx.compose.runtime.snapshots.SnapshotStateSet"""
|
|
100
|
+
...
|
|
101
|
+
|
|
102
|
+
def never_equal_policy() -> SnapshotMutationPolicy:
|
|
103
|
+
"""Kotlin: androidx.compose.runtime.neverEqualPolicy(): androidx.compose.runtime.SnapshotMutationPolicy"""
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
def produce_state__Any_Any(initial_value: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State:
|
|
107
|
+
"""Kotlin: androidx.compose.runtime.produceState(initialValue: kotlin.Any?, producer: kotlin.Function2): androidx.compose.runtime.State"""
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
def produce_state__Any_Any_Any(initial_value: _t.Any | None, key1: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State:
|
|
111
|
+
"""Kotlin: androidx.compose.runtime.produceState(initialValue: kotlin.Any?, key1: kotlin.Any?, producer: kotlin.Function2): androidx.compose.runtime.State"""
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
def produce_state__Any_Any_Any_Any(initial_value: _t.Any | None, key1: _t.Any | None, key2: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State:
|
|
115
|
+
"""Kotlin: androidx.compose.runtime.produceState(initialValue: kotlin.Any?, key1: kotlin.Any?, key2: kotlin.Any?, producer: kotlin.Function2): androidx.compose.runtime.State"""
|
|
116
|
+
...
|
|
117
|
+
|
|
118
|
+
def produce_state__Any_Any_Any_Any_Any(initial_value: _t.Any | None, key1: _t.Any | None, key2: _t.Any | None, key3: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State:
|
|
119
|
+
"""Kotlin: androidx.compose.runtime.produceState(initialValue: kotlin.Any?, key1: kotlin.Any?, key2: kotlin.Any?, key3: kotlin.Any?, producer: kotlin.Function2): androidx.compose.runtime.State"""
|
|
120
|
+
...
|
|
121
|
+
|
|
122
|
+
def produce_state__Any_Array_Any(initial_value: _t.Any | None, keys: _t.Any, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State:
|
|
123
|
+
"""Kotlin: androidx.compose.runtime.produceState(initialValue: kotlin.Any?, keys: kotlin.Array, producer: kotlin.Function2): androidx.compose.runtime.State"""
|
|
124
|
+
...
|
|
125
|
+
|
|
126
|
+
def referential_equality_policy() -> SnapshotMutationPolicy:
|
|
127
|
+
"""Kotlin: androidx.compose.runtime.referentialEqualityPolicy(): androidx.compose.runtime.SnapshotMutationPolicy"""
|
|
128
|
+
...
|
|
129
|
+
|
|
130
|
+
def remember_updated_state(new_value: _t.Any | None) -> State:
|
|
131
|
+
"""Kotlin: androidx.compose.runtime.rememberUpdatedState(newValue: kotlin.Any?): androidx.compose.runtime.State"""
|
|
132
|
+
...
|
|
133
|
+
|
|
134
|
+
def set_value(receiver: MutableState, /, this_obj: _t.Any | None, property: _t.Any, value: _t.Any | None) -> None:
|
|
135
|
+
"""Kotlin: androidx.compose.runtime.MutableState.setValue(thisObj: kotlin.Any?, property: kotlin.reflect.KProperty, value: kotlin.Any?): kotlin.Unit"""
|
|
136
|
+
...
|
|
137
|
+
|
|
138
|
+
def snapshot_flow__Any(block: _t.Callable[[], _t.Any | None]) -> _t.Any:
|
|
139
|
+
"""Kotlin: androidx.compose.runtime.snapshotFlow(block: kotlin.Function0): kotlinx.coroutines.flow.Flow"""
|
|
140
|
+
...
|
|
141
|
+
|
|
142
|
+
def snapshot_flow__SnapshotFlowManager_Any(manager: SnapshotFlowManager, block: _t.Callable[[], _t.Any | None]) -> _t.Any:
|
|
143
|
+
"""Kotlin: androidx.compose.runtime.snapshotFlow(manager: androidx.compose.runtime.SnapshotFlowManager, block: kotlin.Function0): kotlinx.coroutines.flow.Flow"""
|
|
144
|
+
...
|
|
145
|
+
|
|
146
|
+
def structural_equality_policy() -> SnapshotMutationPolicy:
|
|
147
|
+
"""Kotlin: androidx.compose.runtime.structuralEqualityPolicy(): androidx.compose.runtime.SnapshotMutationPolicy"""
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
@_t.overload
|
|
151
|
+
def derived_state_of(calculation: _t.Callable[[], _t.Any | None]) -> State: ...
|
|
152
|
+
@_t.overload
|
|
153
|
+
def derived_state_of(policy: SnapshotMutationPolicy, calculation: _t.Callable[[], _t.Any | None]) -> State: ... # type: ignore[overload-cannot-match]
|
|
154
|
+
|
|
155
|
+
@_t.overload
|
|
156
|
+
def produce_state(initial_value: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State: ...
|
|
157
|
+
@_t.overload
|
|
158
|
+
def produce_state(initial_value: _t.Any | None, key1: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State: ... # type: ignore[overload-cannot-match]
|
|
159
|
+
@_t.overload
|
|
160
|
+
def produce_state(initial_value: _t.Any | None, key1: _t.Any | None, key2: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State: ... # type: ignore[overload-cannot-match]
|
|
161
|
+
@_t.overload
|
|
162
|
+
def produce_state(initial_value: _t.Any | None, key1: _t.Any | None, key2: _t.Any | None, key3: _t.Any | None, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State: ... # type: ignore[overload-cannot-match]
|
|
163
|
+
@_t.overload
|
|
164
|
+
def produce_state(initial_value: _t.Any | None, keys: _t.Any, producer: _t.Callable[[ProduceStateScope, _t.Any], _t.Any | None]) -> State: ... # type: ignore[overload-cannot-match]
|
|
165
|
+
|
|
166
|
+
@_t.overload
|
|
167
|
+
def snapshot_flow(block: _t.Callable[[], _t.Any | None]) -> _t.Any: ...
|
|
168
|
+
@_t.overload
|
|
169
|
+
def snapshot_flow(manager: SnapshotFlowManager, block: _t.Callable[[], _t.Any | None]) -> _t.Any: ... # type: ignore[overload-cannot-match]
|
|
170
|
+
|
|
171
|
+
def Composable(target):
|
|
172
|
+
...
|
|
173
|
+
|
|
174
|
+
app_root: State
|
|
175
|
+
|
|
176
|
+
def state(initial):
|
|
177
|
+
...
|
|
178
|
+
|
|
179
|
+
def app(root):
|
|
180
|
+
...
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""`pythonx/compose/ui/__init__.py` -- the 2024 `from .modifier import Modifier` wrapper, unexecuted, and why.
|
|
2
|
+
|
|
3
|
+
## What used to be here, and why it never ran
|
|
4
|
+
|
|
5
|
+
A `try...except` block executing `from .modifier import Modifier`, `modifier = Modifier()`, and
|
|
6
|
+
`from .alignment import Alignment, AbsoluteAlignment`. `alignment.py` depended on `from java import jclass`
|
|
7
|
+
(Chaquopy-era JVM class lookup, retired in this codebase).
|
|
8
|
+
|
|
9
|
+
## How `pythonx.compose.ui` resolves
|
|
10
|
+
|
|
11
|
+
`import pythonx.compose.ui` loads this file; it is an ordinary package on disk. The binder serves the
|
|
12
|
+
Kotlin package under its Kotlin name, `androidx.compose.ui`, as a separate module, and renames
|
|
13
|
+
nothing. This file re-exports it under Pythonic names (`Modifier`, `describe_modifier`, ...) by the
|
|
14
|
+
one rule in `pythonx/compose/_reexport.py` (SPEC section 3); it names no declaration itself.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from pythonx.compose._reexport import reexport
|
|
20
|
+
|
|
21
|
+
__getattr__, __dir__ = reexport(__name__)
|