Fix a bunch of react18 type errors
This commit is contained in:
parent
5387fda517
commit
7a5b1c744c
24 changed files with 48 additions and 25 deletions
|
@ -5,7 +5,7 @@
|
||||||
import {getProject, types} from '@theatre/core'
|
import {getProject, types} from '@theatre/core'
|
||||||
import studio from '@theatre/studio'
|
import studio from '@theatre/studio'
|
||||||
import React, {useEffect, useState} from 'react'
|
import React, {useEffect, useState} from 'react'
|
||||||
import {render} from 'react-dom/client'
|
import ReactDom from 'react-dom/client'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
const project = getProject('Image type playground', {
|
const project = getProject('Image type playground', {
|
||||||
|
@ -66,7 +66,9 @@ const ImageTypeExample: React.FC<{}> = (props) => {
|
||||||
|
|
||||||
project.ready
|
project.ready
|
||||||
.then(() => {
|
.then(() => {
|
||||||
render(<ImageTypeExample />, document.getElementById('root'))
|
ReactDom.createRoot(document.getElementById('root')!).render(
|
||||||
|
<ImageTypeExample />,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {button, initialize, types, useControls} from 'theatric'
|
import {button, initialize, types, useControls} from 'theatric'
|
||||||
import {render} from 'react-dom/client'
|
import ReactDom from 'react-dom/client'
|
||||||
import React, {useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
import state from './state.json'
|
import state from './state.json'
|
||||||
|
|
||||||
|
@ -79,4 +79,4 @@ function App() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render(<App />, document.getElementById('root'))
|
ReactDom.createRoot(document.getElementById('root')!).render(<App />)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* can be tweaked and animated.
|
* can be tweaked and animated.
|
||||||
*/
|
*/
|
||||||
import React, {useMemo, useState} from 'react'
|
import React, {useMemo, useState} from 'react'
|
||||||
import {render} from 'react-dom/client'
|
import ReactDom from 'react-dom/client'
|
||||||
import {getProject} from '@theatre/core'
|
import {getProject} from '@theatre/core'
|
||||||
import type {ITurtle} from './turtle'
|
import type {ITurtle} from './turtle'
|
||||||
import TurtleRenderer from './TurtleRenderer'
|
import TurtleRenderer from './TurtleRenderer'
|
||||||
|
@ -52,4 +52,4 @@ const TurtleExample: React.FC<{}> = (props) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
render(<TurtleExample />, document.getElementById('root'))
|
ReactDom.createRoot(document.getElementById('root')!).render(<TurtleExample />)
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const OrbitControls = forwardRef<OrbitControlsImpl, OrbitControlsProps>(
|
||||||
if (onChange) onChange(e)
|
if (onChange) onChange(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
controls.connect(explDomElement)
|
controls.connect(explDomElement!)
|
||||||
controls.addEventListener('change', callback)
|
controls.addEventListener('change', callback)
|
||||||
|
|
||||||
if (onStart) controls.addEventListener('start', onStart)
|
if (onStart) controls.addEventListener('start', onStart)
|
||||||
|
|
|
@ -100,9 +100,9 @@ const PointerCapturingContext = React.createContext<PointerCapturingFn>(
|
||||||
null as $IntentionalAny,
|
null as $IntentionalAny,
|
||||||
)
|
)
|
||||||
|
|
||||||
const ProviderChildrenMemo: React.FC<{}> = React.memo(({children}) => (
|
const ProviderChildrenMemo: React.FC<{children?: React.ReactNode}> = React.memo(
|
||||||
<>{children}</>
|
({children}) => <>{children}</>,
|
||||||
))
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link PointerCapturing}.
|
* See {@link PointerCapturing}.
|
||||||
|
|
|
@ -5,7 +5,7 @@ const Container = styled.div`
|
||||||
--colors-panel-1: red;
|
--colors-panel-1: red;
|
||||||
`
|
`
|
||||||
|
|
||||||
const ProvideTheme: React.FC<{}> = (props) => {
|
const ProvideTheme: React.FC<{children?: React.ReactNode}> = (props) => {
|
||||||
return <Container>{props.children}</Container>
|
return <Container>{props.children}</Container>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,10 @@ export const PortalLayer = styled.div`
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
`
|
`
|
||||||
|
|
||||||
export const ProvideStyles: React.FC<{target: undefined | HTMLElement}> = (
|
export const ProvideStyles: React.FC<{
|
||||||
props,
|
target: undefined | HTMLElement
|
||||||
) => {
|
children: React.ReactNode
|
||||||
|
}> = (props) => {
|
||||||
return (
|
return (
|
||||||
<StyleSheetManager disableVendorPrefixes target={props.target}>
|
<StyleSheetManager disableVendorPrefixes target={props.target}>
|
||||||
<>
|
<>
|
||||||
|
@ -104,7 +105,9 @@ export function withStyledShadow<Props>(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProvideStyledShadow: React.FC<{}> = (props) => {
|
const ProvideStyledShadow: React.FC<{
|
||||||
|
children: React.ReactNode
|
||||||
|
}> = (props) => {
|
||||||
const [template, ref] = useState<null | HTMLTemplateElement>(null)
|
const [template, ref] = useState<null | HTMLTemplateElement>(null)
|
||||||
const [shadowRoot, setShadowRoot] = useState<null | ShadowRoot>(null)
|
const [shadowRoot, setShadowRoot] = useState<null | ShadowRoot>(null)
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ const BasePanel: React.FC<{
|
||||||
panelId: UIPanelId
|
panelId: UIPanelId
|
||||||
defaultPosition: PanelPosition
|
defaultPosition: PanelPosition
|
||||||
minDims: {width: number; height: number}
|
minDims: {width: number; height: number}
|
||||||
|
children: React.ReactNode
|
||||||
}> = ({panelId, children, defaultPosition, minDims}) => {
|
}> = ({panelId, children, defaultPosition, minDims}) => {
|
||||||
const windowSize = useWindowSize(800, 200)
|
const windowSize = useWindowSize(800, 200)
|
||||||
const [boundsHighlighted, addBoundsHighlightLock] = useLockSet()
|
const [boundsHighlighted, addBoundsHighlightLock] = useLockSet()
|
||||||
|
|
|
@ -27,8 +27,6 @@ const minDims = {width: 300, height: 300}
|
||||||
const ExtensionPaneWrapper: React.FC<{
|
const ExtensionPaneWrapper: React.FC<{
|
||||||
paneInstance: PaneInstance<$FixMe>
|
paneInstance: PaneInstance<$FixMe>
|
||||||
}> = ({paneInstance}) => {
|
}> = ({paneInstance}) => {
|
||||||
console.log(paneInstance)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePanel
|
<BasePanel
|
||||||
panelId={`pane-${paneInstance.instanceId}` as UIPanelId}
|
panelId={`pane-${paneInstance.instanceId}` as UIPanelId}
|
||||||
|
|
|
@ -138,6 +138,7 @@ const BaseItem: React.FC<{
|
||||||
depth: number
|
depth: number
|
||||||
selectionStatus: SelectionStatus
|
selectionStatus: SelectionStatus
|
||||||
labelDecoration?: React.ReactNode
|
labelDecoration?: React.ReactNode
|
||||||
|
children?: React.ReactNode | undefined
|
||||||
collapsed?: boolean
|
collapsed?: boolean
|
||||||
setIsCollapsed?: (v: boolean) => void
|
setIsCollapsed?: (v: boolean) => void
|
||||||
}> = ({
|
}> = ({
|
||||||
|
|
|
@ -87,6 +87,7 @@ const AnyCompositeRow: React.FC<{
|
||||||
isSelected?: boolean
|
isSelected?: boolean
|
||||||
isSelectable?: boolean
|
isSelectable?: boolean
|
||||||
isCollapsed: boolean
|
isCollapsed: boolean
|
||||||
|
children?: React.ReactNode
|
||||||
}> = ({
|
}> = ({
|
||||||
leaf,
|
leaf,
|
||||||
label,
|
label,
|
||||||
|
|
|
@ -35,6 +35,7 @@ const Container = styled.div<{isShiftDown: boolean}>`
|
||||||
const DopeSheetSelectionView: React.FC<{
|
const DopeSheetSelectionView: React.FC<{
|
||||||
layoutP: Pointer<SequenceEditorPanelLayout>
|
layoutP: Pointer<SequenceEditorPanelLayout>
|
||||||
height: number
|
height: number
|
||||||
|
children: React.ReactNode
|
||||||
}> = ({layoutP, children, height}) => {
|
}> = ({layoutP, children, height}) => {
|
||||||
const [containerRef, containerNode] = useRefAndState<HTMLDivElement | null>(
|
const [containerRef, containerNode] = useRefAndState<HTMLDivElement | null>(
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -34,6 +34,7 @@ const Container = styled.div`
|
||||||
const HorizontallyScrollableArea: React.FC<{
|
const HorizontallyScrollableArea: React.FC<{
|
||||||
layoutP: Pointer<SequenceEditorPanelLayout>
|
layoutP: Pointer<SequenceEditorPanelLayout>
|
||||||
height: number
|
height: number
|
||||||
|
children: React.ReactNode
|
||||||
}> = React.memo(({layoutP, children, height}) => {
|
}> = React.memo(({layoutP, children, height}) => {
|
||||||
const {width, unitSpaceToScaledSpaceMultiplier} = usePrism(
|
const {width, unitSpaceToScaledSpaceMultiplier} = usePrism(
|
||||||
() => ({
|
() => ({
|
||||||
|
|
|
@ -51,6 +51,7 @@ const RightRow: React.FC<{
|
||||||
leaf: SequenceEditorTree_Row<string>
|
leaf: SequenceEditorTree_Row<string>
|
||||||
node: React.ReactElement
|
node: React.ReactElement
|
||||||
isCollapsed: boolean
|
isCollapsed: boolean
|
||||||
|
children?: React.ReactNode | undefined
|
||||||
}> = ({leaf, children, node, isCollapsed}) => {
|
}> = ({leaf, children, node, isCollapsed}) => {
|
||||||
const hasChildren = Array.isArray(children) && children.length > 0
|
const hasChildren = Array.isArray(children) && children.length > 0
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ let lastLockId = 0
|
||||||
*/
|
*/
|
||||||
const FrameStampPositionProvider: React.FC<{
|
const FrameStampPositionProvider: React.FC<{
|
||||||
layoutP: Pointer<SequenceEditorPanelLayout>
|
layoutP: Pointer<SequenceEditorPanelLayout>
|
||||||
|
children: React.ReactNode
|
||||||
}> = ({children, layoutP}) => {
|
}> = ({children, layoutP}) => {
|
||||||
const locksAtom = useMemo(() => new Atom<LockItem[]>([]), [])
|
const locksAtom = useMemo(() => new Atom<LockItem[]>([]), [])
|
||||||
const currentD = useMemo(
|
const currentD = useMemo(
|
||||||
|
|
|
@ -38,7 +38,9 @@ export const useReceiveVerticalWheelEvent = (): ReceiveVerticalWheelEventFn =>
|
||||||
* the code that traps the wheel events to pass them to the vertical scroller root, which
|
* the code that traps the wheel events to pass them to the vertical scroller root, which
|
||||||
* we then use to manually dispatch scroll events.
|
* we then use to manually dispatch scroll events.
|
||||||
*/
|
*/
|
||||||
const VerticalScrollContainer: React.FC<{}> = (props) => {
|
const VerticalScrollContainer: React.FC<{
|
||||||
|
children: React.ReactNode
|
||||||
|
}> = (props) => {
|
||||||
const ref = useRef<HTMLDivElement | null>(null)
|
const ref = useRef<HTMLDivElement | null>(null)
|
||||||
const receiveVerticalWheelEvent = useCallback<ReceiveVerticalWheelEventFn>(
|
const receiveVerticalWheelEvent = useCallback<ReceiveVerticalWheelEventFn>(
|
||||||
(event) => {
|
(event) => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type {PropTypeConfig_Image} from '@theatre/core/propTypes'
|
import type {PropTypeConfig_Image} from '@theatre/core/propTypes'
|
||||||
|
import type {$FixMe} from '@theatre/shared/utils/types'
|
||||||
import {Trash} from '@theatre/studio/uiComponents/icons'
|
import {Trash} from '@theatre/studio/uiComponents/icons'
|
||||||
import React, {useCallback, useEffect} from 'react'
|
import React, {useCallback, useEffect} from 'react'
|
||||||
import styled, {css} from 'styled-components'
|
import styled, {css} from 'styled-components'
|
||||||
|
@ -114,7 +115,7 @@ function ImagePropEditor({
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
const onChange = useCallback(
|
const onChange = useCallback(
|
||||||
async (event) => {
|
async (event: React.ChangeEvent<$FixMe>) => {
|
||||||
const file = event.target.files[0]
|
const file = event.target.files[0]
|
||||||
editingTools.permanentlySetValue({type: 'image', id: undefined})
|
editingTools.permanentlySetValue({type: 'image', id: undefined})
|
||||||
const imageId = await editingTools.createAsset(file)
|
const imageId = await editingTools.createAsset(file)
|
||||||
|
|
|
@ -98,7 +98,9 @@ const GlobalToolbar: React.FC = () => {
|
||||||
: `There are ${conflicts.length} projects that have state conflicts. They are highlighted in the outline below. `}
|
: `There are ${conflicts.length} projects that have state conflicts. They are highlighted in the outline below. `}
|
||||||
</ErrorTooltip>
|
</ErrorTooltip>
|
||||||
) : (
|
) : (
|
||||||
<BasicTooltip>Outline</BasicTooltip>
|
<BasicTooltip>
|
||||||
|
<>Outline</>
|
||||||
|
</BasicTooltip>
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ const context = createContext<Context>({} as $IntentionalAny)
|
||||||
|
|
||||||
const PointerEventsHandler: React.FC<{
|
const PointerEventsHandler: React.FC<{
|
||||||
className?: string
|
className?: string
|
||||||
|
children?: React.ReactNode
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const [locks, setLocks] = useState<Lock[]>([])
|
const [locks, setLocks] = useState<Lock[]>([])
|
||||||
const contextValue = useMemo<Context>(() => {
|
const contextValue = useMemo<Context>(() => {
|
||||||
|
|
|
@ -34,6 +34,7 @@ const Container = styled.div`
|
||||||
const BasicPopover: React.FC<{
|
const BasicPopover: React.FC<{
|
||||||
className?: string
|
className?: string
|
||||||
showPopoverEdgeTriangle?: boolean
|
showPopoverEdgeTriangle?: boolean
|
||||||
|
children: React.ReactNode
|
||||||
}> = React.forwardRef(
|
}> = React.forwardRef(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Prism} from '@theatre/dataverse';
|
import type {Prism} from '@theatre/dataverse'
|
||||||
import {Atom} from '@theatre/dataverse'
|
import {Atom} from '@theatre/dataverse'
|
||||||
import useRefAndState from '@theatre/studio/utils/useRefAndState'
|
import useRefAndState from '@theatre/studio/utils/useRefAndState'
|
||||||
import React, {
|
import React, {
|
||||||
|
@ -39,7 +39,7 @@ export const useTooltipOpenState = (): [
|
||||||
return [isOpen, setIsOpen]
|
return [isOpen, setIsOpen]
|
||||||
}
|
}
|
||||||
|
|
||||||
const TooltipContext: React.FC<{}> = ({children}) => {
|
const TooltipContext: React.FC<{children: React.ReactNode}> = ({children}) => {
|
||||||
const currentTooltipId = useMemo(() => new Atom(-1), [])
|
const currentTooltipId = useMemo(() => new Atom(-1), [])
|
||||||
const cur = currentTooltipId.prism
|
const cur = currentTooltipId.prism
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,9 @@ const editingContext = createContext<{
|
||||||
* stateful and disregard controlling props, while not editing, it should behave
|
* stateful and disregard controlling props, while not editing, it should behave
|
||||||
* in a controlled manner.
|
* in a controlled manner.
|
||||||
*/
|
*/
|
||||||
export const EditingProvider: FC = ({children}) => {
|
export const EditingProvider: FC<{children: React.ReactNode}> = ({
|
||||||
|
children,
|
||||||
|
}) => {
|
||||||
const [editing, setEditing] = useState(false)
|
const [editing, setEditing] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -38,7 +38,9 @@ const BasicSelect: React.FC<{
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Label>{props.label}</Label>
|
<Label>
|
||||||
|
<>{props.label}</>
|
||||||
|
</Label>
|
||||||
<SelectedValueLabel>
|
<SelectedValueLabel>
|
||||||
{selectedLabel}
|
{selectedLabel}
|
||||||
{/* <select
|
{/* <select
|
||||||
|
|
|
@ -46,7 +46,9 @@ const Item: React.FC<{
|
||||||
enabled={props.enabled}
|
enabled={props.enabled}
|
||||||
title={props.enabled ? undefined : 'Disabled'}
|
title={props.enabled ? undefined : 'Disabled'}
|
||||||
>
|
>
|
||||||
<ItemLabel>{props.label}</ItemLabel>
|
<ItemLabel>
|
||||||
|
<>{props.label}</>
|
||||||
|
</ItemLabel>
|
||||||
</ItemContainer>
|
</ItemContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue