Socket
Socket
Sign inDemoInstall

@udecode/slate-utils

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/slate-utils - npm Package Compare versions

Comparing version 36.3.9 to 37.0.0

128

dist/index.d.ts
import * as _udecode_slate from '@udecode/slate';
import { EDescendant, Value, TEditor, FindNodeOptions, TNodeEntry, EAncestor, GetAboveNodeOptions, ChildOf, TNode, EElementOrText, EAncestorEntry, TOperation, EElement, QueryNodeOptions, TAncestor, QueryEditorOptions, TElement, InsertNodesOptions, ENodeEntry, SetNodesOptions, RemoveNodesOptions, EMarks, WrapNodesOptions, TDescendant } from '@udecode/slate';
import { DescendantOf, TEditor, FindNodeOptions, TNodeEntry, AncestorOf, GetAboveNodeOptions, ChildOf, TNode, ElementOrTextOf, AncestorEntryOf, TOperation, ElementOf, QueryNodeOptions, TAncestor, QueryEditorOptions, TElement, InsertNodesOptions, NodeEntryOf, SetNodesOptions, RemoveNodesOptions, MarksOf, WrapNodesOptions, TDescendant } from '@udecode/slate';
import * as slate from 'slate';

@@ -13,9 +13,9 @@ import { Path, Location, Point, Range } from 'slate';

/** Get the first descendant node matching the condition. */
declare const findDescendant: <N extends EDescendant<V>, V extends Value = Value>(editor: TEditor<V>, options: FindNodeOptions<V>) => TNodeEntry<N> | undefined;
declare const findDescendant: <N extends DescendantOf<E>, E extends TEditor = TEditor>(editor: E, options: FindNodeOptions<E>) => TNodeEntry<N> | undefined;
/** Get the top-level block. */
declare const getAncestorNode: <V extends Value = Value>(editor: TEditor<V>, path?: Path) => _udecode_slate.TNodeEntry<_udecode_slate.ENode<V>> | undefined;
declare const getAncestorNode: (editor: TEditor, path?: Path) => _udecode_slate.TNodeEntry<_udecode_slate.NodeOf<TEditor>> | undefined;
/** Get the block above a location (default: selection). */
declare const getBlockAbove: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => _udecode_slate.TNodeEntry<N> | undefined;
declare const getBlockAbove: <N extends AncestorOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetAboveNodeOptions<E>) => _udecode_slate.TNodeEntry<N> | undefined;

@@ -26,3 +26,3 @@ /** Get children node entries of a node entry. TODO: try Node.children */

/** Get the edge blocks above a location (default: selection). */
declare const getEdgeBlocksAbove: <N1 extends EAncestor<V>, N2 extends EAncestor<V> = N1, V extends Value = Value>(editor: TEditor<V>, { at: _at, ...options }?: GetAboveNodeOptions<V>) => [TNodeEntry<N1>, TNodeEntry<N2>] | null;
declare const getEdgeBlocksAbove: <N1 extends AncestorOf<E>, N2 extends AncestorOf<E> = N1, E extends TEditor = TEditor>(editor: E, { at: _at, ...options }?: GetAboveNodeOptions<E>) => [TNodeEntry<N1>, TNodeEntry<N2>] | null;

@@ -37,9 +37,9 @@ /** Get the last child of a node or null if no children. */

/** Get the last node at a given level. */
declare const getLastNodeByLevel: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, level: number) => TNodeEntry<N> | undefined;
declare const getLastNodeByLevel: <N extends ElementOrTextOf<E>, E extends TEditor = TEditor>(editor: E, level: number) => TNodeEntry<N> | undefined;
/** Get selection mark value by key. */
declare const getMark: <V extends Value>(editor: TEditor<V>, key: string) => unknown;
declare const getMark: (editor: TEditor, key: string) => unknown;
/** Get the start point of the next node. */
declare const getNextNodeStartPoint: <V extends Value = Value>(editor: TEditor<V>, at: Path) => slate.BasePoint | undefined;
declare const getNextNodeStartPoint: (editor: TEditor, at: Path) => slate.BasePoint | undefined;

@@ -52,9 +52,9 @@ /**

*/
declare const getNextSiblingNodes: <V extends Value>(ancestorEntry: EAncestorEntry<V>, path: Path) => EElementOrText<V>[];
declare const getNextSiblingNodes: <E extends TEditor>(ancestorEntry: AncestorEntryOf<E>, path: Path) => ElementOrTextOf<E>[];
/** Get node entries range. */
declare const getNodesRange: <V extends Value>(editor: TEditor<V>, nodeEntries: TNodeEntry[]) => slate.BaseRange | undefined;
declare const getNodesRange: (editor: TEditor, nodeEntries: TNodeEntry[]) => slate.BaseRange | undefined;
/** Get typed editor operations. */
declare const getOperations: <V extends Value>(editor: TEditor<V>) => TOperation<EDescendant<V>>[];
declare const getOperations: <E extends TEditor>(editor: E) => TOperation<DescendantOf<E>>[];

@@ -96,3 +96,3 @@ interface BeforeOptions {

*/
declare const getPointBeforeLocation: <V extends Value>(editor: TEditor<V>, at: Location, options?: PointBeforeOptions) => any;
declare const getPointBeforeLocation: (editor: TEditor, at: Location, options?: PointBeforeOptions) => any;

@@ -104,3 +104,3 @@ /**

*/
declare const getPointFromLocation: <V extends Value>(editor: TEditor<V>, { at, focus, }?: {
declare const getPointFromLocation: (editor: TEditor, { at, focus, }?: {
at?: Location | null | undefined;

@@ -114,3 +114,3 @@ focus?: boolean | undefined;

*/
declare const getPointNextToVoid: <V extends Value>(editor: TEditor<V>, { after, at, }: {
declare const getPointNextToVoid: (editor: TEditor, { after, at, }: {
/** Get the point after (instead of before) the void node. */

@@ -125,10 +125,10 @@ after?: boolean | undefined;

*/
declare const getPreviousBlockById: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, id: string, query?: QueryNodeOptions) => TNodeEntry<N> | undefined;
declare const getPreviousBlockById: <N extends ElementOf<E>, E extends TEditor = TEditor>(editor: TEditor, id: string, query?: QueryNodeOptions) => TNodeEntry<N> | undefined;
/** Get the end point of the previous node. */
declare const getPreviousNodeEndPoint: <V extends Value = Value>(editor: TEditor<V>, at: Path) => slate.BasePoint | undefined;
declare const getPreviousNodeEndPoint: (editor: TEditor, at: Path) => slate.BasePoint | undefined;
declare const getPreviousPath: (path: Path) => Path | undefined;
declare const getPreviousSiblingNode: <V extends Value = Value>(editor: TEditor<V>, path: Path) => (number[] | _udecode_slate.NodeOf<TEditor<V>>)[] | undefined;
declare const getPreviousSiblingNode: (editor: TEditor, path: Path) => (number[] | _udecode_slate.NodeOf<TEditor>)[] | undefined;

@@ -138,3 +138,3 @@ interface RangeBeforeOptions extends PointBeforeOptions {

/** Get range from {@link getPointBeforeLocation} to the end point of `at`. */
declare const getRangeBefore: <V extends Value>(editor: TEditor<V>, at: Location, options?: RangeBeforeOptions) => Range | undefined;
declare const getRangeBefore: (editor: TEditor, at: Location, options?: RangeBeforeOptions) => Range | undefined;

@@ -145,3 +145,3 @@ /**

*/
declare const getRangeFromBlockStart: <V extends Value>(editor: TEditor<V>, options?: Omit<GetAboveNodeOptions<V>, 'match'>) => {
declare const getRangeFromBlockStart: <E extends TEditor>(editor: E, options?: Omit<GetAboveNodeOptions<E>, 'match'>) => {
anchor: slate.BasePoint;

@@ -152,9 +152,9 @@ focus: slate.BasePoint;

/** Get the selected text. Return empty string if no selection. */
declare const getSelectionText: <V extends Value>(editor: TEditor<V>) => string;
declare const getSelectionText: (editor: TEditor) => string;
/** Is an ancestor empty (empty text and no inline children). */
declare const isAncestorEmpty: <V extends Value>(editor: TEditor<V>, node: TAncestor) => boolean;
declare const isAncestorEmpty: (editor: TEditor, node: TAncestor) => boolean;
/** Is the block above the selection empty. */
declare const isBlockAboveEmpty: <V extends Value>(editor: TEditor<V>) => boolean;
declare const isBlockAboveEmpty: (editor: TEditor) => boolean;

@@ -166,5 +166,5 @@ /**

*/
declare const isBlockTextEmptyAfterSelection: <V extends Value>(editor: TEditor<V>) => boolean;
declare const isBlockTextEmptyAfterSelection: (editor: TEditor) => boolean;
declare const isDocumentEnd: <V extends Value = Value>(editor: TEditor<V>) => boolean;
declare const isDocumentEnd: (editor: TEditor) => boolean;

@@ -175,3 +175,3 @@ /**

*/
declare const isEditorEmpty: <V extends Value>(editor: TEditor<V>) => boolean;
declare const isEditorEmpty: (editor: TEditor) => boolean;

@@ -182,6 +182,6 @@ /** Is it the first child of the parent */

/** Is the mark defined in the selection. */
declare const isMarkActive: <V extends Value>(editor: TEditor<V>, type: string) => boolean;
declare const isMarkActive: (editor: TEditor, type: string) => boolean;
/** Is a point at the end of a word */
declare const isPointAtWordEnd: <V extends Value>(editor: TEditor<V>, { at }: {
declare const isPointAtWordEnd: (editor: TEditor, { at }: {
at: Point;

@@ -197,10 +197,10 @@ }) => boolean;

*/
declare const isRangeAcrossBlocks: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
declare const isRangeAcrossBlocks: <E extends TEditor>(editor: E, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
} & Omit<GetAboveNodeOptions<E>, "at">) => boolean | undefined;
/** Whether the range is in the same block. */
declare const isRangeInSameBlock: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
declare const isRangeInSameBlock: <E extends TEditor>(editor: E, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
} & Omit<GetAboveNodeOptions<E>, "at">) => boolean | undefined;

@@ -211,3 +211,3 @@ /** Is the range in the same single text path. */

/** Is the selection focus at the end of its parent block. */
declare const isSelectionAtBlockEnd: <V extends Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => boolean;
declare const isSelectionAtBlockEnd: <E extends TEditor>(editor: E, options?: GetAboveNodeOptions<E>) => boolean;

@@ -219,12 +219,12 @@ /**

*/
declare const isSelectionAtBlockStart: <V extends Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => boolean;
declare const isSelectionAtBlockStart: <E extends TEditor>(editor: E, options?: GetAboveNodeOptions<E>) => boolean;
declare const isSelectionCoverBlock: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
declare const isSelectionCoverBlock: <E extends TEditor>(editor: E, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
} & Omit<GetAboveNodeOptions<E>, "at">) => boolean | undefined;
/** Is the selection expanded. */
declare const isSelectionExpanded: <V extends Value>(editor: TEditor<V>) => boolean;
declare const isSelectionExpanded: (editor: TEditor) => boolean;
declare const isTextByPath: <V extends Value>(editor: TEditor<V>, path: Path) => boolean;
declare const isTextByPath: (editor: TEditor, path: Path) => boolean;

@@ -235,3 +235,3 @@ /**

*/
declare const isWordAfterTrigger: <V extends Value>(editor: TEditor<V>, { at, trigger }: {
declare const isWordAfterTrigger: (editor: TEditor, { at, trigger }: {
at: Point;

@@ -245,11 +245,11 @@ trigger: string;

/** Query the editor state. */
declare const queryEditor: <V extends Value = Value, E extends TEditor<V> = TEditor<V>>(editor: E, { allow, at, exclude, filter, selectionAtBlockEnd, selectionAtBlockStart, }?: QueryEditorOptions<V, E>) => boolean;
declare const queryEditor: <E extends TEditor>(editor: E, { allow, at, exclude, filter, selectionAtBlockEnd, selectionAtBlockStart, }?: QueryEditorOptions<E>) => boolean;
declare const insertElements: <V extends Value>(editor: TEditor<V>, nodes: TElement | TElement[], options?: InsertNodesOptions<V>) => void;
declare const insertElements: <E extends TEditor>(editor: E, nodes: TElement | TElement[], options?: InsertNodesOptions<E>) => void;
declare const insertEmptyElement: <V extends Value>(editor: TEditor<V>, type: string, options?: InsertNodesOptions<V>) => void;
declare const insertEmptyElement: <E extends TEditor>(editor: E, type: string, options?: InsertNodesOptions<E>) => void;
interface MoveChildrenOptions<V extends Value = Value> {
interface MoveChildrenOptions<E extends TEditor = TEditor> {
/** Parent node of the children to move. */
at: ENodeEntry<V> | Path;
at: NodeEntryOf<E> | Path;
/** Path where to move the children. */

@@ -263,8 +263,8 @@ to: Path;

/** Condition for the child to be moved */
match?: (entry: ENodeEntry<V>) => boolean;
match?: (entry: NodeEntryOf<E>) => boolean;
}
/** Move the children of a node to a path. Returns the number of children moved. */
declare const moveChildren: <V extends Value>(editor: TEditor<V>, { at, fromStartIndex, match, to }: MoveChildrenOptions<V>) => number;
declare const moveChildren: <E extends TEditor>(editor: E, { at, fromStartIndex, match, to }: MoveChildrenOptions<E>) => number;
interface RemoveMarkOptions<V extends Value = Value> extends Omit<SetNodesOptions<V>, 'match' | 'split'> {
interface RemoveMarkOptions<E extends TEditor> extends Omit<SetNodesOptions<E>, 'match' | 'split'> {
/** Mark or the array of marks that will be removed */

@@ -283,42 +283,38 @@ key: string | string[];

/** Remove mark and trigger `onChange` if collapsed selection. */
declare const removeMark: <V extends Value>(editor: TEditor<V>, { at, key, shouldChange, ...rest }: RemoveMarkOptions<V>) => void;
declare const removeMark: <E extends TEditor>(editor: E, { at, key, shouldChange, ...rest }: RemoveMarkOptions<E>) => void;
/** Remove node children. */
declare const removeNodeChildren: <V extends Value = Value>(editor: TEditor<V>, path: Path, options?: Omit<RemoveNodesOptions<V>, 'at'>) => void;
declare const removeNodeChildren: <E extends TEditor>(editor: E, path: Path, options?: Omit<RemoveNodesOptions<E>, 'at'>) => void;
/** Remove selection marks. */
declare const removeSelectionMark: <V extends Value = Value>(editor: TEditor<V>) => void;
declare const removeSelectionMark: (editor: TEditor) => void;
interface ReplaceNodeChildrenOptions<N extends EElementOrText<V>, V extends Value = Value> {
interface ReplaceNodeChildrenOptions<N extends ElementOrTextOf<E>, E extends TEditor = TEditor> {
at: Path;
nodes: N | N[];
insertOptions?: Omit<InsertNodesOptions<V>, 'at'>;
removeOptions?: Omit<RemoveNodesOptions<V>, 'at'>;
insertOptions?: Omit<InsertNodesOptions<E>, 'at'>;
removeOptions?: Omit<RemoveNodesOptions<E>, 'at'>;
}
/** Replace node children: remove then insert. */
declare const replaceNodeChildren: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, insertOptions, nodes, removeOptions }: ReplaceNodeChildrenOptions<N, V>) => void;
declare const replaceNodeChildren: <N extends ElementOrTextOf<E>, E extends TEditor = TEditor>(editor: E, { at, insertOptions, nodes, removeOptions }: ReplaceNodeChildrenOptions<N, E>) => void;
declare const replaceNode: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, insertOptions, nodes, removeOptions }: ReplaceNodeChildrenOptions<N, V>) => void;
declare const replaceNode: <N extends ElementOrTextOf<E>, E extends TEditor = TEditor>(editor: E, { at, insertOptions, nodes, removeOptions }: ReplaceNodeChildrenOptions<N, E>) => void;
/** Select the end point of the block above the selection. */
declare const selectEndOfBlockAboveSelection: <V extends Value>(editor: TEditor<V>) => void;
declare const selectEndOfBlockAboveSelection: (editor: TEditor) => void;
/** Set marks to selected text. */
declare const setMarks: <V extends Value>(editor: TEditor<V>, marks: EMarks<V>, clear?: string | string[]) => void;
declare const setMarks: <E extends TEditor>(editor: E, marks: MarksOf<E>, clear?: string | string[]) => void;
interface ToggleMarkOptions {
/** The mark key to toggle. */
key: string;
/** Mark keys to clear when adding the mark. */
clear?: string | string[];
}
/**
* Add/remove marks in the selection.
*
* @param editor
* @param key Mark to toggle
* @param clear Marks to clear when adding mark
*/
declare const toggleMark: <V extends Value = Value>(editor: TEditor<V>, { clear, key }: ToggleMarkOptions) => void;
/** Add or remove marks in the selection. */
declare const toggleMark: (editor: TEditor, { clear, key }: ToggleMarkOptions) => void;
/** Unwrap if the node type is in selection. Wrap otherwise. */
declare const toggleWrapNodes: <V extends Value>(editor: TEditor<V>, type: string) => void;
declare const toggleWrapNodes: (editor: TEditor, type: string) => void;

@@ -331,3 +327,3 @@ /**

*/
declare const wrapNodeChildren: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, element: N, options: Modify<WrapNodesOptions<V>, {
declare const wrapNodeChildren: <N extends ElementOf<E>, E extends TEditor = TEditor>(editor: E, element: N, options: Modify<WrapNodesOptions<E>, {
at: Path;

@@ -334,0 +330,0 @@ }>) => void;

{
"name": "@udecode/slate-utils",
"version": "36.3.9",
"version": "37.0.0",
"description": "Slate utils",
"license": "MIT",
"keywords": [
"slate"
],
"homepage": "https://platejs.org",
"bugs": {
"url": "https://github.com/udecode/plate/issues"
},
"repository": {

@@ -12,12 +17,4 @@ "type": "git",

},
"bugs": {
"url": "https://github.com/udecode/plate/issues"
},
"license": "MIT",
"sideEffects": false,
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
],
"exports": {

@@ -31,6 +28,12 @@ ".": {

},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
],
"scripts": {
"brl": "yarn p:brl",
"build": "yarn p:build",
"build:watch": "yarn p:build:watch",
"brl": "yarn p:brl",
"clean": "yarn p:clean",

@@ -44,13 +47,10 @@ "lint": "yarn p:lint",

"dependencies": {
"@udecode/slate": "36.0.6",
"@udecode/utils": "31.0.0",
"@udecode/slate": "37.0.0",
"@udecode/utils": "37.0.0",
"lodash": "^4.17.21"
},
"peerDependencies": {
"slate": ">=0.94.0",
"slate": ">=0.103.0",
"slate-history": ">=0.93.0"
},
"keywords": [
"slate"
],
"publishConfig": {

@@ -57,0 +57,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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