datocms-structured-text-utils
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -5,2 +5,3 @@ export declare type Node = BlockNode | InlineNode; | ||
export declare type RootType = 'root'; | ||
/** Root represents a document */ | ||
export declare type Root = { | ||
@@ -11,2 +12,3 @@ type: RootType; | ||
export declare type ParagraphType = 'paragraph'; | ||
/** Paragraph represents a unit of textual content */ | ||
export declare type Paragraph = { | ||
@@ -17,2 +19,3 @@ type: ParagraphType; | ||
export declare type HeadingType = 'heading'; | ||
/** Heading represents a heading of a section */ | ||
export declare type Heading = { | ||
@@ -24,2 +27,8 @@ type: HeadingType; | ||
export declare type ListType = 'list'; | ||
/** | ||
List represents a list of items. | ||
Unordered lists must have its `style` field set to `bulleted`. | ||
Ordered lists, instead, have its `style` field set to `numbered`. | ||
*/ | ||
export declare type List = { | ||
@@ -31,2 +40,3 @@ type: ListType; | ||
export declare type ListItemType = 'listItem'; | ||
/** ListItem represents an item in a List */ | ||
export declare type ListItem = { | ||
@@ -37,5 +47,8 @@ type: ListItemType; | ||
export declare type CodeType = 'code'; | ||
/** Code represents a block of preformatted text, such as computer code */ | ||
export declare type Code = { | ||
type: CodeType; | ||
/** optional, represents the language of computer code being marked up */ | ||
language?: string; | ||
/** optional, represents an array of line numbers to highlight */ | ||
highlight?: Array<number>; | ||
@@ -45,2 +58,3 @@ code: string; | ||
export declare type BlockquoteType = 'blockquote'; | ||
/** Blockquote is a containter that represents text which is an extended quotation */ | ||
export declare type Blockquote = { | ||
@@ -52,10 +66,15 @@ type: BlockquoteType; | ||
export declare type BlockType = 'block'; | ||
/** Block is a DatoCMS block records references */ | ||
export declare type Block = { | ||
type: BlockType; | ||
/** The record ID. */ | ||
item: string; | ||
}; | ||
export declare type SpanType = 'span'; | ||
/** Supported marks for Span nodes */ | ||
export declare type Mark = 'strong' | 'code' | 'emphasis' | 'underline' | 'strikethrough' | 'highlight'; | ||
/** Span represents a text node. It might optionally contain formatting styles called marks */ | ||
export declare type Span = { | ||
type: SpanType; | ||
/** optional, array of styles for the current chunk of text */ | ||
marks?: Mark[]; | ||
@@ -65,2 +84,3 @@ value: string; | ||
export declare type LinkType = 'link'; | ||
/** Link represents a hyperlink */ | ||
export declare type Link = { | ||
@@ -72,4 +92,6 @@ type: LinkType; | ||
export declare type ItemLinkType = 'itemLink'; | ||
/** ItemLink is similar to a Link node, but instead of linking a portion of text to a URL, it links the document to another record present in the DatoCMS project */ | ||
export declare type ItemLink = { | ||
type: ItemLinkType; | ||
/** the record ID */ | ||
item: string; | ||
@@ -79,7 +101,12 @@ children: Array<Span>; | ||
export declare type InlineItemType = 'inlineItem'; | ||
/** InlineItem, similarly to ItemLink, links the document to another record but does not specify any inner content (children) */ | ||
export declare type InlineItem = { | ||
type: InlineItemType; | ||
/** the record ID */ | ||
item: string; | ||
}; | ||
export declare type WithChildrenNode = Exclude<Node, Code | Span | Block | InlineItem>; | ||
/** | ||
A DatoCMS compatible document. | ||
*/ | ||
export declare type Document = { | ||
@@ -90,5 +117,12 @@ schema: 'dast'; | ||
export declare type NodeType = ParagraphType | HeadingType | LinkType | ItemLinkType | InlineItemType | BlockType | ListType | ListItemType | BlockquoteType | CodeType | RootType | SpanType; | ||
/** | ||
Structured Text enables authors to create rich text content, on par with traditional editors. | ||
Additionally, it allows records and Media Area assets to be linked dynamically and embedded within the flow of the text. | ||
*/ | ||
export declare type StructuredText<R extends Record = Record> = { | ||
/** A DatoCMS compatible document */ | ||
value: Document; | ||
/** Blocks associated with the Structured Text */ | ||
blocks?: R[]; | ||
/** Links associated with the Structured Text */ | ||
links?: R[]; | ||
@@ -95,0 +129,0 @@ }; |
{ | ||
"name": "datocms-structured-text-utils", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "A set of Typescript types and helpers to work with DatoCMS Structured Text fields", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6381b05331181aecc82b7f080c6993fc803a7327" | ||
"gitHead": "a1f48c8cc4e30209eccb138d5c60eea8941eaddc" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33089
532