diff --git a/compatibility-tests/test-cra-react18/package.json b/compatibility-tests/test-cra-react18/package.json
index bab4a91..152c9b3 100644
--- a/compatibility-tests/test-cra-react18/package.json
+++ b/compatibility-tests/test-cra-react18/package.json
@@ -15,6 +15,7 @@
"@testing-library/user-event": "^12.1.10",
"@theatre/core": "^0.0.1-COMPAT.1",
"@theatre/studio": "^0.0.1-COMPAT.1",
+ "@theatre/r3f": "^0.0.1-COMPAT.1",
"react-scripts": "^5.0.1",
"three": ">0.132.0",
"web-vitals": "^1.0.1"
diff --git a/compatibility-tests/test-cra-react18/src/App.js b/compatibility-tests/test-cra-react18/src/App.js
index 1533aae..5a338c6 100644
--- a/compatibility-tests/test-cra-react18/src/App.js
+++ b/compatibility-tests/test-cra-react18/src/App.js
@@ -1,6 +1,154 @@
-import React from 'react'
+import {getProject} from '@theatre/core'
+import * as THREE from 'three'
+import React, {useState, useEffect, useRef} from 'react'
+import {useFrame, Canvas} from '@react-three/fiber'
+import {Shadow, softShadows} from '@react-three/drei'
+import studio from '@theatre/studio'
+import {editable as e, SheetProvider} from '@theatre/r3f'
+import extension from '@theatre/r3f/dist/extension'
-export default function App({obj}) {
- console.log(obj)
- return
hi
+if (process.env.NODE_ENV === 'development') {
+ studio.extend(extension)
+ studio.initialize()
}
+
+// Soft shadows are expensive, comment and refresh when it's too slow
+softShadows()
+
+// credit: https://codesandbox.io/s/camera-pan-nsb7f
+
+function Button() {
+ const vec = new THREE.Vector3()
+ const light = useRef(undefined)
+ const [active, setActive] = useState(false)
+ const [zoom, set] = useState(true)
+ useEffect(
+ () => void (document.body.style.cursor = active ? 'pointer' : 'auto'),
+ [active],
+ )
+
+ useFrame((state) => {
+ const step = 0.1
+ const camera = state.camera
+ camera.fov = THREE.MathUtils.lerp(camera.fov, zoom ? 10 : 42, step)
+ camera.position.lerp(
+ vec.set(zoom ? 25 : 10, zoom ? 1 : 5, zoom ? 0 : 10),
+ step,
+ )
+ state.camera.lookAt(0, 0, 0)
+ state.camera.updateProjectionMatrix()
+
+ light.current.position.lerp(
+ vec.set(zoom ? 4 : 0, zoom ? 3 : 8, zoom ? 3 : 5),
+ step,
+ )
+ })
+
+ return (
+ set(!zoom)}
+ onPointerOver={() => setActive(true)}
+ onPointerOut={() => setActive(false)}
+ uniqueName="The Button"
+ >
+
+
+
+
+
+ )
+}
+
+function Plane({color, uniqueName, ...props}) {
+ return (
+
+
+
+
+ )
+}
+
+function App() {
+ return (
+
+
+
+ )
+}
+
+export default App
diff --git a/compatibility-tests/test-parcel1-react17/.gitignore b/compatibility-tests/test-parcel1-react17/.gitignore
new file mode 100644
index 0000000..6ac9863
--- /dev/null
+++ b/compatibility-tests/test-parcel1-react17/.gitignore
@@ -0,0 +1,3 @@
+/.cache
+/dist
+/package-lock.json
\ No newline at end of file
diff --git a/compatibility-tests/test-parcel1-react17/index.html b/compatibility-tests/test-parcel1-react17/index.html
new file mode 100644
index 0000000..4a8bbbd
--- /dev/null
+++ b/compatibility-tests/test-parcel1-react17/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ Theatre.js Example - DOM
+
+
+
+
+
+
diff --git a/compatibility-tests/test-parcel1-react17/package.json b/compatibility-tests/test-parcel1-react17/package.json
new file mode 100644
index 0000000..06a5670
--- /dev/null
+++ b/compatibility-tests/test-parcel1-react17/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@compat/parcel1-react18",
+ "scripts": {
+ "dev": "parcel serve ./index.html"
+ },
+ "dependencies": {
+ "parcel-bundler": "^1.12.5",
+ "@react-three/drei": "^7.3.1",
+ "@react-three/fiber": "^7.0.6",
+ "@theatre/core": "^0.0.1-COMPAT.1",
+ "@theatre/r3f": "^0.0.1-COMPAT.1",
+ "@theatre/studio": "^0.0.1-COMPAT.1",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "three": "^0.137.0"
+ }
+}
diff --git a/compatibility-tests/test-parcel1-react17/src/App.js b/compatibility-tests/test-parcel1-react17/src/App.js
new file mode 100644
index 0000000..5a338c6
--- /dev/null
+++ b/compatibility-tests/test-parcel1-react17/src/App.js
@@ -0,0 +1,154 @@
+import {getProject} from '@theatre/core'
+import * as THREE from 'three'
+import React, {useState, useEffect, useRef} from 'react'
+import {useFrame, Canvas} from '@react-three/fiber'
+import {Shadow, softShadows} from '@react-three/drei'
+import studio from '@theatre/studio'
+import {editable as e, SheetProvider} from '@theatre/r3f'
+import extension from '@theatre/r3f/dist/extension'
+
+if (process.env.NODE_ENV === 'development') {
+ studio.extend(extension)
+ studio.initialize()
+}
+
+// Soft shadows are expensive, comment and refresh when it's too slow
+softShadows()
+
+// credit: https://codesandbox.io/s/camera-pan-nsb7f
+
+function Button() {
+ const vec = new THREE.Vector3()
+ const light = useRef(undefined)
+ const [active, setActive] = useState(false)
+ const [zoom, set] = useState(true)
+ useEffect(
+ () => void (document.body.style.cursor = active ? 'pointer' : 'auto'),
+ [active],
+ )
+
+ useFrame((state) => {
+ const step = 0.1
+ const camera = state.camera
+ camera.fov = THREE.MathUtils.lerp(camera.fov, zoom ? 10 : 42, step)
+ camera.position.lerp(
+ vec.set(zoom ? 25 : 10, zoom ? 1 : 5, zoom ? 0 : 10),
+ step,
+ )
+ state.camera.lookAt(0, 0, 0)
+ state.camera.updateProjectionMatrix()
+
+ light.current.position.lerp(
+ vec.set(zoom ? 4 : 0, zoom ? 3 : 8, zoom ? 3 : 5),
+ step,
+ )
+ })
+
+ return (
+ set(!zoom)}
+ onPointerOver={() => setActive(true)}
+ onPointerOut={() => setActive(false)}
+ uniqueName="The Button"
+ >
+
+
+
+
+
+ )
+}
+
+function Plane({color, uniqueName, ...props}) {
+ return (
+
+
+
+
+ )
+}
+
+function App() {
+ return (
+
+
+
+ )
+}
+
+export default App
diff --git a/compatibility-tests/test-parcel1-react17/src/index.js b/compatibility-tests/test-parcel1-react17/src/index.js
new file mode 100644
index 0000000..b2d2250
--- /dev/null
+++ b/compatibility-tests/test-parcel1-react17/src/index.js
@@ -0,0 +1,13 @@
+import ReactDOM from 'react-dom'
+import '@theatre/studio'
+import React from 'react'
+import App from './App'
+
+console.log('hj')
+
+ReactDOM.render(
+
+
+ ,
+ document.getElementById('root'),
+)
diff --git a/compatibility-tests/test-vite-react18/package.json b/compatibility-tests/test-vite-react18/package.json
index ae9fc28..877b0dd 100644
--- a/compatibility-tests/test-vite-react18/package.json
+++ b/compatibility-tests/test-vite-react18/package.json
@@ -8,10 +8,14 @@
"preview": "vite preview"
},
"dependencies": {
+ "@react-three/drei": "^9.11.3",
+ "@react-three/fiber": "^8.0.19",
"@theatre/core": "^0.0.1-COMPAT.1",
+ "@theatre/r3f": "^0.0.1-COMPAT.1",
"@theatre/studio": "^0.0.1-COMPAT.1",
"react": "^18.0.0",
- "react-dom": "^18.0.0"
+ "react-dom": "^18.0.0",
+ "three": "^0.141.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
diff --git a/compatibility-tests/test-vite-react18/src/App.tsx b/compatibility-tests/test-vite-react18/src/App.tsx
index 1533aae..5a338c6 100644
--- a/compatibility-tests/test-vite-react18/src/App.tsx
+++ b/compatibility-tests/test-vite-react18/src/App.tsx
@@ -1,6 +1,154 @@
-import React from 'react'
+import {getProject} from '@theatre/core'
+import * as THREE from 'three'
+import React, {useState, useEffect, useRef} from 'react'
+import {useFrame, Canvas} from '@react-three/fiber'
+import {Shadow, softShadows} from '@react-three/drei'
+import studio from '@theatre/studio'
+import {editable as e, SheetProvider} from '@theatre/r3f'
+import extension from '@theatre/r3f/dist/extension'
-export default function App({obj}) {
- console.log(obj)
- return hi
+if (process.env.NODE_ENV === 'development') {
+ studio.extend(extension)
+ studio.initialize()
}
+
+// Soft shadows are expensive, comment and refresh when it's too slow
+softShadows()
+
+// credit: https://codesandbox.io/s/camera-pan-nsb7f
+
+function Button() {
+ const vec = new THREE.Vector3()
+ const light = useRef(undefined)
+ const [active, setActive] = useState(false)
+ const [zoom, set] = useState(true)
+ useEffect(
+ () => void (document.body.style.cursor = active ? 'pointer' : 'auto'),
+ [active],
+ )
+
+ useFrame((state) => {
+ const step = 0.1
+ const camera = state.camera
+ camera.fov = THREE.MathUtils.lerp(camera.fov, zoom ? 10 : 42, step)
+ camera.position.lerp(
+ vec.set(zoom ? 25 : 10, zoom ? 1 : 5, zoom ? 0 : 10),
+ step,
+ )
+ state.camera.lookAt(0, 0, 0)
+ state.camera.updateProjectionMatrix()
+
+ light.current.position.lerp(
+ vec.set(zoom ? 4 : 0, zoom ? 3 : 8, zoom ? 3 : 5),
+ step,
+ )
+ })
+
+ return (
+ set(!zoom)}
+ onPointerOver={() => setActive(true)}
+ onPointerOut={() => setActive(false)}
+ uniqueName="The Button"
+ >
+
+
+
+
+
+ )
+}
+
+function Plane({color, uniqueName, ...props}) {
+ return (
+
+
+
+
+ )
+}
+
+function App() {
+ return (
+
+
+
+ )
+}
+
+export default App
diff --git a/compatibility-tests/test-vite-react18/src/main.tsx b/compatibility-tests/test-vite-react18/src/main.tsx
index 69e4852..7cfe000 100644
--- a/compatibility-tests/test-vite-react18/src/main.tsx
+++ b/compatibility-tests/test-vite-react18/src/main.tsx
@@ -1,19 +1,11 @@
-// import ReactDOM from 'react-dom'
+import ReactDOM from 'react-dom'
+import '@theatre/studio'
+import React from 'react'
+import App from './App'
-import studio from '@theatre/studio'
-import {getProject} from '@theatre/core'
-// import React from 'react'
-// import App from './App'
-
-studio.initialize({usePersistentStorage: false})
-
-const project = getProject('Project')
-const sheet = project.sheet('Sheet')
-const obj = sheet.object('Obj', {str: 'some string', num: 0})
-
-// ReactDOM.render(
-//
-//
-// ,
-// document.getElementById('root'),
-// )
+ReactDOM.render(
+
+
+ ,
+ document.getElementById('root'),
+)
diff --git a/examples/r3f-cra/src/App.js b/examples/r3f-cra/src/App.js
index dc3ef8f..5a338c6 100644
--- a/examples/r3f-cra/src/App.js
+++ b/examples/r3f-cra/src/App.js
@@ -1,11 +1,11 @@
import {getProject} from '@theatre/core'
import * as THREE from 'three'
-import {useState, useEffect, useRef} from 'react'
+import React, {useState, useEffect, useRef} from 'react'
import {useFrame, Canvas} from '@react-three/fiber'
import {Shadow, softShadows} from '@react-three/drei'
-import React from 'react'
import studio from '@theatre/studio'
-import {editable as e, SheetProvider, extension} from '@theatre/r3f'
+import {editable as e, SheetProvider} from '@theatre/r3f'
+import extension from '@theatre/r3f/dist/extension'
if (process.env.NODE_ENV === 'development') {
studio.extend(extension)
@@ -90,6 +90,10 @@ function App() {