pub mod facet;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct BulletListBlock<'a> {
#[serde(borrow)]
pub items: Vec<crate::com_deckbelcher::richtext::ListItem<'a>>,
}
pub mod bullet_list_block_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Items;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Items = Unset;
}
pub struct SetItems<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetItems<S> {}
impl<S: State> State for SetItems<S> {
type Items = Set<members::items>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct items(());
}
}
pub struct BulletListBlockBuilder<'a, S: bullet_list_block_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::com_deckbelcher::richtext::ListItem<'a>>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> BulletListBlock<'a> {
pub fn new() -> BulletListBlockBuilder<'a, bullet_list_block_state::Empty> {
BulletListBlockBuilder::new()
}
}
impl<'a> BulletListBlockBuilder<'a, bullet_list_block_state::Empty> {
pub fn new() -> Self {
BulletListBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> BulletListBlockBuilder<'a, S>
where
S: bullet_list_block_state::State,
S::Items: bullet_list_block_state::IsUnset,
{
pub fn items(
mut self,
value: impl Into<Vec<crate::com_deckbelcher::richtext::ListItem<'a>>>,
) -> BulletListBlockBuilder<'a, bullet_list_block_state::SetItems<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
BulletListBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> BulletListBlockBuilder<'a, S>
where
S: bullet_list_block_state::State,
S::Items: bullet_list_block_state::IsSet,
{
pub fn build(self) -> BulletListBlock<'a> {
BulletListBlock {
items: self.__unsafe_private_named.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> BulletListBlock<'a> {
BulletListBlock {
items: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_com_deckbelcher_richtext() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("com.deckbelcher.richtext"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"bulletListBlock",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"An unordered (bullet) list.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("items")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"items",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static("The list items."),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#listItem"),
}),
min_length: None,
max_length: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("codeBlock"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A code block with optional language hint.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("text")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"language",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Optional language identifier for syntax highlighting.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(50usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The code content (plain text, no facets).",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(100000usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("document"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A multi-block rich text document.\nUsed for primers and other long-form content.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("content")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"content",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Array of blocks (paragraphs, headings, etc).",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: None,
refs: vec![
::jacquard_common::CowStr::new_static("#paragraphBlock"),
::jacquard_common::CowStr::new_static("#headingBlock"),
::jacquard_common::CowStr::new_static("#codeBlock"),
::jacquard_common::CowStr::new_static("#bulletListBlock"),
::jacquard_common::CowStr::new_static("#orderedListBlock"),
::jacquard_common::CowStr::new_static("#horizontalRuleBlock")
],
closed: None,
}),
min_length: None,
max_length: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("headingBlock"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A heading block with level, text, and optional facets.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("level")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"facets",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Annotations of text (formatting, mentions, links, etc).",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.deckbelcher.richtext.facet",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"level",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(1i64),
maximum: Some(6i64),
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The plain text content (no markdown symbols).",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(10000usize),
min_graphemes: None,
max_graphemes: Some(1000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"horizontalRuleBlock",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A horizontal rule (thematic break).",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("listItem"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A single list item with text, optional facets, and optional sublist.",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"facets",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Annotations of text (formatting, mentions, links, etc).",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.deckbelcher.richtext.facet",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"sublist",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Optional nested sublist (bullet or ordered).",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("#bulletListBlock"),
::jacquard_common::CowStr::new_static("#orderedListBlock")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The plain text content (no markdown symbols).",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(100000usize),
min_graphemes: None,
max_graphemes: Some(10000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A single paragraph of rich text with optional facet annotations.\nUsed for descriptions and other short formatted text.",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"facets",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Annotations of text (mentions, URLs, hashtags, formatting, etc).",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.deckbelcher.richtext.facet",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The plain text content (no markdown symbols).",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(500000usize),
min_graphemes: None,
max_graphemes: Some(50000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"orderedListBlock",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"An ordered (numbered) list.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("items")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"items",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static("The list items."),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#listItem"),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"start",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("paragraphBlock"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A paragraph block with text and optional facets.",
),
),
required: None,
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"facets",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Annotations of text (formatting, mentions, links, etc).",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.deckbelcher.richtext.facet",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The plain text content (no markdown symbols).",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(500000usize),
min_graphemes: None,
max_graphemes: Some(50000usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BulletListBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"bulletListBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct CodeBlock<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub language: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub text: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CodeBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"codeBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.language {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 50usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"language",
),
max: 50usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 100000usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Document<'a> {
#[serde(borrow)]
pub content: Vec<DocumentContentItem<'a>>,
}
pub mod document_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Content;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Content = Unset;
}
pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContent<S> {}
impl<S: State> State for SetContent<S> {
type Content = Set<members::content>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct content(());
}
}
pub struct DocumentBuilder<'a, S: document_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<Vec<DocumentContentItem<'a>>>,),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Document<'a> {
pub fn new() -> DocumentBuilder<'a, document_state::Empty> {
DocumentBuilder::new()
}
}
impl<'a> DocumentBuilder<'a, document_state::Empty> {
pub fn new() -> Self {
DocumentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DocumentBuilder<'a, S>
where
S: document_state::State,
S::Content: document_state::IsUnset,
{
pub fn content(
mut self,
value: impl Into<Vec<DocumentContentItem<'a>>>,
) -> DocumentBuilder<'a, document_state::SetContent<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
DocumentBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DocumentBuilder<'a, S>
where
S: document_state::State,
S::Content: document_state::IsSet,
{
pub fn build(self) -> Document<'a> {
Document {
content: self.__unsafe_private_named.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Document<'a> {
Document {
content: self.__unsafe_private_named.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum DocumentContentItem<'a> {
#[serde(rename = "com.deckbelcher.richtext#paragraphBlock")]
ParagraphBlock(Box<crate::com_deckbelcher::richtext::ParagraphBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#headingBlock")]
HeadingBlock(Box<crate::com_deckbelcher::richtext::HeadingBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#codeBlock")]
CodeBlock(Box<crate::com_deckbelcher::richtext::CodeBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#bulletListBlock")]
BulletListBlock(Box<crate::com_deckbelcher::richtext::BulletListBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#orderedListBlock")]
OrderedListBlock(Box<crate::com_deckbelcher::richtext::OrderedListBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#horizontalRuleBlock")]
HorizontalRuleBlock(Box<crate::com_deckbelcher::richtext::HorizontalRuleBlock<'a>>),
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Document<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"document"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct HeadingBlock<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub facets: std::option::Option<
Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>,
>,
pub level: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub text: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod heading_block_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Level;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Level = Unset;
}
pub struct SetLevel<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLevel<S> {}
impl<S: State> State for SetLevel<S> {
type Level = Set<members::level>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct level(());
}
}
pub struct HeadingBlockBuilder<'a, S: heading_block_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> HeadingBlock<'a> {
pub fn new() -> HeadingBlockBuilder<'a, heading_block_state::Empty> {
HeadingBlockBuilder::new()
}
}
impl<'a> HeadingBlockBuilder<'a, heading_block_state::Empty> {
pub fn new() -> Self {
HeadingBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: heading_block_state::State> HeadingBlockBuilder<'a, S> {
pub fn facets(
mut self,
value: impl Into<Option<Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_facets(
mut self,
value: Option<Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> HeadingBlockBuilder<'a, S>
where
S: heading_block_state::State,
S::Level: heading_block_state::IsUnset,
{
pub fn level(
mut self,
value: impl Into<i64>,
) -> HeadingBlockBuilder<'a, heading_block_state::SetLevel<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
HeadingBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: heading_block_state::State> HeadingBlockBuilder<'a, S> {
pub fn text(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_text(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> HeadingBlockBuilder<'a, S>
where
S: heading_block_state::State,
S::Level: heading_block_state::IsSet,
{
pub fn build(self) -> HeadingBlock<'a> {
HeadingBlock {
facets: self.__unsafe_private_named.0,
level: self.__unsafe_private_named.1.unwrap(),
text: self.__unsafe_private_named.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> HeadingBlock<'a> {
HeadingBlock {
facets: self.__unsafe_private_named.0,
level: self.__unsafe_private_named.1.unwrap(),
text: self.__unsafe_private_named.2,
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HeadingBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"headingBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.level;
if *value > 6i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Maximum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"level",
),
max: 6i64,
actual: *value,
});
}
}
{
let value = &self.level;
if *value < 1i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"level",
),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 10000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 1000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 1000usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct HorizontalRuleBlock<'a> {}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for HorizontalRuleBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"horizontalRuleBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct ListItem<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub facets: std::option::Option<
Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub sublist: std::option::Option<ListItemSublist<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub text: std::option::Option<jacquard_common::CowStr<'a>>,
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ListItemSublist<'a> {
#[serde(rename = "com.deckbelcher.richtext#bulletListBlock")]
BulletListBlock(Box<crate::com_deckbelcher::richtext::BulletListBlock<'a>>),
#[serde(rename = "com.deckbelcher.richtext#orderedListBlock")]
OrderedListBlock(Box<crate::com_deckbelcher::richtext::OrderedListBlock<'a>>),
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ListItem<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"listItem"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 100000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 10000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 10000usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct Richtext<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub facets: std::option::Option<
Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub text: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Richtext<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 500000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 50000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 50000usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct OrderedListBlock<'a> {
#[serde(borrow)]
pub items: Vec<crate::com_deckbelcher::richtext::ListItem<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub start: std::option::Option<i64>,
}
pub mod ordered_list_block_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Items;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Items = Unset;
}
pub struct SetItems<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetItems<S> {}
impl<S: State> State for SetItems<S> {
type Items = Set<members::items>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct items(());
}
}
pub struct OrderedListBlockBuilder<'a, S: ordered_list_block_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<crate::com_deckbelcher::richtext::ListItem<'a>>>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> OrderedListBlock<'a> {
pub fn new() -> OrderedListBlockBuilder<'a, ordered_list_block_state::Empty> {
OrderedListBlockBuilder::new()
}
}
impl<'a> OrderedListBlockBuilder<'a, ordered_list_block_state::Empty> {
pub fn new() -> Self {
OrderedListBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> OrderedListBlockBuilder<'a, S>
where
S: ordered_list_block_state::State,
S::Items: ordered_list_block_state::IsUnset,
{
pub fn items(
mut self,
value: impl Into<Vec<crate::com_deckbelcher::richtext::ListItem<'a>>>,
) -> OrderedListBlockBuilder<'a, ordered_list_block_state::SetItems<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
OrderedListBlockBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ordered_list_block_state::State> OrderedListBlockBuilder<'a, S> {
pub fn start(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_start(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> OrderedListBlockBuilder<'a, S>
where
S: ordered_list_block_state::State,
S::Items: ordered_list_block_state::IsSet,
{
pub fn build(self) -> OrderedListBlock<'a> {
OrderedListBlock {
items: self.__unsafe_private_named.0.unwrap(),
start: self.__unsafe_private_named.1,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> OrderedListBlock<'a> {
OrderedListBlock {
items: self.__unsafe_private_named.0.unwrap(),
start: self.__unsafe_private_named.1,
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for OrderedListBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"orderedListBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct ParagraphBlock<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub facets: std::option::Option<
Vec<crate::com_deckbelcher::richtext::facet::Facet<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub text: std::option::Option<jacquard_common::CowStr<'a>>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ParagraphBlock<'a> {
fn nsid() -> &'static str {
"com.deckbelcher.richtext"
}
fn def_name() -> &'static str {
"paragraphBlock"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_deckbelcher_richtext()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.text {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 500000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.text {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 50000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 50000usize,
actual: count,
});
}
}
}
Ok(())
}
}