#![warn(missing_docs, missing_debug_implementations)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![no_std]
#![forbid(unsafe_code)]
#![deny(
clippy::unwrap_used,
clippy::expect_used,
clippy::indexing_slicing,
clippy::panic
)]
extern crate alloc;
#[cfg(any(
feature = "host-std",
feature = "native",
feature = "clap",
all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
)
))]
extern crate std;
#[cfg(all(feature = "ssr", any(feature = "hydrate", feature = "csr")))]
compile_error!(
"mf2: turn on exactly one of `ssr`, `hydrate` and `csr`. cargo unifies \
features across a workspace, so an application that is built both ways \
belongs in a workspace of its own — as `examples/demo-ssr` and \
`conformance/l6-web` are."
);
#[cfg(all(feature = "hydrate", feature = "csr"))]
compile_error!("mf2: turn on exactly one of `ssr`, `hydrate` and `csr`.");
#[cfg(all(feature = "leptos", feature = "leptos-0-8"))]
compile_error!(
"mf2: both Leptos lines are on, `leptos` (Leptos 0.9) and `leptos-0-8`: \
turn on one."
);
#[cfg(all(feature = "ssr", not(any(feature = "leptos", feature = "leptos-0-8"))))]
compile_error!(
"mf2: `ssr` needs a Leptos line: turn on `leptos` (Leptos 0.9) or \
`leptos-0-8` beside it."
);
#[cfg(all(
feature = "hydrate",
not(any(feature = "leptos", feature = "leptos-0-8"))
))]
compile_error!(
"mf2: `hydrate` needs a Leptos line: turn on `leptos` (Leptos 0.9) or \
`leptos-0-8` beside it."
);
#[cfg(all(feature = "csr", not(any(feature = "leptos", feature = "leptos-0-8"))))]
compile_error!(
"mf2: `csr` needs a Leptos line: turn on `leptos` (Leptos 0.9) or \
`leptos-0-8` beside it."
);
#[cfg(all(
feature = "native",
not(feature = "ratatui"),
any(feature = "hydrate", feature = "csr"),
target_arch = "wasm32"
))]
compile_error!(
"mf2: `native` is on beside `hydrate` or `csr` in a build for the \
browser (`wasm32`): `native` is for an application that runs natively \
(a command-line tool, a terminal UI, a server), never for a browser \
build. cargo unifies features across the packages it builds together: \
build the browser client on its own (`-p`), and keep `native` off in \
every crate it depends on."
);
#[cfg(all(
feature = "axum",
any(feature = "hydrate", feature = "csr"),
target_arch = "wasm32"
))]
compile_error!(
"mf2: `axum` is on beside `hydrate` or `csr` in a build for the \
browser (`wasm32`): `axum` is for the server, never for a browser \
build. cargo unifies features across the packages it builds together: \
build the browser client on its own (`-p`), and keep `axum` off in \
every crate it depends on."
);
#[cfg(all(
feature = "ratatui",
any(feature = "hydrate", feature = "csr"),
target_arch = "wasm32"
))]
compile_error!(
"mf2: `ratatui` is on beside `hydrate` or `csr` in a build for the \
browser (`wasm32`): `ratatui` is for a terminal UI, which runs \
natively, and implies `native`; neither belongs in a browser build. \
cargo unifies features across the packages it builds together: build \
the browser client on its own (`-p`), and keep `ratatui` and `native` \
off in every crate it depends on."
);
#[cfg(all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
))]
mod line {
#[cfg(all(feature = "leptos-0-8", not(feature = "leptos")))]
pub(crate) use ::{
leptos_0_8 as leptos, mf2_leptos_ui_0_8 as ui, reactive_graph_0_2 as reactive_graph,
tachys_0_2 as tachys,
};
#[cfg(feature = "leptos")]
pub(crate) use ::{
leptos_0_9 as leptos, mf2_leptos_ui_0_9 as ui, reactive_graph_0_3 as reactive_graph,
tachys_0_3 as tachys,
};
}
mod arg;
#[cfg(feature = "compile")]
mod compile;
mod corpus;
mod debug;
#[cfg(any(
feature = "native",
all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
)
))]
mod display;
mod dynamic;
mod error;
mod into_arg;
#[cfg(any(
feature = "axum",
all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
)
))]
mod links;
mod markup;
mod matching;
mod message;
mod tr;
#[cfg(any(feature = "axum", feature = "ssr"))]
mod warn;
#[cfg(feature = "native")]
#[cfg_attr(docsrs, doc(cfg(feature = "native")))]
pub mod native;
#[cfg(feature = "ratatui")]
#[cfg_attr(docsrs, doc(cfg(feature = "ratatui")))]
pub mod ratatui;
#[cfg(feature = "axum")]
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
pub mod axum;
#[cfg(all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "ssr", feature = "hydrate", feature = "csr")))
)]
pub mod leptos;
pub use corpus::{CatalogFile, Corpus};
pub use error::UnknownLocale;
pub use matching::LanguageMatching;
pub use message::Message;
pub use arg::{ArgList, ArgSource, ArgValue, DateTimeValue, Text};
pub use dynamic::TrDyn;
pub use into_arg::IntoArg;
pub use markup::{Handler, IntoMarkupHandler};
pub use tr::{MarkupHandler, Tr, TrArgs, TrRich};
#[doc(hidden)]
pub use dynamic::tr_dyn;
#[doc(hidden)]
pub mod __arg;
#[doc(hidden)]
pub mod __generated;
#[doc(hidden)]
pub use markup::{markup, markup_view};
#[doc(hidden)]
pub use tr::{tr, tr_args_n, tr_args0, tr_args1, tr_args2, tr_args3, tr_args4, tr_rich};
#[cfg(all(
any(feature = "ssr", feature = "hydrate", feature = "csr"),
any(feature = "leptos", feature = "leptos-0-8")
))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "ssr", feature = "hydrate", feature = "csr")))
)]
#[doc(no_inline)]
pub use leptos::{Flat, FlatHandler, NestingHandler, SignalArg, signal_arg};
#[doc(hidden)]
pub use mf2_macros::__tr_impl;
#[doc(hidden)]
pub use mf2_macros::__msg_id_impl;
#[macro_export]
macro_rules! include_generated {
() => {
include!(concat!(env!("OUT_DIR"), "/mf2_generated.rs"));
};
(catalogs) => {
include!(concat!(env!("OUT_DIR"), "/mf2_catalogs.rs"));
};
($file:literal) => {
include!(concat!(env!("OUT_DIR"), "/", $file));
};
}
#[cfg(all(feature = "hydrate", any(feature = "leptos", feature = "leptos-0-8")))]
#[doc(hidden)]
#[macro_export]
macro_rules! __islands_gate {
() => {
$crate::__islands_gate_export! {}
};
}
#[cfg(all(feature = "hydrate", any(feature = "leptos", feature = "leptos-0-8")))]
#[doc(hidden)]
#[macro_export]
#[rustfmt::skip]
macro_rules! __islands_gate_export {
() => {
#[$crate::leptos::__private::wasm_bindgen::prelude::wasm_bindgen(
wasm_bindgen = $crate::leptos::__private::wasm_bindgen,
wasm_bindgen_futures = $crate::leptos::__private::wasm_bindgen_futures,
js_name = "mf2_islands_gate"
)]
#[doc(hidden)]
pub async fn __mf2_islands_gate(_island: $crate::leptos::__private::web_sys::HtmlElement) {
$crate::leptos::wait_for_catalog().await
}
};
}
#[cfg(not(all(feature = "hydrate", any(feature = "leptos", feature = "leptos-0-8"))))]
#[doc(hidden)]
#[macro_export]
macro_rules! __islands_gate {
() => {};
}
#[cfg(feature = "compile")]
#[doc(hidden)]
pub use mf2_catalog::Manifest;
pub use mf2_catalog::{Catalog, CatalogError, Dir, MsgId};
#[doc(hidden)]
pub use mf2_catalog::{Entry, StrRef, markup_key};
pub use mf2_model::{ErrorKind, MarkupKind};
pub use mf2_runtime::{
Arg, BidiStrategy, Category, CurrencyDisplay, CustomValue, Date, DateFields, DateLength,
DateStyle, DateTime, DateTimeOptions, DateTimeRequest, DigitOptions, Digits, ErrorSink,
ExpressionPart, FallbackSource, FnContext, FormatContext, FormatError, Formatter, Function,
Grouping, Host, Isolation, MarkupOptions, MarkupPart, Measure, MeasureUnit, NoErrors, Number,
NumberFormatter, NumberOut, NumberRequest, NumberSpec, NumberStyle, Operands, OptionValue,
Options, Part, PartSink, Registry, RoundingMode, RoundingPriority, Sign, SignDisplay, Sink,
SubPartSink, Time, TimePrecision, TimeZone, UnitDisplay, Value, ZoneOption, ZoneStyle,
functions, is_zone_name,
};
#[doc(hidden)]
pub use mf2_runtime::{INTL_NUMBERS, plural_category};
#[cfg(feature = "compile")]
pub use compile::{Compiled, compile_str, compile_str_stripped};
#[cfg(feature = "compile")]
pub use error::CompileError;
#[cfg(feature = "fn-number")]
pub use mf2_fn_number as fn_number;
#[cfg(feature = "fn-datetime")]
pub use mf2_fn_datetime as fn_datetime;
#[cfg(feature = "host-std")]
pub use mf2_host_std as host_std;
#[cfg(feature = "host-web")]
pub use mf2_host_web as host_web;