dmeditor
Version:
dmeditor is a block-style visual editor. Data is in json format.
76 lines (75 loc) • 3.49 kB
TypeScript
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 & DMEData.BlockNode)[];
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: {
[key: string]: string[];
}, context: import("../types").DME.EmbedChildContext) => {
settings: import("../types").DME.Setting[];
enabledStyles?: {
[key: string]: string[];
} | undefined;
}) | undefined;
hasOwnView?: ((context: import("../types").DME.EmbedChildContext) => boolean) | undefined;
} | null;