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";
35pub const DEFAULT_LOCAL_LISTENING_ADDRESS_PORT: &str = "127.0.0.1:3000";
36pub const DEFAULT_OUTBOUND_LISTENING_ADDRESS: &str = "0.0.0.0";
37pub const DEFAULT_OUTBOUND_LISTENING_ADDRESS_PORT: &str = "0.0.0.0:3000";
38pub const DEFAULT_LISTENING_PORT: &str = "3000";
39
40/*
41   Misc
42*/
43pub const DEFAULT_TEXT_ITEM: &str = "default";
44pub const DEFAULT_ALT_ITEM: &str = "";
45pub const DEFAULT_CONTACT_ITEM: &str = "company";
46pub const DEFAULT_CONTACT_TYPE: &str = "contact";
47pub const DEFAULT_CONTACT_FUNCTION: &str = "goto_contact";
48pub const DEFAULT_GOTO_FUNCTION: &str = "goto";
49pub const DEFAULT_CONTACT_CSS: &str = "centered";
50pub const DEFAULT_NO_TEXT: &str = "";
51pub const DEFAULT_JOB_LOADER_NAME: &str = "job_loader";
52pub const DEFAULT_HTMX_SWAP_MODE: &str = "outerHTML";
53pub const DEFAULT_PROGRESS_MODE: &str = "hidden";
54pub const DEFAULT_THEME_ITEM: &str = "light";
55pub const DEFAULT_LANG_ITEM: &str = "en";
56pub const DEFAULT_HOME_PAGE: &str = "Home";
57pub const DEFAULT_HOME_PAGE_URL: &str = "./";
58
59/*
60    Options
61*/
62pub const OPT_INVERTED_DIRECTION: &str = "inverted";
63
64/*
65   Params
66*/
67pub const PARAMS_ID: &str = "id";
68pub const PARAMS_TITLE: &str = "title";
69pub const PARAMS_SUMMARY: &str = "summary";
70pub const PARAMS_TYPE: &str = "type";
71pub const PARAMS_CSS_CLASS: &str = "class";
72pub const PARAMS_SOCIAL_LIST: &str = "social_list";
73pub const PARAMS_ITEM: &str = "item";
74pub const PARAMS_INVERTED: &str = "inverted";
75pub const PARAMS_SECTION: &str = "section";
76pub const PARAMS_FUNCTION: &str = "function";
77pub const PARAMS_SOURCE_URL: &str = "source";
78pub const PARAMS_TARGET: &str = "target";
79pub const PARAMS_SIZE: &str = "size";
80pub const PARAMS_CONTENTS: &str = "contents";
81pub const PARAMS_MODULE: &str = "module";
82pub const PARAMS_ENDPOINT: &str = "endpoint";
83pub const PARAMS_ELEMENT: &str = "element";
84pub const PARAMS_TICKS: &str = "ticks";
85pub const PARAMS_SWAP_MODE: &str = "swap_mode";
86pub const PARAMS_PROGRESS_MODE: &str = "progress_mode";
87pub const PARAMS_ALT: &str = "alt";
88
89/*
90   CONF SECTIONS
91*/
92pub const SECTION_TEXT: &str = "text";
93pub const SECTION_PERSONNEL: &str = "personnel";
94pub const SECTION_CONTACT: &str = "contact";
95pub const SECTION_TITLES: &str = "titles";
96pub const SECTION_API: &str = "api";
97pub const SECTION_SOCIALS: &str = "socials";
98pub const SECTION_SERVICES: &str = "services";
99pub const SECTION_PRODUCTS: &str = "products";
100pub const SECTION_LINKS: &str = "links";
101pub const SECTION_MODULES: &str = "modules";
102pub const SECTION_ENDPOINTS: &str = "endpoints";
103pub const SECTION_ALT: &str = "alt";
104pub const SECTION_DEFAULT: &str = "default";
105
106/*
107   Content Types
108*/
109pub const CONTENT_TYPE_PDF: &str = "application/pdf";
110pub const CONTENT_TYPE_HTML: &str = "text/html";
111
112/*
113   Form Data Types
114*/
115pub const FORM_DATA_TYPE_PDF: &str = "pdf";
116pub const FORM_DATA_TYPE_HTML: &str = "html";
117pub const FORM_DATA_TYPE_MARKDOWN: &str = "markdown";
118pub const FORM_DATA_TYPE_DEFAULT: &str = "text";
119
120/*
121   LANGUAGES
122*/
123pub const LANG_EN: &str = "en";
124pub const LANG_ES: &str = "es";
125
126/*
127   Icon
128*/
129pub const DEFAULT_ICON_STYLE: &str = "fa-solid";
130
131/*
132   Robots.txt
133*/
134pub const DEFAULT_ROBOT_TXT: &str = r"
135User-agent: *
136Disallow: /static/
137";
138
139/*
140   JS Module Types
141*/
142pub const DEFAULT_SCRIPT: &str = "default";
143pub const DEFAULT_SCRIPT_MODULE: &str = "module";
144pub const DEFAULT_SCRIPT_IMPORT: &str = "import";
145
146/*
147    Assets
148 */
149pub const DEFAULT_APP_CONFIG: &str = "./app.json";
150pub const DEFAULT_LOGO_SOURCE: &str = "/static/img/logo.svg";
151pub const DEFAULT_ICON_SOURCE: &str = "/static/img/logo.svg";
152pub const DEFAULT_ICON_TYPE: &str = "image/svg+xml";
153
154/*
155    Slices
156 */
157pub static DEFAULT_EMPTY_PARAMS: LazyLock<RUMWebDataProxy> = LazyLock::new( || rumtk_web_params_map!([("", "")]));
158
159/*
160    Elements
161 */
162pub const ELEMENT_INPUT: &str = "input";
163pub const ELEMENT_LABEL: &str = "label";
164pub const ELEMENT_SELECT: &str = "select";
165pub const ELEMENT_TEXTAREA: &str = "textarea";
166
167/*
168   Default static data to minimize allocations.
169*/
170pub static DEFAULT_TEXT: RUMString = RUMString::new();
171pub static DEFAULT_TEXTMAP: LazyLock<TextMap> = LazyLock::new(|| TextMap::default());
172pub static DEFAULT_NESTEDTEXTMAP: LazyLock<NestedTextMap> = LazyLock::new(|| NestedTextMap::default());
173pub static DEFAULT_NESTEDNESTEDTEXTMAP: LazyLock<NestedNestedTextMap> =
174    LazyLock::new(|| NestedNestedTextMap::default());
175
176/*
177   Default HTMX.
178*/
179pub const DEFAULT_HTMX_CHECK_TICKS: &str = "2s";