FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs(events,mutations,platform_metrics): add API reference pages by Adebowale-Morakinyo · Pull Request #31 · pythonnative/pythonnative · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (5) .py  (1) .yml  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
24 changes: 24 additions & 0 deletions docs/api/events.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Events

Event callbacks live in a process-wide registry keyed by a view's
integer tag and the event name. The
[`Reconciler`][pythonnative.reconciler.Reconciler] writes to it during a
commit; platform handlers read from it when a native widget fires.

::: pythonnative.events
options:
show_root_heading: false
show_root_toc_entry: false
members_order: source
filters: ["!^_"]

## Next steps

- See what carries the remaining, non-callable props in
[Mutation ops](mutations.md).
- See how handlers wire a platform listener once, at creation, in
[Native views](native_views.md).
- Read the other Python-side store the native layer reads on demand in
[Platform metrics](platform_metrics.md).
- Follow a full commit end to end in
[Reconciliation](../concepts/reconciliation.md).
25 changes: 25 additions & 0 deletions docs/api/mutations.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Mutation ops

Five record types describe every change to the native view tree:
create, update, insert, destroy, and set frame. The
[`Reconciler`][pythonnative.reconciler.Reconciler] emits them; the
[`NativeViewRegistry`][pythonnative.native_views.NativeViewRegistry]
applies them.

::: pythonnative.mutations
options:
show_root_heading: false
show_root_toc_entry: false
members_order: source
filters: ["!^_"]

## Next steps

- See where the callables stripped from these payloads go in
[Events](events.md).
- See how each op is applied to a concrete widget in
[Native views](native_views.md).
- Read what handlers size themselves against in
[Platform metrics](platform_metrics.md).
- Read the diffing pass that produces these lists in
[Reconciliation](../concepts/reconciliation.md).
24 changes: 10 additions & 14 deletions docs/api/native_views.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Native views

The bridge between PythonNative's element tree and concrete native
widgets. Each commit's diff is expressed as a flat list of mutation
ops referencing integer tags, applied through a single
widgets. Each commit's diff is expressed as a flat list of
[mutation ops](mutations.md) referencing integer tags, applied through a
single
[`apply_mutations`][pythonnative.native_views.NativeViewRegistry.apply_mutations]
call. Every element type maps to a
[`ViewHandler`][pythonnative.native_views.base.ViewHandler]
Expand All @@ -20,21 +21,12 @@ the platform-specific handlers are registered lazily so importing

## Mutation ops

::: pythonnative.mutations
options:
show_root_heading: false
show_root_toc_entry: false
members_order: source
filters: ["!^_"]
The op types themselves are documented in [Mutation ops](mutations.md).

## Event routing

::: pythonnative.events
options:
show_root_heading: false
show_root_toc_entry: false
members_order: source
filters: ["!^_"]
The registry and its dispatch entry point are documented in
[Events](events.md).

## Base classes

Expand All @@ -59,3 +51,7 @@ the platform-specific handlers are registered lazily so importing
- Read the high-level model in
[Native views (concept)](../concepts/native-views.md).
- See how the reconciler drives handlers in [Reconciler](reconciler.md).
- Read the op vocabulary handlers apply in [Mutation ops](mutations.md).
- Read the callback registry handlers dispatch into in [Events](events.md).
- Read the values handlers size themselves against in
[Platform metrics](platform_metrics.md).
29 changes: 29 additions & 0 deletions docs/api/platform_metrics.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Platform metrics

A small process-wide store for values only the screen host can observe:
safe-area insets, viewport size, and keyboard height. The host publishes
them as the platform reports changes, and view handlers read them on
demand instead of receiving them through every measurement call.
Everything here is in layout units, points on iOS and
density-independent pixels on Android, so the values add directly to
other layout-unit values without conversion. Most app code reaches this
indirectly, through
[`use_safe_area_insets`][pythonnative.use_safe_area_insets] and
[`use_window_dimensions`][pythonnative.use_window_dimensions].

::: pythonnative.platform_metrics
options:
show_root_heading: false
show_root_toc_entry: false
members_order: source
filters: ["!^_"]

## Next steps

- See the handlers that read these values in
[Native views](native_views.md).
- See the ops that position a view once it's measured in
[Mutation ops](mutations.md).
- See the other Python-side registry the native layer talks to in
[Events](events.md).
- Use the hooks that wrap these in [Hooks](hooks.md).
3 changes: 3 additions & 0 deletions docs/api/pythonnative.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ The reference is split per module so each page stays scannable:
| Reconciler | [Reconciler](reconciler.md) | [`Reconciler`][pythonnative.reconciler.Reconciler] |
| Native modules | [Native modules](native_modules.md) | `Camera`, `Location`, `FileSystem`, `Notifications` |
| Native views | [Native views](native_views.md) | [`NativeViewRegistry`][pythonnative.native_views.NativeViewRegistry], [`ViewHandler`][pythonnative.native_views.base.ViewHandler] |
| Mutation ops | [Mutation ops](mutations.md) | [`CreateOp`][pythonnative.mutations.CreateOp], [`UpdateOp`][pythonnative.mutations.UpdateOp], [`InsertOp`][pythonnative.mutations.InsertOp], [`DestroyOp`][pythonnative.mutations.DestroyOp], [`SetFrameOp`][pythonnative.mutations.SetFrameOp] |
| Event routing | [Events](events.md) | [`EventRegistry`][pythonnative.events.EventRegistry], [`dispatch_event`][pythonnative.events.dispatch_event], [`extract_events`][pythonnative.events.extract_events] |
| Platform metrics | [Platform metrics](platform_metrics.md) | [`SafeAreaInsets`][pythonnative.platform_metrics.SafeAreaInsets], [`WindowDimensions`][pythonnative.platform_metrics.WindowDimensions], [`subscribe`][pythonnative.platform_metrics.subscribe] |
| Hot reload | [Hot reload](hot_reload.md) | [`FileWatcher`][pythonnative.hot_reload.FileWatcher], [`ModuleReloader`][pythonnative.hot_reload.ModuleReloader] |
| Diagnostics | [Diagnostics](diagnostics.md) | [`HookOrderError`][pythonnative.HookOrderError], [`warn`][pythonnative.diagnostics.warn], [`is_dev`][pythonnative.diagnostics.is_dev], [`report_error`][pythonnative.diagnostics.report_error] |
| Custom components SDK | [SDK](sdk.md) | [`Props`][pythonnative.sdk._components.Props], [`ViewHandler`][pythonnative.native_views.base.ViewHandler], [`native_component`][pythonnative.sdk._components.native_component], [`register_component`][pythonnative.sdk._components.register_component], [`element_factory`][pythonnative.sdk._components.element_factory] |
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ nav:
- Navigation: api/navigation.md
- Native modules: api/native_modules.md
- Native views: api/native_views.md
- Mutation ops: api/mutations.md
- Events: api/events.md
- Platform metrics: api/platform_metrics.md
- SDK: api/sdk.md
- Hot reload: api/hot_reload.md
- Diagnostics: api/diagnostics.md
Expand Down
13 changes: 8 additions & 5 deletions src/pythonnative/platform_metrics.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,15 @@ def reset_keyboard_height() -> None:
# that natural height. Forcing our own height threw off the pill
# geometry, so the Android handler defers entirely to the system.

#: UIKit HIG tab-bar content height in points. The total bar reaches
#: ``IOS_TAB_BAR_BASE_HEIGHT_PT + safe_area_insets.bottom`` so the
#: pill background can extend over the home indicator. Apple's HIG
#: places the tab bar flush with the screen edge and lets UIKit
#: render its own internal padding for the home indicator.
IOS_TAB_BAR_BASE_HEIGHT_PT: float = 49.0
"""UIKit HIG tab-bar content height in points.

The total bar reaches ``IOS_TAB_BAR_BASE_HEIGHT_PT +
safe_area_insets.bottom`` so the pill background can extend over the
home indicator. Apple's HIG places the tab bar flush with the screen
edge and lets UIKit render its own internal padding for the home
indicator.
"""


def ios_tab_bar_height() -> float:
Expand Down
Loading

Back | FazBrowse Home | New Git URL