1.1.2 • Published 3 days ago

@raisins/core v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

Raisins Core

Raisins in a WYSIWYG visual editor for HTML and web components. The core package provides utility functions that are used to validate the HTML being edited and provide additional data, such as parent / child slot validation, locations for moving a node from one location to another, and more.

Available Functions

FunctiondescriptionReturns
htmlSerializerRenders a DOM node or an array of DOM nodes to a stringstring
htmlParserParses HTML into a RaisinDocumentNodeRaisinDocumentNode
isNodeWithChildrenDetermines whether the node has any childrenboolean
isElementNodeDetermines if the given node is an HTML elementboolean
isRootDetermines if the given node is the root elementboolean
isStyleNodeDetermines if the given node is a style elementboolean
isTextNodeDetermines if the given node is a text-only nodeboolean
isCommentNodeDetermines if the given node is an HTML commentboolean
isDirectiveNodeDetermines if the given node is a directive (eg. <!doctype ...>)boolean
getSlotsReturns the available slots based on a node and metadataNodeWithSlots | undefined
doesChildAllowParentGiven a tag's metadata, checks if it allows childrenboolean
doesParentAllowChildGiven a child and it's parent's metadata, checks if the parent will allow the child to be embeddedboolean
isNodeAllowedGiven two nodes and their metadata, check each side to determine if the parent allows the child, and the child allows the parentboolean
validateNodeGiven a node and its meta, return errors of any typeErrorStack
validateChildConstraintsGiven a node and its meta, return errors if either of the parent or child are in an invalid positionErrorStack
validateAttributesGiven a node and its meta, return errors if any attributes have invalid valuesErrorStack
generateJsonPointersGenerate a set of JSON Pointers for all descendents of a RaisinNodeWeakMap<RaisinNode, string>
getSubErrorsGiven a JSON Pointer, return any errors that are descendants of the node at the given pointerErrorStack
hasSubErrorsGiven a JSON Pointer, return true if there are any descendants of the node at the given pointerboolean
removeErrorGiven a JSON Pointer, remove the error at that path and return a new list of errorsErrorStack
calculatePlopTargetsGiven a parent RaisinNode, a potential plop target as a RaisinNode and any metadata, return a PlopTarget for each valid positionPlopTarget[]
getNodeGiven the root node and a NodePath, return the RaisinNodeRaisinNode
getPathGiven the root node and a descendant node, return a NodePath if it's foundNodePath | undefined
cssSerializerConverts a plain CSS node AST into a css stringstring
cssParserParses a CSS expression and returns a pure js object AST representation of the contentCssNodePlain
cssSelectorGiven a RaisinDocumentNode and a css query string, return all matches found as RaisinElementNode[]RaisinElementNode[]

Other Exports

  • HTMLComponents
    • Mappings for all HTML Elements as CustomElements for use in the raisins ecosystem
  • DefaultTextMarks
    • An array of all HTML Elements that should be treated as text nodes for editing purposes
  • htmlUtil
    • A library of HTML Utility functions
  • cssUtil
    • A library of CSS Utility functions
1.1.3-3

3 days ago

1.1.3-2

9 days ago

1.1.3-1

9 days ago

1.1.2

4 months ago

1.1.2-1

4 months ago

1.1.2-0

10 months ago

1.1.1

1 year ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.2-3

2 years ago

1.0.2-2

2 years ago

1.0.2-4

2 years ago

1.0.2-1

2 years ago

1.0.2-0

2 years ago

1.0.0

2 years ago

0.21.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.13.0

2 years ago

0.14.0

2 years ago

0.15.0

2 years ago

0.16.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.28.0

2 years ago

0.27.0

2 years ago

0.26.0

2 years ago

0.25.0

2 years ago

0.24.0

2 years ago

0.23.0

2 years ago

0.22.0

2 years ago

0.20.0-3

2 years ago

0.20.0-1

2 years ago

0.20.0-2

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago