From 875e7ffbbcb4bac266748a1b51e746a51d36c2b6 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Sat, 27 Jul 2024 17:40:58 +0800 Subject: [PATCH] feat: adding parameter comments --- thaw/src/divider/mod.rs | 1 + thaw/src/drawer/inline_drawer.rs | 3 +++ thaw/src/drawer/overlay_drawer.rs | 3 +++ thaw/src/grid/grid_item.rs | 2 ++ thaw/src/grid/mod.rs | 3 +++ thaw/src/input/mod.rs | 2 ++ thaw/src/layout/mod.rs | 1 + thaw/src/message_bar/message_bar.rs | 1 + thaw/src/popover/mod.rs | 1 + thaw/src/progress_bar/progress_bar.rs | 2 ++ thaw/src/radio/mod.rs | 1 + thaw/src/radio/radio_group.rs | 1 + 12 files changed, 21 insertions(+) diff --git a/thaw/src/divider/mod.rs b/thaw/src/divider/mod.rs index adde5f7..49ab2f9 100644 --- a/thaw/src/divider/mod.rs +++ b/thaw/src/divider/mod.rs @@ -5,6 +5,7 @@ use thaw_utils::{class_list, mount_style}; #[component] pub fn Divider( #[prop(optional, into)] class: MaybeProp, + /// A divider can be horizontal (default) or vertical. #[prop(optional, into)] vertical: MaybeSignal, #[prop(optional)] children: Option, ) -> impl IntoView { diff --git a/thaw/src/drawer/inline_drawer.rs b/thaw/src/drawer/inline_drawer.rs index dd129a1..b2af52d 100644 --- a/thaw/src/drawer/inline_drawer.rs +++ b/thaw/src/drawer/inline_drawer.rs @@ -6,8 +6,11 @@ use thaw_utils::{class_list, mount_style, Model}; #[component] pub fn InlineDrawer( #[prop(optional, into)] class: MaybeProp, + /// Controls the open state of the Drawer. #[prop(into)] open: Model, + /// Position of the drawer. #[prop(optional, into)] position: MaybeSignal, + /// Size of the drawer. #[prop(optional, into)] size: MaybeSignal, children: Children, ) -> impl IntoView { diff --git a/thaw/src/drawer/overlay_drawer.rs b/thaw/src/drawer/overlay_drawer.rs index 7fe5eb6..2d31f81 100644 --- a/thaw/src/drawer/overlay_drawer.rs +++ b/thaw/src/drawer/overlay_drawer.rs @@ -7,10 +7,13 @@ use thaw_utils::{class_list, mount_style, use_lock_html_scroll, Model}; #[component] pub fn OverlayDrawer( #[prop(optional, into)] class: MaybeProp, + /// Controls the open state of the Drawer. #[prop(into)] open: Model, #[prop(default = true.into(), into)] mask_closeable: MaybeSignal, #[prop(optional, into)] close_on_esc: bool, + /// Position of the drawer. #[prop(optional, into)] position: MaybeSignal, + /// Size of the drawer. #[prop(optional, into)] size: MaybeSignal, children: Children, ) -> impl IntoView { diff --git a/thaw/src/grid/grid_item.rs b/thaw/src/grid/grid_item.rs index c6e95d3..0b87331 100644 --- a/thaw/src/grid/grid_item.rs +++ b/thaw/src/grid/grid_item.rs @@ -4,7 +4,9 @@ use thaw_utils::class_list; #[component] pub fn GridItem( + /// The number of columns occupied by the grid. The grid item would be hidden if it's 0. #[prop(default = MaybeSignal::Static(1u16), into)] column: MaybeSignal, + /// The number of intervals to the left of the grid. #[prop(optional, into)] offset: MaybeSignal, #[prop(optional, into)] class: MaybeProp, children: Children, diff --git a/thaw/src/grid/mod.rs b/thaw/src/grid/mod.rs index 2605cc1..3b3644e 100644 --- a/thaw/src/grid/mod.rs +++ b/thaw/src/grid/mod.rs @@ -6,8 +6,11 @@ use thaw_utils::class_list; #[component] pub fn Grid( + /// Number of grids displayed. #[prop(default = MaybeSignal::Static(1u16), into)] cols: MaybeSignal, + // Horizontal gap. #[prop(optional, into)] x_gap: MaybeSignal, + /// Vertical gap. #[prop(optional, into)] y_gap: MaybeSignal, #[prop(optional, into)] class: MaybeProp, children: Children, diff --git a/thaw/src/input/mod.rs b/thaw/src/input/mod.rs index 1421dec..099c3d8 100644 --- a/thaw/src/input/mod.rs +++ b/thaw/src/input/mod.rs @@ -36,9 +36,11 @@ pub fn Input( #[prop(optional, into)] value: Model, #[prop(optional, into)] allow_value: Option>, #[prop(optional, into)] variant: MaybeSignal, + /// Placeholder text for the input. #[prop(optional, into)] placeholder: OptionalProp>, #[prop(optional, into)] on_focus: Option>, #[prop(optional, into)] on_blur: Option>, + /// Whether the input is disabled #[prop(optional, into)] disabled: MaybeSignal, #[prop(optional)] input_prefix: Option, #[prop(optional)] input_suffix: Option, diff --git a/thaw/src/layout/mod.rs b/thaw/src/layout/mod.rs index cc0ed21..e7ff9e2 100644 --- a/thaw/src/layout/mod.rs +++ b/thaw/src/layout/mod.rs @@ -30,6 +30,7 @@ pub fn Layout( #[prop(optional, into)] content_class: MaybeProp, #[prop(optional, into)] content_style: MaybeProp, #[prop(optional)] position: LayoutPosition, + /// Whether the component has sider inside. If so it must be true. #[prop(optional, into)] has_sider: MaybeSignal, children: Children, ) -> impl IntoView { diff --git a/thaw/src/message_bar/message_bar.rs b/thaw/src/message_bar/message_bar.rs index fccca38..a983616 100644 --- a/thaw/src/message_bar/message_bar.rs +++ b/thaw/src/message_bar/message_bar.rs @@ -5,6 +5,7 @@ use thaw_utils::{class_list, mount_style, StoredMaybeSignal}; pub fn MessageBar( #[prop(optional, into)] class: MaybeProp, #[prop(optional, into)] layout: MaybeSignal, + /// Default designs announcement presets. #[prop(optional, into)] intent: MaybeSignal, children: Children, ) -> impl IntoView { diff --git a/thaw/src/popover/mod.rs b/thaw/src/popover/mod.rs index 7315678..2e11b68 100644 --- a/thaw/src/popover/mod.rs +++ b/thaw/src/popover/mod.rs @@ -17,6 +17,7 @@ pub fn Popover( #[prop(optional)] trigger_type: PopoverTriggerType, popover_trigger: PopoverTrigger, #[prop(optional)] placement: PopoverPlacement, + /// A popover can appear styled with brand or inverted. When not specified, the default style is used. #[prop(optional, into)] appearance: Option>, children: Children, ) -> impl IntoView { diff --git a/thaw/src/progress_bar/progress_bar.rs b/thaw/src/progress_bar/progress_bar.rs index ec9327b..1d0d495 100644 --- a/thaw/src/progress_bar/progress_bar.rs +++ b/thaw/src/progress_bar/progress_bar.rs @@ -5,6 +5,8 @@ use thaw_utils::{class_list, mount_style}; pub fn ProgressBar( #[prop(optional, into)] class: MaybeProp, #[prop(into, optional)] value: MaybeSignal, + /// The maximum value, which indicates the task is complete. + /// The ProgressBar bar will be full when value equals max. #[prop(default = 1.0.into(), optional)] max: MaybeSignal, #[prop(into, optional)] color: MaybeSignal, ) -> impl IntoView { diff --git a/thaw/src/radio/mod.rs b/thaw/src/radio/mod.rs index 5377887..90cc32e 100644 --- a/thaw/src/radio/mod.rs +++ b/thaw/src/radio/mod.rs @@ -10,6 +10,7 @@ use thaw_utils::{class_list, mount_style}; pub fn Radio( #[prop(optional, into)] class: MaybeProp, #[prop(optional, into)] value: String, + /// The Radio's label. #[prop(optional, into)] label: MaybeProp, ) -> impl IntoView { mount_style("radio", include_str!("./radio.css")); diff --git a/thaw/src/radio/radio_group.rs b/thaw/src/radio/radio_group.rs index 82de9a6..eb2e2ed 100644 --- a/thaw/src/radio/radio_group.rs +++ b/thaw/src/radio/radio_group.rs @@ -4,6 +4,7 @@ use thaw_utils::{class_list, OptionModel}; #[component] pub fn RadioGroup( #[prop(optional, into)] class: MaybeProp, + /// The selected Radio item in this group. #[prop(optional, into)] value: OptionModel, /// The name of this radio group. #[prop(optional, into)]