pythonnative 0.40.0__cp313-cp313-win_amd64.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 +411 -0
- pythonnative/_ios_log.py +92 -0
- pythonnative/_yoga.cp313-win_amd64.pyd +0 -0
- pythonnative/alerts.py +236 -0
- pythonnative/animated.py +1687 -0
- pythonnative/animation_graph.py +78 -0
- pythonnative/appearance.py +124 -0
- pythonnative/bootstrap.py +100 -0
- pythonnative/bridge/__init__.py +302 -0
- pythonnative/bridge/android.py +78 -0
- pythonnative/bridge/codec.py +170 -0
- pythonnative/bridge/commits.py +114 -0
- pythonnative/bridge/fake.py +243 -0
- pythonnative/bridge/ios.py +138 -0
- pythonnative/bridge/web.py +489 -0
- pythonnative/cli/__init__.py +7 -0
- pythonnative/cli/pn.py +1214 -0
- pythonnative/component.py +271 -0
- pythonnative/components/__init__.py +111 -0
- pythonnative/components/_base.py +166 -0
- pythonnative/components/controls.py +521 -0
- pythonnative/components/layout.py +518 -0
- pythonnative/components/lists.py +785 -0
- pythonnative/components/media.py +204 -0
- pythonnative/components/overlays.py +107 -0
- pythonnative/components/pressable.py +252 -0
- pythonnative/components/structural.py +167 -0
- pythonnative/components/text.py +291 -0
- pythonnative/devclient.py +824 -0
- pythonnative/devserver/__init__.py +34 -0
- pythonnative/devserver/server.py +718 -0
- pythonnative/devserver/static/animation_graph.js +82 -0
- pythonnative/devserver/static/bridge.js +147 -0
- pythonnative/devserver/static/colors.js +70 -0
- pythonnative/devserver/static/host.js +552 -0
- pythonnative/devserver/static/index.html +60 -0
- pythonnative/devserver/static/layout.js +85 -0
- pythonnative/devserver/static/preview.css +415 -0
- pythonnative/devserver/static/renderer.js +1994 -0
- pythonnative/devserver/static/shell.js +345 -0
- pythonnative/devserver/static/yoga/LICENSE +21 -0
- pythonnative/devserver/static/yoga/binaries/yoga-wasm-base64-esm.js +75 -0
- pythonnative/devserver/static/yoga/src/generated/YGEnums.d.ts +189 -0
- pythonnative/devserver/static/yoga/src/generated/YGEnums.js +211 -0
- pythonnative/devserver/static/yoga/src/generated/YGEnums.js.map +1 -0
- pythonnative/devserver/static/yoga/src/index.d.ts +12 -0
- pythonnative/devserver/static/yoga/src/index.js +16 -0
- pythonnative/devserver/static/yoga/src/index.js.map +1 -0
- pythonnative/devserver/static/yoga/src/load.d.ts +11 -0
- pythonnative/devserver/static/yoga/src/load.js +17 -0
- pythonnative/devserver/static/yoga/src/load.js.map +1 -0
- pythonnative/devserver/static/yoga/src/wrapAssembly.d.ts +155 -0
- pythonnative/devserver/static/yoga/src/wrapAssembly.js +125 -0
- pythonnative/devserver/static/yoga/src/wrapAssembly.js.map +1 -0
- pythonnative/devserver/watcher.py +267 -0
- pythonnative/devserver/ws.py +421 -0
- pythonnative/diagnostics.py +241 -0
- pythonnative/element.py +159 -0
- pythonnative/equality.py +19 -0
- pythonnative/events.py +231 -0
- pythonnative/gestures.py +1333 -0
- pythonnative/hooks.py +1621 -0
- pythonnative/hosts/__init__.py +63 -0
- pythonnative/hosts/base.py +596 -0
- pythonnative/hosts/native.py +302 -0
- pythonnative/hot_reload.py +585 -0
- pythonnative/layout.py +328 -0
- pythonnative/mutations.py +142 -0
- pythonnative/native/android/build.gradle +52 -0
- pythonnative/native/android/gradle.properties +3 -0
- pythonnative/native/android/settings.gradle +12 -0
- pythonnative/native/android/src/main/AndroidManifest.xml +11 -0
- pythonnative/native/android/src/main/cpp/CMakeLists.txt +9 -0
- pythonnative/native/android/src/main/cpp/yoga_jni.cpp +52 -0
- pythonnative/native/android/src/main/java/com/pythonnative/generated/NativeModules.kt +5 -0
- pythonnative/native/android/src/main/java/com/pythonnative/generated/NativeProps.kt +3705 -0
- pythonnative/native/android/src/main/java/com/pythonnative/generated/PNContracts.kt +129 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/PNBridge.kt +261 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/PythonHost.kt +20 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/animation/AnimationGraph.kt +108 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/animation/AnimationSpecs.kt +141 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/animation/PNAnimator.kt +257 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/CommitState.kt +106 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/JsonUtil.kt +175 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/MainThread.kt +40 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/PNLog.kt +33 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/PNRegistry.kt +82 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/PNTransaction.kt +80 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/TransactionApplier.kt +117 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/bridge/ViewRegistry.kt +74 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/BuiltinComponents.kt +37 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ButtonManager.kt +32 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ComponentManager.kt +213 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ContainerManagers.kt +69 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ControlManagers.kt +186 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/DatePickerManager.kt +123 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ImageLoader.kt +141 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ImageManager.kt +162 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ModalManager.kt +134 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/PNColor.kt +201 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/PickerManager.kt +86 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/PortalManager.kt +55 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/PressableManager.kt +122 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ScreenStackManager.kt +110 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ScrollViewManager.kt +214 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/SegmentedControlManager.kt +113 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/StatusBarManager.kt +52 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/TabBarManager.kt +131 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/TextInputManager.kt +250 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/TextManager.kt +233 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/ViewStyler.kt +355 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/VirtualListManager.kt +159 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/components/WebViewManager.kt +149 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/gestures/GestureArbiter.kt +233 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/gestures/GestureCoordinator.kt +127 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/gestures/GestureRecognizers.kt +527 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/layout/NativeLayout.kt +145 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/layout/YogaNode.kt +29 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/BuiltinModules.kt +73 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/DeviceModules.kt +316 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/HostModule.kt +61 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/MediaModules.kt +200 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/NativeModule.kt +158 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/NotificationsModule.kt +100 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/PermissionsModule.kt +99 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/StorageModules.kt +89 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/modules/SystemModules.kt +178 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/plugins/GeneratedPlugins.kt +16 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/screens/PNScreenFragment.kt +188 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/screens/ScreenRegistry.kt +80 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/views/PNAccessibilityDelegate.kt +48 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/views/PNBorderDrawable.kt +76 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/views/PNEditText.kt +18 -0
- pythonnative/native/android/src/main/java/com/pythonnative/runtime/views/PNFrameLayout.kt +49 -0
- pythonnative/native/android/src/test/java/com/pythonnative/runtime/AnimationSpecsTest.kt +75 -0
- pythonnative/native/android/src/test/java/com/pythonnative/runtime/GestureArbiterTest.kt +197 -0
- pythonnative/native/android/src/test/java/com/pythonnative/runtime/PNColorTest.kt +47 -0
- pythonnative/native/android/src/test/java/com/pythonnative/runtime/PNTransactionTest.kt +78 -0
- pythonnative/native/android/src/test/java/com/pythonnative/runtime/PromiseTest.kt +89 -0
- pythonnative/native/ios/Package.swift +23 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Animation/PNAnimationGraph.swift +199 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Animation/PNAnimator.swift +312 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Bridge/PNBridge.swift +255 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Bridge/PNCommit.swift +104 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Bridge/PNRegistry.swift +142 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Bridge/PNTransaction.swift +166 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Bridge/PNViewRegistry.swift +53 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNButtonManagers.swift +207 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNColor.swift +173 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNComponentManager.swift +183 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNContainerView.swift +56 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNControlManagers.swift +281 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNImageManager.swift +222 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNOverlayManagers.swift +243 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNPressableManager.swift +114 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNScreenStackManager.swift +107 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNScrollViewManager.swift +197 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNTabBarManager.swift +106 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNTextInputManager.swift +297 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNTextManager.swift +230 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNTransform.swift +82 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNViewManager.swift +86 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNViewState.swift +87 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNViewStyler.swift +340 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNVirtualListManager.swift +155 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Components/PNWebViewManager.swift +124 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Generated/NativeModules.swift +1 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Generated/NativeProps.swift +3775 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Generated/PNContracts.swift +46 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Gestures/PNGestureCoordinator.swift +260 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Layout/PNLayout.swift +173 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/AlertModule.swift +92 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/HostModule.swift +80 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/LifecycleModules.swift +174 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/MediaModules.swift +177 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/PNNativeModule.swift +168 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/PermissionModules.swift +266 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Modules/SystemModules.swift +251 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Plugins/PNPluginRegistration.swift +8 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Screens/PNScreenRegistry.swift +46 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Screens/PNViewController.swift +237 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Support/PNCompat.swift +46 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Support/PNJSON.swift +173 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Support/PNLog.swift +47 -0
- pythonnative/native/ios/Sources/PythonNativeKit/Support/PNWindow.swift +51 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNAnimationGraphTests.swift +26 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNColorTests.swift +50 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNCommitTests.swift +86 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNGestureTests.swift +101 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNManagerTests.swift +126 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNModuleTests.swift +111 -0
- pythonnative/native/ios/Tests/PythonNativeKitTests/PNTransactionTests.swift +91 -0
- pythonnative/native/yoga/LICENSE +21 -0
- pythonnative/native/yoga/Package.swift +9 -0
- pythonnative/native/yoga/VENDORED.md +2 -0
- pythonnative/native/yoga/include/PNStyle.h +10 -0
- pythonnative/native/yoga/include/module.modulemap +5 -0
- pythonnative/native/yoga/include/yoga/YGConfig.h +158 -0
- pythonnative/native/yoga/include/yoga/YGEnums.h +142 -0
- pythonnative/native/yoga/include/yoga/YGMacros.h +99 -0
- pythonnative/native/yoga/include/yoga/YGNode.h +304 -0
- pythonnative/native/yoga/include/yoga/YGNodeLayout.h +35 -0
- pythonnative/native/yoga/include/yoga/YGNodeStyle.h +130 -0
- pythonnative/native/yoga/include/yoga/YGPixelGrid.h +29 -0
- pythonnative/native/yoga/include/yoga/YGValue.h +84 -0
- pythonnative/native/yoga/include/yoga/Yoga.h +21 -0
- pythonnative/native/yoga/python.cpp +16 -0
- pythonnative/native/yoga/style.cpp +272 -0
- pythonnative/native/yoga/yoga/CMakeLists.txt +41 -0
- pythonnative/native/yoga/yoga/YGConfig.cpp +92 -0
- pythonnative/native/yoga/yoga/YGConfig.h +158 -0
- pythonnative/native/yoga/yoga/YGEnums.cpp +262 -0
- pythonnative/native/yoga/yoga/YGEnums.h +142 -0
- pythonnative/native/yoga/yoga/YGMacros.h +99 -0
- pythonnative/native/yoga/yoga/YGNode.cpp +366 -0
- pythonnative/native/yoga/yoga/YGNode.h +304 -0
- pythonnative/native/yoga/yoga/YGNodeLayout.cpp +92 -0
- pythonnative/native/yoga/yoga/YGNodeLayout.h +35 -0
- pythonnative/native/yoga/yoga/YGNodeStyle.cpp +405 -0
- pythonnative/native/yoga/yoga/YGNodeStyle.h +130 -0
- pythonnative/native/yoga/yoga/YGPixelGrid.cpp +22 -0
- pythonnative/native/yoga/yoga/YGPixelGrid.h +29 -0
- pythonnative/native/yoga/yoga/YGValue.cpp +20 -0
- pythonnative/native/yoga/yoga/YGValue.h +84 -0
- pythonnative/native/yoga/yoga/Yoga.h +21 -0
- pythonnative/native/yoga/yoga/algorithm/AbsoluteLayout.cpp +563 -0
- pythonnative/native/yoga/yoga/algorithm/AbsoluteLayout.h +41 -0
- pythonnative/native/yoga/yoga/algorithm/Align.h +72 -0
- pythonnative/native/yoga/yoga/algorithm/Baseline.cpp +78 -0
- pythonnative/native/yoga/yoga/algorithm/Baseline.h +21 -0
- pythonnative/native/yoga/yoga/algorithm/BoundAxis.h +79 -0
- pythonnative/native/yoga/yoga/algorithm/Cache.cpp +121 -0
- pythonnative/native/yoga/yoga/algorithm/Cache.h +30 -0
- pythonnative/native/yoga/yoga/algorithm/CalculateLayout.cpp +2428 -0
- pythonnative/native/yoga/yoga/algorithm/CalculateLayout.h +38 -0
- pythonnative/native/yoga/yoga/algorithm/FlexDirection.h +120 -0
- pythonnative/native/yoga/yoga/algorithm/FlexLine.cpp +124 -0
- pythonnative/native/yoga/yoga/algorithm/FlexLine.h +75 -0
- pythonnative/native/yoga/yoga/algorithm/PixelGrid.cpp +132 -0
- pythonnative/native/yoga/yoga/algorithm/PixelGrid.h +29 -0
- pythonnative/native/yoga/yoga/algorithm/SizingMode.h +73 -0
- pythonnative/native/yoga/yoga/algorithm/TrailingPosition.h +44 -0
- pythonnative/native/yoga/yoga/config/Config.cpp +135 -0
- pythonnative/native/yoga/yoga/config/Config.h +92 -0
- pythonnative/native/yoga/yoga/debug/AssertFatal.cpp +53 -0
- pythonnative/native/yoga/yoga/debug/AssertFatal.h +29 -0
- pythonnative/native/yoga/yoga/debug/Log.cpp +107 -0
- pythonnative/native/yoga/yoga/debug/Log.h +34 -0
- pythonnative/native/yoga/yoga/enums/Align.h +47 -0
- pythonnative/native/yoga/yoga/enums/BoxSizing.h +40 -0
- pythonnative/native/yoga/yoga/enums/Dimension.h +40 -0
- pythonnative/native/yoga/yoga/enums/Direction.h +41 -0
- pythonnative/native/yoga/yoga/enums/Display.h +41 -0
- pythonnative/native/yoga/yoga/enums/Edge.h +47 -0
- pythonnative/native/yoga/yoga/enums/Errata.h +41 -0
- pythonnative/native/yoga/yoga/enums/ExperimentalFeature.h +39 -0
- pythonnative/native/yoga/yoga/enums/FlexDirection.h +42 -0
- pythonnative/native/yoga/yoga/enums/Gutter.h +41 -0
- pythonnative/native/yoga/yoga/enums/Justify.h +44 -0
- pythonnative/native/yoga/yoga/enums/LogLevel.h +44 -0
- pythonnative/native/yoga/yoga/enums/MeasureMode.h +41 -0
- pythonnative/native/yoga/yoga/enums/NodeType.h +40 -0
- pythonnative/native/yoga/yoga/enums/Overflow.h +41 -0
- pythonnative/native/yoga/yoga/enums/PhysicalEdge.h +21 -0
- pythonnative/native/yoga/yoga/enums/PositionType.h +41 -0
- pythonnative/native/yoga/yoga/enums/Unit.h +42 -0
- pythonnative/native/yoga/yoga/enums/Wrap.h +41 -0
- pythonnative/native/yoga/yoga/enums/YogaEnums.h +85 -0
- pythonnative/native/yoga/yoga/event/event.cpp +87 -0
- pythonnative/native/yoga/yoga/event/event.h +130 -0
- pythonnative/native/yoga/yoga/module.modulemap +21 -0
- pythonnative/native/yoga/yoga/node/CachedMeasurement.h +53 -0
- pythonnative/native/yoga/yoga/node/LayoutResults.cpp +48 -0
- pythonnative/native/yoga/yoga/node/LayoutResults.h +122 -0
- pythonnative/native/yoga/yoga/node/LayoutableChildren.h +148 -0
- pythonnative/native/yoga/yoga/node/Node.cpp +443 -0
- pythonnative/native/yoga/yoga/node/Node.h +337 -0
- pythonnative/native/yoga/yoga/numeric/Comparison.h +81 -0
- pythonnative/native/yoga/yoga/numeric/FloatOptional.h +93 -0
- pythonnative/native/yoga/yoga/style/SmallValueBuffer.h +133 -0
- pythonnative/native/yoga/yoga/style/Style.h +757 -0
- pythonnative/native/yoga/yoga/style/StyleLength.h +107 -0
- pythonnative/native/yoga/yoga/style/StyleValueHandle.h +98 -0
- pythonnative/native/yoga/yoga/style/StyleValuePool.h +127 -0
- pythonnative/native_modules/__init__.py +124 -0
- pythonnative/native_modules/app_state.py +99 -0
- pythonnative/native_modules/battery.py +75 -0
- pythonnative/native_modules/biometrics.py +42 -0
- pythonnative/native_modules/camera.py +65 -0
- pythonnative/native_modules/clipboard.py +46 -0
- pythonnative/native_modules/fallback.py +324 -0
- pythonnative/native_modules/file_system.py +145 -0
- pythonnative/native_modules/haptics.py +75 -0
- pythonnative/native_modules/linking.py +123 -0
- pythonnative/native_modules/location.py +75 -0
- pythonnative/native_modules/net_info.py +112 -0
- pythonnative/native_modules/notifications.py +129 -0
- pythonnative/native_modules/permissions.py +108 -0
- pythonnative/native_modules/registry.py +526 -0
- pythonnative/native_modules/secure_store.py +52 -0
- pythonnative/native_modules/share.py +51 -0
- pythonnative/native_views/__init__.py +375 -0
- pythonnative/native_views/base.py +316 -0
- pythonnative/native_views/bridge_backend.py +277 -0
- pythonnative/navigation/__init__.py +103 -0
- pythonnative/navigation/container.py +154 -0
- pythonnative/navigation/handle.py +540 -0
- pythonnative/navigation/hooks.py +133 -0
- pythonnative/navigation/host.py +58 -0
- pythonnative/navigation/linking.py +200 -0
- pythonnative/navigation/navigators.py +659 -0
- pythonnative/navigation/screen.py +149 -0
- pythonnative/navigation/state.py +269 -0
- pythonnative/net.py +248 -0
- pythonnative/platform.py +166 -0
- pythonnative/platform_metrics.py +252 -0
- pythonnative/preview.py +287 -0
- pythonnative/profiling.py +101 -0
- pythonnative/project/__init__.py +68 -0
- pythonnative/project/android.py +557 -0
- pythonnative/project/builder.py +817 -0
- pythonnative/project/config.py +773 -0
- pythonnative/project/deps.py +719 -0
- pythonnative/project/devices.py +304 -0
- pythonnative/project/doctor.py +283 -0
- pythonnative/project/fingerprint.py +171 -0
- pythonnative/project/icons.py +247 -0
- pythonnative/project/ios.py +325 -0
- pythonnative/project/lockfile.py +100 -0
- pythonnative/project/permissions.py +361 -0
- pythonnative/project/plugins.py +519 -0
- pythonnative/project/runtime_assets.py +183 -0
- pythonnative/py.typed +0 -0
- pythonnative/query.py +153 -0
- pythonnative/reconciler/__init__.py +29 -0
- pythonnative/reconciler/boundaries.py +375 -0
- pythonnative/reconciler/children.py +88 -0
- pythonnative/reconciler/core.py +1165 -0
- pythonnative/reconciler/layout_pass.py +393 -0
- pythonnative/reconciler/vnode.py +266 -0
- pythonnative/refresh.py +55 -0
- pythonnative/runtime.py +306 -0
- pythonnative/scheduler.py +159 -0
- pythonnative/sdk/__init__.py +153 -0
- pythonnative/sdk/_components.py +427 -0
- pythonnative/sdk/builtins.py +91 -0
- pythonnative/sdk/codegen.py +149 -0
- pythonnative/sdk/module_codegen.py +184 -0
- pythonnative/sdk/schema.py +224 -0
- pythonnative/sdk/templates/contracts.kt +46 -0
- pythonnative/sdk/templates/contracts.swift +46 -0
- pythonnative/storage.py +184 -0
- pythonnative/style.py +841 -0
- pythonnative/suspense.py +183 -0
- pythonnative/templates/android_template/app/build.gradle +75 -0
- pythonnative/templates/android_template/app/proguard-rules.pro +21 -0
- pythonnative/templates/android_template/app/src/androidTest/java/com/pythonnative/android_template/ExampleInstrumentedTest.kt +24 -0
- pythonnative/templates/android_template/app/src/debug/AndroidManifest.xml +7 -0
- pythonnative/templates/android_template/app/src/main/AndroidManifest.xml +32 -0
- pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/MainActivity.kt +130 -0
- pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/ScreenFragment.kt +13 -0
- pythonnative/templates/android_template/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- pythonnative/templates/android_template/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +30 -0
- pythonnative/templates/android_template/app/src/main/res/layout/activity_main.xml +10 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- pythonnative/templates/android_template/app/src/main/res/navigation/nav_graph.xml +22 -0
- pythonnative/templates/android_template/app/src/main/res/values/colors.xml +5 -0
- pythonnative/templates/android_template/app/src/main/res/values/strings.xml +5 -0
- pythonnative/templates/android_template/app/src/main/res/values/themes.xml +9 -0
- pythonnative/templates/android_template/app/src/main/res/values-night/themes.xml +7 -0
- pythonnative/templates/android_template/app/src/main/res/xml/backup_rules.xml +13 -0
- pythonnative/templates/android_template/app/src/main/res/xml/data_extraction_rules.xml +19 -0
- pythonnative/templates/android_template/app/src/test/java/com/pythonnative/android_template/ExampleUnitTest.kt +17 -0
- pythonnative/templates/android_template/build.gradle +10 -0
- pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.jar +0 -0
- pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.properties +6 -0
- pythonnative/templates/android_template/gradle.properties +23 -0
- pythonnative/templates/android_template/gradlew +185 -0
- pythonnative/templates/android_template/gradlew.bat +89 -0
- pythonnative/templates/android_template/settings.gradle +17 -0
- pythonnative/templates/ios_template/ios_template/AppDelegate.swift +51 -0
- pythonnative/templates/ios_template/ios_template/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- pythonnative/templates/ios_template/ios_template/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- pythonnative/templates/ios_template/ios_template/Assets.xcassets/Contents.json +6 -0
- pythonnative/templates/ios_template/ios_template/Base.lproj/LaunchScreen.storyboard +25 -0
- pythonnative/templates/ios_template/ios_template/BridgingHeader.h +14 -0
- pythonnative/templates/ios_template/ios_template/Info.plist +28 -0
- pythonnative/templates/ios_template/ios_template/PythonRuntime.swift +390 -0
- pythonnative/templates/ios_template/ios_template/SceneDelegate.swift +61 -0
- pythonnative/templates/ios_template/ios_template/ViewController.swift +23 -0
- pythonnative/templates/ios_template/ios_template.xcodeproj/project.pbxproj +745 -0
- pythonnative/templates/ios_template/ios_template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- pythonnative/templates/ios_template/ios_templateTests/ios_templateTests.swift +36 -0
- pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITests.swift +41 -0
- pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITestsLaunchTests.swift +32 -0
- pythonnative/testing/__init__.py +53 -0
- pythonnative/testing/backend.py +276 -0
- pythonnative/testing/harness.py +369 -0
- pythonnative/utils.py +145 -0
- pythonnative-0.40.0.dist-info/DELVEWHEEL +2 -0
- pythonnative-0.40.0.dist-info/METADATA +150 -0
- pythonnative-0.40.0.dist-info/RECORD +418 -0
- pythonnative-0.40.0.dist-info/WHEEL +5 -0
- pythonnative-0.40.0.dist-info/entry_points.txt +2 -0
- pythonnative-0.40.0.dist-info/licenses/LICENSE +21 -0
- pythonnative-0.40.0.dist-info/top_level.txt +1 -0
- pythonnative.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
"""Form controls and side-effect elements.
|
|
2
|
+
|
|
3
|
+
``Switch``, ``Slider``, ``ProgressBar``, ``ActivityIndicator``,
|
|
4
|
+
``Checkbox``, ``SegmentedControl``, ``DatePicker``, ``Picker``, the
|
|
5
|
+
``RefreshControl``, and ``StatusBar``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Any, Callable, Dict, List, Literal, Optional
|
|
9
|
+
|
|
10
|
+
from ..element import Element
|
|
11
|
+
from ..hooks import Ref
|
|
12
|
+
from ..style import AccessibilityState, Color, StyleProp
|
|
13
|
+
from ._base import REFRESH_CONTROL_TYPE, _make_element
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def Switch(
|
|
17
|
+
*,
|
|
18
|
+
value: bool = False,
|
|
19
|
+
on_change: Optional[Callable[[bool], Any]] = None,
|
|
20
|
+
accessibility_label: Optional[str] = None,
|
|
21
|
+
style: StyleProp = None,
|
|
22
|
+
key: Optional[str] = None,
|
|
23
|
+
) -> Element:
|
|
24
|
+
"""Display a toggle switch.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
value: Current on/off state.
|
|
28
|
+
on_change: Callback invoked with the new boolean state.
|
|
29
|
+
accessibility_label: Label exposed to assistive technology (and
|
|
30
|
+
UI test drivers) for the switch.
|
|
31
|
+
style: Style dict (or list of dicts).
|
|
32
|
+
key: Stable identity for keyed reconciliation.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
An [`Element`][pythonnative.Element] of type ``"Switch"``.
|
|
36
|
+
"""
|
|
37
|
+
return _make_element(
|
|
38
|
+
"Switch",
|
|
39
|
+
style=style,
|
|
40
|
+
key=key,
|
|
41
|
+
value=value,
|
|
42
|
+
on_change=on_change,
|
|
43
|
+
accessibility_label=accessibility_label,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def Slider(
|
|
48
|
+
*,
|
|
49
|
+
value: float = 0.0,
|
|
50
|
+
min_value: float = 0.0,
|
|
51
|
+
max_value: float = 1.0,
|
|
52
|
+
on_change: Optional[Callable[[float], Any]] = None,
|
|
53
|
+
accessibility_label: Optional[str] = None,
|
|
54
|
+
style: StyleProp = None,
|
|
55
|
+
key: Optional[str] = None,
|
|
56
|
+
) -> Element:
|
|
57
|
+
"""Continuous-value slider between ``min_value`` and ``max_value``.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
value: Current slider value.
|
|
61
|
+
min_value: Lower bound.
|
|
62
|
+
max_value: Upper bound.
|
|
63
|
+
on_change: Callback invoked with the new value as the user
|
|
64
|
+
drags.
|
|
65
|
+
accessibility_label: Label exposed to assistive technology (and
|
|
66
|
+
UI test drivers) for the slider.
|
|
67
|
+
style: Style dict (or list of dicts).
|
|
68
|
+
key: Stable identity for keyed reconciliation.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
An [`Element`][pythonnative.Element] of type ``"Slider"``.
|
|
72
|
+
"""
|
|
73
|
+
return _make_element(
|
|
74
|
+
"Slider",
|
|
75
|
+
style=style,
|
|
76
|
+
key=key,
|
|
77
|
+
value=value,
|
|
78
|
+
min_value=min_value,
|
|
79
|
+
max_value=max_value,
|
|
80
|
+
on_change=on_change,
|
|
81
|
+
accessibility_label=accessibility_label,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def ProgressBar(
|
|
86
|
+
*,
|
|
87
|
+
value: float = 0.0,
|
|
88
|
+
color: Optional[Color] = None,
|
|
89
|
+
track_color: Optional[Color] = None,
|
|
90
|
+
indeterminate: bool = False,
|
|
91
|
+
style: StyleProp = None,
|
|
92
|
+
key: Optional[str] = None,
|
|
93
|
+
) -> Element:
|
|
94
|
+
"""Show determinate progress as a value between ``0.0`` and ``1.0``.
|
|
95
|
+
|
|
96
|
+
For a spinner instead of a bar, use
|
|
97
|
+
[`ActivityIndicator`][pythonnative.ActivityIndicator]; for an
|
|
98
|
+
indeterminate *bar* pass ``indeterminate=True``.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
value: Fraction complete (clamped to ``[0.0, 1.0]`` by the
|
|
102
|
+
platform handler).
|
|
103
|
+
color: Color of the filled portion of the bar.
|
|
104
|
+
track_color: Color of the unfilled track behind the fill.
|
|
105
|
+
indeterminate: When ``True``, the bar animates continuously and
|
|
106
|
+
``value`` is ignored.
|
|
107
|
+
style: Style dict (or list of dicts).
|
|
108
|
+
key: Stable identity for keyed reconciliation.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
An [`Element`][pythonnative.Element] of type ``"ProgressBar"``.
|
|
112
|
+
"""
|
|
113
|
+
return _make_element(
|
|
114
|
+
"ProgressBar",
|
|
115
|
+
style=style,
|
|
116
|
+
key=key,
|
|
117
|
+
value=value,
|
|
118
|
+
color=color,
|
|
119
|
+
track_color=track_color,
|
|
120
|
+
indeterminate=indeterminate or None,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def ActivityIndicator(
|
|
125
|
+
*,
|
|
126
|
+
animating: bool = True,
|
|
127
|
+
color: Optional[Color] = None,
|
|
128
|
+
size: Literal["small", "large"] = "small",
|
|
129
|
+
style: StyleProp = None,
|
|
130
|
+
key: Optional[str] = None,
|
|
131
|
+
) -> Element:
|
|
132
|
+
"""Show an indeterminate loading spinner.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
animating: When ``False``, the spinner is hidden.
|
|
136
|
+
color: Spinner color.
|
|
137
|
+
size: ``"small"`` (default) or ``"large"``.
|
|
138
|
+
style: Style dict (or list of dicts).
|
|
139
|
+
key: Stable identity for keyed reconciliation.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
An [`Element`][pythonnative.Element] of type
|
|
143
|
+
``"ActivityIndicator"``.
|
|
144
|
+
"""
|
|
145
|
+
return _make_element(
|
|
146
|
+
"ActivityIndicator",
|
|
147
|
+
style=style,
|
|
148
|
+
key=key,
|
|
149
|
+
animating=animating,
|
|
150
|
+
color=color,
|
|
151
|
+
size=size,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def Checkbox(
|
|
156
|
+
*,
|
|
157
|
+
value: bool = False,
|
|
158
|
+
on_change: Optional[Callable[[bool], Any]] = None,
|
|
159
|
+
label: Optional[str] = None,
|
|
160
|
+
disabled: bool = False,
|
|
161
|
+
color: Optional[Color] = None,
|
|
162
|
+
style: StyleProp = None,
|
|
163
|
+
accessibility_label: Optional[str] = None,
|
|
164
|
+
accessibility_hint: Optional[str] = None,
|
|
165
|
+
accessible: Optional[bool] = None,
|
|
166
|
+
accessibility_state: Optional[AccessibilityState] = None,
|
|
167
|
+
accessibility_live_region: Optional[Literal["none", "polite", "assertive"]] = None,
|
|
168
|
+
test_id: Optional[str] = None,
|
|
169
|
+
key: Optional[str] = None,
|
|
170
|
+
) -> Element:
|
|
171
|
+
"""A boolean checkbox with an optional inline label.
|
|
172
|
+
|
|
173
|
+
Backed by ``android.widget.CheckBox`` on Android and a checkmark
|
|
174
|
+
``UIButton`` on iOS. Tapping the control (or its label) toggles the
|
|
175
|
+
value and fires ``on_change(new_value)``.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
value: Current checked state.
|
|
179
|
+
on_change: Callback invoked with the new boolean state.
|
|
180
|
+
label: Optional text shown beside the box (also tappable).
|
|
181
|
+
disabled: When ``True``, the control is greyed out and inert.
|
|
182
|
+
color: Tint applied to the checked box.
|
|
183
|
+
style: Style dict (or list of dicts).
|
|
184
|
+
accessibility_label: Spoken description for screen readers.
|
|
185
|
+
accessibility_hint: Spoken extra detail (iOS only).
|
|
186
|
+
accessible: Override whether the element is exposed to AT.
|
|
187
|
+
accessibility_state: Current widget state for assistive tech,
|
|
188
|
+
e.g. ``{"disabled": True, "selected": False}``. Recognized
|
|
189
|
+
keys: ``disabled``, ``selected``, ``checked``, ``busy``,
|
|
190
|
+
``expanded``.
|
|
191
|
+
accessibility_live_region: How AT announces dynamic changes to
|
|
192
|
+
this view: ``"none"``, ``"polite"``, or ``"assertive"``
|
|
193
|
+
(Android only).
|
|
194
|
+
test_id: Stable identifier for UI tests; exposed as
|
|
195
|
+
``resource-id`` on Android and ``accessibilityIdentifier``
|
|
196
|
+
on iOS.
|
|
197
|
+
key: Stable identity for keyed reconciliation.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
An [`Element`][pythonnative.Element] of type ``"Checkbox"``.
|
|
201
|
+
"""
|
|
202
|
+
return _make_element(
|
|
203
|
+
"Checkbox",
|
|
204
|
+
style=style,
|
|
205
|
+
key=key,
|
|
206
|
+
value=value,
|
|
207
|
+
on_change=on_change,
|
|
208
|
+
label=label,
|
|
209
|
+
disabled=disabled or None,
|
|
210
|
+
color=color,
|
|
211
|
+
accessibility_label=accessibility_label,
|
|
212
|
+
accessibility_hint=accessibility_hint,
|
|
213
|
+
accessible=accessible,
|
|
214
|
+
accessibility_state=accessibility_state,
|
|
215
|
+
accessibility_live_region=accessibility_live_region,
|
|
216
|
+
test_id=test_id,
|
|
217
|
+
_defaults={"accessibility_role": "checkbox"},
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def SegmentedControl(
|
|
222
|
+
*,
|
|
223
|
+
segments: Optional[List[str]] = None,
|
|
224
|
+
selected_index: int = 0,
|
|
225
|
+
on_change: Optional[Callable[[int], Any]] = None,
|
|
226
|
+
disabled: bool = False,
|
|
227
|
+
tint_color: Optional[Color] = None,
|
|
228
|
+
style: StyleProp = None,
|
|
229
|
+
accessibility_label: Optional[str] = None,
|
|
230
|
+
accessible: Optional[bool] = None,
|
|
231
|
+
accessibility_state: Optional[AccessibilityState] = None,
|
|
232
|
+
accessibility_live_region: Optional[Literal["none", "polite", "assertive"]] = None,
|
|
233
|
+
test_id: Optional[str] = None,
|
|
234
|
+
key: Optional[str] = None,
|
|
235
|
+
) -> Element:
|
|
236
|
+
"""A horizontal multi-choice control (one selected segment at a time).
|
|
237
|
+
|
|
238
|
+
Backed by ``UISegmentedControl`` on iOS and a styled toggle row on
|
|
239
|
+
Android. Selecting a segment fires ``on_change(index)``.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
segments: Ordered list of segment labels.
|
|
243
|
+
selected_index: Index of the currently selected segment.
|
|
244
|
+
on_change: Callback invoked with the newly selected index.
|
|
245
|
+
disabled: When ``True``, the control is disabled.
|
|
246
|
+
tint_color: Accent color for the selected segment.
|
|
247
|
+
style: Style dict (or list of dicts).
|
|
248
|
+
accessibility_label: Spoken description for screen readers.
|
|
249
|
+
accessible: Override whether the element is exposed to AT.
|
|
250
|
+
accessibility_state: Current widget state for assistive tech,
|
|
251
|
+
e.g. ``{"disabled": True, "selected": False}``. Recognized
|
|
252
|
+
keys: ``disabled``, ``selected``, ``checked``, ``busy``,
|
|
253
|
+
``expanded``.
|
|
254
|
+
accessibility_live_region: How AT announces dynamic changes to
|
|
255
|
+
this view: ``"none"``, ``"polite"``, or ``"assertive"``
|
|
256
|
+
(Android only).
|
|
257
|
+
test_id: Stable identifier for UI tests; exposed as
|
|
258
|
+
``resource-id`` on Android and ``accessibilityIdentifier``
|
|
259
|
+
on iOS.
|
|
260
|
+
key: Stable identity for keyed reconciliation.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
An [`Element`][pythonnative.Element] of type
|
|
264
|
+
``"SegmentedControl"``.
|
|
265
|
+
"""
|
|
266
|
+
return _make_element(
|
|
267
|
+
"SegmentedControl",
|
|
268
|
+
style=style,
|
|
269
|
+
key=key,
|
|
270
|
+
segments=list(segments) if segments is not None else [],
|
|
271
|
+
selected_index=selected_index,
|
|
272
|
+
on_change=on_change,
|
|
273
|
+
disabled=disabled or None,
|
|
274
|
+
tint_color=tint_color,
|
|
275
|
+
accessibility_label=accessibility_label,
|
|
276
|
+
accessible=accessible,
|
|
277
|
+
accessibility_state=accessibility_state,
|
|
278
|
+
accessibility_live_region=accessibility_live_region,
|
|
279
|
+
test_id=test_id,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def DatePicker(
|
|
284
|
+
*,
|
|
285
|
+
value: Optional[str] = None,
|
|
286
|
+
mode: Literal["date", "time", "datetime"] = "date",
|
|
287
|
+
on_change: Optional[Callable[[str], Any]] = None,
|
|
288
|
+
minimum: Optional[str] = None,
|
|
289
|
+
maximum: Optional[str] = None,
|
|
290
|
+
disabled: bool = False,
|
|
291
|
+
style: StyleProp = None,
|
|
292
|
+
accessibility_label: Optional[str] = None,
|
|
293
|
+
accessible: Optional[bool] = None,
|
|
294
|
+
accessibility_state: Optional[AccessibilityState] = None,
|
|
295
|
+
accessibility_live_region: Optional[Literal["none", "polite", "assertive"]] = None,
|
|
296
|
+
test_id: Optional[str] = None,
|
|
297
|
+
key: Optional[str] = None,
|
|
298
|
+
) -> Element:
|
|
299
|
+
"""A native date / time picker.
|
|
300
|
+
|
|
301
|
+
Backed by ``UIDatePicker`` on iOS and a trigger button that opens
|
|
302
|
+
the platform ``DatePickerDialog`` / ``TimePickerDialog`` on
|
|
303
|
+
Android. ``value`` and the value reported to ``on_change`` are
|
|
304
|
+
ISO-8601 strings (``"2026-05-31"`` for ``mode="date"``, ``"14:30"``
|
|
305
|
+
for ``mode="time"``, ``"2026-05-31T14:30"`` for
|
|
306
|
+
``mode="datetime"``), so values stay JSON-serializable and
|
|
307
|
+
platform-agnostic.
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
value: Currently selected value as an ISO-8601 string.
|
|
311
|
+
mode: ``"date"`` (default), ``"time"``, or ``"datetime"``.
|
|
312
|
+
on_change: Callback invoked with the new ISO-8601 string.
|
|
313
|
+
minimum: Earliest selectable value (ISO-8601), if any.
|
|
314
|
+
maximum: Latest selectable value (ISO-8601), if any.
|
|
315
|
+
disabled: When ``True``, the picker is disabled.
|
|
316
|
+
style: Style dict (or list of dicts).
|
|
317
|
+
accessibility_label: Spoken description for screen readers.
|
|
318
|
+
accessible: Override whether the element is exposed to AT.
|
|
319
|
+
accessibility_state: Current widget state for assistive tech,
|
|
320
|
+
e.g. ``{"disabled": True, "selected": False}``. Recognized
|
|
321
|
+
keys: ``disabled``, ``selected``, ``checked``, ``busy``,
|
|
322
|
+
``expanded``.
|
|
323
|
+
accessibility_live_region: How AT announces dynamic changes to
|
|
324
|
+
this view: ``"none"``, ``"polite"``, or ``"assertive"``
|
|
325
|
+
(Android only).
|
|
326
|
+
test_id: Stable identifier for UI tests; exposed as
|
|
327
|
+
``resource-id`` on Android and ``accessibilityIdentifier``
|
|
328
|
+
on iOS.
|
|
329
|
+
key: Stable identity for keyed reconciliation.
|
|
330
|
+
|
|
331
|
+
Returns:
|
|
332
|
+
An [`Element`][pythonnative.Element] of type ``"DatePicker"``.
|
|
333
|
+
"""
|
|
334
|
+
return _make_element(
|
|
335
|
+
"DatePicker",
|
|
336
|
+
style=style,
|
|
337
|
+
key=key,
|
|
338
|
+
value=value,
|
|
339
|
+
mode=mode,
|
|
340
|
+
on_change=on_change,
|
|
341
|
+
minimum=minimum,
|
|
342
|
+
maximum=maximum,
|
|
343
|
+
disabled=disabled or None,
|
|
344
|
+
accessibility_label=accessibility_label,
|
|
345
|
+
accessible=accessible,
|
|
346
|
+
accessibility_state=accessibility_state,
|
|
347
|
+
accessibility_live_region=accessibility_live_region,
|
|
348
|
+
test_id=test_id,
|
|
349
|
+
_defaults={"accessibility_role": "button"},
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def Picker(
|
|
354
|
+
*,
|
|
355
|
+
value: Any = None,
|
|
356
|
+
disabled: bool = False,
|
|
357
|
+
items: Optional[List[Dict[str, Any]]] = None,
|
|
358
|
+
on_change: Optional[Callable[[Any], Any]] = None,
|
|
359
|
+
placeholder: str = "Select…",
|
|
360
|
+
style: StyleProp = None,
|
|
361
|
+
accessibility_label: Optional[str] = None,
|
|
362
|
+
accessibility_hint: Optional[str] = None,
|
|
363
|
+
accessible: Optional[bool] = None,
|
|
364
|
+
accessibility_state: Optional[AccessibilityState] = None,
|
|
365
|
+
accessibility_live_region: Optional[Literal["none", "polite", "assertive"]] = None,
|
|
366
|
+
test_id: Optional[str] = None,
|
|
367
|
+
ref: Optional[Ref] = None,
|
|
368
|
+
key: Optional[str] = None,
|
|
369
|
+
) -> Element:
|
|
370
|
+
"""A real native dropdown / select widget.
|
|
371
|
+
|
|
372
|
+
Renders a tappable trigger labelled with the selected item; the
|
|
373
|
+
iOS handler attaches a ``UIMenu`` (system dropdown) and the Android
|
|
374
|
+
handler uses a native ``Spinner``. Selecting an item fires
|
|
375
|
+
``on_change(value)``.
|
|
376
|
+
|
|
377
|
+
``items`` is an ordered list of ``{"value": Any, "label": str}``
|
|
378
|
+
entries (``label`` defaults to ``str(value)`` when omitted).
|
|
379
|
+
|
|
380
|
+
Args:
|
|
381
|
+
disabled: Whether the control ignores user input.
|
|
382
|
+
value: Currently selected value (matched against
|
|
383
|
+
``items[i]["value"]``).
|
|
384
|
+
items: Selectable options.
|
|
385
|
+
on_change: Callback invoked with the new value.
|
|
386
|
+
placeholder: Label shown when no item matches ``value``.
|
|
387
|
+
style: Style dict applied to the trigger.
|
|
388
|
+
accessibility_label: Spoken description for screen readers.
|
|
389
|
+
accessibility_hint: Spoken extra detail (iOS only).
|
|
390
|
+
accessible: Override whether the element is exposed to AT.
|
|
391
|
+
accessibility_state: Current widget state for assistive tech,
|
|
392
|
+
e.g. ``{"disabled": True, "selected": False}``. Recognized
|
|
393
|
+
keys: ``disabled``, ``selected``, ``checked``, ``busy``,
|
|
394
|
+
``expanded``.
|
|
395
|
+
accessibility_live_region: How AT announces dynamic changes to
|
|
396
|
+
this view: ``"none"``, ``"polite"``, or ``"assertive"``
|
|
397
|
+
(Android only).
|
|
398
|
+
test_id: Stable identifier for UI tests; exposed as
|
|
399
|
+
``resource-id`` on Android and ``accessibilityIdentifier``
|
|
400
|
+
on iOS.
|
|
401
|
+
ref: Optional [`Ref`][pythonnative.Ref] from ``use_ref()``.
|
|
402
|
+
key: Stable identity for keyed reconciliation.
|
|
403
|
+
|
|
404
|
+
Returns:
|
|
405
|
+
An [`Element`][pythonnative.Element] of type ``"Picker"``.
|
|
406
|
+
"""
|
|
407
|
+
return _make_element(
|
|
408
|
+
"Picker",
|
|
409
|
+
style=style,
|
|
410
|
+
ref=ref,
|
|
411
|
+
key=key,
|
|
412
|
+
value=value,
|
|
413
|
+
disabled=disabled or None,
|
|
414
|
+
items=list(items) if items is not None else [],
|
|
415
|
+
on_change=on_change,
|
|
416
|
+
placeholder=placeholder,
|
|
417
|
+
accessibility_label=accessibility_label,
|
|
418
|
+
accessibility_hint=accessibility_hint,
|
|
419
|
+
accessible=accessible,
|
|
420
|
+
accessibility_state=accessibility_state,
|
|
421
|
+
accessibility_live_region=accessibility_live_region,
|
|
422
|
+
test_id=test_id,
|
|
423
|
+
_defaults={"accessibility_role": "button"},
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def RefreshControl(
|
|
428
|
+
*,
|
|
429
|
+
refreshing: bool = False,
|
|
430
|
+
on_refresh: Optional[Callable[[], Any]] = None,
|
|
431
|
+
tint_color: Optional[Color] = None,
|
|
432
|
+
) -> Element:
|
|
433
|
+
"""Pull-to-refresh control for [`ScrollView`][pythonnative.ScrollView] and the list components.
|
|
434
|
+
|
|
435
|
+
Pass the result as the ``refresh_control=`` prop of a
|
|
436
|
+
[`ScrollView`][pythonnative.ScrollView],
|
|
437
|
+
[`FlatList`][pythonnative.FlatList], or
|
|
438
|
+
[`SectionList`][pythonnative.SectionList]. It is a regular
|
|
439
|
+
[`Element`][pythonnative.Element] (type ``"RefreshControl"``) built
|
|
440
|
+
like every other piece of UI; the scroll container attaches it to
|
|
441
|
+
its native scroll view rather than rendering it as a child, and
|
|
442
|
+
rejects anything else with a ``TypeError``.
|
|
443
|
+
|
|
444
|
+
Args:
|
|
445
|
+
refreshing: Drive the spinner's visibility from a use_state
|
|
446
|
+
value.
|
|
447
|
+
on_refresh: Callback invoked when the user pulls down past the
|
|
448
|
+
threshold. Set ``refreshing`` to ``True`` for the duration
|
|
449
|
+
of the work, then back to ``False`` on completion.
|
|
450
|
+
tint_color: Color of the spinner.
|
|
451
|
+
|
|
452
|
+
Returns:
|
|
453
|
+
An [`Element`][pythonnative.Element] of type ``"RefreshControl"``.
|
|
454
|
+
|
|
455
|
+
Example:
|
|
456
|
+
```python
|
|
457
|
+
import pythonnative as pn
|
|
458
|
+
|
|
459
|
+
@pn.component
|
|
460
|
+
def MyList():
|
|
461
|
+
refreshing, set_refreshing = pn.use_state(False)
|
|
462
|
+
|
|
463
|
+
def reload():
|
|
464
|
+
set_refreshing(True)
|
|
465
|
+
# ... fetch data ...
|
|
466
|
+
set_refreshing(False)
|
|
467
|
+
|
|
468
|
+
return pn.ScrollView(
|
|
469
|
+
pn.Text("Pull me!"),
|
|
470
|
+
refresh_control=pn.RefreshControl(
|
|
471
|
+
refreshing=refreshing, on_refresh=reload
|
|
472
|
+
),
|
|
473
|
+
)
|
|
474
|
+
```
|
|
475
|
+
"""
|
|
476
|
+
return _make_element(
|
|
477
|
+
REFRESH_CONTROL_TYPE,
|
|
478
|
+
refreshing=bool(refreshing),
|
|
479
|
+
on_refresh=on_refresh,
|
|
480
|
+
tint_color=tint_color,
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def StatusBar(
|
|
485
|
+
*,
|
|
486
|
+
bar_style: Optional[Literal["light", "dark", "default"]] = None,
|
|
487
|
+
background_color: Optional[Color] = None,
|
|
488
|
+
hidden: Optional[bool] = None,
|
|
489
|
+
key: Optional[str] = None,
|
|
490
|
+
) -> Element:
|
|
491
|
+
"""Configure the device's status bar appearance.
|
|
492
|
+
|
|
493
|
+
StatusBar is a side-effect element: it doesn't render any visible
|
|
494
|
+
content but applies its props to the host platform's status bar.
|
|
495
|
+
Mount one near the top of your tree.
|
|
496
|
+
|
|
497
|
+
The ``bar_style`` parameter is named separately from the universal
|
|
498
|
+
``style`` kwarg (which is unused here) to avoid the conflict that
|
|
499
|
+
``style="light"`` would create with the visual-style dict used
|
|
500
|
+
elsewhere.
|
|
501
|
+
|
|
502
|
+
Args:
|
|
503
|
+
bar_style: ``"light"`` (light icons over dark backgrounds),
|
|
504
|
+
``"dark"`` (dark icons over light backgrounds), or
|
|
505
|
+
``"default"`` (system default).
|
|
506
|
+
background_color: Color of the status-bar background (Android
|
|
507
|
+
only; iOS draws the bar transparent over your content).
|
|
508
|
+
hidden: When ``True``, the status bar is hidden.
|
|
509
|
+
key: Stable identity for keyed reconciliation.
|
|
510
|
+
|
|
511
|
+
Returns:
|
|
512
|
+
An [`Element`][pythonnative.Element] of type ``"StatusBar"``.
|
|
513
|
+
"""
|
|
514
|
+
props: Dict[str, Any] = {}
|
|
515
|
+
if bar_style is not None:
|
|
516
|
+
props["bar_style"] = bar_style
|
|
517
|
+
if background_color is not None:
|
|
518
|
+
props["background_color"] = background_color
|
|
519
|
+
if hidden is not None:
|
|
520
|
+
props["hidden"] = hidden
|
|
521
|
+
return Element("StatusBar", props, [], key=key)
|