Socket
Socket
Sign inDemoInstall

@uniformdev/richtext

Package Overview
Dependencies
Maintainers
10
Versions
388
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniformdev/richtext - npm Package Compare versions

Comparing version 19.23.1-alpha.12 to 19.24.0

23

./dist/index.js

@@ -33,2 +33,4 @@ "use strict";

isRichTextNodeType: () => isRichTextNodeType,
isRichTextValue: () => isRichTextValue,
isRichTextValueConsideredEmpty: () => isRichTextValueConsideredEmpty,
linkHtmlRenderer: () => linkHtmlRenderer,

@@ -97,5 +99,24 @@ linkParamValueToHref: () => linkParamValueToHref,

}
function isRichTextValue(value) {
return typeof value === "object" && value !== null && "root" in value && isRichTextNode(value.root);
}
function isRichTextNodeType(node, type) {
return isRichTextNode(node) && node.type === type;
}
function isRichTextValueConsideredEmpty(value) {
if (!value) {
return true;
}
if (value.root.children.length === 0) {
return true;
}
if (value.root.children.length > 1) {
return false;
}
const child = value.root.children[0];
if (!isRichTextNodeType(child, "paragraph")) {
return false;
}
return child.children === void 0 || child.children.length === 0;
}
function hasChildren(node) {

@@ -479,2 +500,4 @@ return "children" in node && isArrayWithLength(node.children);

isRichTextNodeType,
isRichTextValue,
isRichTextValueConsideredEmpty,
linkHtmlRenderer,

@@ -481,0 +504,0 @@ linkParamValueToHref,

11

dist/index.d.ts

@@ -1,6 +0,6 @@

import { LinkParamValue, RichTextBuiltInElement, RichTextBuiltInFormat } from '@uniformdev/canvas';
import { LinkParamValue, RichTextParamValue, RichTextBuiltInElement, RichTextBuiltInFormat } from '@uniformdev/canvas';
declare function purifyText(text: string): string;
declare function isPureTextAlign(format?: string): format is string;
declare function isPureDirection(direction?: string): direction is string;
declare function isPureDirection(direction?: string | null): direction is string;
declare function renderHtmlElement(tag: string, attributes: Map<string, string> | null, children?: string): string;

@@ -11,2 +11,3 @@

children?: RichTextNode[];
version: number;
}

@@ -55,3 +56,3 @@ type RichTextNodeWithChildren = RichTextNode & {

format?: 'center' | 'end' | 'justify' | 'left' | 'match-parent' | 'right' | 'start';
direction?: 'ltr' | 'rtl';
direction?: 'ltr' | 'rtl' | null;
}

@@ -86,2 +87,3 @@ declare const paragraphHtmlRenderer: NodeStringRenderer;

declare function isRichTextNode(node: unknown): node is RichTextNode;
declare function isRichTextValue(value: unknown): value is NonNullable<RichTextParamValue>;
declare function isRichTextNodeType(node: unknown, type: 'heading'): node is HeadingNode;

@@ -94,2 +96,3 @@ declare function isRichTextNodeType(node: unknown, type: 'paragraph'): node is ParagraphNode;

declare function isRichTextNodeType(node: unknown, type: string): node is RichTextNode;
declare function isRichTextValueConsideredEmpty(value: RichTextParamValue): boolean;
declare function hasChildren<TRichTextNode extends RichTextNode>(node: TRichTextNode): node is TRichTextNode & {

@@ -159,2 +162,2 @@ children: RichTextNode[];

export { HeadingNode, LinkNode, ListItemNode, ListNode, NodeStringRenderer, NodeStringRendererProps, ParagraphNode, ParameterRichTextValue, ResolveStringRenderer, RichTextNode, RichTextNodeWithChildren, StringRenderContext, TextNode, getLabelForElement, getLabelForFormat, getRichTextTagsFromTextFormat, hasChildren, headingHtmlRenderer, isArrayWithLength, isPureDirection, isPureTextAlign, isRichTextNode, isRichTextNodeType, linkHtmlRenderer, linkParamValueToHref, listHtmlRenderer, listitemHtmlRenderer, paragraphHtmlRenderer, purifyText, renderChildrenToHtml, renderChildrenToText, renderHtmlElement, renderToHtml, renderToText, resolveDefaultRenderer$1 as resolveDefaultHtmlRenderer, resolveDefaultRenderer as resolveDefaultTextRenderer, richTextBuiltInElements, richTextBuiltInFormats, rootHtmlRenderer, textHtmlRenderer, walkRichTextTree };
export { HeadingNode, LinkNode, ListItemNode, ListNode, NodeStringRenderer, NodeStringRendererProps, ParagraphNode, ParameterRichTextValue, ResolveStringRenderer, RichTextNode, RichTextNodeWithChildren, StringRenderContext, TextNode, getLabelForElement, getLabelForFormat, getRichTextTagsFromTextFormat, hasChildren, headingHtmlRenderer, isArrayWithLength, isPureDirection, isPureTextAlign, isRichTextNode, isRichTextNodeType, isRichTextValue, isRichTextValueConsideredEmpty, linkHtmlRenderer, linkParamValueToHref, listHtmlRenderer, listitemHtmlRenderer, paragraphHtmlRenderer, purifyText, renderChildrenToHtml, renderChildrenToText, renderHtmlElement, renderToHtml, renderToText, resolveDefaultRenderer$1 as resolveDefaultHtmlRenderer, resolveDefaultRenderer as resolveDefaultTextRenderer, richTextBuiltInElements, richTextBuiltInFormats, rootHtmlRenderer, textHtmlRenderer, walkRichTextTree };

@@ -43,5 +43,24 @@ // src/elements.ts

}
function isRichTextValue(value) {
return typeof value === "object" && value !== null && "root" in value && isRichTextNode(value.root);
}
function isRichTextNodeType(node, type) {
return isRichTextNode(node) && node.type === type;
}
function isRichTextValueConsideredEmpty(value) {
if (!value) {
return true;
}
if (value.root.children.length === 0) {
return true;
}
if (value.root.children.length > 1) {
return false;
}
const child = value.root.children[0];
if (!isRichTextNodeType(child, "paragraph")) {
return false;
}
return child.children === void 0 || child.children.length === 0;
}
function hasChildren(node) {

@@ -424,2 +443,4 @@ return "children" in node && isArrayWithLength(node.children);

isRichTextNodeType,
isRichTextValue,
isRichTextValueConsideredEmpty,
linkHtmlRenderer,

@@ -426,0 +447,0 @@ linkParamValueToHref,

@@ -33,2 +33,4 @@ "use strict";

isRichTextNodeType: () => isRichTextNodeType,
isRichTextValue: () => isRichTextValue,
isRichTextValueConsideredEmpty: () => isRichTextValueConsideredEmpty,
linkHtmlRenderer: () => linkHtmlRenderer,

@@ -97,5 +99,24 @@ linkParamValueToHref: () => linkParamValueToHref,

}
function isRichTextValue(value) {
return typeof value === "object" && value !== null && "root" in value && isRichTextNode(value.root);
}
function isRichTextNodeType(node, type) {
return isRichTextNode(node) && node.type === type;
}
function isRichTextValueConsideredEmpty(value) {
if (!value) {
return true;
}
if (value.root.children.length === 0) {
return true;
}
if (value.root.children.length > 1) {
return false;
}
const child = value.root.children[0];
if (!isRichTextNodeType(child, "paragraph")) {
return false;
}
return child.children === void 0 || child.children.length === 0;
}
function hasChildren(node) {

@@ -479,2 +500,4 @@ return "children" in node && isArrayWithLength(node.children);

isRichTextNodeType,
isRichTextValue,
isRichTextValueConsideredEmpty,
linkHtmlRenderer,

@@ -481,0 +504,0 @@ linkParamValueToHref,

{
"name": "@uniformdev/richtext",
"version": "19.23.1-alpha.12+669adf812",
"version": "19.24.0",
"description": "Common functionality and types for Uniform Rich Text parameters",

@@ -48,3 +48,3 @@ "license": "SEE LICENSE IN LICENSE.txt",

"@lexical/rich-text": "^0.11.0",
"@uniformdev/canvas": "^19.23.1-alpha.12+669adf812",
"@uniformdev/canvas": "^19.24.0",
"lexical": "^0.11.0"

@@ -58,3 +58,3 @@ },

},
"gitHead": "669adf812df13a7856fb9bc5c4332c77e0697f3f"
"gitHead": "ca1c309ce7eed5bffa76130e2baa0f03b08377ac"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc