diff --git a/packages/example-dom/Scene.tsx b/packages/example-dom/Scene.tsx index 43544e3..36c5e18 100644 --- a/packages/example-dom/Scene.tsx +++ b/packages/example-dom/Scene.tsx @@ -6,12 +6,10 @@ import {types as t} from '@theatre/core' import type {UseDragOpts} from './useDrag' import useDrag from './useDrag' -const boxObjectConfig = { - props: t.compound({ - x: t.number(0), - y: t.number(0), - }), -} +const boxObjectConfig = t.compound({ + x: t.number(0), + y: t.number(0), +}) const Box: React.FC<{ id: string diff --git a/packages/playground/src/dom/Scene.tsx b/packages/playground/src/dom/Scene.tsx index 72f8176..1e22437 100644 --- a/packages/playground/src/dom/Scene.tsx +++ b/packages/playground/src/dom/Scene.tsx @@ -6,12 +6,10 @@ import type {IProject, ISheet, ISheetObject} from '@theatre/core' import {types as t} from '@theatre/core' import type {IScrub, IStudio} from '@theatre/studio' -const boxObjectConfig = { - props: t.compound({ - x: t.number(0), - y: t.number(0), - }), -} +const boxObjectConfig = t.compound({ + x: t.number(0), + y: t.number(0), +}) const Box: React.FC<{ id: string diff --git a/packages/playground/src/redesign/Scene.tsx b/packages/playground/src/redesign/Scene.tsx index ec35bf9..9e3652c 100644 --- a/packages/playground/src/redesign/Scene.tsx +++ b/packages/playground/src/redesign/Scene.tsx @@ -6,25 +6,23 @@ import type {IProject, ISheet, ISheetObject} from '@theatre/core' import {types as t} from '@theatre/core' import type {IScrub, IStudio} from '@theatre/studio' -const boxObjectConfig = { - props: t.compound({ - position: t.compound({ - x: t.number(0), - y: t.number(0), - z: t.number(0), - }), - scale: t.compound({ - x: t.number(0), - y: t.number(0), - z: t.number(0), - origin: t.compound({ - x: t.number(0), - y: t.number(0), - }), - w: t.number(0), - }), +const boxObjectConfig = t.compound({ + position: t.compound({ + x: t.number(0), + y: t.number(0), + z: t.number(0), }), -} + scale: t.compound({ + x: t.number(0), + y: t.number(0), + z: t.number(0), + origin: t.compound({ + x: t.number(0), + y: t.number(0), + }), + w: t.number(0), + }), +}) const Box: React.FC<{ id: string diff --git a/packages/playground/src/turtle/TurtleRenderer.tsx b/packages/playground/src/turtle/TurtleRenderer.tsx index 97b77e9..1002ea4 100644 --- a/packages/playground/src/turtle/TurtleRenderer.tsx +++ b/packages/playground/src/turtle/TurtleRenderer.tsx @@ -13,15 +13,13 @@ import {types} from '@theatre/core' import type {ITurtle} from './turtle' import {drawTurtlePlan, makeTurtlePlan} from './turtle' -const objConfig = { - props: types.compound({ - startingPoint: types.compound({ - x: types.number(0.5, {min: 0, max: 1}), - y: types.number(0.5, {min: 0, max: 1}), - }), - scale: types.number(1, {min: 0.1}), +const objConfig = types.compound({ + startingPoint: types.compound({ + x: types.number(0.5, {min: 0, max: 1}), + y: types.number(0.5, {min: 0, max: 1}), }), -} + scale: types.number(1, {min: 0.1}), +}) const TurtleRenderer: React.FC<{ sheet: ISheet diff --git a/packages/plugin-r3f/src/store.ts b/packages/plugin-r3f/src/store.ts index 96e941b..1a0ee85 100644 --- a/packages/plugin-r3f/src/store.ts +++ b/packages/plugin-r3f/src/store.ts @@ -22,29 +22,25 @@ export type TransformControlsMode = 'translate' | 'rotate' | 'scale' export type TransformControlsSpace = 'world' | 'local' export type ViewportShading = 'wireframe' | 'flat' | 'solid' | 'rendered' -export const baseSheetObjectType = { - props: types.compound({ - position: types.compound({ - x: types.number(0), - y: types.number(0), - z: types.number(0), - }), - rotation: types.compound({ - x: types.number(0), - y: types.number(0), - z: types.number(0), - }), - scale: types.compound({ - x: types.number(1), - y: types.number(1), - z: types.number(1), - }), +export const baseSheetObjectType = types.compound({ + position: types.compound({ + x: types.number(0), + y: types.number(0), + z: types.number(0), }), -} + rotation: types.compound({ + x: types.number(0), + y: types.number(0), + z: types.number(0), + }), + scale: types.compound({ + x: types.number(1), + y: types.number(1), + z: types.number(1), + }), +}) -export type BaseSheetObjectType = ISheetObject< - typeof baseSheetObjectType['props'] -> +export type BaseSheetObjectType = ISheetObject export interface AbstractEditable { type: T @@ -137,7 +133,7 @@ export interface EditableState { export type EditorStore = { sheet: ISheet | null - editorObject: ISheetObject | null + editorObject: ISheetObject | null sheetObjects: {[uniqueName in string]?: BaseSheetObjectType} scene: Scene | null gl: WebGLRenderer | null @@ -157,7 +153,7 @@ export type EditorStore = { allowImplicitInstancing: boolean, editorCamera: ContainerProps['camera'], sheet: ISheet, - editorObject: null | ISheetObject, + editorObject: null | ISheetObject, ) => void setOrbitControlsRef: ( @@ -292,29 +288,27 @@ export type BindFunction = (options: { sheet: ISheet }) => (options: {gl: WebGLRenderer; scene: Scene}) => void -const editorSheetObjectConfig = { - props: types.compound({ - isOpen: types.boolean(false), - showAxes: types.boolean(true), - showGrid: types.boolean(true), - showOverlayIcons: types.boolean(false), - referenceWindowSize: types.number(120, {min: 0, max: 800}), - transformControlsMode: types.stringLiteral( - 'translate', - ['translate', 'rotate', 'scale'], - ), - transformControlsSpace: types.stringLiteral( - 'world', - ['local', 'world'], - ), - viewportShading: types.stringLiteral('rendered', [ - 'flat', - 'rendered', - 'solid', - 'wireframe', - ]), - }), -} +const editorSheetObjectConfig = types.compound({ + isOpen: types.boolean(false), + showAxes: types.boolean(true), + showGrid: types.boolean(true), + showOverlayIcons: types.boolean(false), + referenceWindowSize: types.number(120, {min: 0, max: 800}), + transformControlsMode: types.stringLiteral( + 'translate', + ['translate', 'rotate', 'scale'], + ), + transformControlsSpace: types.stringLiteral('world', [ + 'local', + 'world', + ]), + viewportShading: types.stringLiteral('rendered', [ + 'flat', + 'rendered', + 'solid', + 'wireframe', + ]), +}) export const bindToCanvas: BindFunction = ({ allowImplicitInstancing = false, diff --git a/theatre/core/src/sheets/TheatreSheet.ts b/theatre/core/src/sheets/TheatreSheet.ts index 117079d..dbcc553 100644 --- a/theatre/core/src/sheets/TheatreSheet.ts +++ b/theatre/core/src/sheets/TheatreSheet.ts @@ -13,9 +13,7 @@ import userReadableTypeOfValue from '@theatre/shared/utils/userReadableTypeOfVal export type SheetObjectConfig< Props extends PropTypeConfig_Compound<$IntentionalAny>, -> = { - props: Props -} +> = Props export interface ISheet { readonly type: 'Theatre_Sheet_PublicAPI' diff --git a/theatre/package.json b/theatre/package.json index 2ef762d..7bf399a 100644 --- a/theatre/package.json +++ b/theatre/package.json @@ -1,4 +1,5 @@ { + "name": "theatre", "private": true, "version": "0.4.0-dev.3", "workspaces": [ diff --git a/theatre/shared/src/testUtils.ts b/theatre/shared/src/testUtils.ts index 9bb7e32..965bc04 100644 --- a/theatre/shared/src/testUtils.ts +++ b/theatre/shared/src/testUtils.ts @@ -27,15 +27,17 @@ export async function setupTestSheet(sheetState: SheetState_Historic) { ticker.tick() await project.ready const sheetPublicAPI = project.sheet('Sheet') - const objPublicAPI = sheetPublicAPI.object('obj', null, { - props: t.compound({ + const objPublicAPI = sheetPublicAPI.object( + 'obj', + null, + t.compound({ position: t.compound({ x: t.number(0), y: t.number(1), z: t.number(2), }), }), - }) + ) const obj = privateAPI(objPublicAPI) diff --git a/theatre/studio/src/panels/ObjectEditorPanel/propEditors/CompoundPropEditor.tsx b/theatre/studio/src/panels/ObjectEditorPanel/propEditors/CompoundPropEditor.tsx index 17869ab..ed2a91e 100644 --- a/theatre/studio/src/panels/ObjectEditorPanel/propEditors/CompoundPropEditor.tsx +++ b/theatre/studio/src/panels/ObjectEditorPanel/propEditors/CompoundPropEditor.tsx @@ -1,5 +1,5 @@ import type {PropTypeConfig_Compound} from '@theatre/core/propTypes' -import {isPropConfigComposite} from '@theatre/shared/src/propTypes/utils' +import {isPropConfigComposite} from '@theatre/shared/propTypes/utils' import type SheetObject from '@theatre/core/sheetObjects/SheetObject' import {theme} from '@theatre/studio/css' import {voidFn} from '@theatre/shared/utils' diff --git a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts index 52705cc..8fa09c0 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts +++ b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts @@ -4,7 +4,7 @@ import type { PropTypeConfig_AllPrimitives, PropTypeConfig_Compound, } from '@theatre/core/propTypes' -import {isPropConfigComposite} from '@theatre/shared/src/propTypes/utils' +import {isPropConfigComposite} from '@theatre/shared/propTypes/utils' import type SheetObject from '@theatre/core/sheetObjects/SheetObject' import type {IPropPathToTrackIdTree} from '@theatre/core/sheetObjects/SheetObjectTemplate' import type Sheet from '@theatre/core/sheets/Sheet' diff --git a/yarn.lock b/yarn.lock index 2eca95d..d5c5e55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17672,9 +17672,53 @@ resolve@1.17.0: languageName: node linkType: hard -"theatre-7edd9a@workspace:theatre": +"theatre-example-dom@workspace:packages/example-dom": version: 0.0.0-use.local - resolution: "theatre-7edd9a@workspace:theatre" + resolution: "theatre-example-dom@workspace:packages/example-dom" + dependencies: + "@theatre/core": "workspace:*" + "@theatre/studio": "workspace:*" + "@types/react": ^17.0.9 + "@types/react-dom": ^17.0.6 + parcel-bundler: ^1.12.5 + react: ^17.0.2 + react-dom: ^17.0.2 + typescript: ^4.3.2 + languageName: unknown + linkType: soft + +"theatre-monorepo@workspace:.": + version: 0.0.0-use.local + resolution: "theatre-monorepo@workspace:." + dependencies: + "@babel/core": ^7.14.3 + "@babel/plugin-proposal-class-properties": ^7.13.0 + "@babel/plugin-proposal-nullish-coalescing-operator": ^7.14.2 + "@babel/plugin-proposal-optional-chaining": ^7.14.2 + "@babel/preset-env": ^7.14.4 + "@babel/preset-react": ^7.13.13 + "@babel/preset-typescript": ^7.13.0 + "@typescript-eslint/eslint-plugin": ^4.26.0 + "@typescript-eslint/parser": ^4.26.0 + esbuild: ^0.12.5 + esbuild-jest: ^0.5.0 + eslint: ^7.27.0 + eslint-plugin-jsx-a11y: ^6.4.1 + eslint-plugin-react-hooks: ^4.2.0 + eslint-plugin-unused-imports: ^1.1.1 + husky: ^6.0.0 + jest: ^27.0.3 + lerna: ^4.0.0 + lint-staged: ^11.0.0 + node-gyp: ^8.1.0 + prettier: ^2.3.1 + typescript: ^4.3.2 + languageName: unknown + linkType: soft + +"theatre@workspace:theatre": + version: 0.0.0-use.local + resolution: "theatre@workspace:theatre" dependencies: "@babel/cli": ^7.14.3 "@babel/core": ^7.14.3 @@ -17748,50 +17792,6 @@ resolve@1.17.0: languageName: unknown linkType: soft -"theatre-example-dom@workspace:packages/example-dom": - version: 0.0.0-use.local - resolution: "theatre-example-dom@workspace:packages/example-dom" - dependencies: - "@theatre/core": "workspace:*" - "@theatre/studio": "workspace:*" - "@types/react": ^17.0.9 - "@types/react-dom": ^17.0.6 - parcel-bundler: ^1.12.5 - react: ^17.0.2 - react-dom: ^17.0.2 - typescript: ^4.3.2 - languageName: unknown - linkType: soft - -"theatre-monorepo@workspace:.": - version: 0.0.0-use.local - resolution: "theatre-monorepo@workspace:." - dependencies: - "@babel/core": ^7.14.3 - "@babel/plugin-proposal-class-properties": ^7.13.0 - "@babel/plugin-proposal-nullish-coalescing-operator": ^7.14.2 - "@babel/plugin-proposal-optional-chaining": ^7.14.2 - "@babel/preset-env": ^7.14.4 - "@babel/preset-react": ^7.13.13 - "@babel/preset-typescript": ^7.13.0 - "@typescript-eslint/eslint-plugin": ^4.26.0 - "@typescript-eslint/parser": ^4.26.0 - esbuild: ^0.12.5 - esbuild-jest: ^0.5.0 - eslint: ^7.27.0 - eslint-plugin-jsx-a11y: ^6.4.1 - eslint-plugin-react-hooks: ^4.2.0 - eslint-plugin-unused-imports: ^1.1.1 - husky: ^6.0.0 - jest: ^27.0.3 - lerna: ^4.0.0 - lint-staged: ^11.0.0 - node-gyp: ^8.1.0 - prettier: ^2.3.1 - typescript: ^4.3.2 - languageName: unknown - linkType: soft - "three-stdlib@npm:^2.0.1": version: 2.0.5 resolution: "three-stdlib@npm:2.0.5"