#![allow(rustdoc::invalid_html_tags)]
#[expect(unused)]
pub(crate) const DATASTAR_KEY: &str = "datastar";
#[allow(unused)]
pub(crate) const DATASTAR_REQ_HEADER_STR: &str = "datastar-request";
#[expect(unused)]
pub(crate) const VERSION: &str = "1.0.0-beta.11";
pub const DEFAULT_SSE_RETRY_DURATION: u64 = 1000;
pub(crate) const DEFAULT_EXECUTE_SCRIPT_ATTRIBUTES: &str = "type module";
pub(crate) const SELECTOR_DATALINE_LITERAL: &str = "selector";
pub(crate) const MERGE_MODE_DATALINE_LITERAL: &str = "mergeMode";
pub(crate) const FRAGMENTS_DATALINE_LITERAL: &str = "fragments";
pub(crate) const USE_VIEW_TRANSITION_DATALINE_LITERAL: &str = "useViewTransition";
pub(crate) const SIGNALS_DATALINE_LITERAL: &str = "signals";
pub(crate) const ONLY_IF_MISSING_DATALINE_LITERAL: &str = "onlyIfMissing";
pub(crate) const PATHS_DATALINE_LITERAL: &str = "paths";
pub(crate) const SCRIPT_DATALINE_LITERAL: &str = "script";
pub(crate) const ATTRIBUTES_DATALINE_LITERAL: &str = "attributes";
pub(crate) const AUTO_REMOVE_DATALINE_LITERAL: &str = "autoRemove";
pub(crate) const DEFAULT_FRAGMENTS_USE_VIEW_TRANSITIONS: bool = false;
pub(crate) const DEFAULT_MERGE_SIGNALS_ONLY_IF_MISSING: bool = false;
pub(crate) const DEFAULT_EXECUTE_SCRIPT_AUTO_REMOVE: bool = true;
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum FragmentMergeMode {
#[default]
Morph,
Inner,
Outer,
Prepend,
Append,
Before,
After,
UpsertAttributes,
}
impl FragmentMergeMode {
pub(crate) const fn as_str(&self) -> &str {
match self {
Self::Morph => "morph",
Self::Inner => "inner",
Self::Outer => "outer",
Self::Prepend => "prepend",
Self::Append => "append",
Self::Before => "before",
Self::After => "after",
Self::UpsertAttributes => "upsertAttributes",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum EventType {
MergeFragments,
MergeSignals,
RemoveFragments,
RemoveSignals,
ExecuteScript,
}
impl EventType {
pub(crate) const fn as_str(&self) -> &str {
match self {
Self::MergeFragments => "datastar-merge-fragments",
Self::MergeSignals => "datastar-merge-signals",
Self::RemoveFragments => "datastar-remove-fragments",
Self::RemoveSignals => "datastar-remove-signals",
Self::ExecuteScript => "datastar-execute-script",
}
}
}