===== view.generated.mbt =====
// Generated by selene-xaml@0.37.3. DO NOT EDIT.
// input user fixtures/path.xaml sha256=7e3ac25bdf3160b37d84323d9097488d11a7689442172d27f117b0cc68d02c0c
// input moon-info fixtures/model.mbti sha256=eeaffdc444e675598699272abcb0db972352876e05a5fa605e14a164cb184add

///|
type PathState = @model.PathState

///|
pub(all) enum PathViewAction {} derive(Eq, Debug)

///|
#warnings("-unused_value")
fn generated_rect_component(
  value : String,
  index : Int,
  path : String,
  image_region : Bool,
  corner_radius : Bool,
  non_negative : Bool,
) -> Double raise {
  @xaml_view.generated_view_rect_component(
    value,
    index,
    path,
    image_region,
    corner_radius~,
    non_negative~,
  )
}

///|
#warnings("-unused_value")
fn generated_image_drop_shadow(
  value : String,
  path : String,
) -> @xaml_view.ImageDropShadow? raise {
  @xaml_view.generated_view_image_drop_shadow(value, path)
}

///|
#warnings("-struct_never_constructed")
pub struct PathView {}

///|
let generated_runtime : @xaml_view.GeneratedViewRuntime[
  PathState,
  PathViewAction,
] = @xaml_view.GeneratedViewRuntime::new(generated_handle_event)

///|
/// World-isolated typed actions emitted by this view.
pub let action_event_bus : @event.Events[
  @xaml_view.GeneratedViewAction[PathViewAction],
] = generated_runtime.action_events()

///|
/// ViewModel components mounted by this View in the current World.
pub fn PathView::view_models() -> Map[@entity.Entity, PathState] {
  generated_runtime.view_models()
}

///|
#warnings("-unused_error_type")
fn generated_specs(state : PathState) -> Array[@xaml_view.NodeSpec] raise {
  let nodes : Array[@xaml_view.NodeSpec] = []
  nodes.push({
    key: "node-root-view",
    parent: None,
    kind: @xaml_view.NodeKind::View,
    text: "",
    spans: [],
    source: "",
    path_geometry: None,
    active: true,
    enabled: true,
    focusable: false,
    tab_index: 0,
    focus_scope: false,
    auto_focus: false,
    navigation_up: "",
    navigation_down: "",
    navigation_left: "",
    navigation_right: "",
    automation_name: "",
    style: { ..@xaml_view.NodeStyle::default() },
    visual_state_groups: [],
  })
  nodes.push({
    key: "mark",
    parent: Some("node-root-view"),
    kind: @xaml_view.NodeKind::PathIcon,
    text: "",
    spans: [],
    source: "",
    path_geometry: Some({
      commands: [
        @xaml_view.PathCommand2D::MoveTo(@math.Vec2(0, 0)),
        @xaml_view.PathCommand2D::LineTo(@math.Vec2(8, 0)),
        @xaml_view.PathCommand2D::QuadraticTo(
          @math.Vec2(10, 4),
          @math.Vec2(8, 8),
        ),
        @xaml_view.PathCommand2D::CubicTo(
          @math.Vec2(6, 10),
          @math.Vec2(2, 10),
          @math.Vec2(0, 8),
        ),
        @xaml_view.PathCommand2D::Close,
      ],
      bounds_position: @math.Vec2(0, 0),
      bounds_size: @math.Vec2(10, 10),
    }),
    active: true,
    enabled: true,
    focusable: false,
    tab_index: 0,
    focus_scope: false,
    auto_focus: false,
    navigation_up: "",
    navigation_down: "",
    navigation_left: "",
    navigation_right: "",
    automation_name: "Selected page",
    style: {
      ..@xaml_view.NodeStyle::default(),
      width: @xaml_view.LayoutValue::Px(16),
      height: @xaml_view.LayoutValue::Px(16),
      color: "#f0a040",
      stroke_width: 1.5,
      path_stretch: @xaml_view.PathStretch2D::Uniform,
      horizontal_alignment: Some(@xaml_view.AlignItems::Center),
    },
    visual_state_groups: [
      {
        order: 0,
        name: "Selection",
        current: "",
        interaction: true,
        states: [
          {
            name: "Selected",
            setters: [
              {
                target: "mark",
                property: "Color",
                value: @xaml_view.VisualStateValue::StringValue("#ffffff"),
              },
              {
                target: "mark",
                property: "StrokeWidth",
                value: @xaml_view.VisualStateValue::DoubleValue(2),
              },
            ],
          },
        ],
        transitions: [],
      },
    ],
  })
  nodes
}

///|
/// Mounts this view on an alive root entity in the current world.
/// Destroying the root ends the view lifetime.
pub fn PathView::mount(
  entity : @entity.Entity,
  view_model : PathState,
) -> Unit raise {
  let desired = generated_specs(view_model)
  generated_runtime.mount(entity, view_model, desired)
}

///|
/// Releases this View while leaving its caller-owned root entity alive.
pub fn PathView::unmount(entity : @entity.Entity) -> Unit raise {
  generated_runtime.unmount(entity)
}

///|
/// Refreshes the complete presentation from the current ViewModel component.
pub fn PathView::refresh(entity : @entity.Entity) -> Unit raise {
  let view_model = generated_runtime.view_model(entity)
  let desired = generated_specs(view_model)
  generated_runtime.refresh(entity, desired)
}

///|
/// Reconciles this mounted View with a new ViewModel.
pub fn PathView::replace(
  entity : @entity.Entity,
  view_model : PathState,
) -> Unit raise {
  let desired = generated_specs(view_model)
  generated_runtime.replace(entity, view_model, desired)
}

///|
#warnings("-unused_value")
fn generated_handle_event(
  view_model : PathState,
  event : @xaml_view.UiEvent,
) -> PathViewAction? {
  None
}

///|
/// Installs this View below a root generated View that owns the shared host.
pub fn component_plugin(app : @app.App) -> @app.App {
  generated_runtime.install_component(app, "selene_xaml_PathView_events")
}

///|
/// Installs the shared host and this View package component tree.
pub fn plugin(app : @app.App) -> @app.App {
  app.add_plugin(@xaml_view.plugin).add_plugin(component_plugin)
}

