Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "index"

Index

References

__express

Re-exports __express

renderFile

Renames and re-exports __express

Variables

DynamicComponent

DynamicComponent: DynamicComponent

FormComponent

FormComponent: FormComponent

Const _jsonxChildren

_jsonxChildren: "children" = jsonxChildren

Const _jsonxComponents

_jsonxComponents: "components" = jsonxComponents

Const _jsonxProps

_jsonxProps: "props" = jsonxProps

Const _jsonxUtils

_jsonxUtils: "utils" = jsonxUtils

componentMap

componentMap: any

Const createElement

createElement: createElement = React.createElement

displayComponent

displayComponent: displayComponent

getBoundedComponents

getBoundedComponents: getBoundedComponents

getComponentFromMap

getComponentFromMap: getComponentFromMap

getComputedProps

getComputedProps: getComputedProps

getJSONXChildren

getJSONXChildren: getJSONXChildren

Const getReactElement

getReactElement: getReactElementFromJSONX = getReactElementFromJSONX

Const getRenderedJSON

getRenderedJSON: getReactElementFromJSONX = getReactElementFromJSONX

Const jsonxHTMLString

jsonxHTMLString: outputHTML = outputHTML

Let renderIndex

renderIndex: number = 0

Functions

__getReact

  • __getReact(): React
  • Exposes react module used in JSONX

    Returns React

    React

__getReactDOM

  • __getReactDOM(): "/home/runner/work/jsonx/jsonx/node_modules/@types/react-dom/index"
  • Exposes react dom module used in JSONX

    Returns "/home/runner/work/jsonx/jsonx/node_modules/@types/react-dom/index"

    ReactDOM

compile

  • compile(this: Context, jsonx: jsonx, resources?: {}): compiledJSONX
  • converts a jsonx json object into a react function component

    example

    jsonx.compile({jsonx:{component:'div',props:{title:'some title attribute'},children:'inner html text'}}) //=>React Function Component

    Parameters

    • this: Context
    • jsonx: jsonx

      valid JSONX JSON

    • Default value resources: {} = {}

      props for react element

    Returns compiledJSONX

    React element via React.createElement

getReactElementFromJSON

  • getReactElementFromJSON(__namedParameters: { children: any; props: any; type: string }): ReactElementLike
  • converts a json object {type,props,children} into a react element

    example

    jsonx.getReactElementFromJSON({type:'div',props:{title:'some title attribute'},children:'inner html text'})

    Parameters

    • __namedParameters: { children: any; props: any; type: string }
      • children: any
      • props: any
      • type: string

    Returns ReactElementLike

    React element via React.createElement

getReactElementFromJSONX

  • Use React.createElement and JSONX JSON to create React elements

    example

    // Uses react to create the equivalent JSX hello world jsonx.getReactElementFromJSONX({component:'myCompnent',props:{style:{color:'blue'}},children:'hello world'})

    property

    {object} this - options for getReactElementFromJSONX

    property

    {Object} [this.componentLibraries] - react components to render with JSONX

    property

    {boolean} [this.debug=false] - use debug messages

    property

    {boolean} [this.returnJSON=false] - return json object of {type,props,children} instead of react element

    property

    {boolean} [this.disableRenderIndexKey=false] - disables auto assign a key prop

    property

    {function} [this.logError=console.error] - error logging function

    property

    {string[]} [this.boundedComponents=[]] - list of components that require a bound this context (usefult for redux router)

    Parameters

    • this: Context
    • Optional jsonx: jsonx | simpleJsonx

      any valid JSONX JSON object

    • Default value resources: {} = {}

      any additional resource used for asynchronous properties

    Returns ReactElementLike | JSONReactElement | null | string | undefined

    React element via React.createElement

jsonToJSX

  • converts JSONX JSON IR to JSX

    example

    jsonx.jsonToJSX({ type: 'div', props: { key: 5, title: 'test' }, children: 'hello' }) // => '

    hello
    '

    Parameters

    Returns string

    jsx string

jsonxRender

  • jsonxRender(this: Context, config?: defs.RenderConfig): void
  • Use JSONX without any configuration to render JSONX JSON to HTML and insert JSONX into querySelector using ReactDOM.render

    example

    // Uses react to create

    hello world

    jsonx.jsonxRender({ jsonx: { component: 'div', props:{className:'jsonx-generated',children:[{ component:'p',props:{style:{color:'red'}}, children:'hello world' }]}}, querySelector:'#myApp', });

    property

    {object} this - options for getReactElementFromJSONX

    Parameters

    • this: Context
    • Default value config: defs.RenderConfig = { jsonx: { component: "" }, querySelector: "" }

      options used to inject html via ReactDOM.render

    Returns void

outputHTML

  • outputHTML(this: defs.OutputHTMLContext, config?: defs.OutputHTMLConfig): string
  • Use ReactDOMServer.renderToString to render html from JSONX

    example

    // Uses react to create

    hello world

    jsonx.outputHTML({ jsonx: { component: 'div', props:{className:'jsonx-generated',children:[{ component:'p',props:{style:{color:'red'}}, children:'hello world' }]}}, });

    property

    {object} this - options for getReactElementFromJSONX

    Parameters

    • this: defs.OutputHTMLContext
    • Default value config: defs.OutputHTMLConfig = { jsonx: { component: "" } }

      options used to inject html via ReactDOM.render

    Returns string

    React genereated html via JSONX JSON

outputJSON

  • Compiles JSONX into JSON IR format for react create element

    example

    jsonx.outputJSON({ component: 'div', props: { title: 'test', }, children: 'hello', }); //=> { type: 'div', props: { key: 5, title: 'test' }, children: 'hello' }

    property

    {object} this - options for getReactElementFromJSONX

    Parameters

    • jsonx: jsonx

      any valid JSONX JSON object

    • Default value resources: {} = {}

      any additional resource used for asynchronous properties

    Returns JSONReactElement

    json - {type,props,children}

outputJSX

  • outputJSX(this: Context, jsonx: jsonx, resources?: {}): string
  • converts JSONX JSON IR to JSX

    example

    jsonx.jsonToJSX({ type: 'div', props: { key: 5, title: 'test' }, children: 'hello' }) // => '

    hello
    '

    Parameters

    • this: Context
    • jsonx: jsonx
    • Default value resources: {} = {}

    Returns string

    jsx string

Object literals

Const _jsonxHelpers

_jsonxHelpers: object

luxon

luxon: "/home/runner/work/jsonx/jsonx/node_modules/@types/luxon/index"

numeral

numeral: Numeral