Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Migrate to React renderer #35

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

marklundin
Copy link
Member

This PR migrates @pc/react to use a custom react renderer. This is built upon the react-reconciler and brings a number of improvements over the existing approach.

Improvements

  • Provides react refs to underlying pc components/entities (this was previously unavailable)
  • Drastically reduces the amount of code. No longer necessary to back each pc component with a react element.
  • Host PC ComponentSystems become available automatically without requiring wrapper components
  • Removing the component wrappers, is less abstraction and likely better overall performance

…mponents

- Bumped version of `@playcanvas/react` to 0.2.0 in `package-lock.json` and `package.json`.
- Added new components: `Application`, `Container`, `Entity`, `Align`, `Anim`, `Camera`, `Collision`, `EnvAtlas`, `GSplat`, `Light`, `Render`, `RigidBody`, `Script`, and `Sprite`.
- Implemented hooks for managing application state and components, including `useApp`, `useComponent`, and `useParent`.
- Introduced utility functions for color handling and asset fetching.
- Enhanced event handling with synthetic events for better interaction management.
- Updated documentation and structure for improved clarity and maintainability.
- Upgraded React and React-DOM to version 19.0.0 in package.json and package-lock.json.
- Removed deprecated types for React and React-DOM from devDependencies.
- Refactored MDX components to utilize PlayCanvasCanvas instead of Application and related components.
- Commented out unused imports and components in various files to streamline the codebase.
- Updated documentation references for TypeScript configuration in next-env.d.ts.
- Cleaned up package.json in the docs directory to align with the latest versions of nextra and nextra-theme-docs.
- Removed unnecessary components and hooks related to PlayCanvas, enhancing maintainability and clarity.
- Upgraded `type-fest` to version 4.32.0 in `package.json` and `package-lock.json`.
- Introduced a new dependency `its-fine` version 1.2.5.
- Refactored MDX components to replace `PlayCanvasCanvas` with `Application`.
- Updated TypeScript configuration to include `@playcanvas/react` types.
- Removed the `layout.tsx` file to streamline the documentation structure.
- Enhanced the `next.config.js` to improve configuration clarity.
- Cleaned up unused hooks and components from the library, improving maintainability.
- Removed commented-out components and imports from `mdx-components.js` to clean up the codebase.
- Simplified the `useMDXComponents` function by directly using `defaultComponents` without the previously commented-out `docsComponents`.
- Improved maintainability by reducing clutter in the component definitions.
@marklundin marklundin added the enhancement New feature or request label Jan 13, 2025
@marklundin marklundin self-assigned this Jan 13, 2025
- Updated the `Spinner` class to use a smaller random seed range for improved variability.
- Modified the `Content` component to conditionally render the `Spinner` script based on a new `runScript` prop.
- Added a button in the `Sandbox` component to toggle the `runScript` state, allowing users to enable or disable the script dynamically.
- Refactored `hostConfig.tsx` to integrate script handling, enabling the creation and management of script components alongside entities and components.
- Updated `component-config.tsx` and `script-config.tsx` to streamline the handling of component and script instances, improving overall code clarity and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant