Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uniformdev/richtext

Package Overview
Dependencies
Maintainers
0
Versions
429
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.180.0 to 19.181.1-alpha.4

79

./dist/index.js

@@ -23,4 +23,6 @@ "use strict";

__export(src_exports, {
emptyRichTextValue: () => emptyRichTextValue,
getLabelForElement: () => getLabelForElement,
getLabelForFormat: () => getLabelForFormat,
getRichTextTagFromTableCellHeaderState: () => getRichTextTagFromTableCellHeaderState,
getRichTextTagsFromTextFormat: () => getRichTextTagsFromTextFormat,

@@ -52,2 +54,5 @@ hasChildren: () => hasChildren,

rootHtmlRenderer: () => rootHtmlRenderer,
tableHtmlRenderer: () => tableHtmlRenderer,
tablecellHtmlRenderer: () => tablecellHtmlRenderer,
tablerowHtmlRenderer: () => tablerowHtmlRenderer,
textHtmlRenderer: () => textHtmlRenderer,

@@ -215,2 +220,36 @@ walkRichTextTree: () => walkRichTextTree

// src/nodes/table.ts
var tableHtmlRenderer = ({ context, renderChildren }) => {
return ["table", "tbody"].reduceRight((children, tag) => {
return renderHtmlElement(tag, null, children);
}, renderChildren(context.currentNode.children));
};
var tableTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/tablecell.ts
var tablecellHtmlRenderer = ({ context, renderChildren }) => {
const node = context.currentNode;
const tag = getRichTextTagFromTableCellHeaderState(node.headerState);
return renderHtmlElement(tag, null, renderChildren(context.currentNode.children));
};
var tablecellTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
function getRichTextTagFromTableCellHeaderState(headerState) {
if (headerState === 0) {
return "td";
}
return "th";
}
// src/nodes/tablerow.ts
var tablerowHtmlRenderer = ({ context, renderChildren }) => {
return renderHtmlElement("tr", null, renderChildren(context.currentNode.children));
};
var tablerowTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/text.ts

@@ -272,3 +311,6 @@ var textHtmlRenderer = ({ context }) => {

["text", textHtmlRenderer],
["tab", tabHtmlRenderer]
["tab", tabHtmlRenderer],
["table", tableHtmlRenderer],
["tablecell", tablecellHtmlRenderer],
["tablerow", tablerowHtmlRenderer]
]);

@@ -341,3 +383,6 @@ var resolveDefaultRenderer = (context) => {

["listitem", listitemTextRenderer],
["heading", headingTextRenderer]
["heading", headingTextRenderer],
["table", tableTextRenderer],
["tablecell", tablecellTextRenderer],
["tablerow", tablerowTextRenderer]
]);

@@ -446,2 +491,6 @@ var resolveDefaultRenderer2 = (context) => {

{
label: "Table",
type: "table"
},
{
label: "Dynamic Token",

@@ -494,6 +543,29 @@ type: "variable"

};
var emptyRichTextValue = {
root: {
type: "root",
version: 1,
direction: null,
format: "",
indent: 0,
children: [
{
type: "paragraph",
version: 1,
format: "start",
indent: 0,
direction: null,
children: [],
textFormat: 0,
textStyle: ""
}
]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
emptyRichTextValue,
getLabelForElement,
getLabelForFormat,
getRichTextTagFromTableCellHeaderState,
getRichTextTagsFromTextFormat,

@@ -525,4 +597,7 @@ hasChildren,

rootHtmlRenderer,
tableHtmlRenderer,
tablecellHtmlRenderer,
tablerowHtmlRenderer,
textHtmlRenderer,
walkRichTextTree
});

@@ -1,2 +0,2 @@

import { LinkParamValue, RichTextParamValue, RichTextBuiltInElement, RichTextBuiltInFormat } from '@uniformdev/canvas';
import { SerializedEditorState, SerializedParagraphNode } from 'lexical';

@@ -27,5 +27,5 @@ declare function purifyText(text: string): string;

type NodeStringRenderer = (props: NodeStringRendererProps) => string;
type ParameterRichTextValue = {
root: RichTextNode;
} | undefined;
type ParameterRichTextValue = SerializedEditorState | undefined | null;
type RichTextBuiltInFormat = 'code' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'superscript' | 'subscript';
type RichTextBuiltInElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'unorderedList' | 'orderedList' | 'link' | 'quote' | 'code' | 'variable' | 'table';

@@ -41,2 +41,15 @@ interface HeadingNode extends RichTextNode {

declare const linkHtmlRenderer: NodeStringRenderer;
type LinkParameterType = 'projectMapNode' | 'url' | 'tel' | 'email';
type ProjectMapLinkParamValue = {
type: 'projectMapNode';
projectMapId: string;
nodeId: string;
path: string;
dynamicInputValues?: Record<string, string>;
};
type NonProjectMapLinkParamValue = {
type: Exclude<LinkParameterType, 'projectMapNode'>;
path: string;
};
type LinkParamValue = ProjectMapLinkParamValue | NonProjectMapLinkParamValue | undefined;
declare function linkParamValueToHref(link: LinkParamValue): string | undefined;

@@ -63,2 +76,26 @@

interface TableNode extends RichTextNode {
}
declare const tableHtmlRenderer: NodeStringRenderer;
interface TableCellNode extends RichTextNode {
/**
* headerState:
* 0: no header
* 1: row header
* 2: column header
* 3: row and column header
*/
headerState: number;
}
declare const tablecellHtmlRenderer: NodeStringRenderer;
/**
* Convert headerState into relevant tag
*/
declare function getRichTextTagFromTableCellHeaderState(headerState: number): "td" | "th";
interface TableRowNode extends RichTextNode {
}
declare const tablerowHtmlRenderer: NodeStringRenderer;
interface TextNode extends RichTextNode {

@@ -88,3 +125,3 @@ /**

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

@@ -97,3 +134,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 isRichTextValueConsideredEmpty(value: ParameterRichTextValue): boolean;
declare function hasChildren<TRichTextNode extends RichTextNode>(node: TRichTextNode): node is TRichTextNode & {

@@ -162,3 +199,13 @@ children: RichTextNode[];

declare const getLabelForFormat: (type: string) => string;
declare const emptyRichTextValue: {
root: {
type: string;
version: number;
direction: null;
format: "";
indent: number;
children: SerializedParagraphNode[];
};
};
export { type HeadingNode, type LinkNode, type ListItemNode, type ListNode, type NodeStringRenderer, type NodeStringRendererProps, type ParagraphNode, type ParameterRichTextValue, type ResolveStringRenderer, type RichTextNode, type RichTextNodeWithChildren, type StringRenderContext, type 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 };
export { type HeadingNode, type LinkNode, type ListItemNode, type ListNode, type NodeStringRenderer, type NodeStringRendererProps, type ParagraphNode, type ParameterRichTextValue, type ResolveStringRenderer, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextNode, type RichTextNodeWithChildren, type StringRenderContext, type TableCellNode, type TableNode, type TableRowNode, type TextNode, emptyRichTextValue, getLabelForElement, getLabelForFormat, getRichTextTagFromTableCellHeaderState, 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, tableHtmlRenderer, tablecellHtmlRenderer, tablerowHtmlRenderer, textHtmlRenderer, walkRichTextTree };

@@ -158,2 +158,36 @@ // src/elements.ts

// src/nodes/table.ts
var tableHtmlRenderer = ({ context, renderChildren }) => {
return ["table", "tbody"].reduceRight((children, tag) => {
return renderHtmlElement(tag, null, children);
}, renderChildren(context.currentNode.children));
};
var tableTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/tablecell.ts
var tablecellHtmlRenderer = ({ context, renderChildren }) => {
const node = context.currentNode;
const tag = getRichTextTagFromTableCellHeaderState(node.headerState);
return renderHtmlElement(tag, null, renderChildren(context.currentNode.children));
};
var tablecellTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
function getRichTextTagFromTableCellHeaderState(headerState) {
if (headerState === 0) {
return "td";
}
return "th";
}
// src/nodes/tablerow.ts
var tablerowHtmlRenderer = ({ context, renderChildren }) => {
return renderHtmlElement("tr", null, renderChildren(context.currentNode.children));
};
var tablerowTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/text.ts

@@ -215,3 +249,6 @@ var textHtmlRenderer = ({ context }) => {

["text", textHtmlRenderer],
["tab", tabHtmlRenderer]
["tab", tabHtmlRenderer],
["table", tableHtmlRenderer],
["tablecell", tablecellHtmlRenderer],
["tablerow", tablerowHtmlRenderer]
]);

@@ -284,3 +321,6 @@ var resolveDefaultRenderer = (context) => {

["listitem", listitemTextRenderer],
["heading", headingTextRenderer]
["heading", headingTextRenderer],
["table", tableTextRenderer],
["tablecell", tablecellTextRenderer],
["tablerow", tablerowTextRenderer]
]);

@@ -389,2 +429,6 @@ var resolveDefaultRenderer2 = (context) => {

{
label: "Table",
type: "table"
},
{
label: "Dynamic Token",

@@ -437,5 +481,28 @@ type: "variable"

};
var emptyRichTextValue = {
root: {
type: "root",
version: 1,
direction: null,
format: "",
indent: 0,
children: [
{
type: "paragraph",
version: 1,
format: "start",
indent: 0,
direction: null,
children: [],
textFormat: 0,
textStyle: ""
}
]
}
};
export {
emptyRichTextValue,
getLabelForElement,
getLabelForFormat,
getRichTextTagFromTableCellHeaderState,
getRichTextTagsFromTextFormat,

@@ -467,4 +534,7 @@ hasChildren,

rootHtmlRenderer,
tableHtmlRenderer,
tablecellHtmlRenderer,
tablerowHtmlRenderer,
textHtmlRenderer,
walkRichTextTree
};

@@ -23,4 +23,6 @@ "use strict";

__export(src_exports, {
emptyRichTextValue: () => emptyRichTextValue,
getLabelForElement: () => getLabelForElement,
getLabelForFormat: () => getLabelForFormat,
getRichTextTagFromTableCellHeaderState: () => getRichTextTagFromTableCellHeaderState,
getRichTextTagsFromTextFormat: () => getRichTextTagsFromTextFormat,

@@ -52,2 +54,5 @@ hasChildren: () => hasChildren,

rootHtmlRenderer: () => rootHtmlRenderer,
tableHtmlRenderer: () => tableHtmlRenderer,
tablecellHtmlRenderer: () => tablecellHtmlRenderer,
tablerowHtmlRenderer: () => tablerowHtmlRenderer,
textHtmlRenderer: () => textHtmlRenderer,

@@ -215,2 +220,36 @@ walkRichTextTree: () => walkRichTextTree

// src/nodes/table.ts
var tableHtmlRenderer = ({ context, renderChildren }) => {
return ["table", "tbody"].reduceRight((children, tag) => {
return renderHtmlElement(tag, null, children);
}, renderChildren(context.currentNode.children));
};
var tableTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/tablecell.ts
var tablecellHtmlRenderer = ({ context, renderChildren }) => {
const node = context.currentNode;
const tag = getRichTextTagFromTableCellHeaderState(node.headerState);
return renderHtmlElement(tag, null, renderChildren(context.currentNode.children));
};
var tablecellTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
function getRichTextTagFromTableCellHeaderState(headerState) {
if (headerState === 0) {
return "td";
}
return "th";
}
// src/nodes/tablerow.ts
var tablerowHtmlRenderer = ({ context, renderChildren }) => {
return renderHtmlElement("tr", null, renderChildren(context.currentNode.children));
};
var tablerowTextRenderer = ({ context, renderChildren }) => {
return hasChildren(context.currentNode) ? `${renderChildren(context.currentNode.children)} ` : "";
};
// src/nodes/text.ts

@@ -272,3 +311,6 @@ var textHtmlRenderer = ({ context }) => {

["text", textHtmlRenderer],
["tab", tabHtmlRenderer]
["tab", tabHtmlRenderer],
["table", tableHtmlRenderer],
["tablecell", tablecellHtmlRenderer],
["tablerow", tablerowHtmlRenderer]
]);

@@ -341,3 +383,6 @@ var resolveDefaultRenderer = (context) => {

["listitem", listitemTextRenderer],
["heading", headingTextRenderer]
["heading", headingTextRenderer],
["table", tableTextRenderer],
["tablecell", tablecellTextRenderer],
["tablerow", tablerowTextRenderer]
]);

@@ -446,2 +491,6 @@ var resolveDefaultRenderer2 = (context) => {

{
label: "Table",
type: "table"
},
{
label: "Dynamic Token",

@@ -494,6 +543,29 @@ type: "variable"

};
var emptyRichTextValue = {
root: {
type: "root",
version: 1,
direction: null,
format: "",
indent: 0,
children: [
{
type: "paragraph",
version: 1,
format: "start",
indent: 0,
direction: null,
children: [],
textFormat: 0,
textStyle: ""
}
]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
emptyRichTextValue,
getLabelForElement,
getLabelForFormat,
getRichTextTagFromTableCellHeaderState,
getRichTextTagsFromTextFormat,

@@ -525,4 +597,7 @@ hasChildren,

rootHtmlRenderer,
tableHtmlRenderer,
tablecellHtmlRenderer,
tablerowHtmlRenderer,
textHtmlRenderer,
walkRichTextTree
});

5

package.json
{
"name": "@uniformdev/richtext",
"version": "19.180.0",
"version": "19.181.1-alpha.4+63886f3999",
"description": "Common functionality and types for Uniform Rich Text parameters",

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

"@lexical/rich-text": "0.17.0",
"@uniformdev/canvas": "^19.180.0",
"lexical": "0.17.0"

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

},
"gitHead": "309600b88571d0ffb2b80d7d2c27b7aa3e5ae72b"
"gitHead": "63886f3999fa693ef6b012fdcaefc930e238fc4d"
}

Sorry, the diff of this file is not supported yet

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