===== moon.pkg =====
import {
  "example/reveal/model",
  "KKKIIO/selene/app",
  "KKKIIO/selene/entity",
  "KKKIIO/selene/event",
  "KKKIIO/selene/xaml_view",
}

supported_targets = "native+js"

===== view.generated.mbt =====
// Generated by selene-xaml@0.37.3. DO NOT EDIT.
// input user fixtures/reveal.xaml sha256=f3b5767d4715e7d45c75e7ca53c73e568183b64ab47c13d15bf236f959bca396
// input moon-info fixtures/reveal.mbti sha256=be2a876719a67f35a5e7750b7f8213242dba7e406621cdf00dad2939a9cde3cf

///|
type RevealState = @model.RevealState

///|
pub(all) enum RevealViewAction {} 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 RevealView {}

///|
let generated_runtime : @xaml_view.GeneratedViewRuntime[
  RevealState,
  RevealViewAction,
] = @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[RevealViewAction],
] = generated_runtime.action_events()

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

///|
#warnings("-unused_error_type")
fn generated_specs(state : RevealState) -> 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: "node-root-0-scroll-view",
    parent: Some("node-root-view"),
    kind: @xaml_view.NodeKind::ScrollView,
    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(),
      vertical_scroll: true,
      bring_into_view_on_focus_change: true,
    },
    visual_state_groups: [],
  })
  nodes.push({
    key: "node-root-1-scroll-view",
    parent: Some("node-root-view"),
    kind: @xaml_view.NodeKind::ScrollView,
    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(),
      horizontal_scroll: true,
      focus_reveal_margin: state.reveal_margin,
      bring_into_view_on_focus_change: false,
    },
    visual_state_groups: [],
  })
  nodes
}

///|
/// Mounts this view on an alive root entity in the current world.
/// Destroying the root ends the view lifetime.
pub fn RevealView::mount(
  entity : @entity.Entity,
  view_model : RevealState,
) -> 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 RevealView::unmount(entity : @entity.Entity) -> Unit raise {
  generated_runtime.unmount(entity)
}

///|
/// Refreshes the complete presentation from the current ViewModel component.
pub fn RevealView::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 RevealView::replace(
  entity : @entity.Entity,
  view_model : RevealState,
) -> Unit raise {
  let desired = generated_specs(view_model)
  generated_runtime.replace(entity, view_model, desired)
}

///|
#warnings("-unused_value")
fn generated_handle_event(
  view_model : RevealState,
  event : @xaml_view.UiEvent,
) -> RevealViewAction? {
  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_RevealView_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)
}

===== view.generated.mbt.map.json =====
{
  "mappings": [
    {
      "source": "fixtures/reveal.xaml",
      "original_offset": 237,
      "generated_offset": 3358,
      "length": 19
    }
  ]
}

