@marvr/storyblok-rich-text-types
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -0,46 +1,36 @@ | ||
export declare type BlockNodes = DocumentNode | HeadingNode | ParagraphNode | ListItemNode | OrderedListNode | UnorderedListNode | QuoteNode | CodeBlockNode | HorizontalRuleNode | BreakNode | ImageNode; | ||
export declare enum Block { | ||
DOCUMENT = "doc", | ||
HEADING = "heading", | ||
PARAGRAPH = "paragraph", | ||
QUOTE = "blockquote", | ||
OL_LIST = "ordered_list", | ||
UL_LIST = "bullet_list", | ||
LIST_ITEM = "list_item", | ||
CODE = "code_block", | ||
HR = "horizontal_rule", | ||
BR = "hard_break", | ||
IMAGE = "image" | ||
} | ||
export declare type BlockNodesWithAttributes = ImageNode; | ||
export declare interface BlockNode extends Node_2 { | ||
} | ||
export declare type BlockNodesWithContent = DocumentNode | ParagraphNode | QuoteNode | UnorderedListNode | ListItemNode; | ||
export declare interface BlockNodeWithContent extends BlockNode { | ||
content: BlockNode[]; | ||
} | ||
export declare type BlockNodesWithContentAndAttributes = HeadingNode | OrderedListNode | CodeBlockNode; | ||
export declare interface BoldNode extends MarkNode { | ||
type: Mark.BOLD; | ||
export declare type BlockNodesWithoutOptions = HorizontalRuleNode | BreakNode; | ||
export declare const blockNodeTypes: NodeTypes[]; | ||
export declare interface BoldNode extends Node_2 { | ||
type: NodeTypes.BOLD; | ||
} | ||
export declare interface BrNode extends BlockNode { | ||
type: Block.BR; | ||
export declare interface BreakNode extends Node_2 { | ||
type: NodeTypes.BR; | ||
} | ||
export declare interface CodeAttributes extends NodeAttributes { | ||
export declare interface CodeBlockAttributes extends NodeAttributes { | ||
class: string; | ||
} | ||
export declare interface CodeBlockNode extends BlockNodeWithContent { | ||
type: Block.CODE; | ||
attrs: CodeAttributes; | ||
export declare interface CodeBlockNode extends NodeWithContent { | ||
type: NodeTypes.CODE_BLOCK; | ||
content: TextNode[]; | ||
attrs: CodeBlockAttributes; | ||
} | ||
export declare interface CodeNode extends MarkNode { | ||
type: Mark.CODE; | ||
export declare interface CodeNode extends Node_2 { | ||
type: NodeTypes.CODE; | ||
} | ||
export declare interface ComponentAttributes { | ||
export declare interface ComponentAttributes extends NodeAttributes { | ||
id: string; | ||
@@ -50,8 +40,8 @@ body: ComponentBody[]; | ||
export declare interface ComponentBody extends ComponentBodyCover { | ||
export declare interface ComponentBody extends ComponentBodyShell { | ||
component: string; | ||
_uid: string; | ||
component: string; | ||
} | ||
declare interface ComponentBodyCover { | ||
export declare interface ComponentBodyShell { | ||
[key: string]: any; | ||
@@ -61,13 +51,9 @@ } | ||
export declare interface ComponentNode extends Node_2 { | ||
type: ComponentType; | ||
type: NodeTypes.COMPONENT; | ||
attrs: ComponentAttributes; | ||
} | ||
export declare const ComponentType = "blok"; | ||
export declare type ComponentType = typeof ComponentType; | ||
export declare interface DocumentNode extends BlockNodeWithContent { | ||
type: Block.DOCUMENT; | ||
content: TopLevelNode[]; | ||
export declare interface DocumentNode extends NodeWithContent { | ||
type: NodeTypes.DOCUMENT; | ||
content: RootNodes[]; | ||
} | ||
@@ -81,10 +67,10 @@ | ||
export declare interface HeadingNode extends BlockNodeWithContent { | ||
type: Block.HEADING; | ||
export declare interface HeadingNode extends NodeWithContent { | ||
type: NodeTypes.HEADING; | ||
content: TextNode[]; | ||
attrs: HeadingAttributes; | ||
content: TextNode[]; | ||
} | ||
export declare interface HrNode extends BlockNode { | ||
type: Block.HR; | ||
export declare interface HorizontalRuleNode extends Node_2 { | ||
type: NodeTypes.HR; | ||
} | ||
@@ -98,9 +84,15 @@ | ||
export declare interface ImageNode extends BlockNode { | ||
type: Block.IMAGE; | ||
export declare interface ImageNode extends Node_2 { | ||
type: NodeTypes.IMAGE; | ||
attrs: ImageAttributes; | ||
} | ||
export declare interface ItalicNode extends MarkNode { | ||
type: Mark.ITALIC; | ||
export declare function isBlockNode(node: Node_2): node is BlockNodes; | ||
export declare function isComponentNode(node: Node_2): node is ComponentNode; | ||
export declare function isTextNode(node: Node_2): node is TextNode; | ||
export declare interface ItalicNode extends Node_2 { | ||
type: NodeTypes.ITALIC; | ||
} | ||
@@ -111,30 +103,56 @@ | ||
uuid: string | null; | ||
target: LinkTarget; | ||
linktype: LinkType; | ||
target: LinkTargets | null; | ||
linktype: LinkTypes; | ||
} | ||
export declare interface LinkNode extends MarkNode { | ||
type: Mark.LINK; | ||
export declare interface LinkNode extends Node_2 { | ||
type: NodeTypes.LINK; | ||
attrs: LinkAttributes; | ||
} | ||
export declare type LinkTarget = '_self' | '_blank' | null; | ||
export declare enum LinkTargets { | ||
SELF = "_self", | ||
BLANK = "_blank" | ||
} | ||
export declare type LinkType = 'url' | 'story' | 'asset' | 'email'; | ||
export declare interface ListAttributes extends NodeAttributes { | ||
export declare enum LinkTypes { | ||
URL = "url", | ||
STORY = "story", | ||
ASSET = "asset", | ||
EMAIL = "email" | ||
} | ||
export declare interface ListItemNode extends BlockNodeWithContent { | ||
type: Block.LIST_ITEM; | ||
export declare interface ListItemNode extends NodeWithContent { | ||
type: NodeTypes.LIST_ITEM; | ||
content: ParagraphNode[]; | ||
attrs: NodeAttributes; | ||
} | ||
export declare interface ListNode extends BlockNodeWithContent { | ||
type: Block.OL_LIST | Block.UL_LIST; | ||
attrs?: ListAttributes; | ||
content: ListItemNode[]; | ||
export declare type MarkNodes = BoldNode | StrongNode | StrikeNode | UnderlineNode | ItalicNode | CodeNode | LinkNode | StyledNode; | ||
export declare type MarkNodesWithAttributes = LinkNode | StyledNode; | ||
export declare type MarkNodesWithoutOptions = BoldNode | StrongNode | StrikeNode | UnderlineNode | ItalicNode | CodeNode; | ||
declare interface Node_2 { | ||
type: NodeTypes; | ||
attrs?: NodeAttributes; | ||
} | ||
export { Node_2 as Node } | ||
export declare enum Mark { | ||
export declare interface NodeAttributes { | ||
} | ||
export declare enum NodeTypes { | ||
DOCUMENT = "doc", | ||
HEADING = "heading", | ||
PARAGRAPH = "paragraph", | ||
QUOTE = "blockquote", | ||
OL_LIST = "ordered_list", | ||
UL_LIST = "bullet_list", | ||
LIST_ITEM = "list_item", | ||
CODE_BLOCK = "code_block", | ||
HR = "horizontal_rule", | ||
BR = "hard_break", | ||
IMAGE = "image", | ||
BOLD = "bold", | ||
@@ -147,42 +165,39 @@ STRONG = "strong", | ||
LINK = "link", | ||
STYLED = "styled" | ||
STYLED = "styled", | ||
TEXT = "text", | ||
COMPONENT = "blok" | ||
} | ||
export declare interface MarkNode extends Node_2 { | ||
export declare interface NodeWithContent extends Node_2 { | ||
content?: BlockNodes[] | TextNode[]; | ||
} | ||
declare interface Node_2 { | ||
readonly type: Block | Mark | ComponentType | TextType; | ||
attrs?: NodeAttributes; | ||
} | ||
export { Node_2 as Node } | ||
export declare interface NodeAttributes { | ||
} | ||
export declare interface OrderedListAttributes extends ListAttributes { | ||
export declare interface OrderedListAttributes extends NodeAttributes { | ||
order: number; | ||
} | ||
export declare interface OrderedListNode extends ListNode { | ||
type: Block.OL_LIST; | ||
export declare interface OrderedListNode extends NodeWithContent { | ||
type: NodeTypes.OL_LIST; | ||
content: ListItemNode[]; | ||
attrs: OrderedListAttributes; | ||
} | ||
export declare interface ParagraphNode extends BlockNodeWithContent { | ||
type: Block.PARAGRAPH; | ||
export declare interface ParagraphNode extends NodeWithContent { | ||
type: NodeTypes.PARAGRAPH; | ||
content: TextNode[]; | ||
} | ||
export declare interface QuoteNode extends BlockNodeWithContent { | ||
type: Block.QUOTE; | ||
export declare interface QuoteNode extends NodeWithContent { | ||
type: NodeTypes.QUOTE; | ||
content: ParagraphNode[]; | ||
} | ||
export declare interface StrikeNode extends MarkNode { | ||
type: Mark.STRIKE; | ||
export declare type RootNodes = HeadingNode | ParagraphNode | OrderedListNode | UnorderedListNode | QuoteNode | HorizontalRuleNode | ImageNode; | ||
export declare interface StrikeNode extends Node_2 { | ||
type: NodeTypes.STRIKE; | ||
} | ||
export declare interface StrongNode extends MarkNode { | ||
type: Mark.STRONG; | ||
export declare interface StrongNode extends Node_2 { | ||
type: NodeTypes.STRONG; | ||
} | ||
@@ -194,4 +209,4 @@ | ||
export declare interface StyledNode extends MarkNode { | ||
type: Mark.STYLED; | ||
export declare interface StyledNode extends Node_2 { | ||
type: NodeTypes.STYLED; | ||
attrs: StyledAttributes; | ||
@@ -201,23 +216,16 @@ } | ||
export declare interface TextNode extends Node_2 { | ||
type: TextType; | ||
type: NodeTypes.TEXT; | ||
text: string; | ||
marks?: MarkNode[]; | ||
marks?: MarkNodes[]; | ||
} | ||
export declare const TextType = "text"; | ||
export declare type TextType = typeof TextType; | ||
export declare type TopLevelNode = HeadingNode | ParagraphNode | OrderedListNode | UnorderedListNode | QuoteNode | CodeBlockNode | HrNode | ImageNode | ComponentNode; | ||
export declare interface UnderlineNode extends MarkNode { | ||
type: Mark.UNDERLINE; | ||
export declare interface UnderlineNode extends Node_2 { | ||
type: NodeTypes.UNDERLINE; | ||
} | ||
export declare interface UnorderedListNode extends ListNode { | ||
type: Block.UL_LIST; | ||
export declare interface UnorderedListNode extends NodeWithContent { | ||
type: NodeTypes.UL_LIST; | ||
content: ListItemNode[]; | ||
} | ||
export declare type VoidBlockNodes = HrNode | BrNode | ImageNode; | ||
export { } |
{ | ||
"name": "@marvr/storyblok-rich-text-types", | ||
"version": "2.0.1", | ||
"description": "Type definitions for Storyblok's rich-text", | ||
"keywords": [ | ||
"rich-text", | ||
"renderer", | ||
"storyblok", | ||
"types", | ||
"typescript", | ||
"declaration" | ||
], | ||
"homepage": "https://storyblok-rich-text-renderer.netlify.com/", | ||
"bugs": { | ||
"url": "https://github.com/MarvinRudolph/storyblok-rich-text-renderer/issues" | ||
}, | ||
"license": "MIT", | ||
"author": { | ||
"name": "Marvin Rudolph", | ||
"email": "info@marvin-rudolph.de" | ||
}, | ||
"sideEffects": false, | ||
"main": "dist/storyblok-rich-text-types.umd.js", | ||
"unpkg": "dist/storyblok-rich-text-types.min.js", | ||
"module": "dist/storyblok-rich-text-types.esm.js", | ||
"types": "dist/storyblok-rich-text-types.d.ts", | ||
"version": "3.0.0", | ||
"main": "./dist/storyblok-rich-text-types.cjs.js", | ||
"module": "./dist/storyblok-rich-text-types.es.js", | ||
"types": "./dist/storyblok-rich-text-types.d.ts", | ||
"scripts": { | ||
"build": "tsc" | ||
"build": "pnpm clean && rollup -c", | ||
"clean": "rm -rf dist" | ||
}, | ||
"buildOptions": { | ||
"name": "StoryblokRichTextTypes" | ||
} | ||
"files": [ | ||
"dist" | ||
], | ||
"gitHead": "43319c5a732de47e19a08a9f565a3b083593a67f" | ||
} |
@@ -1,7 +0,3 @@ | ||
# @marvr/storyblok-rich-text-types :zap: | ||
# @marvr/storyblok-rich-text-types | ||
Type definitions for every node. | ||
## Information :grey_exclamation: | ||
This package is always shipped together with the renderer. I don't think you will need to install by yourself. :grimacing: | ||
## WIP |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
10203
5
1
296
2
3
1