===== default/view.generated.mbt =====
// Generated by selene-xaml@0.37.3. DO NOT EDIT.
// input user fixtures/properties.xaml sha256=90d3af232402bd54330d26388c05a0fbb213ee381e36d9e0992843beebe68265
// input moon-info fixtures/model.mbti sha256=7afc0e41a3aed65ab3b5331702d5f0cd8895285c954d2b1e475da41a58243030

///|
type DemoState = @model.DemoState

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

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

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

///|
#warnings("-unused_error_type")
fn generated_specs(state : DemoState) -> Array[@xaml_view.NodeSpec] raise {
  let nodes : Array[@xaml_view.NodeSpec] = []
  nodes.push({
    key: "root",
    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-flex",
    parent: Some("root"),
    kind: @xaml_view.NodeKind::Flex,
    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(),
      direction: @xaml_view.FlexDirection::RowReverse,
    },
    visual_state_groups: [],
  })
  nodes.push({
    key: "node-root-0/0-text",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Text,
    text: state.title,
    spans: [
      {
        text: "!",
        color: "",
        font_family: "",
        font_size: 0.0,
        font_weight: Some(@xaml_view.FontWeight::bold()),
        line_height: Some(1.75),
        letter_spacing: Some(2),
        underline: true,
      },
    ],
    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(),
      font_weight: @xaml_view.FontWeight::semi_bold(),
      align: @xaml_view.TextAlign::Center,
      wrap: true,
      line_height: 1.5,
      letter_spacing: 0.75,
      text_overflow: @xaml_view.TextOverflow::Ellipsis,
    },
    visual_state_groups: [
      {
        order: 0,
        name: "Emphasis",
        current: "",
        interaction: true,
        states: [
          {
            name: "Quiet",
            setters: [
              {
                target: "node-root-0/0-text",
                property: "FontWeight",
                value: @xaml_view.VisualStateValue::FontWeightValue(
                  @xaml_view.FontWeight::medium(),
                ),
              },
            ],
          },
        ],
        transitions: [],
      },
    ],
  })
  nodes.push({
    key: "node-root-0/1-image",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Image,
    text: "",
    spans: [],
    source: "icon.png",
    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(),
      tint: "#80ff40",
      source_region: Some({
        position: @math.Vec2(128, 64),
        size: @math.Vec2(32, 24),
      }),
      fit: @xaml_view.ImageFit::Fill,
      sampler: @xaml_view.ImageSampler::Nearest,
    },
    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 DemoView::mount(
  entity : @entity.Entity,
  view_model : DemoState,
) -> 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 DemoView::unmount(entity : @entity.Entity) -> Unit raise {
  generated_runtime.unmount(entity)
}

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

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

===== fit-none/view.generated.mbt =====
// Generated by selene-xaml@0.37.3. DO NOT EDIT.
// input user fixtures/properties.xaml sha256=c9a23c40bb9df773f95a6be0102f716618f62e94b6a7b667cb725a6a8633ff09
// input moon-info fixtures/model.mbti sha256=7afc0e41a3aed65ab3b5331702d5f0cd8895285c954d2b1e475da41a58243030

///|
type DemoState = @model.DemoState

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

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

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

///|
#warnings("-unused_error_type")
fn generated_specs(state : DemoState) -> Array[@xaml_view.NodeSpec] raise {
  let nodes : Array[@xaml_view.NodeSpec] = []
  nodes.push({
    key: "root",
    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-flex",
    parent: Some("root"),
    kind: @xaml_view.NodeKind::Flex,
    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(),
      direction: @xaml_view.FlexDirection::RowReverse,
    },
    visual_state_groups: [],
  })
  nodes.push({
    key: "node-root-0/0-text",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Text,
    text: state.title,
    spans: [
      {
        text: "!",
        color: "",
        font_family: "",
        font_size: 0.0,
        font_weight: Some(@xaml_view.FontWeight::bold()),
        line_height: Some(1.75),
        letter_spacing: Some(2),
        underline: true,
      },
    ],
    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(),
      font_weight: @xaml_view.FontWeight::semi_bold(),
      align: @xaml_view.TextAlign::Center,
      wrap: true,
      line_height: 1.5,
      letter_spacing: 0.75,
      text_overflow: @xaml_view.TextOverflow::Ellipsis,
    },
    visual_state_groups: [
      {
        order: 0,
        name: "Emphasis",
        current: "",
        interaction: true,
        states: [
          {
            name: "Quiet",
            setters: [
              {
                target: "node-root-0/0-text",
                property: "FontWeight",
                value: @xaml_view.VisualStateValue::FontWeightValue(
                  @xaml_view.FontWeight::medium(),
                ),
              },
            ],
          },
        ],
        transitions: [],
      },
    ],
  })
  nodes.push({
    key: "node-root-0/1-image",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Image,
    text: "",
    spans: [],
    source: "icon.png",
    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(),
      tint: "#80ff40",
      source_region: Some({
        position: @math.Vec2(128, 64),
        size: @math.Vec2(32, 24),
      }),
      fit: @xaml_view.ImageFit::None,
      sampler: @xaml_view.ImageSampler::Nearest,
    },
    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 DemoView::mount(
  entity : @entity.Entity,
  view_model : DemoState,
) -> 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 DemoView::unmount(entity : @entity.Entity) -> Unit raise {
  generated_runtime.unmount(entity)
}

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

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

===== constrained/view.generated.mbt =====
// Generated by selene-xaml@0.37.3. DO NOT EDIT.
// input user fixtures/properties.xaml sha256=89ec030c8dc8dfec0862e88f42a2cf8fe1af94f2131b56211ff88b5478309432
// input moon-info fixtures/model.mbti sha256=7afc0e41a3aed65ab3b5331702d5f0cd8895285c954d2b1e475da41a58243030

///|
type DemoState = @model.DemoState

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

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

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

///|
#warnings("-unused_error_type")
fn generated_specs(state : DemoState) -> Array[@xaml_view.NodeSpec] raise {
  let nodes : Array[@xaml_view.NodeSpec] = []
  nodes.push({
    key: "root",
    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(),
      min_width: @xaml_view.LayoutValue::Px(320),
    },
    visual_state_groups: [],
  })
  nodes.push({
    key: "node-root-0-flex",
    parent: Some("root"),
    kind: @xaml_view.NodeKind::Flex,
    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(),
      direction: @xaml_view.FlexDirection::RowReverse,
    },
    visual_state_groups: [],
  })
  nodes.push({
    key: "node-root-0/0-text",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Text,
    text: state.title,
    spans: [
      {
        text: "!",
        color: "",
        font_family: "",
        font_size: 0.0,
        font_weight: Some(@xaml_view.FontWeight::bold()),
        line_height: Some(1.75),
        letter_spacing: Some(2),
        underline: true,
      },
    ],
    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(),
      font_weight: @xaml_view.FontWeight::semi_bold(),
      align: @xaml_view.TextAlign::Center,
      wrap: true,
      line_height: 1.5,
      letter_spacing: 0.75,
      text_overflow: @xaml_view.TextOverflow::Ellipsis,
    },
    visual_state_groups: [
      {
        order: 0,
        name: "Emphasis",
        current: "",
        interaction: true,
        states: [
          {
            name: "Quiet",
            setters: [
              {
                target: "node-root-0/0-text",
                property: "FontWeight",
                value: @xaml_view.VisualStateValue::FontWeightValue(
                  @xaml_view.FontWeight::medium(),
                ),
              },
            ],
          },
        ],
        transitions: [],
      },
    ],
  })
  nodes.push({
    key: "node-root-0/1-image",
    parent: Some("node-root-0-flex"),
    kind: @xaml_view.NodeKind::Image,
    text: "",
    spans: [],
    source: "icon.png",
    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(),
      tint: "#80ff40",
      source_region: Some({
        position: @math.Vec2(128, 64),
        size: @math.Vec2(32, 24),
      }),
      fit: @xaml_view.ImageFit::Fill,
      sampler: @xaml_view.ImageSampler::Nearest,
    },
    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 DemoView::mount(
  entity : @entity.Entity,
  view_model : DemoState,
) -> 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 DemoView::unmount(entity : @entity.Entity) -> Unit raise {
  generated_runtime.unmount(entity)
}

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

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

