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