From 6b373ccae599dcb031acee36b053d05a67dceb60 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Thu, 2 Sep 2021 10:26:39 +0200 Subject: [PATCH] Removed nativeObject from the API --- packages/playground/src/dom/Scene.tsx | 2 +- packages/playground/src/redesign/Scene.tsx | 2 +- packages/playground/src/turtle/TurtleRenderer.tsx | 2 +- packages/plugin-r3f/src/components/editable.tsx | 2 +- packages/plugin-r3f/src/components/editorStuff.ts | 2 +- .../plugin-r3f/src/components/useSnapshotEditorCamera.tsx | 1 - theatre/core/src/sheets/TheatreSheet.ts | 4 ++-- theatre/shared/src/testUtils.ts | 1 - 8 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/playground/src/dom/Scene.tsx b/packages/playground/src/dom/Scene.tsx index 3bf6661..108ef4f 100644 --- a/packages/playground/src/dom/Scene.tsx +++ b/packages/playground/src/dom/Scene.tsx @@ -19,7 +19,7 @@ const Box: React.FC<{ selection: ISheetObject[] }> = ({id, sheet, selection}) => { // This is cheap to call and always returns the same value, so no need for useMemo() - const obj = sheet.object(id, null, boxObjectConfig) + const obj = sheet.object(id, boxObjectConfig) const isSelected = selection.includes(obj) diff --git a/packages/playground/src/redesign/Scene.tsx b/packages/playground/src/redesign/Scene.tsx index dc143b1..ac17256 100644 --- a/packages/playground/src/redesign/Scene.tsx +++ b/packages/playground/src/redesign/Scene.tsx @@ -32,7 +32,7 @@ const Box: React.FC<{ selection: ISheetObject[] }> = ({id, sheet, selection: selection}) => { // This is cheap to call and always returns the same value, so no need for useMemo() - const obj = sheet.object('object ' + id, null, boxObjectConfig) + const obj = sheet.object('object ' + id, boxObjectConfig) const isSelected = selection.includes(obj) diff --git a/packages/playground/src/turtle/TurtleRenderer.tsx b/packages/playground/src/turtle/TurtleRenderer.tsx index 96696a3..1314909 100644 --- a/packages/playground/src/turtle/TurtleRenderer.tsx +++ b/packages/playground/src/turtle/TurtleRenderer.tsx @@ -42,7 +42,7 @@ const TurtleRenderer: React.FC<{ dimsRef.current = {width: props.width, height: props.height} const obj = useMemo(() => { - return props.sheet.object(props.objKey, null, objConfig) + return props.sheet.object(props.objKey, objConfig) }, [props.sheet, props.objKey]) useEffect(() => { diff --git a/packages/plugin-r3f/src/components/editable.tsx b/packages/plugin-r3f/src/components/editable.tsx index f9b165a..39f5f04 100644 --- a/packages/plugin-r3f/src/components/editable.tsx +++ b/packages/plugin-r3f/src/components/editable.tsx @@ -59,7 +59,7 @@ const editable = < useLayoutEffect(() => { if (!sheet) return - const sheetObject = sheet.object(uniqueName, {}, baseSheetObjectType) + const sheetObject = sheet.object(uniqueName, baseSheetObjectType) setSheetObject(sheetObject) useEditorStore diff --git a/packages/plugin-r3f/src/components/editorStuff.ts b/packages/plugin-r3f/src/components/editorStuff.ts index 7090830..24ead05 100644 --- a/packages/plugin-r3f/src/components/editorStuff.ts +++ b/packages/plugin-r3f/src/components/editorStuff.ts @@ -66,7 +66,7 @@ export function getEditorSheetObject(): ISheetObject< > | null { if (!sheetObject) { sheetObject = - getEditorSheet().object('Editor', null, editorSheetObjectConfig) || null + getEditorSheet().object('Editor', editorSheetObjectConfig) || null } return sheetObject } diff --git a/packages/plugin-r3f/src/components/useSnapshotEditorCamera.tsx b/packages/plugin-r3f/src/components/useSnapshotEditorCamera.tsx index 071129b..5482093 100644 --- a/packages/plugin-r3f/src/components/useSnapshotEditorCamera.tsx +++ b/packages/plugin-r3f/src/components/useSnapshotEditorCamera.tsx @@ -57,7 +57,6 @@ export default function useSnapshotEditorCamera( if (!objRef.current) { objRef.current = snapshotEditorSheet.object( `Editor Camera ${paneId}`, - {}, camConf, ) } diff --git a/theatre/core/src/sheets/TheatreSheet.ts b/theatre/core/src/sheets/TheatreSheet.ts index dbcc553..29ce91f 100644 --- a/theatre/core/src/sheets/TheatreSheet.ts +++ b/theatre/core/src/sheets/TheatreSheet.ts @@ -22,7 +22,6 @@ export interface ISheet { object>( key: string, - nativeObject: unknown, config: SheetObjectConfig, ): ISheetObject @@ -42,7 +41,6 @@ export default class TheatreSheet implements ISheet { object>( key: string, - nativeObject: unknown, config: SheetObjectConfig, ): ISheetObject { const internal = privateAPI(this) @@ -55,6 +53,8 @@ export default class TheatreSheet implements ISheet { const existingObject = internal.getObject(sanitizedPath) + const nativeObject = null + if (existingObject) { existingObject.overrideConfig(nativeObject, config) return existingObject.publicApi as $IntentionalAny diff --git a/theatre/shared/src/testUtils.ts b/theatre/shared/src/testUtils.ts index d142f1a..f2c477c 100644 --- a/theatre/shared/src/testUtils.ts +++ b/theatre/shared/src/testUtils.ts @@ -30,7 +30,6 @@ export async function setupTestSheet(sheetState: SheetState_Historic) { const sheetPublicAPI = project.sheet('Sheet') const objPublicAPI = sheetPublicAPI.object( 'obj', - null, t.compound({ position: t.compound({ x: t.number(0),