Skip to main content

jacquard_api/sh_weaver/notebook/
theme.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.notebook.theme
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::types::blob::BlobRef;
18use jacquard_common::types::collection::{Collection, RecordError};
19use jacquard_common::types::string::{Did, AtUri, Cid};
20use jacquard_common::types::uri::{RecordUri, UriError};
21use jacquard_common::xrpc::XrpcResp;
22use jacquard_derive::{IntoStatic, lexicon, open_union};
23use jacquard_lexicon::lexicon::LexiconDoc;
24use jacquard_lexicon::schema::LexiconSchema;
25
26#[allow(unused_imports)]
27use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
28use serde::{Serialize, Deserialize};
29use crate::com_atproto::repo::strong_ref::StrongRef;
30use crate::sh_weaver::notebook::theme;
31/// Custom syntax highlighting theme file (sublime text/textmate theme format)
32
33#[lexicon]
34#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
35#[serde(rename_all = "camelCase")]
36pub struct CodeThemeFile<'a> {
37    #[serde(borrow)]
38    pub content: BlobRef<'a>,
39    #[serde(borrow)]
40    pub did: Did<'a>,
41    #[serde(borrow)]
42    pub name: CowStr<'a>,
43}
44
45pub type CodeThemeName<'a> = CowStr<'a>;
46
47#[lexicon]
48#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
49#[serde(rename_all = "camelCase")]
50pub struct Font<'a> {
51    ///Font for a notebook
52    #[serde(borrow)]
53    pub value: FontValue<'a>,
54}
55
56
57#[open_union]
58#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
59#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
60pub enum FontValue<'a> {
61    #[serde(rename = "sh.weaver.notebook.theme#fontName")]
62    FontName(Box<theme::FontName<'a>>),
63    #[serde(rename = "sh.weaver.notebook.theme#fontFile")]
64    FontFile(Box<theme::FontFile<'a>>),
65}
66
67/// Custom woff(2) or ttf font file
68
69#[lexicon]
70#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
71#[serde(rename_all = "camelCase")]
72pub struct FontFile<'a> {
73    #[serde(borrow)]
74    pub content: BlobRef<'a>,
75    #[serde(borrow)]
76    pub did: Did<'a>,
77    #[serde(borrow)]
78    pub name: CowStr<'a>,
79}
80
81pub type FontName<'a> = CowStr<'a>;
82/// Theme for a notebook
83
84#[lexicon]
85#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
86#[serde(rename_all = "camelCase", rename = "sh.weaver.notebook.theme", tag = "$type")]
87pub struct Theme<'a> {
88    ///Syntax highlighting theme for dark mode
89    #[serde(borrow)]
90    pub dark_code_theme: ThemeDarkCodeTheme<'a>,
91    ///Reference to a dark colour scheme
92    #[serde(borrow)]
93    pub dark_scheme: StrongRef<'a>,
94    /// Defaults to `"auto"`.
95    #[serde(skip_serializing_if = "Option::is_none")]
96    #[serde(default = "_default_theme_default_theme")]
97    #[serde(borrow)]
98    pub default_theme: Option<CowStr<'a>>,
99    ///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.
100    #[serde(borrow)]
101    pub fonts: ThemeFonts<'a>,
102    ///Syntax highlighting theme for light mode
103    #[serde(borrow)]
104    pub light_code_theme: ThemeLightCodeTheme<'a>,
105    ///Reference to a light colour scheme
106    #[serde(borrow)]
107    pub light_scheme: StrongRef<'a>,
108    #[serde(borrow)]
109    pub spacing: ThemeSpacing<'a>,
110}
111
112
113#[open_union]
114#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
115#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
116pub enum ThemeDarkCodeTheme<'a> {
117    #[serde(rename = "sh.weaver.notebook.theme#codeThemeName")]
118    CodeThemeName(Box<theme::CodeThemeName<'a>>),
119    #[serde(rename = "sh.weaver.notebook.theme#codeThemeFile")]
120    CodeThemeFile(Box<theme::CodeThemeFile<'a>>),
121}
122
123/// 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.
124
125#[lexicon]
126#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
127#[serde(rename_all = "camelCase")]
128pub struct ThemeFonts<'a> {
129    #[serde(borrow)]
130    pub body: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
131    #[serde(borrow)]
132    pub heading: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
133    #[serde(borrow)]
134    pub monospace: Vec<crate::sh_weaver::notebook::theme::Font<'a>>,
135}
136
137
138#[open_union]
139#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
140#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
141pub enum ThemeLightCodeTheme<'a> {
142    #[serde(rename = "sh.weaver.notebook.theme#codeThemeName")]
143    CodeThemeName(Box<theme::CodeThemeName<'a>>),
144    #[serde(rename = "sh.weaver.notebook.theme#codeThemeFile")]
145    CodeThemeFile(Box<theme::CodeThemeFile<'a>>),
146}
147
148
149#[lexicon]
150#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
151#[serde(rename_all = "camelCase")]
152pub struct ThemeSpacing<'a> {
153    #[serde(borrow)]
154    pub base_size: CowStr<'a>,
155    #[serde(borrow)]
156    pub line_height: CowStr<'a>,
157    #[serde(borrow)]
158    pub scale: CowStr<'a>,
159}
160
161/// Typed wrapper for GetRecord response with this collection's record type.
162
163#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
164#[serde(rename_all = "camelCase")]
165pub struct ThemeGetRecordOutput<'a> {
166    #[serde(skip_serializing_if = "Option::is_none")]
167    #[serde(borrow)]
168    pub cid: Option<Cid<'a>>,
169    #[serde(borrow)]
170    pub uri: AtUri<'a>,
171    #[serde(borrow)]
172    pub value: Theme<'a>,
173}
174
175impl<'a> Theme<'a> {
176    pub fn uri(
177        uri: impl Into<CowStr<'a>>,
178    ) -> Result<RecordUri<'a, ThemeRecord>, UriError> {
179        RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
180    }
181}
182
183impl<'a> LexiconSchema for CodeThemeFile<'a> {
184    fn nsid() -> &'static str {
185        "sh.weaver.notebook.theme"
186    }
187    fn def_name() -> &'static str {
188        "codeThemeFile"
189    }
190    fn lexicon_doc() -> LexiconDoc<'static> {
191        lexicon_doc_sh_weaver_notebook_theme()
192    }
193    fn validate(&self) -> Result<(), ConstraintError> {
194        {
195            let value = &self.content;
196            {
197                let size = value.blob().size;
198                if size > 20000usize {
199                    return Err(ConstraintError::BlobTooLarge {
200                        path: ValidationPath::from_field("content"),
201                        max: 20000usize,
202                        actual: size,
203                    });
204                }
205            }
206        }
207        {
208            let value = &self.content;
209            {
210                let mime = value.blob().mime_type.as_str();
211                let accepted: &[&str] = &["*/*"];
212                let matched = accepted
213                    .iter()
214                    .any(|pattern| {
215                        if *pattern == "*/*" {
216                            true
217                        } else if pattern.ends_with("/*") {
218                            let prefix = &pattern[..pattern.len() - 2];
219                            mime.starts_with(prefix)
220                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
221                        } else {
222                            mime == *pattern
223                        }
224                    });
225                if !matched {
226                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
227                        path: ValidationPath::from_field("content"),
228                        accepted: vec!["*/*".to_string()],
229                        actual: mime.to_string(),
230                    });
231                }
232            }
233        }
234        Ok(())
235    }
236}
237
238impl<'a> LexiconSchema for Font<'a> {
239    fn nsid() -> &'static str {
240        "sh.weaver.notebook.theme"
241    }
242    fn def_name() -> &'static str {
243        "font"
244    }
245    fn lexicon_doc() -> LexiconDoc<'static> {
246        lexicon_doc_sh_weaver_notebook_theme()
247    }
248    fn validate(&self) -> Result<(), ConstraintError> {
249        Ok(())
250    }
251}
252
253impl<'a> LexiconSchema for FontFile<'a> {
254    fn nsid() -> &'static str {
255        "sh.weaver.notebook.theme"
256    }
257    fn def_name() -> &'static str {
258        "fontFile"
259    }
260    fn lexicon_doc() -> LexiconDoc<'static> {
261        lexicon_doc_sh_weaver_notebook_theme()
262    }
263    fn validate(&self) -> Result<(), ConstraintError> {
264        {
265            let value = &self.content;
266            {
267                let size = value.blob().size;
268                if size > 20000usize {
269                    return Err(ConstraintError::BlobTooLarge {
270                        path: ValidationPath::from_field("content"),
271                        max: 20000usize,
272                        actual: size,
273                    });
274                }
275            }
276        }
277        {
278            let value = &self.content;
279            {
280                let mime = value.blob().mime_type.as_str();
281                let accepted: &[&str] = &["*/*"];
282                let matched = accepted
283                    .iter()
284                    .any(|pattern| {
285                        if *pattern == "*/*" {
286                            true
287                        } else if pattern.ends_with("/*") {
288                            let prefix = &pattern[..pattern.len() - 2];
289                            mime.starts_with(prefix)
290                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
291                        } else {
292                            mime == *pattern
293                        }
294                    });
295                if !matched {
296                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
297                        path: ValidationPath::from_field("content"),
298                        accepted: vec!["*/*".to_string()],
299                        actual: mime.to_string(),
300                    });
301                }
302            }
303        }
304        Ok(())
305    }
306}
307
308/// Marker type for deserializing records from this collection.
309
310#[derive(Debug, Serialize, Deserialize)]
311pub struct ThemeRecord;
312impl XrpcResp for ThemeRecord {
313    const NSID: &'static str = "sh.weaver.notebook.theme";
314    const ENCODING: &'static str = "application/json";
315    type Output<'de> = ThemeGetRecordOutput<'de>;
316    type Err<'de> = RecordError<'de>;
317}
318
319impl From<ThemeGetRecordOutput<'_>> for Theme<'_> {
320    fn from(output: ThemeGetRecordOutput<'_>) -> Self {
321        use jacquard_common::IntoStatic;
322        output.value.into_static()
323    }
324}
325
326impl Collection for Theme<'_> {
327    const NSID: &'static str = "sh.weaver.notebook.theme";
328    type Record = ThemeRecord;
329}
330
331impl Collection for ThemeRecord {
332    const NSID: &'static str = "sh.weaver.notebook.theme";
333    type Record = ThemeRecord;
334}
335
336impl<'a> LexiconSchema for Theme<'a> {
337    fn nsid() -> &'static str {
338        "sh.weaver.notebook.theme"
339    }
340    fn def_name() -> &'static str {
341        "main"
342    }
343    fn lexicon_doc() -> LexiconDoc<'static> {
344        lexicon_doc_sh_weaver_notebook_theme()
345    }
346    fn validate(&self) -> Result<(), ConstraintError> {
347        Ok(())
348    }
349}
350
351pub mod code_theme_file_state {
352
353    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
354    #[allow(unused)]
355    use ::core::marker::PhantomData;
356    mod sealed {
357        pub trait Sealed {}
358    }
359    /// State trait tracking which required fields have been set
360    pub trait State: sealed::Sealed {
361        type Name;
362        type Content;
363        type Did;
364    }
365    /// Empty state - all required fields are unset
366    pub struct Empty(());
367    impl sealed::Sealed for Empty {}
368    impl State for Empty {
369        type Name = Unset;
370        type Content = Unset;
371        type Did = Unset;
372    }
373    ///State transition - sets the `name` field to Set
374    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
375    impl<S: State> sealed::Sealed for SetName<S> {}
376    impl<S: State> State for SetName<S> {
377        type Name = Set<members::name>;
378        type Content = S::Content;
379        type Did = S::Did;
380    }
381    ///State transition - sets the `content` field to Set
382    pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
383    impl<S: State> sealed::Sealed for SetContent<S> {}
384    impl<S: State> State for SetContent<S> {
385        type Name = S::Name;
386        type Content = Set<members::content>;
387        type Did = S::Did;
388    }
389    ///State transition - sets the `did` field to Set
390    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
391    impl<S: State> sealed::Sealed for SetDid<S> {}
392    impl<S: State> State for SetDid<S> {
393        type Name = S::Name;
394        type Content = S::Content;
395        type Did = Set<members::did>;
396    }
397    /// Marker types for field names
398    #[allow(non_camel_case_types)]
399    pub mod members {
400        ///Marker type for the `name` field
401        pub struct name(());
402        ///Marker type for the `content` field
403        pub struct content(());
404        ///Marker type for the `did` field
405        pub struct did(());
406    }
407}
408
409/// Builder for constructing an instance of this type
410pub struct CodeThemeFileBuilder<'a, S: code_theme_file_state::State> {
411    _state: PhantomData<fn() -> S>,
412    _fields: (Option<BlobRef<'a>>, Option<Did<'a>>, Option<CowStr<'a>>),
413    _lifetime: PhantomData<&'a ()>,
414}
415
416impl<'a> CodeThemeFile<'a> {
417    /// Create a new builder for this type
418    pub fn new() -> CodeThemeFileBuilder<'a, code_theme_file_state::Empty> {
419        CodeThemeFileBuilder::new()
420    }
421}
422
423impl<'a> CodeThemeFileBuilder<'a, code_theme_file_state::Empty> {
424    /// Create a new builder with all fields unset
425    pub fn new() -> Self {
426        CodeThemeFileBuilder {
427            _state: PhantomData,
428            _fields: (None, None, None),
429            _lifetime: PhantomData,
430        }
431    }
432}
433
434impl<'a, S> CodeThemeFileBuilder<'a, S>
435where
436    S: code_theme_file_state::State,
437    S::Content: code_theme_file_state::IsUnset,
438{
439    /// Set the `content` field (required)
440    pub fn content(
441        mut self,
442        value: impl Into<BlobRef<'a>>,
443    ) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetContent<S>> {
444        self._fields.0 = Option::Some(value.into());
445        CodeThemeFileBuilder {
446            _state: PhantomData,
447            _fields: self._fields,
448            _lifetime: PhantomData,
449        }
450    }
451}
452
453impl<'a, S> CodeThemeFileBuilder<'a, S>
454where
455    S: code_theme_file_state::State,
456    S::Did: code_theme_file_state::IsUnset,
457{
458    /// Set the `did` field (required)
459    pub fn did(
460        mut self,
461        value: impl Into<Did<'a>>,
462    ) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetDid<S>> {
463        self._fields.1 = Option::Some(value.into());
464        CodeThemeFileBuilder {
465            _state: PhantomData,
466            _fields: self._fields,
467            _lifetime: PhantomData,
468        }
469    }
470}
471
472impl<'a, S> CodeThemeFileBuilder<'a, S>
473where
474    S: code_theme_file_state::State,
475    S::Name: code_theme_file_state::IsUnset,
476{
477    /// Set the `name` field (required)
478    pub fn name(
479        mut self,
480        value: impl Into<CowStr<'a>>,
481    ) -> CodeThemeFileBuilder<'a, code_theme_file_state::SetName<S>> {
482        self._fields.2 = Option::Some(value.into());
483        CodeThemeFileBuilder {
484            _state: PhantomData,
485            _fields: self._fields,
486            _lifetime: PhantomData,
487        }
488    }
489}
490
491impl<'a, S> CodeThemeFileBuilder<'a, S>
492where
493    S: code_theme_file_state::State,
494    S::Name: code_theme_file_state::IsSet,
495    S::Content: code_theme_file_state::IsSet,
496    S::Did: code_theme_file_state::IsSet,
497{
498    /// Build the final struct
499    pub fn build(self) -> CodeThemeFile<'a> {
500        CodeThemeFile {
501            content: self._fields.0.unwrap(),
502            did: self._fields.1.unwrap(),
503            name: self._fields.2.unwrap(),
504            extra_data: Default::default(),
505        }
506    }
507    /// Build the final struct with custom extra_data
508    pub fn build_with_data(
509        self,
510        extra_data: BTreeMap<
511            jacquard_common::deps::smol_str::SmolStr,
512            jacquard_common::types::value::Data<'a>,
513        >,
514    ) -> CodeThemeFile<'a> {
515        CodeThemeFile {
516            content: self._fields.0.unwrap(),
517            did: self._fields.1.unwrap(),
518            name: self._fields.2.unwrap(),
519            extra_data: Some(extra_data),
520        }
521    }
522}
523
524fn lexicon_doc_sh_weaver_notebook_theme() -> LexiconDoc<'static> {
525    #[allow(unused_imports)]
526    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
527    use jacquard_lexicon::lexicon::*;
528    use alloc::collections::BTreeMap;
529    LexiconDoc {
530        lexicon: Lexicon::Lexicon1,
531        id: CowStr::new_static("sh.weaver.notebook.theme"),
532        defs: {
533            let mut map = BTreeMap::new();
534            map.insert(
535                SmolStr::new_static("codeThemeFile"),
536                LexUserType::Object(LexObject {
537                    description: Some(
538                        CowStr::new_static(
539                            "Custom syntax highlighting theme file (sublime text/textmate theme format)",
540                        ),
541                    ),
542                    required: Some(
543                        vec![
544                            SmolStr::new_static("name"), SmolStr::new_static("did"),
545                            SmolStr::new_static("content")
546                        ],
547                    ),
548                    properties: {
549                        #[allow(unused_mut)]
550                        let mut map = BTreeMap::new();
551                        map.insert(
552                            SmolStr::new_static("content"),
553                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
554                        );
555                        map.insert(
556                            SmolStr::new_static("did"),
557                            LexObjectProperty::String(LexString {
558                                format: Some(LexStringFormat::Did),
559                                ..Default::default()
560                            }),
561                        );
562                        map.insert(
563                            SmolStr::new_static("name"),
564                            LexObjectProperty::String(LexString { ..Default::default() }),
565                        );
566                        map
567                    },
568                    ..Default::default()
569                }),
570            );
571            map.insert(
572                SmolStr::new_static("codeThemeName"),
573                LexUserType::String(LexString { ..Default::default() }),
574            );
575            map.insert(
576                SmolStr::new_static("font"),
577                LexUserType::Object(LexObject {
578                    required: Some(vec![SmolStr::new_static("value")]),
579                    properties: {
580                        #[allow(unused_mut)]
581                        let mut map = BTreeMap::new();
582                        map.insert(
583                            SmolStr::new_static("value"),
584                            LexObjectProperty::Union(LexRefUnion {
585                                description: Some(
586                                    CowStr::new_static("Font for a notebook"),
587                                ),
588                                refs: vec![
589                                    CowStr::new_static("#fontName"),
590                                    CowStr::new_static("#fontFile")
591                                ],
592                                ..Default::default()
593                            }),
594                        );
595                        map
596                    },
597                    ..Default::default()
598                }),
599            );
600            map.insert(
601                SmolStr::new_static("fontFile"),
602                LexUserType::Object(LexObject {
603                    description: Some(
604                        CowStr::new_static("Custom woff(2) or ttf font file"),
605                    ),
606                    required: Some(
607                        vec![
608                            SmolStr::new_static("name"), SmolStr::new_static("did"),
609                            SmolStr::new_static("content")
610                        ],
611                    ),
612                    properties: {
613                        #[allow(unused_mut)]
614                        let mut map = BTreeMap::new();
615                        map.insert(
616                            SmolStr::new_static("content"),
617                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
618                        );
619                        map.insert(
620                            SmolStr::new_static("did"),
621                            LexObjectProperty::String(LexString {
622                                format: Some(LexStringFormat::Did),
623                                ..Default::default()
624                            }),
625                        );
626                        map.insert(
627                            SmolStr::new_static("name"),
628                            LexObjectProperty::String(LexString { ..Default::default() }),
629                        );
630                        map
631                    },
632                    ..Default::default()
633                }),
634            );
635            map.insert(
636                SmolStr::new_static("fontName"),
637                LexUserType::String(LexString { ..Default::default() }),
638            );
639            map.insert(
640                SmolStr::new_static("main"),
641                LexUserType::Record(LexRecord {
642                    description: Some(CowStr::new_static("Theme for a notebook")),
643                    key: Some(CowStr::new_static("tid")),
644                    record: LexRecordRecord::Object(LexObject {
645                        required: Some(
646                            vec![
647                                SmolStr::new_static("darkScheme"),
648                                SmolStr::new_static("lightScheme"),
649                                SmolStr::new_static("fonts"),
650                                SmolStr::new_static("spacing"),
651                                SmolStr::new_static("darkCodeTheme"),
652                                SmolStr::new_static("lightCodeTheme")
653                            ],
654                        ),
655                        properties: {
656                            #[allow(unused_mut)]
657                            let mut map = BTreeMap::new();
658                            map.insert(
659                                SmolStr::new_static("darkCodeTheme"),
660                                LexObjectProperty::Union(LexRefUnion {
661                                    description: Some(
662                                        CowStr::new_static(
663                                            "Syntax highlighting theme for dark mode",
664                                        ),
665                                    ),
666                                    refs: vec![
667                                        CowStr::new_static("#codeThemeName"),
668                                        CowStr::new_static("#codeThemeFile")
669                                    ],
670                                    ..Default::default()
671                                }),
672                            );
673                            map.insert(
674                                SmolStr::new_static("darkScheme"),
675                                LexObjectProperty::Ref(LexRef {
676                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
677                                    ..Default::default()
678                                }),
679                            );
680                            map.insert(
681                                SmolStr::new_static("defaultTheme"),
682                                LexObjectProperty::String(LexString {
683                                    ..Default::default()
684                                }),
685                            );
686                            map.insert(
687                                SmolStr::new_static("fonts"),
688                                LexObjectProperty::Object(LexObject {
689                                    description: Some(
690                                        CowStr::new_static(
691                                            "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.",
692                                        ),
693                                    ),
694                                    required: Some(
695                                        vec![
696                                            SmolStr::new_static("body"), SmolStr::new_static("heading"),
697                                            SmolStr::new_static("monospace")
698                                        ],
699                                    ),
700                                    properties: {
701                                        #[allow(unused_mut)]
702                                        let mut map = BTreeMap::new();
703                                        map.insert(
704                                            SmolStr::new_static("body"),
705                                            LexObjectProperty::Array(LexArray {
706                                                items: LexArrayItem::Ref(LexRef {
707                                                    r#ref: CowStr::new_static("#font"),
708                                                    ..Default::default()
709                                                }),
710                                                ..Default::default()
711                                            }),
712                                        );
713                                        map.insert(
714                                            SmolStr::new_static("heading"),
715                                            LexObjectProperty::Array(LexArray {
716                                                items: LexArrayItem::Ref(LexRef {
717                                                    r#ref: CowStr::new_static("#font"),
718                                                    ..Default::default()
719                                                }),
720                                                ..Default::default()
721                                            }),
722                                        );
723                                        map.insert(
724                                            SmolStr::new_static("monospace"),
725                                            LexObjectProperty::Array(LexArray {
726                                                items: LexArrayItem::Ref(LexRef {
727                                                    r#ref: CowStr::new_static("#font"),
728                                                    ..Default::default()
729                                                }),
730                                                ..Default::default()
731                                            }),
732                                        );
733                                        map
734                                    },
735                                    ..Default::default()
736                                }),
737                            );
738                            map.insert(
739                                SmolStr::new_static("lightCodeTheme"),
740                                LexObjectProperty::Union(LexRefUnion {
741                                    description: Some(
742                                        CowStr::new_static(
743                                            "Syntax highlighting theme for light mode",
744                                        ),
745                                    ),
746                                    refs: vec![
747                                        CowStr::new_static("#codeThemeName"),
748                                        CowStr::new_static("#codeThemeFile")
749                                    ],
750                                    ..Default::default()
751                                }),
752                            );
753                            map.insert(
754                                SmolStr::new_static("lightScheme"),
755                                LexObjectProperty::Ref(LexRef {
756                                    r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
757                                    ..Default::default()
758                                }),
759                            );
760                            map.insert(
761                                SmolStr::new_static("spacing"),
762                                LexObjectProperty::Object(LexObject {
763                                    required: Some(
764                                        vec![
765                                            SmolStr::new_static("baseSize"),
766                                            SmolStr::new_static("lineHeight"),
767                                            SmolStr::new_static("scale")
768                                        ],
769                                    ),
770                                    properties: {
771                                        #[allow(unused_mut)]
772                                        let mut map = BTreeMap::new();
773                                        map.insert(
774                                            SmolStr::new_static("baseSize"),
775                                            LexObjectProperty::String(LexString {
776                                                ..Default::default()
777                                            }),
778                                        );
779                                        map.insert(
780                                            SmolStr::new_static("lineHeight"),
781                                            LexObjectProperty::String(LexString {
782                                                ..Default::default()
783                                            }),
784                                        );
785                                        map.insert(
786                                            SmolStr::new_static("scale"),
787                                            LexObjectProperty::String(LexString {
788                                                ..Default::default()
789                                            }),
790                                        );
791                                        map
792                                    },
793                                    ..Default::default()
794                                }),
795                            );
796                            map
797                        },
798                        ..Default::default()
799                    }),
800                    ..Default::default()
801                }),
802            );
803            map
804        },
805        ..Default::default()
806    }
807}
808
809pub mod font_state {
810
811    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
812    #[allow(unused)]
813    use ::core::marker::PhantomData;
814    mod sealed {
815        pub trait Sealed {}
816    }
817    /// State trait tracking which required fields have been set
818    pub trait State: sealed::Sealed {
819        type Value;
820    }
821    /// Empty state - all required fields are unset
822    pub struct Empty(());
823    impl sealed::Sealed for Empty {}
824    impl State for Empty {
825        type Value = Unset;
826    }
827    ///State transition - sets the `value` field to Set
828    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
829    impl<S: State> sealed::Sealed for SetValue<S> {}
830    impl<S: State> State for SetValue<S> {
831        type Value = Set<members::value>;
832    }
833    /// Marker types for field names
834    #[allow(non_camel_case_types)]
835    pub mod members {
836        ///Marker type for the `value` field
837        pub struct value(());
838    }
839}
840
841/// Builder for constructing an instance of this type
842pub struct FontBuilder<'a, S: font_state::State> {
843    _state: PhantomData<fn() -> S>,
844    _fields: (Option<FontValue<'a>>,),
845    _lifetime: PhantomData<&'a ()>,
846}
847
848impl<'a> Font<'a> {
849    /// Create a new builder for this type
850    pub fn new() -> FontBuilder<'a, font_state::Empty> {
851        FontBuilder::new()
852    }
853}
854
855impl<'a> FontBuilder<'a, font_state::Empty> {
856    /// Create a new builder with all fields unset
857    pub fn new() -> Self {
858        FontBuilder {
859            _state: PhantomData,
860            _fields: (None,),
861            _lifetime: PhantomData,
862        }
863    }
864}
865
866impl<'a, S> FontBuilder<'a, S>
867where
868    S: font_state::State,
869    S::Value: font_state::IsUnset,
870{
871    /// Set the `value` field (required)
872    pub fn value(
873        mut self,
874        value: impl Into<FontValue<'a>>,
875    ) -> FontBuilder<'a, font_state::SetValue<S>> {
876        self._fields.0 = Option::Some(value.into());
877        FontBuilder {
878            _state: PhantomData,
879            _fields: self._fields,
880            _lifetime: PhantomData,
881        }
882    }
883}
884
885impl<'a, S> FontBuilder<'a, S>
886where
887    S: font_state::State,
888    S::Value: font_state::IsSet,
889{
890    /// Build the final struct
891    pub fn build(self) -> Font<'a> {
892        Font {
893            value: self._fields.0.unwrap(),
894            extra_data: Default::default(),
895        }
896    }
897    /// Build the final struct with custom extra_data
898    pub fn build_with_data(
899        self,
900        extra_data: BTreeMap<
901            jacquard_common::deps::smol_str::SmolStr,
902            jacquard_common::types::value::Data<'a>,
903        >,
904    ) -> Font<'a> {
905        Font {
906            value: self._fields.0.unwrap(),
907            extra_data: Some(extra_data),
908        }
909    }
910}
911
912pub mod font_file_state {
913
914    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
915    #[allow(unused)]
916    use ::core::marker::PhantomData;
917    mod sealed {
918        pub trait Sealed {}
919    }
920    /// State trait tracking which required fields have been set
921    pub trait State: sealed::Sealed {
922        type Name;
923        type Did;
924        type Content;
925    }
926    /// Empty state - all required fields are unset
927    pub struct Empty(());
928    impl sealed::Sealed for Empty {}
929    impl State for Empty {
930        type Name = Unset;
931        type Did = Unset;
932        type Content = Unset;
933    }
934    ///State transition - sets the `name` field to Set
935    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
936    impl<S: State> sealed::Sealed for SetName<S> {}
937    impl<S: State> State for SetName<S> {
938        type Name = Set<members::name>;
939        type Did = S::Did;
940        type Content = S::Content;
941    }
942    ///State transition - sets the `did` field to Set
943    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
944    impl<S: State> sealed::Sealed for SetDid<S> {}
945    impl<S: State> State for SetDid<S> {
946        type Name = S::Name;
947        type Did = Set<members::did>;
948        type Content = S::Content;
949    }
950    ///State transition - sets the `content` field to Set
951    pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
952    impl<S: State> sealed::Sealed for SetContent<S> {}
953    impl<S: State> State for SetContent<S> {
954        type Name = S::Name;
955        type Did = S::Did;
956        type Content = Set<members::content>;
957    }
958    /// Marker types for field names
959    #[allow(non_camel_case_types)]
960    pub mod members {
961        ///Marker type for the `name` field
962        pub struct name(());
963        ///Marker type for the `did` field
964        pub struct did(());
965        ///Marker type for the `content` field
966        pub struct content(());
967    }
968}
969
970/// Builder for constructing an instance of this type
971pub struct FontFileBuilder<'a, S: font_file_state::State> {
972    _state: PhantomData<fn() -> S>,
973    _fields: (Option<BlobRef<'a>>, Option<Did<'a>>, Option<CowStr<'a>>),
974    _lifetime: PhantomData<&'a ()>,
975}
976
977impl<'a> FontFile<'a> {
978    /// Create a new builder for this type
979    pub fn new() -> FontFileBuilder<'a, font_file_state::Empty> {
980        FontFileBuilder::new()
981    }
982}
983
984impl<'a> FontFileBuilder<'a, font_file_state::Empty> {
985    /// Create a new builder with all fields unset
986    pub fn new() -> Self {
987        FontFileBuilder {
988            _state: PhantomData,
989            _fields: (None, None, None),
990            _lifetime: PhantomData,
991        }
992    }
993}
994
995impl<'a, S> FontFileBuilder<'a, S>
996where
997    S: font_file_state::State,
998    S::Content: font_file_state::IsUnset,
999{
1000    /// Set the `content` field (required)
1001    pub fn content(
1002        mut self,
1003        value: impl Into<BlobRef<'a>>,
1004    ) -> FontFileBuilder<'a, font_file_state::SetContent<S>> {
1005        self._fields.0 = Option::Some(value.into());
1006        FontFileBuilder {
1007            _state: PhantomData,
1008            _fields: self._fields,
1009            _lifetime: PhantomData,
1010        }
1011    }
1012}
1013
1014impl<'a, S> FontFileBuilder<'a, S>
1015where
1016    S: font_file_state::State,
1017    S::Did: font_file_state::IsUnset,
1018{
1019    /// Set the `did` field (required)
1020    pub fn did(
1021        mut self,
1022        value: impl Into<Did<'a>>,
1023    ) -> FontFileBuilder<'a, font_file_state::SetDid<S>> {
1024        self._fields.1 = Option::Some(value.into());
1025        FontFileBuilder {
1026            _state: PhantomData,
1027            _fields: self._fields,
1028            _lifetime: PhantomData,
1029        }
1030    }
1031}
1032
1033impl<'a, S> FontFileBuilder<'a, S>
1034where
1035    S: font_file_state::State,
1036    S::Name: font_file_state::IsUnset,
1037{
1038    /// Set the `name` field (required)
1039    pub fn name(
1040        mut self,
1041        value: impl Into<CowStr<'a>>,
1042    ) -> FontFileBuilder<'a, font_file_state::SetName<S>> {
1043        self._fields.2 = Option::Some(value.into());
1044        FontFileBuilder {
1045            _state: PhantomData,
1046            _fields: self._fields,
1047            _lifetime: PhantomData,
1048        }
1049    }
1050}
1051
1052impl<'a, S> FontFileBuilder<'a, S>
1053where
1054    S: font_file_state::State,
1055    S::Name: font_file_state::IsSet,
1056    S::Did: font_file_state::IsSet,
1057    S::Content: font_file_state::IsSet,
1058{
1059    /// Build the final struct
1060    pub fn build(self) -> FontFile<'a> {
1061        FontFile {
1062            content: self._fields.0.unwrap(),
1063            did: self._fields.1.unwrap(),
1064            name: self._fields.2.unwrap(),
1065            extra_data: Default::default(),
1066        }
1067    }
1068    /// Build the final struct with custom extra_data
1069    pub fn build_with_data(
1070        self,
1071        extra_data: BTreeMap<
1072            jacquard_common::deps::smol_str::SmolStr,
1073            jacquard_common::types::value::Data<'a>,
1074        >,
1075    ) -> FontFile<'a> {
1076        FontFile {
1077            content: self._fields.0.unwrap(),
1078            did: self._fields.1.unwrap(),
1079            name: self._fields.2.unwrap(),
1080            extra_data: Some(extra_data),
1081        }
1082    }
1083}
1084
1085fn _default_theme_default_theme() -> Option<CowStr<'static>> {
1086    Some(CowStr::from("auto"))
1087}
1088
1089impl<'a> LexiconSchema for ThemeFonts<'a> {
1090    fn nsid() -> &'static str {
1091        "sh.weaver.notebook.theme"
1092    }
1093    fn def_name() -> &'static str {
1094        "ThemeFonts"
1095    }
1096    fn lexicon_doc() -> LexiconDoc<'static> {
1097        lexicon_doc_sh_weaver_notebook_theme()
1098    }
1099    fn validate(&self) -> Result<(), ConstraintError> {
1100        Ok(())
1101    }
1102}
1103
1104pub mod theme_fonts_state {
1105
1106    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1107    #[allow(unused)]
1108    use ::core::marker::PhantomData;
1109    mod sealed {
1110        pub trait Sealed {}
1111    }
1112    /// State trait tracking which required fields have been set
1113    pub trait State: sealed::Sealed {
1114        type Monospace;
1115        type Body;
1116        type Heading;
1117    }
1118    /// Empty state - all required fields are unset
1119    pub struct Empty(());
1120    impl sealed::Sealed for Empty {}
1121    impl State for Empty {
1122        type Monospace = Unset;
1123        type Body = Unset;
1124        type Heading = Unset;
1125    }
1126    ///State transition - sets the `monospace` field to Set
1127    pub struct SetMonospace<S: State = Empty>(PhantomData<fn() -> S>);
1128    impl<S: State> sealed::Sealed for SetMonospace<S> {}
1129    impl<S: State> State for SetMonospace<S> {
1130        type Monospace = Set<members::monospace>;
1131        type Body = S::Body;
1132        type Heading = S::Heading;
1133    }
1134    ///State transition - sets the `body` field to Set
1135    pub struct SetBody<S: State = Empty>(PhantomData<fn() -> S>);
1136    impl<S: State> sealed::Sealed for SetBody<S> {}
1137    impl<S: State> State for SetBody<S> {
1138        type Monospace = S::Monospace;
1139        type Body = Set<members::body>;
1140        type Heading = S::Heading;
1141    }
1142    ///State transition - sets the `heading` field to Set
1143    pub struct SetHeading<S: State = Empty>(PhantomData<fn() -> S>);
1144    impl<S: State> sealed::Sealed for SetHeading<S> {}
1145    impl<S: State> State for SetHeading<S> {
1146        type Monospace = S::Monospace;
1147        type Body = S::Body;
1148        type Heading = Set<members::heading>;
1149    }
1150    /// Marker types for field names
1151    #[allow(non_camel_case_types)]
1152    pub mod members {
1153        ///Marker type for the `monospace` field
1154        pub struct monospace(());
1155        ///Marker type for the `body` field
1156        pub struct body(());
1157        ///Marker type for the `heading` field
1158        pub struct heading(());
1159    }
1160}
1161
1162/// Builder for constructing an instance of this type
1163pub struct ThemeFontsBuilder<'a, S: theme_fonts_state::State> {
1164    _state: PhantomData<fn() -> S>,
1165    _fields: (
1166        Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1167        Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1168        Option<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1169    ),
1170    _lifetime: PhantomData<&'a ()>,
1171}
1172
1173impl<'a> ThemeFonts<'a> {
1174    /// Create a new builder for this type
1175    pub fn new() -> ThemeFontsBuilder<'a, theme_fonts_state::Empty> {
1176        ThemeFontsBuilder::new()
1177    }
1178}
1179
1180impl<'a> ThemeFontsBuilder<'a, theme_fonts_state::Empty> {
1181    /// Create a new builder with all fields unset
1182    pub fn new() -> Self {
1183        ThemeFontsBuilder {
1184            _state: PhantomData,
1185            _fields: (None, None, None),
1186            _lifetime: PhantomData,
1187        }
1188    }
1189}
1190
1191impl<'a, S> ThemeFontsBuilder<'a, S>
1192where
1193    S: theme_fonts_state::State,
1194    S::Body: theme_fonts_state::IsUnset,
1195{
1196    /// Set the `body` field (required)
1197    pub fn body(
1198        mut self,
1199        value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1200    ) -> ThemeFontsBuilder<'a, theme_fonts_state::SetBody<S>> {
1201        self._fields.0 = Option::Some(value.into());
1202        ThemeFontsBuilder {
1203            _state: PhantomData,
1204            _fields: self._fields,
1205            _lifetime: PhantomData,
1206        }
1207    }
1208}
1209
1210impl<'a, S> ThemeFontsBuilder<'a, S>
1211where
1212    S: theme_fonts_state::State,
1213    S::Heading: theme_fonts_state::IsUnset,
1214{
1215    /// Set the `heading` field (required)
1216    pub fn heading(
1217        mut self,
1218        value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1219    ) -> ThemeFontsBuilder<'a, theme_fonts_state::SetHeading<S>> {
1220        self._fields.1 = Option::Some(value.into());
1221        ThemeFontsBuilder {
1222            _state: PhantomData,
1223            _fields: self._fields,
1224            _lifetime: PhantomData,
1225        }
1226    }
1227}
1228
1229impl<'a, S> ThemeFontsBuilder<'a, S>
1230where
1231    S: theme_fonts_state::State,
1232    S::Monospace: theme_fonts_state::IsUnset,
1233{
1234    /// Set the `monospace` field (required)
1235    pub fn monospace(
1236        mut self,
1237        value: impl Into<Vec<crate::sh_weaver::notebook::theme::Font<'a>>>,
1238    ) -> ThemeFontsBuilder<'a, theme_fonts_state::SetMonospace<S>> {
1239        self._fields.2 = Option::Some(value.into());
1240        ThemeFontsBuilder {
1241            _state: PhantomData,
1242            _fields: self._fields,
1243            _lifetime: PhantomData,
1244        }
1245    }
1246}
1247
1248impl<'a, S> ThemeFontsBuilder<'a, S>
1249where
1250    S: theme_fonts_state::State,
1251    S::Monospace: theme_fonts_state::IsSet,
1252    S::Body: theme_fonts_state::IsSet,
1253    S::Heading: theme_fonts_state::IsSet,
1254{
1255    /// Build the final struct
1256    pub fn build(self) -> ThemeFonts<'a> {
1257        ThemeFonts {
1258            body: self._fields.0.unwrap(),
1259            heading: self._fields.1.unwrap(),
1260            monospace: self._fields.2.unwrap(),
1261            extra_data: Default::default(),
1262        }
1263    }
1264    /// Build the final struct with custom extra_data
1265    pub fn build_with_data(
1266        self,
1267        extra_data: BTreeMap<
1268            jacquard_common::deps::smol_str::SmolStr,
1269            jacquard_common::types::value::Data<'a>,
1270        >,
1271    ) -> ThemeFonts<'a> {
1272        ThemeFonts {
1273            body: self._fields.0.unwrap(),
1274            heading: self._fields.1.unwrap(),
1275            monospace: self._fields.2.unwrap(),
1276            extra_data: Some(extra_data),
1277        }
1278    }
1279}
1280
1281impl<'a> LexiconSchema for ThemeSpacing<'a> {
1282    fn nsid() -> &'static str {
1283        "sh.weaver.notebook.theme"
1284    }
1285    fn def_name() -> &'static str {
1286        "ThemeSpacing"
1287    }
1288    fn lexicon_doc() -> LexiconDoc<'static> {
1289        lexicon_doc_sh_weaver_notebook_theme()
1290    }
1291    fn validate(&self) -> Result<(), ConstraintError> {
1292        Ok(())
1293    }
1294}
1295
1296pub mod theme_state {
1297
1298    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1299    #[allow(unused)]
1300    use ::core::marker::PhantomData;
1301    mod sealed {
1302        pub trait Sealed {}
1303    }
1304    /// State trait tracking which required fields have been set
1305    pub trait State: sealed::Sealed {
1306        type LightScheme;
1307        type DarkCodeTheme;
1308        type DarkScheme;
1309        type Fonts;
1310        type LightCodeTheme;
1311        type Spacing;
1312    }
1313    /// Empty state - all required fields are unset
1314    pub struct Empty(());
1315    impl sealed::Sealed for Empty {}
1316    impl State for Empty {
1317        type LightScheme = Unset;
1318        type DarkCodeTheme = Unset;
1319        type DarkScheme = Unset;
1320        type Fonts = Unset;
1321        type LightCodeTheme = Unset;
1322        type Spacing = Unset;
1323    }
1324    ///State transition - sets the `light_scheme` field to Set
1325    pub struct SetLightScheme<S: State = Empty>(PhantomData<fn() -> S>);
1326    impl<S: State> sealed::Sealed for SetLightScheme<S> {}
1327    impl<S: State> State for SetLightScheme<S> {
1328        type LightScheme = Set<members::light_scheme>;
1329        type DarkCodeTheme = S::DarkCodeTheme;
1330        type DarkScheme = S::DarkScheme;
1331        type Fonts = S::Fonts;
1332        type LightCodeTheme = S::LightCodeTheme;
1333        type Spacing = S::Spacing;
1334    }
1335    ///State transition - sets the `dark_code_theme` field to Set
1336    pub struct SetDarkCodeTheme<S: State = Empty>(PhantomData<fn() -> S>);
1337    impl<S: State> sealed::Sealed for SetDarkCodeTheme<S> {}
1338    impl<S: State> State for SetDarkCodeTheme<S> {
1339        type LightScheme = S::LightScheme;
1340        type DarkCodeTheme = Set<members::dark_code_theme>;
1341        type DarkScheme = S::DarkScheme;
1342        type Fonts = S::Fonts;
1343        type LightCodeTheme = S::LightCodeTheme;
1344        type Spacing = S::Spacing;
1345    }
1346    ///State transition - sets the `dark_scheme` field to Set
1347    pub struct SetDarkScheme<S: State = Empty>(PhantomData<fn() -> S>);
1348    impl<S: State> sealed::Sealed for SetDarkScheme<S> {}
1349    impl<S: State> State for SetDarkScheme<S> {
1350        type LightScheme = S::LightScheme;
1351        type DarkCodeTheme = S::DarkCodeTheme;
1352        type DarkScheme = Set<members::dark_scheme>;
1353        type Fonts = S::Fonts;
1354        type LightCodeTheme = S::LightCodeTheme;
1355        type Spacing = S::Spacing;
1356    }
1357    ///State transition - sets the `fonts` field to Set
1358    pub struct SetFonts<S: State = Empty>(PhantomData<fn() -> S>);
1359    impl<S: State> sealed::Sealed for SetFonts<S> {}
1360    impl<S: State> State for SetFonts<S> {
1361        type LightScheme = S::LightScheme;
1362        type DarkCodeTheme = S::DarkCodeTheme;
1363        type DarkScheme = S::DarkScheme;
1364        type Fonts = Set<members::fonts>;
1365        type LightCodeTheme = S::LightCodeTheme;
1366        type Spacing = S::Spacing;
1367    }
1368    ///State transition - sets the `light_code_theme` field to Set
1369    pub struct SetLightCodeTheme<S: State = Empty>(PhantomData<fn() -> S>);
1370    impl<S: State> sealed::Sealed for SetLightCodeTheme<S> {}
1371    impl<S: State> State for SetLightCodeTheme<S> {
1372        type LightScheme = S::LightScheme;
1373        type DarkCodeTheme = S::DarkCodeTheme;
1374        type DarkScheme = S::DarkScheme;
1375        type Fonts = S::Fonts;
1376        type LightCodeTheme = Set<members::light_code_theme>;
1377        type Spacing = S::Spacing;
1378    }
1379    ///State transition - sets the `spacing` field to Set
1380    pub struct SetSpacing<S: State = Empty>(PhantomData<fn() -> S>);
1381    impl<S: State> sealed::Sealed for SetSpacing<S> {}
1382    impl<S: State> State for SetSpacing<S> {
1383        type LightScheme = S::LightScheme;
1384        type DarkCodeTheme = S::DarkCodeTheme;
1385        type DarkScheme = S::DarkScheme;
1386        type Fonts = S::Fonts;
1387        type LightCodeTheme = S::LightCodeTheme;
1388        type Spacing = Set<members::spacing>;
1389    }
1390    /// Marker types for field names
1391    #[allow(non_camel_case_types)]
1392    pub mod members {
1393        ///Marker type for the `light_scheme` field
1394        pub struct light_scheme(());
1395        ///Marker type for the `dark_code_theme` field
1396        pub struct dark_code_theme(());
1397        ///Marker type for the `dark_scheme` field
1398        pub struct dark_scheme(());
1399        ///Marker type for the `fonts` field
1400        pub struct fonts(());
1401        ///Marker type for the `light_code_theme` field
1402        pub struct light_code_theme(());
1403        ///Marker type for the `spacing` field
1404        pub struct spacing(());
1405    }
1406}
1407
1408/// Builder for constructing an instance of this type
1409pub struct ThemeBuilder<'a, S: theme_state::State> {
1410    _state: PhantomData<fn() -> S>,
1411    _fields: (
1412        Option<ThemeDarkCodeTheme<'a>>,
1413        Option<StrongRef<'a>>,
1414        Option<CowStr<'a>>,
1415        Option<ThemeFonts<'a>>,
1416        Option<ThemeLightCodeTheme<'a>>,
1417        Option<StrongRef<'a>>,
1418        Option<ThemeSpacing<'a>>,
1419    ),
1420    _lifetime: PhantomData<&'a ()>,
1421}
1422
1423impl<'a> Theme<'a> {
1424    /// Create a new builder for this type
1425    pub fn new() -> ThemeBuilder<'a, theme_state::Empty> {
1426        ThemeBuilder::new()
1427    }
1428}
1429
1430impl<'a> ThemeBuilder<'a, theme_state::Empty> {
1431    /// Create a new builder with all fields unset
1432    pub fn new() -> Self {
1433        ThemeBuilder {
1434            _state: PhantomData,
1435            _fields: (None, None, None, None, None, None, None),
1436            _lifetime: PhantomData,
1437        }
1438    }
1439}
1440
1441impl<'a, S> ThemeBuilder<'a, S>
1442where
1443    S: theme_state::State,
1444    S::DarkCodeTheme: theme_state::IsUnset,
1445{
1446    /// Set the `darkCodeTheme` field (required)
1447    pub fn dark_code_theme(
1448        mut self,
1449        value: impl Into<ThemeDarkCodeTheme<'a>>,
1450    ) -> ThemeBuilder<'a, theme_state::SetDarkCodeTheme<S>> {
1451        self._fields.0 = Option::Some(value.into());
1452        ThemeBuilder {
1453            _state: PhantomData,
1454            _fields: self._fields,
1455            _lifetime: PhantomData,
1456        }
1457    }
1458}
1459
1460impl<'a, S> ThemeBuilder<'a, S>
1461where
1462    S: theme_state::State,
1463    S::DarkScheme: theme_state::IsUnset,
1464{
1465    /// Set the `darkScheme` field (required)
1466    pub fn dark_scheme(
1467        mut self,
1468        value: impl Into<StrongRef<'a>>,
1469    ) -> ThemeBuilder<'a, theme_state::SetDarkScheme<S>> {
1470        self._fields.1 = Option::Some(value.into());
1471        ThemeBuilder {
1472            _state: PhantomData,
1473            _fields: self._fields,
1474            _lifetime: PhantomData,
1475        }
1476    }
1477}
1478
1479impl<'a, S: theme_state::State> ThemeBuilder<'a, S> {
1480    /// Set the `defaultTheme` field (optional)
1481    pub fn default_theme(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
1482        self._fields.2 = value.into();
1483        self
1484    }
1485    /// Set the `defaultTheme` field to an Option value (optional)
1486    pub fn maybe_default_theme(mut self, value: Option<CowStr<'a>>) -> Self {
1487        self._fields.2 = value;
1488        self
1489    }
1490}
1491
1492impl<'a, S> ThemeBuilder<'a, S>
1493where
1494    S: theme_state::State,
1495    S::Fonts: theme_state::IsUnset,
1496{
1497    /// Set the `fonts` field (required)
1498    pub fn fonts(
1499        mut self,
1500        value: impl Into<ThemeFonts<'a>>,
1501    ) -> ThemeBuilder<'a, theme_state::SetFonts<S>> {
1502        self._fields.3 = Option::Some(value.into());
1503        ThemeBuilder {
1504            _state: PhantomData,
1505            _fields: self._fields,
1506            _lifetime: PhantomData,
1507        }
1508    }
1509}
1510
1511impl<'a, S> ThemeBuilder<'a, S>
1512where
1513    S: theme_state::State,
1514    S::LightCodeTheme: theme_state::IsUnset,
1515{
1516    /// Set the `lightCodeTheme` field (required)
1517    pub fn light_code_theme(
1518        mut self,
1519        value: impl Into<ThemeLightCodeTheme<'a>>,
1520    ) -> ThemeBuilder<'a, theme_state::SetLightCodeTheme<S>> {
1521        self._fields.4 = Option::Some(value.into());
1522        ThemeBuilder {
1523            _state: PhantomData,
1524            _fields: self._fields,
1525            _lifetime: PhantomData,
1526        }
1527    }
1528}
1529
1530impl<'a, S> ThemeBuilder<'a, S>
1531where
1532    S: theme_state::State,
1533    S::LightScheme: theme_state::IsUnset,
1534{
1535    /// Set the `lightScheme` field (required)
1536    pub fn light_scheme(
1537        mut self,
1538        value: impl Into<StrongRef<'a>>,
1539    ) -> ThemeBuilder<'a, theme_state::SetLightScheme<S>> {
1540        self._fields.5 = Option::Some(value.into());
1541        ThemeBuilder {
1542            _state: PhantomData,
1543            _fields: self._fields,
1544            _lifetime: PhantomData,
1545        }
1546    }
1547}
1548
1549impl<'a, S> ThemeBuilder<'a, S>
1550where
1551    S: theme_state::State,
1552    S::Spacing: theme_state::IsUnset,
1553{
1554    /// Set the `spacing` field (required)
1555    pub fn spacing(
1556        mut self,
1557        value: impl Into<ThemeSpacing<'a>>,
1558    ) -> ThemeBuilder<'a, theme_state::SetSpacing<S>> {
1559        self._fields.6 = Option::Some(value.into());
1560        ThemeBuilder {
1561            _state: PhantomData,
1562            _fields: self._fields,
1563            _lifetime: PhantomData,
1564        }
1565    }
1566}
1567
1568impl<'a, S> ThemeBuilder<'a, S>
1569where
1570    S: theme_state::State,
1571    S::LightScheme: theme_state::IsSet,
1572    S::DarkCodeTheme: theme_state::IsSet,
1573    S::DarkScheme: theme_state::IsSet,
1574    S::Fonts: theme_state::IsSet,
1575    S::LightCodeTheme: theme_state::IsSet,
1576    S::Spacing: theme_state::IsSet,
1577{
1578    /// Build the final struct
1579    pub fn build(self) -> Theme<'a> {
1580        Theme {
1581            dark_code_theme: self._fields.0.unwrap(),
1582            dark_scheme: self._fields.1.unwrap(),
1583            default_theme: self._fields.2.or_else(|| Some(CowStr::from("auto"))),
1584            fonts: self._fields.3.unwrap(),
1585            light_code_theme: self._fields.4.unwrap(),
1586            light_scheme: self._fields.5.unwrap(),
1587            spacing: self._fields.6.unwrap(),
1588            extra_data: Default::default(),
1589        }
1590    }
1591    /// Build the final struct with custom extra_data
1592    pub fn build_with_data(
1593        self,
1594        extra_data: BTreeMap<
1595            jacquard_common::deps::smol_str::SmolStr,
1596            jacquard_common::types::value::Data<'a>,
1597        >,
1598    ) -> Theme<'a> {
1599        Theme {
1600            dark_code_theme: self._fields.0.unwrap(),
1601            dark_scheme: self._fields.1.unwrap(),
1602            default_theme: self._fields.2.or_else(|| Some(CowStr::from("auto"))),
1603            fonts: self._fields.3.unwrap(),
1604            light_code_theme: self._fields.4.unwrap(),
1605            light_scheme: self._fields.5.unwrap(),
1606            spacing: self._fields.6.unwrap(),
1607            extra_data: Some(extra_data),
1608        }
1609    }
1610}