Skip to content

Commit

Permalink
feat: React 19
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 committed Jan 29, 2025
1 parent a6f0a83 commit 0e3aa11
Show file tree
Hide file tree
Showing 95 changed files with 136 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/theme-json-schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from "react"

// Plugin config
declare module "docusaurus-json-schema-plugin" {
import type { Plugin } from "@docusaurus/types"
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ErrorOccurredLabel,
} from "@theme/JSONSchemaViewer/labels"

import type { JSX } from "react"
import type { JSONSchema as Draft_07 } from "json-schema-typed/draft-07"
import type { EditorWillMount, MonacoEditorProps } from "react-monaco-editor"
import type { Props as ErrorProps } from "@theme/Error"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Translate from "@docusaurus/Translate"

import { TypeLabel, FalseLabel } from "@theme/JSONSchemaViewer/labels"

import type { JSX } from "react"

// When schema has the value "true", it means that it is ALWAYS valid
export default function CreateAlwaysValid(): JSX.Element {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TypeLabel, BooleanLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react"

import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"

type Props = {
description: string
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TypeLabel, IntegerLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TypeLabel, NullLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TypeLabel, NumberLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TypeLabel, StringLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { JSONSchema } from "@theme/JSONSchemaViewer/types"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts"
import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages"

import type { JSX } from "react"

type Props = {
value: unknown
schema: JSONSchema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DependentSchemas,
} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react"

import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition"

import type { JSX } from "react"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react"

import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition"

import type { JSX } from "react"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import { IfLabel, ThenLabel, ElseLabel } from "@theme/JSONSchemaViewer/labels"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional"
import { Collapsible } from "@theme/JSONSchemaViewer/components"

import type { JSX } from "react"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ArrayLabel, TypeLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ObjectLabel, TypeLabel } from "@theme/JSONSchemaViewer/labels"

import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"
import { encodeStringForJSONPointer } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"
import { encodeStringForJSONPointer } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from "react"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Translate from "@docusaurus/Translate"
import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CreateEdge } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"
import { encodeStringForJSONPointer } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from "react"
import { CreateNodes } from "@theme/JSONSchemaViewer/components"
import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SchemaHierarchyComponent } from "@theme/JSONSchemaViewer/contexts"

import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
OneOfSchema,
} from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/components/Collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import React, {
// import Details from "@theme-original/Details"
import Details from "@theme-original/Details"

import type { JSX } from "react"

// For collapse component
export default function Collapsible(props: {
summary: ReactNode
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/components/CreateEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { ReactNode } from "react"

import { SchemaItem } from "@theme/JSONSchemaViewer/components"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

// Creates the edge or "leave" of a schema tree. Edge can branch into sub-nodes.
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/components/CreateNodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from "@theme/JSONSchemaViewer/utils"

import type { JSONSchema } from "@theme/JSONSchemaViewer/types"
import type { JSX } from "react"

type Props = {
[x: string]: any
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/components/CreateTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
detectedTypes,
} from "@theme/JSONSchemaViewer/utils"

import type { JSX } from "react"
import type { JSONSchema, TypeValues } from "@theme/JSONSchemaViewer/types"

// Render a single type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CreateAlwaysValid,
} from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CreateNull,
} from "@theme/JSONSchemaViewer/JSONSchemaElements"

import type { JSX } from "react"
import type {
JSONSchema,
JSONSchemaNS,
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/components/TypeLabelSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
FalseLabel,
} from "@theme/JSONSchemaViewer/labels"

import type { JSX } from "react"
import type { TypeValues } from "@theme/JSONSchemaViewer/types"

type Props = {
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/contexts/jsvOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useContext, createContext } from "react"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"
import type { CheckKey } from "@theme/JSONSchemaViewer/utils/QualifierMessages"

Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/contexts/schemaHierarchy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useContext, createContext } from "react"

import type { JSX } from "react"
export type SchemaHierarchy = {
/**
* JSON Pointer of the current element
Expand Down
1 change: 1 addition & 0 deletions src/theme/JSONSchemaViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SchemaHierarchyContextProvider,
} from "@theme/JSONSchemaViewer/contexts"

import type { JSX } from "react"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"
import type { JSVOptions } from "@theme/JSONSchemaViewer/contexts"
import {
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/labels/And.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react"

import Translate from "@docusaurus/Translate"

import type { JSX } from "react"

// Label for "and"
// And label (commonly used in multiple situation)
export default function AndLabel(): JSX.Element {
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/labels/Array.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react"

import Translate from "@docusaurus/Translate"

import type { JSX } from "react"

// Label for "array"
export default function ArrayLabel(): JSX.Element {
return (
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/labels/Boolean.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react"

import Translate from "@docusaurus/Translate"

import type { JSX } from "react"

// Label for "boolean"
export default function BooleanLabel(): JSX.Element {
return (
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/labels/Constant/Constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Translate from "@docusaurus/Translate"

import styles from "./styles.module.css"

import type { JSX } from "react"

export default function ConstantLabel(): JSX.Element {
return (
<strong className={styles.constant}>
Expand Down
2 changes: 2 additions & 0 deletions src/theme/JSONSchemaViewer/labels/Deprecated/Deprecated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Translate from "@docusaurus/Translate"

import styles from "./styles.module.css"

import type { JSX } from "react"

export default function DeprecatedLabel(): JSX.Element {
return (
<strong className={styles.deprecated}>
Expand Down
Loading

0 comments on commit 0e3aa11

Please sign in to comment.