#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct CodeThemeFile<'a> {
#[serde(borrow)]
pub content: jacquard_common::types::blob::BlobRef<'a>,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
}
pub mod code_theme_file_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Content;
type Name;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Content = Unset;
type Name = Unset;
type Did = Unset;
}
pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContent<S> {}
impl<S: State> State for SetContent<S> {
type Content = Set<members::content>;
type Name = S::Name;
type Did = S::Did;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Content = S::Content;
type Name = Set<members::name>;
type Did = S::Did;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Content = S::Content;
type Name = S::Name;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct content(());
pub struct name(());
pub struct did(());
}
}
pub struct CodeThemeFileBuilder<'a, S: code_theme_file_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> CodeThemeFile<'a> {
pub fn new() -> CodeThemeFileBuilder<'a, code_theme_file_state::Empty> {
CodeThemeFileBuilder::new()
}
}
impl<'a> CodeThemeFileBuilder<'a, code_theme_file_state::Empty> {
pub fn new() -> Self {
CodeThemeFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CodeThemeFileBuilder<'a, S>
where
S: code_theme_file_state::State,
S::Content: code_theme_file_state::IsUnset,
{
pub fn content(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetContent<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
CodeThemeFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CodeThemeFileBuilder<'a, S>
where
S: code_theme_file_state::State,
S::Did: code_theme_file_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
CodeThemeFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CodeThemeFileBuilder<'a, S>
where
S: code_theme_file_state::State,
S::Name: code_theme_file_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetName<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
CodeThemeFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CodeThemeFileBuilder<'a, S>
where
S: code_theme_file_state::State,
S::Content: code_theme_file_state::IsSet,
S::Name: code_theme_file_state::IsSet,
S::Did: code_theme_file_state::IsSet,
{
pub fn build(self) -> CodeThemeFile<'a> {
CodeThemeFile {
content: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> CodeThemeFile<'a> {
CodeThemeFile {
content: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_notebook_theme() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("sh.weaver.notebook.theme"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("codeThemeFile"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Custom syntax highlighting theme file (sublime text/textmate theme format)",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("content")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"content",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
description: None,
accept: None,
max_size: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Did,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("codeThemeName"),
::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("font"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("value")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"value",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static("Font for a notebook"),
),
refs: vec![
::jacquard_common::CowStr::new_static("#fontName"),
::jacquard_common::CowStr::new_static("#fontFile")
],
closed: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("fontFile"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Custom woff(2) or ttf font file",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("content")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"content",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
description: None,
accept: None,
max_size: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Did,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("fontName"),
::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static("Theme for a notebook"),
),
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("darkScheme"),
::jacquard_common::deps::smol_str::SmolStr::new_static("lightScheme"),
::jacquard_common::deps::smol_str::SmolStr::new_static("fonts"),
::jacquard_common::deps::smol_str::SmolStr::new_static("spacing"),
::jacquard_common::deps::smol_str::SmolStr::new_static("darkCodeTheme"),
::jacquard_common::deps::smol_str::SmolStr::new_static("lightCodeTheme")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"darkCodeTheme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Syntax highlighting theme for dark mode",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("#codeThemeName"),
::jacquard_common::CowStr::new_static("#codeThemeFile")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"darkScheme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"defaultTheme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"fonts",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Fonts to be used in the notebook. Can specify a name or list of names (will load if available) or a file or list of files for each. Empty lists will use site defaults.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("body"),
::jacquard_common::deps::smol_str::SmolStr::new_static("heading"),
::jacquard_common::deps::smol_str::SmolStr::new_static("monospace")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"body",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#font"),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"heading",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#font"),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"monospace",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#font"),
}),
min_length: None,
max_length: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"lightCodeTheme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Syntax highlighting theme for light mode",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("#codeThemeName"),
::jacquard_common::CowStr::new_static("#codeThemeFile")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"lightScheme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"spacing",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("baseSize"),
::jacquard_common::deps::smol_str::SmolStr::new_static("lineHeight"),
::jacquard_common::deps::smol_str::SmolStr::new_static("scale")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"baseSize",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"lineHeight",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"scale",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map
},
}),
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CodeThemeFile<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"codeThemeFile"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.content;
{
let size = value.blob().size;
if size > 20000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobTooLarge {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"content",
),
max: 20000usize,
actual: size,
});
}
}
}
{
let value = &self.content;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["*/*"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobMimeTypeNotAccepted {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"content",
),
accepted: vec!["*/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
pub type CodeThemeName<'a> = jacquard_common::CowStr<'a>;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Font<'a> {
#[serde(borrow)]
pub value: FontValue<'a>,
}
pub mod font_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Value = Unset;
}
pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValue<S> {}
impl<S: State> State for SetValue<S> {
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct value(());
}
}
pub struct FontBuilder<'a, S: font_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<FontValue<'a>>,),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Font<'a> {
pub fn new() -> FontBuilder<'a, font_state::Empty> {
FontBuilder::new()
}
}
impl<'a> FontBuilder<'a, font_state::Empty> {
pub fn new() -> Self {
FontBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontBuilder<'a, S>
where
S: font_state::State,
S::Value: font_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<FontValue<'a>>,
) -> FontBuilder<'a, font_state::SetValue<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
FontBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontBuilder<'a, S>
where
S: font_state::State,
S::Value: font_state::IsSet,
{
pub fn build(self) -> Font<'a> {
Font {
value: self.__unsafe_private_named.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Font<'a> {
Font {
value: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum FontValue<'a> {
#[serde(rename = "sh.weaver.notebook.theme#fontName")]
FontName(Box<crate::sh_weaver::notebook::theme::FontName<'a>>),
#[serde(rename = "sh.weaver.notebook.theme#fontFile")]
FontFile(Box<crate::sh_weaver::notebook::theme::FontFile<'a>>),
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Font<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"font"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct FontFile<'a> {
#[serde(borrow)]
pub content: jacquard_common::types::blob::BlobRef<'a>,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
}
pub mod font_file_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Content;
type Name;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Content = Unset;
type Name = Unset;
type Did = Unset;
}
pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContent<S> {}
impl<S: State> State for SetContent<S> {
type Content = Set<members::content>;
type Name = S::Name;
type Did = S::Did;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Content = S::Content;
type Name = Set<members::name>;
type Did = S::Did;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Content = S::Content;
type Name = S::Name;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct content(());
pub struct name(());
pub struct did(());
}
}
pub struct FontFileBuilder<'a, S: font_file_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> FontFile<'a> {
pub fn new() -> FontFileBuilder<'a, font_file_state::Empty> {
FontFileBuilder::new()
}
}
impl<'a> FontFileBuilder<'a, font_file_state::Empty> {
pub fn new() -> Self {
FontFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontFileBuilder<'a, S>
where
S: font_file_state::State,
S::Content: font_file_state::IsUnset,
{
pub fn content(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> FontFileBuilder<'a, font_file_state::SetContent<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
FontFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontFileBuilder<'a, S>
where
S: font_file_state::State,
S::Did: font_file_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> FontFileBuilder<'a, font_file_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
FontFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontFileBuilder<'a, S>
where
S: font_file_state::State,
S::Name: font_file_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> FontFileBuilder<'a, font_file_state::SetName<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
FontFileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> FontFileBuilder<'a, S>
where
S: font_file_state::State,
S::Content: font_file_state::IsSet,
S::Name: font_file_state::IsSet,
S::Did: font_file_state::IsSet,
{
pub fn build(self) -> FontFile<'a> {
FontFile {
content: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> FontFile<'a> {
FontFile {
content: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
name: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FontFile<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"fontFile"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.content;
{
let size = value.blob().size;
if size > 20000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobTooLarge {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"content",
),
max: 20000usize,
actual: size,
});
}
}
}
{
let value = &self.content;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["*/*"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobMimeTypeNotAccepted {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"content",
),
accepted: vec!["*/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
pub type FontName<'a> = jacquard_common::CowStr<'a>;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Theme<'a> {
#[serde(borrow)]
pub dark_code_theme: ThemeDarkCodeTheme<'a>,
#[serde(borrow)]
pub dark_scheme: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_theme_default_theme")]
#[serde(borrow)]
pub default_theme: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub fonts: ThemeFonts<'a>,
#[serde(borrow)]
pub light_code_theme: ThemeLightCodeTheme<'a>,
#[serde(borrow)]
pub light_scheme: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
#[serde(borrow)]
pub spacing: ThemeSpacing<'a>,
}
fn _default_theme_default_theme() -> std::option::Option<
jacquard_common::CowStr<'static>,
> {
Some(jacquard_common::CowStr::from("auto"))
}
pub mod theme_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Fonts;
type LightScheme;
type LightCodeTheme;
type DarkScheme;
type DarkCodeTheme;
type Spacing;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Fonts = Unset;
type LightScheme = Unset;
type LightCodeTheme = Unset;
type DarkScheme = Unset;
type DarkCodeTheme = Unset;
type Spacing = Unset;
}
pub struct SetFonts<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFonts<S> {}
impl<S: State> State for SetFonts<S> {
type Fonts = Set<members::fonts>;
type LightScheme = S::LightScheme;
type LightCodeTheme = S::LightCodeTheme;
type DarkScheme = S::DarkScheme;
type DarkCodeTheme = S::DarkCodeTheme;
type Spacing = S::Spacing;
}
pub struct SetLightScheme<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLightScheme<S> {}
impl<S: State> State for SetLightScheme<S> {
type Fonts = S::Fonts;
type LightScheme = Set<members::light_scheme>;
type LightCodeTheme = S::LightCodeTheme;
type DarkScheme = S::DarkScheme;
type DarkCodeTheme = S::DarkCodeTheme;
type Spacing = S::Spacing;
}
pub struct SetLightCodeTheme<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLightCodeTheme<S> {}
impl<S: State> State for SetLightCodeTheme<S> {
type Fonts = S::Fonts;
type LightScheme = S::LightScheme;
type LightCodeTheme = Set<members::light_code_theme>;
type DarkScheme = S::DarkScheme;
type DarkCodeTheme = S::DarkCodeTheme;
type Spacing = S::Spacing;
}
pub struct SetDarkScheme<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDarkScheme<S> {}
impl<S: State> State for SetDarkScheme<S> {
type Fonts = S::Fonts;
type LightScheme = S::LightScheme;
type LightCodeTheme = S::LightCodeTheme;
type DarkScheme = Set<members::dark_scheme>;
type DarkCodeTheme = S::DarkCodeTheme;
type Spacing = S::Spacing;
}
pub struct SetDarkCodeTheme<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDarkCodeTheme<S> {}
impl<S: State> State for SetDarkCodeTheme<S> {
type Fonts = S::Fonts;
type LightScheme = S::LightScheme;
type LightCodeTheme = S::LightCodeTheme;
type DarkScheme = S::DarkScheme;
type DarkCodeTheme = Set<members::dark_code_theme>;
type Spacing = S::Spacing;
}
pub struct SetSpacing<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSpacing<S> {}
impl<S: State> State for SetSpacing<S> {
type Fonts = S::Fonts;
type LightScheme = S::LightScheme;
type LightCodeTheme = S::LightCodeTheme;
type DarkScheme = S::DarkScheme;
type DarkCodeTheme = S::DarkCodeTheme;
type Spacing = Set<members::spacing>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct fonts(());
pub struct light_scheme(());
pub struct light_code_theme(());
pub struct dark_scheme(());
pub struct dark_code_theme(());
pub struct spacing(());
}
}
pub struct ThemeBuilder<'a, S: theme_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<ThemeDarkCodeTheme<'a>>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<ThemeFonts<'a>>,
::core::option::Option<ThemeLightCodeTheme<'a>>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<ThemeSpacing<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Theme<'a> {
pub fn new() -> ThemeBuilder<'a, theme_state::Empty> {
ThemeBuilder::new()
}
}
impl<'a> ThemeBuilder<'a, theme_state::Empty> {
pub fn new() -> Self {
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::DarkCodeTheme: theme_state::IsUnset,
{
pub fn dark_code_theme(
mut self,
value: impl Into<ThemeDarkCodeTheme<'a>>,
) -> ThemeBuilder<'a, theme_state::SetDarkCodeTheme<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::DarkScheme: theme_state::IsUnset,
{
pub fn dark_scheme(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> ThemeBuilder<'a, theme_state::SetDarkScheme<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: theme_state::State> ThemeBuilder<'a, S> {
pub fn default_theme(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_default_theme(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::Fonts: theme_state::IsUnset,
{
pub fn fonts(
mut self,
value: impl Into<ThemeFonts<'a>>,
) -> ThemeBuilder<'a, theme_state::SetFonts<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::LightCodeTheme: theme_state::IsUnset,
{
pub fn light_code_theme(
mut self,
value: impl Into<ThemeLightCodeTheme<'a>>,
) -> ThemeBuilder<'a, theme_state::SetLightCodeTheme<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::LightScheme: theme_state::IsUnset,
{
pub fn light_scheme(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> ThemeBuilder<'a, theme_state::SetLightScheme<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::Spacing: theme_state::IsUnset,
{
pub fn spacing(
mut self,
value: impl Into<ThemeSpacing<'a>>,
) -> ThemeBuilder<'a, theme_state::SetSpacing<S>> {
self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
ThemeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeBuilder<'a, S>
where
S: theme_state::State,
S::Fonts: theme_state::IsSet,
S::LightScheme: theme_state::IsSet,
S::LightCodeTheme: theme_state::IsSet,
S::DarkScheme: theme_state::IsSet,
S::DarkCodeTheme: theme_state::IsSet,
S::Spacing: theme_state::IsSet,
{
pub fn build(self) -> Theme<'a> {
Theme {
dark_code_theme: self.__unsafe_private_named.0.unwrap(),
dark_scheme: self.__unsafe_private_named.1.unwrap(),
default_theme: self
.__unsafe_private_named
.2
.or_else(|| Some(jacquard_common::CowStr::from("auto"))),
fonts: self.__unsafe_private_named.3.unwrap(),
light_code_theme: self.__unsafe_private_named.4.unwrap(),
light_scheme: self.__unsafe_private_named.5.unwrap(),
spacing: self.__unsafe_private_named.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Theme<'a> {
Theme {
dark_code_theme: self.__unsafe_private_named.0.unwrap(),
dark_scheme: self.__unsafe_private_named.1.unwrap(),
default_theme: self
.__unsafe_private_named
.2
.or_else(|| Some(jacquard_common::CowStr::from("auto"))),
fonts: self.__unsafe_private_named.3.unwrap(),
light_code_theme: self.__unsafe_private_named.4.unwrap(),
light_scheme: self.__unsafe_private_named.5.unwrap(),
spacing: self.__unsafe_private_named.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Theme<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, ThemeRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ThemeDarkCodeTheme<'a> {
#[serde(rename = "sh.weaver.notebook.theme#codeThemeName")]
CodeThemeName(Box<crate::sh_weaver::notebook::theme::CodeThemeName<'a>>),
#[serde(rename = "sh.weaver.notebook.theme#codeThemeFile")]
CodeThemeFile(Box<crate::sh_weaver::notebook::theme::CodeThemeFile<'a>>),
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ThemeFonts<'a> {
#[serde(borrow)]
pub body: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
#[serde(borrow)]
pub heading: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
#[serde(borrow)]
pub monospace: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
}
pub mod theme_fonts_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Monospace;
type Heading;
type Body;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Monospace = Unset;
type Heading = Unset;
type Body = Unset;
}
pub struct SetMonospace<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMonospace<S> {}
impl<S: State> State for SetMonospace<S> {
type Monospace = Set<members::monospace>;
type Heading = S::Heading;
type Body = S::Body;
}
pub struct SetHeading<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHeading<S> {}
impl<S: State> State for SetHeading<S> {
type Monospace = S::Monospace;
type Heading = Set<members::heading>;
type Body = S::Body;
}
pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBody<S> {}
impl<S: State> State for SetBody<S> {
type Monospace = S::Monospace;
type Heading = S::Heading;
type Body = Set<members::body>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct monospace(());
pub struct heading(());
pub struct body(());
}
}
pub struct ThemeFontsBuilder<'a, S: theme_fonts_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
::core::option::Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
::core::option::Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ThemeFonts<'a> {
pub fn new() -> ThemeFontsBuilder<'a, theme_fonts_state::Empty> {
ThemeFontsBuilder::new()
}
}
impl<'a> ThemeFontsBuilder<'a, theme_fonts_state::Empty> {
pub fn new() -> Self {
ThemeFontsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeFontsBuilder<'a, S>
where
S: theme_fonts_state::State,
S::Body: theme_fonts_state::IsUnset,
{
pub fn body(
mut self,
value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
) -> ThemeFontsBuilder<'a, theme_fonts_state::SetBody<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ThemeFontsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeFontsBuilder<'a, S>
where
S: theme_fonts_state::State,
S::Heading: theme_fonts_state::IsUnset,
{
pub fn heading(
mut self,
value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
) -> ThemeFontsBuilder<'a, theme_fonts_state::SetHeading<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ThemeFontsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeFontsBuilder<'a, S>
where
S: theme_fonts_state::State,
S::Monospace: theme_fonts_state::IsUnset,
{
pub fn monospace(
mut self,
value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
) -> ThemeFontsBuilder<'a, theme_fonts_state::SetMonospace<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
ThemeFontsBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ThemeFontsBuilder<'a, S>
where
S: theme_fonts_state::State,
S::Monospace: theme_fonts_state::IsSet,
S::Heading: theme_fonts_state::IsSet,
S::Body: theme_fonts_state::IsSet,
{
pub fn build(self) -> ThemeFonts<'a> {
ThemeFonts {
body: self.__unsafe_private_named.0.unwrap(),
heading: self.__unsafe_private_named.1.unwrap(),
monospace: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ThemeFonts<'a> {
ThemeFonts {
body: self.__unsafe_private_named.0.unwrap(),
heading: self.__unsafe_private_named.1.unwrap(),
monospace: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThemeFonts<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"ThemeFonts"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ThemeLightCodeTheme<'a> {
#[serde(rename = "sh.weaver.notebook.theme#codeThemeName")]
CodeThemeName(Box<crate::sh_weaver::notebook::theme::CodeThemeName<'a>>),
#[serde(rename = "sh.weaver.notebook.theme#codeThemeFile")]
CodeThemeFile(Box<crate::sh_weaver::notebook::theme::CodeThemeFile<'a>>),
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct ThemeSpacing<'a> {
#[serde(borrow)]
pub base_size: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub line_height: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub scale: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ThemeSpacing<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"ThemeSpacing"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ThemeGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Theme<'a>,
}
impl From<ThemeGetRecordOutput<'_>> for Theme<'_> {
fn from(output: ThemeGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Theme<'_> {
const NSID: &'static str = "sh.weaver.notebook.theme";
type Record = ThemeRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct ThemeRecord;
impl jacquard_common::xrpc::XrpcResp for ThemeRecord {
const NSID: &'static str = "sh.weaver.notebook.theme";
const ENCODING: &'static str = "application/json";
type Output<'de> = ThemeGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for ThemeRecord {
const NSID: &'static str = "sh.weaver.notebook.theme";
type Record = ThemeRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Theme<'a> {
fn nsid() -> &'static str {
"sh.weaver.notebook.theme"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_theme()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}