// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

use std::sync::Arc;

use super::button::Button;
use super::container::Container;
use super::element::Element;
use super::external::{ External, ExternalSource };
use super::image::Image;
use super::text::Text;
use super::text_edit::TextEdit;

pub fn button<Msg: Clone>( label: impl Into<String> ) -> Button<Msg>
{
	Button::new( label.into() )
}

pub fn icon_button<Msg: Clone>( rgba: Arc<Vec<u8>>, img_w: u32, img_h: u32 ) -> Button<Msg>
{
	Button::new_icon( rgba, img_w, img_h )
}

pub fn text_edit<Msg: Clone>(
	placeholder: impl Into<String>,
	value: impl Into<String>,
) -> TextEdit<Msg>
{
	TextEdit::new( placeholder.into(), value.into() )
}

pub fn image( rgba: Arc<Vec<u8>>, width: u32, height: u32 ) -> Image
{
	Image::new( rgba, width, height )
}

pub fn text( content: impl Into<String> ) -> Text
{
	Text::new( content )
}

pub fn container<Msg: Clone>( child: impl Into<Element<Msg>> ) -> Container<Msg>
{
	Container::new( child )
}

/// Build an [`External`] widget that hosts content rendered by
/// a caller-managed GL texture producer.
pub fn external( width: f32, height: f32, source: ExternalSource ) -> External
{
	External::new( width, height, source )
}
