dmeditor
Version:
dmeditor is a block-style visual editor. Data is in json format.
81 lines (80 loc) • 4.23 kB
TypeScript
import { ContextWithStyleType, type DMEConfigType } from '../config';
import type { DMEData } from '../types';
export declare function jsonParse<T>(obj: string): T;
export declare function jsonStringify<T>(obj: T): string;
export declare function simpleCloneDeep<T>(obj: T): unknown;
export declare function isHTMLElement(node: unknown): node is HTMLElement;
export declare function isStrictlyInfinity(value: number): value is typeof Infinity;
/**
* @method isNull
* @param value
* @returns {boolean} true if value is null
*/
export declare function isNull(value: unknown): value is null;
export declare function isUndefined(value: unknown): value is undefined;
/**
* @method isUndefinedOrNull
* @param {unknown} value
* @returns {boolean} true if value is undefined or null
* false if value is not undefined or null
**/
export declare function isUndefinedOrNull(value: unknown): value is boolean;
/**
* @method isPlainObject
* @param value
* @returns {boolean} true if value is plain object
* false if value is not plain object
*/
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
/**
* @method isKeyInObject
* @param {string} key - key to check
* @param {object} obj - object to check
* @returns {boolean} true if key is in object
*/
export declare function isKeyInObject<T, K extends keyof T>(key: string, obj: T): obj is T & Record<K, unknown>;
export declare function getPropertyName(name: string): string;
export declare const getPropertyFromChildren: (name: string, blockChildren: DMEData.Block['children']) => DMEData.DefaultBlockType[];
export declare function isEmptyString(value: string): boolean;
/**
* @method imageExtensionIsValid
* @param extension string image extension
* @returns boolean true if extension is valid
*/
export declare function imageExtensionIsValid(extension: string | undefined): boolean;
/**
* @method isUrl
* @param url string url to check
* @returns boolean true if url is valid
*/
export declare function isUrl(url: string): boolean;
export declare function isNumber(value: unknown): value is number;
/**
* @method isString
* @param value
* @returns {boolean} true if value is string
* false if value is not string
* */
export declare function isString(value: unknown): Boolean;
export declare const getPropertyFromCssStyle: (property: string, blockData: DMEData.Block) => string | null | undefined;
export declare const getPropertyFromSettings: (blockData: DMEData.Block) => import("../types").DME.WidgetStyleOptionSettings | undefined;
export declare const getPropertyFromData: (property: string, blockData: DMEData.Block) => any;
export declare const getPropertyValue: (property: string, blockData: DMEData.Block) => any;
export declare const scrollBlockToView: (id: string) => void;
export declare const arrayHasCommonElement: (a: Array<unknown>, b: Array<unknown>) => boolean;
export declare const arrayStarts: (a: Array<unknown>, b: Array<unknown>) => boolean;
export declare const getEmbedConfigObject: (rootWidget: string) => {
enabledSettings?: ((settings: import("../types").DME.Setting[], styles: Record<string, string[]>, context: import("../types").DME.EmbedChildContext) => {
settings: import("../types").DME.Setting[];
enabledStyles?: Record<string, string[]> | undefined;
}) | undefined;
hasOwnView?: ((context: import("../types").DME.EmbedChildContext) => boolean) | undefined;
} | null;
export declare const editorConfigConverted: (str: string) => keyof DMEConfigType['editor'];
export declare const mapBlockList: (children: DMEData.BlockList | DMEData.BlockMap, fn: (item: DMEData.Block, index: number | string) => any) => any[];
export declare const getConfigByPath: (path: string) => any;
export declare const updateLocation: (vars: any) => void;
export declare const queryFromLocaton: (location: string) => Record<string, string>;
export declare const matchContext: (context: ContextWithStyleType, path: string) => boolean;
export declare const convertStyleDataToArray: (styles?: Record<string, string>) => string[];
export declare const setBlockValueByPath: (block: any, propName: string, propValue: any) => void;