Skip to content

Commit

Permalink
upgrade and fix warnings; tag 0.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Nov 18, 2024
1 parent 6aceff9 commit 94b6e26
Show file tree
Hide file tree
Showing 24 changed files with 365 additions and 364 deletions.
4 changes: 2 additions & 2 deletions moon.mod.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "tiye/respo",
"version": "0.0.14",
"version": "0.0.15",
"deps": {
"tiye/dom-ffi": "0.0.5",
"tiye/dom-ffi": "0.0.6",
"tiye/cirru-parser": "0.0.7"
},
"readme": "README.md",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/app.mbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// get basic App structure
pub struct RespoApp[Model] {
pub(all) struct RespoApp[Model] {
store : Ref[Model]
storage_key : String
mount_target : @dom_ffi.Node
Expand Down
8 changes: 4 additions & 4 deletions src/lib/dialog/alert.mbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// The options for alert modal.
// #[derive(Debug, Clone, Default)]
pub struct AlertOptions {
pub(all) struct AlertOptions {
/// inline style for backdrop
mut backdrop_style : @node.RespoStyle
/// inline style for card
Expand Down Expand Up @@ -40,7 +40,7 @@ fn comp_alert_modal[T](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand All @@ -58,7 +58,7 @@ fn comp_alert_modal[T](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand Down Expand Up @@ -111,7 +111,7 @@ struct AlertPluginState {

/// abstraction for Alert modal, new with `AlertOption`,
/// just displaying a message, you read it, you close it
pub struct AlertPlugin[T] {
pub(all) struct AlertPlugin[T] {
state : AlertPluginState
options : AlertOptions
/// tracking content to display
Expand Down
8 changes: 4 additions & 4 deletions src/lib/dialog/confirm.mbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let next_task_name : String = "_RESPO_CONFIRM_NEXT_TASK"

/// options for confirm dialog
pub struct ConfirmOptions {
pub(all) struct ConfirmOptions {
/// inline style for backdrop
backdrop_style : @node.RespoStyle
/// inline style for card
Expand Down Expand Up @@ -43,7 +43,7 @@ fn comp_confirm_modal[T](
Click,
fn(e, dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand All @@ -61,7 +61,7 @@ fn comp_confirm_modal[T](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand Down Expand Up @@ -123,7 +123,7 @@ struct ConfirmPluginState {
} derive(Default, ToJson, @json.FromJson)

/// Popup a confirmation dialog, confirm to process next task
pub struct ConfirmPlugin[T] {
pub(all) struct ConfirmPlugin[T] {
state : ConfirmPluginState
options : ConfirmOptions
/// tracking content to display
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dialog/dialogs.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub fn comp_esc_listener[T](
Keydown,
fn(e, dispatch) {
match e {
Keyboard(~key, ..) => if key == "Escape" { on_close(dispatch) }
Keyboard(key~, ..) => if key == "Escape" { on_close(dispatch) }
_ => ()
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/lib/dialog/drawer.mbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// The options for custom drawer.
// #[derive(Debug, Clone, Default)]
pub struct DrawerOptions[T] {
pub(all) struct DrawerOptions[T] {
/// inline style for backdrop
backdrop_style : @node.RespoStyle
/// inline style for card
Expand Down Expand Up @@ -66,7 +66,7 @@ fn comp_drawer[T](
Click,
fn(e, dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand All @@ -83,7 +83,7 @@ fn comp_drawer[T](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand Down Expand Up @@ -123,7 +123,7 @@ struct DrawerPluginState {

/// a drawer that you can render you down card body
// #[derive(Debug, Clone)]
pub struct DrawerPlugin[T] {
pub(all) struct DrawerPlugin[T] {
state : DrawerPluginState
options : DrawerOptions[T]
/// tracking content to display
Expand Down
15 changes: 8 additions & 7 deletions src/lib/dialog/modal.mbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// The options for custom modal.
// #[derive(Debug, Clone, Default)]
pub struct ModalOptions[T] {
pub(all) struct ModalOptions[T] {
/// inline style for backdrop
backdrop_style : @node.RespoStyle
/// inline style for card
Expand All @@ -11,9 +11,10 @@ pub struct ModalOptions[T] {
render : ModalRenderer[T]
} derive(Default)

pub type ModalRenderer[T] ((@node.DispatchFn[T]) -> Unit!@node.RespoCommonError) -> @node.RespoNode[
T,
]!@node.RespoCommonError
/// tmp fix since syntax error
typealias Dispatcher[T] = (@node.DispatchFn[T]) -> Unit!@node.RespoCommonError

pub(all) type ModalRenderer[T] (Dispatcher[T]) -> @node.RespoNode[T]!@node.RespoCommonError

pub fn ModalRenderer::default[T]() -> ModalRenderer[T] {
fn(_close) { div([]) }
Expand Down Expand Up @@ -61,7 +62,7 @@ fn comp_modal[T](
Click,
fn(e, dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand All @@ -78,7 +79,7 @@ fn comp_modal[T](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand Down Expand Up @@ -119,7 +120,7 @@ struct ModalPluginState {

/// a modal that you can render you down card body
// #[derive(Debug, Clone)]
pub struct ModalPlugin[T] {
pub(all) struct ModalPlugin[T] {
// where
// T: Clone + Debug,
state : ModalPluginState
Expand Down
12 changes: 6 additions & 6 deletions src/lib/dialog/prompt.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let next_prompt_task_name : String = "_RESPO_PROMPT_NEXT_TASK"

/// options for prompt dialog
// #[derive(Debug, Clone, Default)]
pub struct PromptOptions {
pub(all) struct PromptOptions {
/// inline style for backdrop
backdrop_style : @node.RespoStyle
/// inline style for card
Expand All @@ -24,7 +24,7 @@ pub struct PromptOptions {
// /// wraps validator function
// #[allow(clippy::type_complexity)]
// #[derive(Clone)]
pub type PromptValidator (String) -> Result[Unit, String]
pub(all) type PromptValidator (String) -> Result[Unit, String]

pub fn to_string(self : PromptValidator) -> String {
"(PromptValidator \{self})"
Expand Down Expand Up @@ -85,7 +85,7 @@ fn comp_prompt_modal[T : @node.RespoAction](
// dispatch.run_state(&cursor, InputState { draft: value, error: None })?;
// }
match e {
Input(~value, ..) =>
Input(value~, ..) =>
// @dom_ffi.log("input value: " + value.escape())
// @dom_ffi.log("input state: " + s.to_json().stringify(indent=2))
dispatch.run_state!(cursor, InputState::{ draft: value, error: None })
Expand Down Expand Up @@ -146,7 +146,7 @@ fn comp_prompt_modal[T : @node.RespoAction](
Click,
fn(e, dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand All @@ -166,7 +166,7 @@ fn comp_prompt_modal[T : @node.RespoAction](
Click,
fn(e, _dispatch) {
match e {
Click(~original_event, ..) =>
Click(original_event~, ..) =>
original_event.stop_propagation()
_ => ()
}
Expand Down Expand Up @@ -248,7 +248,7 @@ struct PromptPluginState {

/// a dialog for prompt, request for some input, and submit
// #[derive(Debug, Clone)]
pub struct PromptPlugin[T] {
pub(all) struct PromptPlugin[T] {
states : @respo.RespoStatesTree
state : PromptPluginState
options : PromptOptions
Expand Down
Loading

0 comments on commit 94b6e26

Please sign in to comment.