fix broken links
This commit is contained in:
@@ -128,7 +128,7 @@ rsx! {
|
|||||||
|
|
||||||
Beyond `crossterm` events, you can define and dispatch your own custom event types using the `event!` macro. This is useful for communication between different parts of your application or custom extensions.
|
Beyond `crossterm` events, you can define and dispatch your own custom event types using the `event!` macro. This is useful for communication between different parts of your application or custom extensions.
|
||||||
|
|
||||||
See the [Advanced: Custom Events](../advanced/custom_events.md) guide for details.
|
See the [Advanced: Custom Events](/docs/advanced/custom_events.md) guide for details.
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
|
|||||||
@@ -105,10 +105,10 @@ Once registered, the `Screen` will call the appropriate lifecycle methods of you
|
|||||||
|
|
||||||
OSUI comes with several useful built-in extensions:
|
OSUI comes with several useful built-in extensions:
|
||||||
|
|
||||||
* [`InputExtension`](../reference/extensions_api.md#inputextension): Handles keyboard input and dispatches `crossterm::event::Event`s. **Crucial for interactive applications.**
|
* [`InputExtension`](/docs/reference/extensions_api.md#inputextension): Handles keyboard input and dispatches `crossterm::event::Event`s. **Crucial for interactive applications.**
|
||||||
* [`TickExtension`](../reference/extensions_api.md#tickextension): Dispatches `TickEvent`s at a specified rate, useful for animations or periodic updates.
|
* [`TickExtension`](/docs/reference/extensions_api.md#tickextension): Dispatches `TickEvent`s at a specified rate, useful for animations or periodic updates.
|
||||||
* [`VelocityExtension`](../reference/extensions_api.md#velocityextension): Automatically updates the `Transform` of widgets that have a `Velocity` component, causing them to move.
|
* [`VelocityExtension`](/docs/reference/extensions_api.md#velocityextension): Automatically updates the `Transform` of widgets that have a `Velocity` component, causing them to move.
|
||||||
* [`IdExtension`](../reference/extensions_api.md#idextension): Provides a way to retrieve specific widgets by a unique `Id` component. (Note: The current `IdExtension` implementation only *stores* a screen reference but doesn't actively do anything unless you manually call its `get_element` method.)
|
* [`IdExtension`](/docs/reference/extensions_api.md#idextension): Provides a way to retrieve specific widgets by a unique `Id` component. (Note: The current `IdExtension` implementation only *stores* a screen reference but doesn't actively do anything unless you manually call its `get_element` method.)
|
||||||
|
|
||||||
You use these built-in extensions by simply calling `screen.extension(...)` with an instance of them, just like `MyLoggerExtension`.
|
You use these built-in extensions by simply calling `screen.extension(...)` with an instance of them, just like `MyLoggerExtension`.
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ The central component for defining layout rules. It encapsulates all the propert
|
|||||||
* `px: u16`, `py: u16`: **Padding** - internal space between the element's border and its content/children. This increases the overall size of the element.
|
* `px: u16`, `py: u16`: **Padding** - internal space between the element's border and its content/children. This increases the overall size of the element.
|
||||||
* `mx: i32`, `my: i32`: **Margin** - an offset applied *after* the element's position is calculated. This creates space *around* the element relative to its parent's edges. Can be negative for overlap.
|
* `mx: i32`, `my: i32`: **Margin** - an offset applied *after* the element's position is calculated. This creates space *around* the element relative to its parent's edges. Can be negative for overlap.
|
||||||
|
|
||||||
(See [Reference: Style API - Transform](./../reference/style_api.md#transform-component) for full details)
|
(See [Reference: Style API - Transform](.//docs/reference/style_api.md#transform-component) for full details)
|
||||||
|
|
||||||
### `Position` Enum
|
### `Position` Enum
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ Determines the `x` or `y` coordinate.
|
|||||||
* `Center`: Centers the element within the parent's available space on that axis.
|
* `Center`: Centers the element within the parent's available space on that axis.
|
||||||
* `End`: Aligns the element to the right or bottom edge of the parent.
|
* `End`: Aligns the element to the right or bottom edge of the parent.
|
||||||
|
|
||||||
(See [Reference: Style API - Position](./../reference/style_api.md#position-enum) for full details)
|
(See [Reference: Style API - Position](.//docs/reference/style_api.md#position-enum) for full details)
|
||||||
|
|
||||||
### `Dimension` Enum
|
### `Dimension` Enum
|
||||||
|
|
||||||
@@ -42,13 +42,13 @@ Determines the `width` or `height`.
|
|||||||
* `Content`: Sizes itself to fit its content (text) or children. This is dynamic.
|
* `Content`: Sizes itself to fit its content (text) or children. This is dynamic.
|
||||||
* `Const(u16)`: Fixed size in terminal cells.
|
* `Const(u16)`: Fixed size in terminal cells.
|
||||||
|
|
||||||
(See [Reference: Style API - Dimension](./../reference/style_api.md#dimension-enum) for full details)
|
(See [Reference: Style API - Dimension](.//docs/reference/style_api.md#dimension-enum) for full details)
|
||||||
|
|
||||||
### `RawTransform` Struct
|
### `RawTransform` Struct
|
||||||
|
|
||||||
This is the internal, resolved representation of a `Transform`. After all calculations, a `Transform`'s declarative rules are converted into a `RawTransform` with concrete `u16` values for `x`, `y`, `width`, `height`, `px`, `py`. This `RawTransform` is then used by the `RenderScope` for actual drawing.
|
This is the internal, resolved representation of a `Transform`. After all calculations, a `Transform`'s declarative rules are converted into a `RawTransform` with concrete `u16` values for `x`, `y`, `width`, `height`, `px`, `py`. This `RawTransform` is then used by the `RenderScope` for actual drawing.
|
||||||
|
|
||||||
(See [Reference: Style API - RawTransform](./../reference/style_api.md#rawtransform-struct) for full details)
|
(See [Reference: Style API - RawTransform](.//docs/reference/style_api.md#rawtransform-struct) for full details)
|
||||||
|
|
||||||
## Layout Calculation Flow (Simplified)
|
## Layout Calculation Flow (Simplified)
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ OSUI automates this process. When a `State<T>` value is modified, any `DynWidget
|
|||||||
* `**my_state.get() = new_value` (or `my_state.get().deref_mut().field = new_value`): Mutates the value directly through a `MutexGuard`. The `DerefMut` implementation automatically marks the state as changed by setting `inner.changed = inner.dependencies`.
|
* `**my_state.get() = new_value` (or `my_state.get().deref_mut().field = new_value`): Mutates the value directly through a `MutexGuard`. The `DerefMut` implementation automatically marks the state as changed by setting `inner.changed = inner.dependencies`.
|
||||||
* **Dependency Tracking**: Implements the `DependencyHandler` trait, allowing `DynWidget`s to register themselves.
|
* **Dependency Tracking**: Implements the `DependencyHandler` trait, allowing `DynWidget`s to register themselves.
|
||||||
|
|
||||||
(See [Reference: State API](../reference/state_api.md) for more details)
|
(See [Reference: State API](/docs/reference/state_api.md) for more details)
|
||||||
|
|
||||||
### 2. `DependencyHandler` Trait
|
### 2. `DependencyHandler` Trait
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ A trait that `State<T>` (and potentially other future reactive types) implements
|
|||||||
* `add()`: Called when a `DynWidget` first registers itself as a listener to this dependency. It increments an internal counter of listeners.
|
* `add()`: Called when a `DynWidget` first registers itself as a listener to this dependency. It increments an internal counter of listeners.
|
||||||
* `check()`: Called by `DynWidget` during its `auto_refresh` cycle. It decrements the `changed` counter and returns `true` if there are still pending changes to be processed by a listener. This ensures each listener processes a change only once per update cycle.
|
* `check()`: Called by `DynWidget` during its `auto_refresh` cycle. It decrements the `changed` counter and returns `true` if there are still pending changes to be processed by a listener. This ensures each listener processes a change only once per update cycle.
|
||||||
|
|
||||||
(See [Reference: State API - DependencyHandler Trait](../reference/state_api.md#dependencyhandler-trait) for more details)
|
(See [Reference: State API - DependencyHandler Trait](/docs/reference/state_api.md#dependencyhandler-trait) for more details)
|
||||||
|
|
||||||
### 3. `DynWidget`: The Reactive Widget Wrapper
|
### 3. `DynWidget`: The Reactive Widget Wrapper
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ A trait that `State<T>` (and potentially other future reactive types) implements
|
|||||||
* `refresh()`: Forces the widget to rebuild immediately by re-executing its creation closure.
|
* `refresh()`: Forces the widget to rebuild immediately by re-executing its creation closure.
|
||||||
* `auto_refresh()`: The core of reactivity. It iterates through all registered `DependencyHandler`s. If `handler.check()` returns `true` for any of them, it calls `refresh()` to rebuild the widget.
|
* `auto_refresh()`: The core of reactivity. It iterates through all registered `DependencyHandler`s. If `handler.check()` returns `true` for any of them, it calls `refresh()` to rebuild the widget.
|
||||||
|
|
||||||
(See [Reference: Widget API - DynWidget Struct](../reference/widget_api.md#dynwidget-struct) for more details)
|
(See [Reference: Widget API - DynWidget Struct](/docs/reference/widget_api.md#dynwidget-struct) for more details)
|
||||||
|
|
||||||
## How Reactive Updates Work in Practice
|
## How Reactive Updates Work in Practice
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ The orchestrator. It holds the list of top-level `Widget`s, manages extensions,
|
|||||||
* Iterates through top-level widgets, initiating their rendering.
|
* Iterates through top-level widgets, initiating their rendering.
|
||||||
* Calls `Extension::on_close` and restores terminal state on shutdown.
|
* Calls `Extension::on_close` and restores terminal state on shutdown.
|
||||||
|
|
||||||
(See [Reference: Screen API](../reference/screen_api.md) for more details)
|
(See [Reference: Screen API](/docs/reference/screen_api.md) for more details)
|
||||||
|
|
||||||
### 2. `Widget` (`Arc<Widget>`)
|
### 2. `Widget` (`Arc<Widget>`)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ The container for an `Element` and its `Component`s. It's the unit passed around
|
|||||||
* `DynWidget`: Its `Element` can be re-instantiated (rebuilt) if its dependencies change. This rebuild happens *before* its `render` method is called in a subsequent frame.
|
* `DynWidget`: Its `Element` can be re-instantiated (rebuilt) if its dependencies change. This rebuild happens *before* its `render` method is called in a subsequent frame.
|
||||||
* Provides access to its `Element` (`get_elem()`) and `Component`s (`get()`, `set_component()`).
|
* Provides access to its `Element` (`get_elem()`) and `Component`s (`get()`, `set_component()`).
|
||||||
|
|
||||||
(See [Reference: Widget API](../reference/widget_api.md) for more details)
|
(See [Reference: Widget API](/docs/reference/widget_api.md) for more details)
|
||||||
|
|
||||||
### 3. `Element` (`Box<dyn Element>`)
|
### 3. `Element` (`Box<dyn Element>`)
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ The drawing context for a single element. It's a mutable structure that holds:
|
|||||||
* `clear()`: Resets the scope for the next element.
|
* `clear()`: Resets the scope for the next element.
|
||||||
* `set_parent_size()`: Crucial for container elements to establish the bounding box for their children.
|
* `set_parent_size()`: Crucial for container elements to establish the bounding box for their children.
|
||||||
|
|
||||||
(See [Reference: RenderScope API](../reference/render_scope_api.md) for more details)
|
(See [Reference: RenderScope API](/docs/reference/render_scope_api.md) for more details)
|
||||||
|
|
||||||
### 5. `Transform` and `Style` Components
|
### 5. `Transform` and `Style` Components
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ These components, attached to a `Widget`, provide the declarative rules for layo
|
|||||||
* `Transform`: Contains `Position` and `Dimension` rules, plus `margin` and `padding`. These are resolved into `RawTransform` by `RenderScope`.
|
* `Transform`: Contains `Position` and `Dimension` rules, plus `margin` and `padding`. These are resolved into `RawTransform` by `RenderScope`.
|
||||||
* `Style`: Contains `Background` and `foreground` color. Applied to `RenderScope`.
|
* `Style`: Contains `Background` and `foreground` color. Applied to `RenderScope`.
|
||||||
|
|
||||||
(See [Reference: Style API](../reference/style_api.md) for more details)
|
(See [Reference: Style API](/docs/reference/style_api.md) for more details)
|
||||||
|
|
||||||
### 6. `Extension`s
|
### 6. `Extension`s
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ Extensions are hooks into the pipeline.
|
|||||||
|
|
||||||
* `Extension::render_widget(scope, widget)`: Called for each top-level widget *before* its `Element::render`. Allows extensions to inspect or modify the `RenderScope` or widget before rendering.
|
* `Extension::render_widget(scope, widget)`: Called for each top-level widget *before* its `Element::render`. Allows extensions to inspect or modify the `RenderScope` or widget before rendering.
|
||||||
|
|
||||||
(See [Reference: Extensions API](../reference/extensions_api.md) for more details)
|
(See [Reference: Extensions API](/docs/reference/extensions_api.md) for more details)
|
||||||
|
|
||||||
## Flow Diagram (Conceptual)
|
## Flow Diagram (Conceptual)
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ OSUI uses a few internal components to control rendering behavior:
|
|||||||
|
|
||||||
* `NoRender`: If a widget has this component, the `Screen`'s main rendering loop will skip rendering it directly. This is typically used for widgets that are managed and rendered by their parent `Element::after_render` method.
|
* `NoRender`: If a widget has this component, the `Screen`'s main rendering loop will skip rendering it directly. This is typically used for widgets that are managed and rendered by their parent `Element::after_render` method.
|
||||||
* `NoRenderRoot`: Similar to `NoRender`, but specifically signals that the widget is a child being managed by a parent element, preventing the `Screen` from considering it a top-level root widget for direct rendering.
|
* `NoRenderRoot`: Similar to `NoRender`, but specifically signals that the widget is a child being managed by a parent element, preventing the `Screen` from considering it a top-level root widget for direct rendering.
|
||||||
* `Handler<E>`: (Described in [Handling Input](/docs/guides/handling_input.md) and [Extensions API](../reference/extensions_api.md)) Enables widgets to subscribe to specific event types.
|
* `Handler<E>`: (Described in [Handling Input](/docs/guides/handling_input.md) and [Extensions API](/docs/reference/extensions_api.md)) Enables widgets to subscribe to specific event types.
|
||||||
|
|
||||||
## Usage Patterns
|
## Usage Patterns
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user