Skip to main content

systemprompt_provider_contracts/web_config/
mod.rs

1//! Web rendering configuration: paths, branding, theme, layout, and
2//! navigation. These types are serialized to / from YAML in the
3//! `webconfig.yaml` of each profile.
4//!
5//! Copyright (c) systemprompt.io — Business Source License 1.1.
6//! See <https://systemprompt.io> for licensing details.
7
8mod branding;
9mod error;
10mod i18n;
11mod paths;
12mod theme;
13
14pub use branding::{BrandingConfig, LogoConfig, LogoVariant};
15pub use error::WebConfigError;
16pub use i18n::SiteI18nConfig;
17pub use paths::{ContentConfig, PathsConfig, ScriptConfig};
18pub use theme::{
19    AnimationConfig, BackgroundColors, BorderColors, CardConfig, CardGradient, CardPadding,
20    CardRadius, ColorPalette, ColorsConfig, FontConfig, FontFile, FontsConfig, LayoutConfig,
21    MobileCardConfig, MobileConfig, MobileLayout, MobileTypography, PrimaryColor, RadiusConfig,
22    ShadowSet, ShadowsConfig, SidebarConfig, SpacingConfig, SurfaceColors, TextColors,
23    TouchTargetsConfig, TypographyConfig, TypographySizes, TypographyWeights, ZIndexConfig,
24};
25
26use serde::{Deserialize, Serialize};
27use std::collections::HashMap;
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(deny_unknown_fields)]
31pub struct WebConfig {
32    pub paths: PathsConfig,
33    #[serde(default)]
34    pub scripts: Vec<ScriptConfig>,
35    #[serde(default)]
36    pub content: Option<ContentConfig>,
37    pub branding: BrandingConfig,
38    pub fonts: FontsConfig,
39    pub colors: ColorsConfig,
40    pub typography: TypographyConfig,
41    pub spacing: SpacingConfig,
42    pub radius: RadiusConfig,
43    pub shadows: ShadowsConfig,
44    pub animation: AnimationConfig,
45    #[serde(rename = "zIndex")]
46    pub z_index: ZIndexConfig,
47    pub layout: LayoutConfig,
48    pub card: CardConfig,
49    pub mobile: MobileConfig,
50    #[serde(rename = "touchTargets")]
51    pub touch_targets: TouchTargetsConfig,
52    #[serde(default)]
53    pub nav: NavConfig,
54    #[serde(default)]
55    pub social_action_bar: SocialActionBarConfig,
56    // JSON: per-page template data is free-form YAML owned by the site's
57    // templates; the engine passes it through to Tera untouched.
58    #[serde(default)]
59    // JSON: Per-page template variables from the profile YAML; the page data model is dynamic.
60    pub pages: HashMap<String, serde_json::Value>,
61    #[serde(default)]
62    pub i18n: SiteI18nConfig,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize, Default)]
66#[serde(deny_unknown_fields)]
67pub struct NavConfig {
68    #[serde(default, rename = "app_url")]
69    pub app: String,
70    #[serde(default, rename = "docs_url")]
71    pub docs: String,
72    #[serde(default, rename = "blog_url")]
73    pub blog: String,
74    #[serde(default, rename = "playbooks_url")]
75    pub playbooks: String,
76    #[serde(default, rename = "github_url")]
77    pub github: String,
78    #[serde(default, rename = "getting_started_url")]
79    pub getting_started: String,
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize, Default)]
83#[serde(deny_unknown_fields)]
84pub struct SocialActionBarConfig {
85    #[serde(default)]
86    pub label: String,
87    #[serde(default)]
88    pub platforms: Vec<SocialPlatform>,
89    #[serde(default)]
90    pub enable_share: bool,
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize, Default)]
94#[serde(deny_unknown_fields)]
95pub struct SocialPlatform {
96    #[serde(rename = "type")]
97    pub platform_type: String,
98    #[serde(default)]
99    pub url: Option<String>,
100    #[serde(default)]
101    pub label: Option<String>,
102}