Skip to content

Commit

Permalink
feat: expose dataTypes, themes and utils in browser build
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Feb 15, 2024
1 parent 6a69326 commit 922065f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import type { Root } from 'react-dom/client'
import { createRoot } from 'react-dom/client'

import { JsonViewer as JsonViewerComponent } from '.'
import * as dataTypes from './components/DataTypes'
import * as base16 from './theme/base16'
import type { JsonViewerProps } from './type'
import { applyValue, defineDataType, deleteValue, isCycleReference, safeStringify } from './utils'

const getElementFromConfig = (el?: string | Element) => (el
? (typeof el === 'string' ? document.querySelector(el) : el)
Expand All @@ -13,6 +16,15 @@ export default class JsonViewer {
private root?: Root

static Component = JsonViewerComponent
static DataTypes = dataTypes
static Themes = base16
static Utils = {
applyValue,
defineDataType,
deleteValue,
isCycleReference,
safeStringify
}

constructor (props: JsonViewerProps) {
this.props = props
Expand Down

0 comments on commit 922065f

Please sign in to comment.