1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! What the page carries so that the client needs no inline script, no JSON
//! and no second negotiation.
//!
//! Three names, shared by the shell that writes them (the server) and the
//! boot that reads them (the client), so the two cannot drift.
/// The `data-` attribute that marks the preload link of the locale the page
/// was rendered in. The link is the boot data: the client reads the URL from
/// it and the locale from `<html lang>`.
pub const PRELOAD_ATTR: &str = "data-mf2";
/// The `rel` of the optional per-locale catalog links — the in-page tag → URL
/// map, which trades a few bytes in every page for the switch-time round trip
/// (the in-page tag → URL map).
pub const CATALOG_LINK_REL: &str = "mf2-catalog";
/// The attribute that carries a catalog link's locale tag.
pub const CATALOG_LINK_LOCALE_ATTR: &str = "data-mf2-locale";
/// The island name of [`IslandsGate`](crate::leptos::IslandsGate) — the export
/// [`islands_gate!`](crate::leptos::islands_gate) defines. The macro spells it as a
/// literal (an attribute argument cannot name a constant); if the two drift,
/// Leptos warns that it cannot find the island's function, and the islands
/// browser check fails on that warning.
pub const ISLANDS_GATE: &str = "mf2_islands_gate";
pub use crateLOCALE_COOKIE;
/// The cookie that carries the reader's time zone, an IANA name
/// The client writes it when a page was
/// rendered in another zone than the reader's; `mf2::axum` reads it and
/// renders the next page in that zone. Its attributes are
/// [`LOCALE_COOKIE`]'s.
pub const TIME_ZONE_COOKIE: &str = "mf2_tz";
/// The attribute of the preload link ([`PRELOAD_ATTR`]) that states the
/// time zone the page was rendered in, when it was a reader's. Absent, the
/// page was rendered in `Setup`'s zone.
pub const ZONE_ATTR: &str = "data-mf2-zone";
/// The attribute of the preload link ([`PRELOAD_ATTR`]) that states the
/// date formatter the server rendered the page with, as
/// [`date_formatter`] spells it. When it is not the client's, the client
/// rewrites every text it hydrated (`plan/08` §4.3). Absent, the server
/// formats no dates, or the application's two formatters never make a
/// rewrite (the same on both sides, or ICU4X under `Intl`), and nothing is
/// rewritten for the formatter.
pub const DATES_ATTR: &str = "data-mf2-dates";
/// The date formatter of this build's side: `icu`, `intl` (a browser build
/// only) or `iso`; `None` without a date feature. The strongest of the
/// side's features formats, as `mf2-fn-datetime` picks its backend: in a
/// browser build ICU4X, then `Intl`, then ISO; natively ICU4X, then ISO.
pub const
/// What a server's page states in [`DATES_ATTR`]: [`date_formatter`], but
/// `None` where this build sees both sides' date formatters and they never
/// make the client rewrite (the same on both sides, or ICU4X on the server
/// under `Intl`, `plan/08` §4.3). Such a client links no rewrite code, so
/// the page need not say.
pub const
pub use crateLOCALE_QUERY;
/// The attribute of the preload link ([`PRELOAD_ATTR`]) that names the query
/// parameter the switcher submits, when it is not [`LOCALE_QUERY`]: what a
/// client's switch takes out of the address.
pub const QUERY_ATTR: &str = "data-mf2-query";
/// The `data-` attribute that marks a client-only page's preload of its
/// catalog index: `index.html` writes
/// `<link rel="preload" as="fetch" crossorigin="anonymous" href="i18n/index.json" data-mf2-index>`,
/// and the boot reads the index's URL from it. A catalog's file name in the
/// index is relative to the index.
pub const CSR_INDEX_ATTR: &str = "data-mf2-index";
/// Where a client-only page's boot looks for the index when the page has no
/// [`CSR_INDEX_ATTR`] link — relative to the page, as `mf2 compile --site`
/// lays a site out.
pub const CSR_INDEX_URL: &str = "i18n/index.json";
/// The `localStorage` key a client-only application remembers its locale
/// under: a switch writes it, and the next boot reads it before
/// `navigator.languages`.
pub const LOCALE_STORAGE_KEY: &str = "mf2_locale";
pub use crateCATALOG_ROUTE;
/// The URL a catalog published as `file` is served at.