pythonnative 0.23.0__py3-none-any.whl → 0.24.0__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.
- pythonnative/__init__.py +29 -50
- pythonnative/animated.py +1 -1
- pythonnative/cli/pn.py +3 -3
- pythonnative/components.py +250 -513
- pythonnative/diagnostics.py +214 -0
- pythonnative/element.py +5 -2
- pythonnative/events.py +13 -8
- pythonnative/hooks.py +413 -49
- pythonnative/hot_reload.py +9 -1
- pythonnative/native_views/android.py +78 -1
- pythonnative/native_views/desktop.py +38 -1
- pythonnative/native_views/ios.py +241 -7
- pythonnative/navigation.py +41 -17
- pythonnative/preview.py +43 -7
- pythonnative/reconciler.py +863 -441
- pythonnative/screen.py +324 -27
- pythonnative/storage.py +3 -3
- pythonnative/style.py +83 -0
- pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/ScreenFragment.kt +22 -0
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/METADATA +5 -4
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/RECORD +25 -24
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/WHEEL +0 -0
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/entry_points.txt +0 -0
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/licenses/LICENSE +0 -0
- {pythonnative-0.23.0.dist-info → pythonnative-0.24.0.dist-info}/top_level.txt +0 -0
pythonnative/__init__.py
CHANGED
|
@@ -54,88 +54,72 @@ Example:
|
|
|
54
54
|
count, set_count = pn.use_state(0)
|
|
55
55
|
return pn.Column(
|
|
56
56
|
pn.Text(f"Count: {count}", style=pn.style(font_size=24)),
|
|
57
|
-
pn.Button("+",
|
|
57
|
+
pn.Button("+", on_press=lambda: set_count(count + 1)),
|
|
58
58
|
style=pn.style(spacing=12),
|
|
59
59
|
)
|
|
60
60
|
```
|
|
61
61
|
"""
|
|
62
62
|
|
|
63
|
-
__version__ = "0.
|
|
63
|
+
__version__ = "0.24.0"
|
|
64
64
|
|
|
65
|
-
from . import appearance, gestures, images, runtime, sdk
|
|
65
|
+
from . import appearance, diagnostics, gestures, images, runtime, sdk
|
|
66
66
|
from .alerts import Alert
|
|
67
67
|
from .animated import Animated, AnimatedValue, use_animated_value
|
|
68
68
|
from .components import (
|
|
69
69
|
ActivityIndicator,
|
|
70
|
-
ActivityIndicatorProps,
|
|
71
70
|
Button,
|
|
72
|
-
ButtonProps,
|
|
73
71
|
Checkbox,
|
|
74
|
-
CheckboxProps,
|
|
75
72
|
Column,
|
|
76
73
|
DatePicker,
|
|
77
|
-
DatePickerProps,
|
|
78
74
|
ErrorBoundary,
|
|
79
75
|
FlatList,
|
|
80
76
|
Fragment,
|
|
81
77
|
Image,
|
|
82
78
|
ImageBackground,
|
|
83
|
-
ImageBackgroundProps,
|
|
84
|
-
ImageProps,
|
|
85
79
|
KeyboardAvoidingView,
|
|
86
|
-
|
|
80
|
+
ListController,
|
|
87
81
|
Modal,
|
|
88
|
-
ModalProps,
|
|
89
82
|
Picker,
|
|
90
|
-
|
|
83
|
+
Portal,
|
|
91
84
|
Pressable,
|
|
92
|
-
PressableProps,
|
|
93
85
|
ProgressBar,
|
|
94
|
-
ProgressBarProps,
|
|
95
86
|
RefreshControl,
|
|
96
87
|
Row,
|
|
97
88
|
SafeAreaView,
|
|
98
|
-
SafeAreaViewProps,
|
|
99
89
|
ScrollView,
|
|
100
|
-
ScrollViewProps,
|
|
101
90
|
SectionList,
|
|
102
91
|
SegmentedControl,
|
|
103
|
-
SegmentedControlProps,
|
|
104
92
|
Slider,
|
|
105
|
-
SliderProps,
|
|
106
93
|
Spacer,
|
|
107
|
-
SpacerProps,
|
|
108
94
|
StatusBar,
|
|
109
|
-
StatusBarProps,
|
|
110
95
|
Switch,
|
|
111
|
-
SwitchProps,
|
|
112
96
|
Text,
|
|
113
97
|
TextInput,
|
|
114
|
-
TextInputProps,
|
|
115
|
-
TextProps,
|
|
116
98
|
TouchableOpacity,
|
|
117
|
-
TouchableOpacityProps,
|
|
118
99
|
View,
|
|
119
|
-
ViewProps,
|
|
120
100
|
WebView,
|
|
121
|
-
WebViewProps,
|
|
122
101
|
)
|
|
102
|
+
from .diagnostics import HookOrderError
|
|
123
103
|
from .element import Element
|
|
124
104
|
from .hooks import (
|
|
125
105
|
MutationCall,
|
|
126
106
|
MutationState,
|
|
127
107
|
Provider,
|
|
128
108
|
QueryResult,
|
|
109
|
+
Ref,
|
|
129
110
|
batch_updates,
|
|
130
111
|
component,
|
|
131
112
|
create_context,
|
|
132
113
|
memo,
|
|
133
114
|
use_async_effect,
|
|
115
|
+
use_back_handler,
|
|
134
116
|
use_callback,
|
|
135
117
|
use_color_scheme,
|
|
136
118
|
use_context,
|
|
137
119
|
use_effect,
|
|
120
|
+
use_imperative_handle,
|
|
138
121
|
use_keyboard_height,
|
|
122
|
+
use_layout_effect,
|
|
139
123
|
use_memo,
|
|
140
124
|
use_mutation,
|
|
141
125
|
use_navigation,
|
|
@@ -167,6 +151,7 @@ from .native_modules import (
|
|
|
167
151
|
)
|
|
168
152
|
from .navigation import (
|
|
169
153
|
NavigationContainer,
|
|
154
|
+
ScreenOptions,
|
|
170
155
|
create_drawer_navigator,
|
|
171
156
|
create_stack_navigator,
|
|
172
157
|
create_tab_navigator,
|
|
@@ -188,6 +173,8 @@ from .storage import AsyncStorage, use_persisted_state
|
|
|
188
173
|
from .style import (
|
|
189
174
|
DEFAULT_DARK_THEME,
|
|
190
175
|
DEFAULT_LIGHT_THEME,
|
|
176
|
+
AccessibilityState,
|
|
177
|
+
AlignContent,
|
|
191
178
|
AlignItems,
|
|
192
179
|
AlignSelf,
|
|
193
180
|
AutoCapitalize,
|
|
@@ -195,9 +182,11 @@ from .style import (
|
|
|
195
182
|
Dimension,
|
|
196
183
|
EdgeInsets,
|
|
197
184
|
FlexDirection,
|
|
185
|
+
FlexWrap,
|
|
198
186
|
FontWeight,
|
|
199
187
|
JustifyContent,
|
|
200
188
|
KeyboardType,
|
|
189
|
+
LayoutDirection,
|
|
201
190
|
Overflow,
|
|
202
191
|
Position,
|
|
203
192
|
ReturnKeyType,
|
|
@@ -229,8 +218,10 @@ __all__ = [
|
|
|
229
218
|
"Image",
|
|
230
219
|
"ImageBackground",
|
|
231
220
|
"KeyboardAvoidingView",
|
|
221
|
+
"ListController",
|
|
232
222
|
"Modal",
|
|
233
223
|
"Picker",
|
|
224
|
+
"Portal",
|
|
234
225
|
"Pressable",
|
|
235
226
|
"ProgressBar",
|
|
236
227
|
"RefreshControl",
|
|
@@ -248,30 +239,6 @@ __all__ = [
|
|
|
248
239
|
"TouchableOpacity",
|
|
249
240
|
"View",
|
|
250
241
|
"WebView",
|
|
251
|
-
# Built-in Props dataclasses
|
|
252
|
-
"ActivityIndicatorProps",
|
|
253
|
-
"ButtonProps",
|
|
254
|
-
"CheckboxProps",
|
|
255
|
-
"DatePickerProps",
|
|
256
|
-
"ImageBackgroundProps",
|
|
257
|
-
"ImageProps",
|
|
258
|
-
"KeyboardAvoidingViewProps",
|
|
259
|
-
"ModalProps",
|
|
260
|
-
"PickerProps",
|
|
261
|
-
"PressableProps",
|
|
262
|
-
"ProgressBarProps",
|
|
263
|
-
"SafeAreaViewProps",
|
|
264
|
-
"ScrollViewProps",
|
|
265
|
-
"SegmentedControlProps",
|
|
266
|
-
"SliderProps",
|
|
267
|
-
"SpacerProps",
|
|
268
|
-
"StatusBarProps",
|
|
269
|
-
"SwitchProps",
|
|
270
|
-
"TextInputProps",
|
|
271
|
-
"TextProps",
|
|
272
|
-
"TouchableOpacityProps",
|
|
273
|
-
"ViewProps",
|
|
274
|
-
"WebViewProps",
|
|
275
242
|
# Core
|
|
276
243
|
"Element",
|
|
277
244
|
"create_screen",
|
|
@@ -283,13 +250,17 @@ __all__ = [
|
|
|
283
250
|
"MutationCall",
|
|
284
251
|
"MutationState",
|
|
285
252
|
"QueryResult",
|
|
253
|
+
"Ref",
|
|
286
254
|
"use_async_effect",
|
|
255
|
+
"use_back_handler",
|
|
287
256
|
"use_callback",
|
|
288
257
|
"use_color_scheme",
|
|
289
258
|
"use_context",
|
|
290
259
|
"use_effect",
|
|
291
260
|
"use_focus_effect",
|
|
261
|
+
"use_imperative_handle",
|
|
292
262
|
"use_keyboard_height",
|
|
263
|
+
"use_layout_effect",
|
|
293
264
|
"use_memo",
|
|
294
265
|
"use_mutation",
|
|
295
266
|
"use_navigation",
|
|
@@ -304,10 +275,13 @@ __all__ = [
|
|
|
304
275
|
"Provider",
|
|
305
276
|
# Navigation
|
|
306
277
|
"NavigationContainer",
|
|
278
|
+
"ScreenOptions",
|
|
307
279
|
"create_drawer_navigator",
|
|
308
280
|
"create_stack_navigator",
|
|
309
281
|
"create_tab_navigator",
|
|
310
282
|
# Styling - typed primitives
|
|
283
|
+
"AccessibilityState",
|
|
284
|
+
"AlignContent",
|
|
311
285
|
"AlignItems",
|
|
312
286
|
"AlignSelf",
|
|
313
287
|
"AutoCapitalize",
|
|
@@ -317,9 +291,11 @@ __all__ = [
|
|
|
317
291
|
"Dimension",
|
|
318
292
|
"EdgeInsets",
|
|
319
293
|
"FlexDirection",
|
|
294
|
+
"FlexWrap",
|
|
320
295
|
"FontWeight",
|
|
321
296
|
"JustifyContent",
|
|
322
297
|
"KeyboardType",
|
|
298
|
+
"LayoutDirection",
|
|
323
299
|
"Overflow",
|
|
324
300
|
"Position",
|
|
325
301
|
"ReturnKeyType",
|
|
@@ -374,6 +350,9 @@ __all__ = [
|
|
|
374
350
|
# Runtime
|
|
375
351
|
"run_async",
|
|
376
352
|
"runtime",
|
|
353
|
+
# Diagnostics
|
|
354
|
+
"HookOrderError",
|
|
355
|
+
"diagnostics",
|
|
377
356
|
# Platform
|
|
378
357
|
"Platform",
|
|
379
358
|
# Custom-component SDK
|
pythonnative/animated.py
CHANGED
|
@@ -834,7 +834,7 @@ def _make_animated_factory(
|
|
|
834
834
|
ref = use_ref(None)
|
|
835
835
|
|
|
836
836
|
def _attach_bindings() -> Callable[[], None]:
|
|
837
|
-
tag = ref.
|
|
837
|
+
tag = ref._pn_tag
|
|
838
838
|
if tag is None:
|
|
839
839
|
return lambda: None
|
|
840
840
|
detachers = [value.attach(tag, _animated_prop_name(prop)) for prop, value in bindings.items()]
|
pythonnative/cli/pn.py
CHANGED
|
@@ -59,8 +59,8 @@ def HomeScreen():
|
|
|
59
59
|
pn.Column(
|
|
60
60
|
pn.Text("Hello from PythonNative!", style={"font_size": 24, "bold": True}),
|
|
61
61
|
pn.Text(f"Tapped {count} times"),
|
|
62
|
-
pn.Button("Tap me",
|
|
63
|
-
pn.Button("Open detail",
|
|
62
|
+
pn.Button("Tap me", on_press=lambda: set_count(count + 1)),
|
|
63
|
+
pn.Button("Open detail", on_press=lambda: nav.navigate("Detail", {"count": count})),
|
|
64
64
|
style={"spacing": 12, "padding": 16, "align_items": "stretch"},
|
|
65
65
|
)
|
|
66
66
|
)
|
|
@@ -72,7 +72,7 @@ def DetailScreen():
|
|
|
72
72
|
params = pn.use_route()
|
|
73
73
|
return pn.Column(
|
|
74
74
|
pn.Text(f"Detail: count was {params.get('count', 0)}", style={"font_size": 20}),
|
|
75
|
-
pn.Button("Back",
|
|
75
|
+
pn.Button("Back", on_press=nav.go_back),
|
|
76
76
|
style={"spacing": 12, "padding": 16},
|
|
77
77
|
)
|
|
78
78
|
|