Added examples/basic-dom to CI
This commit is contained in:
parent
dcf90983a5
commit
e14ba296f2
3 changed files with 13 additions and 6 deletions
|
@ -9,6 +9,7 @@
|
||||||
{"path": "../../theatre"},
|
{"path": "../../theatre"},
|
||||||
{"path": "../../packages/dataverse"},
|
{"path": "../../packages/dataverse"},
|
||||||
{"path": "../../packages/playground"},
|
{"path": "../../packages/playground"},
|
||||||
{"path": "../../packages/r3f"}
|
{"path": "../../packages/r3f"},
|
||||||
|
{"path": "../../examples/basic-dom"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type {IScrub, IStudio} from '@theatre/studio'
|
import type {IScrub} from '@theatre/studio'
|
||||||
import studio from '@theatre/studio'
|
import studio from '@theatre/studio'
|
||||||
import React, {useLayoutEffect, useMemo, useState} from 'react'
|
import React, {useLayoutEffect, useMemo, useState} from 'react'
|
||||||
import type {ISheet, ISheetObject, IProject} from '@theatre/core'
|
import type {ISheet, ISheetObject, IProject} from '@theatre/core'
|
||||||
|
@ -15,7 +15,7 @@ const boxObjectConfig = {
|
||||||
const Box: React.FC<{
|
const Box: React.FC<{
|
||||||
id: string
|
id: string
|
||||||
sheet: ISheet
|
sheet: ISheet
|
||||||
selectedObject: ISheetObject | undefined
|
selectedObject: ISheetObject<any> | undefined
|
||||||
}> = ({id, sheet, selectedObject}) => {
|
}> = ({id, sheet, selectedObject}) => {
|
||||||
// This is cheap to call and always returns the same value, so no need for useMemo()
|
// This is cheap to call and always returns the same value, so no need for useMemo()
|
||||||
const obj = sheet.object(id, boxObjectConfig)
|
const obj = sheet.object(id, boxObjectConfig)
|
||||||
|
@ -92,11 +92,15 @@ export const Scene: React.FC<{project: IProject}> = ({project}) => {
|
||||||
|
|
||||||
// This is cheap to call and always returns the same value, so no need for useMemo()
|
// This is cheap to call and always returns the same value, so no need for useMemo()
|
||||||
const sheet = project.sheet('Scene', 'default')
|
const sheet = project.sheet('Scene', 'default')
|
||||||
const [selection, _setSelection] = useState<IStudio['selection']>([])
|
const [selection, _setSelection] = useState<Array<ISheetObject>>([])
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
return studio.onSelectionChange((newSelection) => {
|
return studio.onSelectionChange((newSelection) => {
|
||||||
_setSelection(newSelection)
|
_setSelection(
|
||||||
|
newSelection.filter(
|
||||||
|
(s): s is ISheetObject => s.type === 'Theatre_SheetObject_PublicAPI',
|
||||||
|
),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
|
"composite": true,
|
||||||
|
"noEmit": true
|
||||||
},
|
},
|
||||||
"files": ["index.tsx", "Scene.tsx", "useDrag.ts"]
|
"files": ["index.tsx", "Scene.tsx", "useDrag.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue