Skip to main content

rumtk_web/utils/
defaults.rs

1/*
2 * rumtk attempts to implement HL7 and medical protocols for interoperability in medicine.
3 * This toolkit aims to be reliable, simple, performant, and standards compliant.
4 * Copyright (C) 2025  Luis M. Santos, M.D. <lsantos@medicalmasses.com>
5 * Copyright (C) 2025  Ethan Dixon
6 * Copyright (C) 2025  MedicalMasses L.L.C. <contact@medicalmasses.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 */
21use crate::utils::ConstTextMap;
22use crate::{rumtk_web_params_map, NestedNestedTextMap, NestedTextMap, RUMWebDataProxy, TextMap};
23use phf_macros::phf_ordered_map;
24use rumtk_core::strings::RUMString;
25use std::sync::LazyLock;
26/*
27   TextMap
28*/
29pub static DEFAULT_TEXT_MAP: ConstTextMap = phf_ordered_map!();
30
31/*
32   IP
33*/
34pub const DEFAULT_LOCAL_LISTENING_ADDRESS: &str = "127.0.0.1:3000";
35pub const DEFAULT_OUTBOUND_LISTENING_ADDRESS: &str = "0.0.0.0:3000";
36
37/*
38   Misc
39*/
40pub const DEFAULT_TEXT_ITEM: &str = "default";
41pub const DEFAULT_ALT_ITEM: &str = "";
42pub const DEFAULT_CONTACT_ITEM: &str = "company";
43pub const DEFAULT_CONTACT_TYPE: &str = "contact";
44pub const DEFAULT_CONTACT_FUNCTION: &str = "goto_contact";
45pub const DEFAULT_GOTO_FUNCTION: &str = "goto";
46pub const DEFAULT_CONTACT_CSS: &str = "centered";
47pub const DEFAULT_NO_TEXT: &str = "";
48pub const DEFAULT_JOB_LOADER_NAME: &str = "job_loader";
49pub const DEFAULT_HTMX_SWAP_MODE: &str = "outerHTML";
50pub const DEFAULT_PROGRESS_MODE: &str = "hidden";
51pub const DEFAULT_THEME_ITEM: &str = "light";
52pub const DEFAULT_LANG_ITEM: &str = "en";
53pub const DEFAULT_HOME_PAGE: &str = "Home";
54pub const DEFAULT_HOME_PAGE_URL: &str = "./";
55
56/*
57    Options
58*/
59pub const OPT_INVERTED_DIRECTION: &str = "inverted";
60
61/*
62   Params
63*/
64pub const PARAMS_ID: &str = "id";
65pub const PARAMS_TITLE: &str = "title";
66pub const PARAMS_SUMMARY: &str = "summary";
67pub const PARAMS_TYPE: &str = "type";
68pub const PARAMS_CSS_CLASS: &str = "class";
69pub const PARAMS_SOCIAL_LIST: &str = "social_list";
70pub const PARAMS_ITEM: &str = "item";
71pub const PARAMS_INVERTED: &str = "inverted";
72pub const PARAMS_SECTION: &str = "section";
73pub const PARAMS_FUNCTION: &str = "function";
74pub const PARAMS_SOURCE_URL: &str = "source";
75pub const PARAMS_TARGET: &str = "target";
76pub const PARAMS_SIZE: &str = "size";
77pub const PARAMS_CONTENTS: &str = "contents";
78pub const PARAMS_MODULE: &str = "module";
79pub const PARAMS_ENDPOINT: &str = "endpoint";
80pub const PARAMS_ELEMENT: &str = "element";
81pub const PARAMS_TICKS: &str = "ticks";
82pub const PARAMS_SWAP_MODE: &str = "swap_mode";
83pub const PARAMS_PROGRESS_MODE: &str = "progress_mode";
84pub const PARAMS_ALT: &str = "alt";
85
86/*
87   CONF SECTIONS
88*/
89pub const SECTION_TEXT: &str = "text";
90pub const SECTION_PERSONNEL: &str = "personnel";
91pub const SECTION_CONTACT: &str = "contact";
92pub const SECTION_TITLES: &str = "titles";
93pub const SECTION_API: &str = "api";
94pub const SECTION_SOCIALS: &str = "socials";
95pub const SECTION_SERVICES: &str = "services";
96pub const SECTION_PRODUCTS: &str = "products";
97pub const SECTION_LINKS: &str = "links";
98pub const SECTION_MODULES: &str = "modules";
99pub const SECTION_ENDPOINTS: &str = "endpoints";
100pub const SECTION_ALT: &str = "alt";
101pub const SECTION_DEFAULT: &str = "default";
102
103/*
104   Content Types
105*/
106pub const CONTENT_TYPE_PDF: &str = "application/pdf";
107pub const CONTENT_TYPE_HTML: &str = "text/html";
108
109/*
110   Form Data Types
111*/
112pub const FORM_DATA_TYPE_PDF: &str = "pdf";
113pub const FORM_DATA_TYPE_HTML: &str = "html";
114pub const FORM_DATA_TYPE_MARKDOWN: &str = "markdown";
115pub const FORM_DATA_TYPE_DEFAULT: &str = "text";
116
117/*
118   LANGUAGES
119*/
120pub const LANG_EN: &str = "en";
121pub const LANG_ES: &str = "es";
122
123/*
124   Icon
125*/
126pub const DEFAULT_ICON_STYLE: &str = "fa-solid";
127
128/*
129   Robots.txt
130*/
131pub const DEFAULT_ROBOT_TXT: &str = r"
132User-agent: *
133Disallow: /static/
134";
135
136/*
137   JS Module Types
138*/
139pub const DEFAULT_SCRIPT: &str = "default";
140pub const DEFAULT_SCRIPT_MODULE: &str = "module";
141pub const DEFAULT_SCRIPT_IMPORT: &str = "import";
142
143/*
144    Assets
145 */
146pub const DEFAULT_APP_CONFIG: &str = "./app.json";
147pub const DEFAULT_LOGO_SOURCE: &str = "/static/img/logo.svg";
148pub const DEFAULT_ICON_SOURCE: &str = "/static/img/logo.svg";
149pub const DEFAULT_ICON_TYPE: &str = "image/svg+xml";
150
151/*
152    Slices
153 */
154pub static DEFAULT_EMPTY_PARAMS: LazyLock<RUMWebDataProxy> = LazyLock::new( || rumtk_web_params_map!([("", "")]));
155
156/*
157    Elements
158 */
159pub const ELEMENT_INPUT: &str = "input";
160pub const ELEMENT_LABEL: &str = "label";
161pub const ELEMENT_SELECT: &str = "select";
162pub const ELEMENT_TEXTAREA: &str = "textarea";
163
164/*
165   Default static data to minimize allocations.
166*/
167pub static DEFAULT_TEXT: RUMString = RUMString::new();
168pub static DEFAULT_TEXTMAP: LazyLock<TextMap> = LazyLock::new(|| TextMap::default());
169pub static DEFAULT_NESTEDTEXTMAP: LazyLock<NestedTextMap> = LazyLock::new(|| NestedTextMap::default());
170pub static DEFAULT_NESTEDNESTEDTEXTMAP: LazyLock<NestedNestedTextMap> =
171    LazyLock::new(|| NestedNestedTextMap::default());
172
173/*
174   Default HTMX.
175*/
176pub const DEFAULT_HTMX_CHECK_TICKS: &str = "2s";