@recursive-robot/react-jsx-parser 1.42.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/JsxParser.d.ts +32 -32
- package/dist/constants/attributeNames.d.ts +2 -2
- package/dist/constants/specialTags.d.ts +4 -4
- package/dist/helpers/camelCase.d.ts +7 -7
- package/dist/helpers/functionProxy.d.ts +5 -5
- package/dist/helpers/functionUtilities.d.ts +7 -7
- package/dist/helpers/hash.d.ts +10 -10
- package/dist/helpers/parseStyle.d.ts +8 -8
- package/dist/helpers/resolvePath.d.ts +9 -9
- package/dist/index.d.ts +4 -5
- package/dist/react-jsx-parser.js +7502 -0
- package/dist/react-jsx-parser.js.map +1 -0
- package/package.json +38 -58
- package/dist/cjs/react-jsx-parser.min.js +0 -2
- package/dist/cjs/react-jsx-parser.min.js.map +0 -1
- package/dist/demo.d.ts +0 -1
- package/dist/es5/react-jsx-parser.min.js +0 -2
- package/dist/es5/react-jsx-parser.min.js.map +0 -1
- package/dist/umd/react-jsx-parser.min.js +0 -2
- package/dist/umd/react-jsx-parser.min.js.map +0 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
export
|
|
3
|
-
allowUnknownElements?: boolean;
|
|
4
|
-
autoCloseVoidElements?: boolean;
|
|
5
|
-
bindings?: {
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
};
|
|
8
|
-
blacklistedAttrs?: Array<string | RegExp>;
|
|
9
|
-
blacklistedTags?: string[];
|
|
10
|
-
className?: string;
|
|
11
|
-
components?: Record<string, ComponentType | ExoticComponent>;
|
|
12
|
-
componentsOnly?: boolean;
|
|
13
|
-
disableFragments?: boolean;
|
|
14
|
-
disableKeyGeneration?: boolean;
|
|
15
|
-
jsx?: string;
|
|
16
|
-
onError?: (error: Error) => void;
|
|
17
|
-
showWarnings?: boolean;
|
|
18
|
-
renderError?: (props: {
|
|
19
|
-
error: string;
|
|
20
|
-
}) => JSX.Element | null;
|
|
21
|
-
renderInWrapper?: boolean;
|
|
22
|
-
renderUnrecognized?: (tagName: string) => JSX.Element | null;
|
|
23
|
-
};
|
|
24
|
-
export default class JsxParser extends React.Component<TProps> {
|
|
25
|
-
#private;
|
|
26
|
-
static displayName: string;
|
|
27
|
-
static defaultProps: TProps;
|
|
28
|
-
private ParsedChildren;
|
|
29
|
-
private lastAttributeName;
|
|
30
|
-
jsx: string;
|
|
31
|
-
render: () => JSX.Element;
|
|
32
|
-
}
|
|
1
|
+
import { default as React, ComponentType, ExoticComponent } from 'react';
|
|
2
|
+
export type TProps = {
|
|
3
|
+
allowUnknownElements?: boolean;
|
|
4
|
+
autoCloseVoidElements?: boolean;
|
|
5
|
+
bindings?: {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
blacklistedAttrs?: Array<string | RegExp>;
|
|
9
|
+
blacklistedTags?: string[];
|
|
10
|
+
className?: string;
|
|
11
|
+
components?: Record<string, ComponentType | ExoticComponent>;
|
|
12
|
+
componentsOnly?: boolean;
|
|
13
|
+
disableFragments?: boolean;
|
|
14
|
+
disableKeyGeneration?: boolean;
|
|
15
|
+
jsx?: string;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
showWarnings?: boolean;
|
|
18
|
+
renderError?: (props: {
|
|
19
|
+
error: string;
|
|
20
|
+
}) => React.JSX.Element | null;
|
|
21
|
+
renderInWrapper?: boolean;
|
|
22
|
+
renderUnrecognized?: (tagName: string) => React.JSX.Element | null;
|
|
23
|
+
};
|
|
24
|
+
export default class JsxParser extends React.Component<TProps> {
|
|
25
|
+
#private;
|
|
26
|
+
static displayName: string;
|
|
27
|
+
static defaultProps: TProps;
|
|
28
|
+
private ParsedChildren;
|
|
29
|
+
private lastAttributeName;
|
|
30
|
+
jsx: string;
|
|
31
|
+
render: () => React.JSX.Element;
|
|
32
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: Record<string, string>;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: Record<string, string>;
|
|
2
|
+
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const VOID_ELEMENTS: string[];
|
|
2
|
-
export default VOID_ELEMENTS;
|
|
3
|
-
export declare function canHaveChildren(tagName: string): boolean;
|
|
4
|
-
export declare function canHaveWhitespace(tagName: string): boolean;
|
|
1
|
+
declare const VOID_ELEMENTS: string[];
|
|
2
|
+
export default VOID_ELEMENTS;
|
|
3
|
+
export declare function canHaveChildren(tagName: string): boolean;
|
|
4
|
+
export declare function canHaveWhitespace(tagName: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a string from other cases to camelCase
|
|
3
|
-
* @param string the value to camelCase
|
|
4
|
-
* @example
|
|
5
|
-
* camelCase('foo-bar') // 'fooBar'
|
|
6
|
-
*/
|
|
7
|
-
export declare const camelCase: (string: string) => string;
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string from other cases to camelCase
|
|
3
|
+
* @param string the value to camelCase
|
|
4
|
+
* @example
|
|
5
|
+
* camelCase('foo-bar') // 'fooBar'
|
|
6
|
+
*/
|
|
7
|
+
export declare const camelCase: (string: string) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
scope?: Record<string, any>;
|
|
3
|
-
};
|
|
4
|
-
export
|
|
5
|
-
export declare function createFunctionProxy(fn: ScopedFunction, scope: Record<string, any>): FunctionProxy;
|
|
1
|
+
export type ScopedFunction = Function & {
|
|
2
|
+
scope?: Record<string, any>;
|
|
3
|
+
};
|
|
4
|
+
export type FunctionProxy = ProxyHandler<ScopedFunction>;
|
|
5
|
+
export declare function createFunctionProxy(fn: ScopedFunction, scope: Record<string, any>): FunctionProxy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as AcornJSX from 'acorn-jsx';
|
|
2
|
-
export declare function isSpreadElement(node: AcornJSX.BaseExpression): node is AcornJSX.SpreadElement;
|
|
3
|
-
export declare function getClosureBindings(fullExpression: AcornJSX.Expression): string[];
|
|
4
|
-
export declare function getRenderFunction(jsx: string, bindings: Record<string, any>, parseExpression: (body: string, exp: AcornJSX.Expression, scope?: Record<string, any>) => any): (args: Record<string, any>) => any;
|
|
5
|
-
export declare function getAllJsxElements(code: string): (AcornJSX.JSXElement | AcornJSX.JSXFragment)[];
|
|
6
|
-
export declare function transpileFunctionBody(body: string, bindings: Record<string, any>, parseExpression: (jsx: string, exp: AcornJSX.Expression, scope?: Record<string, any>) => any): [string, Record<string, any>];
|
|
7
|
-
export declare function constructFunction(paramNames: string[], body: string, name?: string, onError?: (error: any) => void): (...args: any[]) => any;
|
|
1
|
+
import * as AcornJSX from 'acorn-jsx';
|
|
2
|
+
export declare function isSpreadElement(node: AcornJSX.BaseExpression): node is AcornJSX.SpreadElement;
|
|
3
|
+
export declare function getClosureBindings(fullExpression: AcornJSX.Expression): string[];
|
|
4
|
+
export declare function getRenderFunction(jsx: string, bindings: Record<string, any>, parseExpression: (body: string, exp: AcornJSX.Expression, scope?: Record<string, any>) => any): (args: Record<string, any>) => any;
|
|
5
|
+
export declare function getAllJsxElements(code: string): (AcornJSX.JSXElement | AcornJSX.JSXFragment)[];
|
|
6
|
+
export declare function transpileFunctionBody(body: string, bindings: Record<string, any>, parseExpression: (jsx: string, exp: AcornJSX.Expression, scope?: Record<string, any>) => any): [string, Record<string, any>];
|
|
7
|
+
export declare function constructFunction(paramNames: string[], body: string, name?: string, onError?: (error: any) => void): (...args: any[]) => any;
|
package/dist/helpers/hash.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hashes a value
|
|
3
|
-
* @param value the value to hash
|
|
4
|
-
* @param radix the base-n to hash into (default 16)
|
|
5
|
-
*/
|
|
6
|
-
export declare const hash: (value?: string, radix?: number) => string;
|
|
7
|
-
/**
|
|
8
|
-
* Hashes a Math.random() value, returning it in base16
|
|
9
|
-
*/
|
|
10
|
-
export declare const randomHash: () => string;
|
|
1
|
+
/**
|
|
2
|
+
* Hashes a value
|
|
3
|
+
* @param value the value to hash
|
|
4
|
+
* @param radix the base-n to hash into (default 16)
|
|
5
|
+
*/
|
|
6
|
+
export declare const hash: (value?: string, radix?: number) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Hashes a Math.random() value, returning it in base16
|
|
9
|
+
*/
|
|
10
|
+
export declare const randomHash: () => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Converts a CSS Style string
|
|
4
|
-
* @param {string | Partial<CSSStyleDeclaration>} style A string to convert, or object to return
|
|
5
|
-
* @returns {Partial<CSSStyleDeclaration>} a partial CSSStyleDeclaration
|
|
6
|
-
*/
|
|
7
|
-
export declare const parseStyle: (style: Style) => Partial<CSSStyleDeclaration> | undefined;
|
|
8
|
-
export {};
|
|
1
|
+
type Style = string | Partial<CSSStyleDeclaration>;
|
|
2
|
+
/**
|
|
3
|
+
* Converts a CSS Style string
|
|
4
|
+
* @param {string | Partial<CSSStyleDeclaration>} style A string to convert, or object to return
|
|
5
|
+
* @returns {Partial<CSSStyleDeclaration>} a partial CSSStyleDeclaration
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseStyle: (style: Style) => Partial<CSSStyleDeclaration> | undefined;
|
|
8
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the result of a path query from an object
|
|
3
|
-
* @param {any} object the object to search
|
|
4
|
-
* @param {string} path the path, whose value will be retrieved
|
|
5
|
-
* @returns {any} the value (undefined if the path doesn't exist)
|
|
6
|
-
* @example
|
|
7
|
-
* resolvePath({ foo: { bar: { baz: 3 } } }, 'foo.bar.baz') // 3
|
|
8
|
-
*/
|
|
9
|
-
export declare const resolvePath: (object: any, path: string) => any;
|
|
1
|
+
/**
|
|
2
|
+
* Returns the result of a path query from an object
|
|
3
|
+
* @param {any} object the object to search
|
|
4
|
+
* @param {string} path the path, whose value will be retrieved
|
|
5
|
+
* @returns {any} the value (undefined if the path doesn't exist)
|
|
6
|
+
* @example
|
|
7
|
+
* resolvePath({ foo: { bar: { baz: 3 } } }, 'foo.bar.baz') // 3
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolvePath: (object: any, path: string) => any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type {
|
|
4
|
-
export
|
|
5
|
-
export default JsxParser;
|
|
1
|
+
import { default as JsxParser } from './components/JsxParser';
|
|
2
|
+
export type { TProps } from './components/JsxParser';
|
|
3
|
+
export type { ScopedFunction, FunctionProxy } from './helpers/functionProxy';
|
|
4
|
+
export default JsxParser;
|