├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .eslintrc.js ├── .github └── workflows │ └── release.yml.txt ├── .gitignore ├── .prettierrc ├── .releaserc ├── CHANGELOG.md ├── CONTRIBUTION.md ├── README.md ├── index.html ├── package.json ├── playground ├── App.tsx ├── Box.tsx ├── main.tsx └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── src ├── core │ ├── events.ts │ ├── index.tsx │ ├── is.ts │ ├── loop.ts │ ├── renderer.ts │ ├── store.ts │ └── utils.ts ├── hooks.ts ├── index.tsx ├── renderer.tsx ├── solid.ts ├── three-types.ts └── web │ ├── Canvas.tsx │ └── events.ts ├── tsconfig.json └── vite.config.ts /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # For more information, please refer to https://aka.ms/vscode-docker-python 2 | FROM mcr.microsoft.com/devcontainers/typescript-node:0-20 3 | 4 | WORKDIR /app 5 | COPY . /app 6 | 7 | # Install pip requirements 8 | RUN apt-get update 9 | 10 | # Creates a non-root user with an explicit UID and adds permission to access the /app folder 11 | # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers 12 | RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app 13 | USER appuser -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node 3 | { 4 | "name": "Node.js & TypeScript", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | //"image": "" 7 | 8 | "build": { 9 | // Sets the run context to one level up instead of the .devcontainer folder. 10 | "context": "..", 11 | // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. 12 | "dockerfile": "Dockerfile" 13 | }, 14 | 15 | 16 | "features": { 17 | "ghcr.io/akhildevelops/devcontainer-features/apt:0": {} 18 | }, 19 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 20 | // "forwardPorts": [], 21 | // Use 'postCreateCommand' to run commands after the container is created. 22 | "postCreateCommand": "pnpm install", 23 | // Configure tool-specific properties. 24 | "customizations": { 25 | "vscode": { 26 | "settings": {}, 27 | "extensions": [ 28 | //"streetsidesoftware.code-spell-checker", 29 | "ms-azuretools.vscode-docker", 30 | "wayou.vscode-todo-highlight", 31 | "gruntfuggly.todo-tree", 32 | "eamodio.gitlens", 33 | "github.vscode-pull-request-github", 34 | "dbaeumer.vscode-eslint", 35 | "pkief.material-icon-theme", 36 | "esbenp.prettier-vscode", 37 | "ms-vscode.vscode-typescript-tslint-plugin" 38 | ] 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("@vinxi/scripts/eslint-preset"); 2 | -------------------------------------------------------------------------------- /.github/workflows/release.yml.txt: -------------------------------------------------------------------------------- 1 | name: Lib Builder 2 | on: 3 | workflow_dispatch: 4 | push: 5 | tags: 6 | - "v*" 7 | branches: 8 | - main 9 | - master 10 | 11 | env: 12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.ref }} 16 | cancel-in-progress: true 17 | permissions: 18 | contents: write 19 | 20 | jobs: 21 | build: 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | node-version: [18.x] 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout repository 29 | uses: actions/checkout@v3 30 | with: 31 | token: ${{ env.GITHUB_TOKEN }} 32 | - name: Node.js setup ${{ matrix.node-version }} 33 | uses: actions/setup-node@v3 34 | with: 35 | node-version: ${{ matrix.node-version }} 36 | # node-version-file: '.nvmrc' 37 | - name: Install dependencies 38 | run: | 39 | sudo apt-get update 40 | npm install -g pnpm 41 | npm install -g typescript 42 | - name: Build 43 | id: app_build 44 | run: | 45 | pnpm install 46 | pnpm run build:lib 47 | - uses: actions/upload-artifact@v3 48 | with: 49 | name: production-files 50 | path: "${{ join(fromJSON(steps.app_build.outputs.artifacts), '\n') }}" 51 | deploy: 52 | runs-on: ubuntu-latest 53 | name: Deploy 54 | needs: [build] 55 | steps: 56 | - name: Checkout 57 | uses: actions/checkout@v3 58 | with: 59 | fetch-depth: 0 60 | - name: Create Deploy Directory 61 | run: mkdir -p dist 62 | - name: Download artifact 63 | uses: actions/download-artifact@v2 64 | with: 65 | name: production-files 66 | path: ./dist 67 | - name: Setup node 68 | uses: actions/setup-node@v3 69 | with: 70 | node-version: 18 71 | - run: npm install -g conventional-changelog-conventionalcommits 72 | - run: npm install -g semantic-release@v19.0.5 73 | - run: npm install -g @semantic-release/exec 74 | - run: npm install -g @semantic-release/git 75 | - run: npm install -g @semantic-release/release-notes-generator 76 | - run: npm install -g @semantic-release/changelog 77 | - run: npm install -g @semantic-release/github 78 | - name: Release 79 | env: 80 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 81 | #sudo apt-get install -y jq 82 | #chmod +x ./scripts/prepareCMD.sh 83 | run: | 84 | semantic-release 85 | 86 | cleanup: 87 | name: Cleanup actions 88 | needs: 89 | - deploy 90 | runs-on: ubuntu-latest 91 | timeout-minutes: 10 92 | steps: 93 | - name: "♻️ remove build artifacts" 94 | uses: geekyeggo/delete-artifact@v1 95 | with: 96 | name: production-files 97 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .scratch 2 | dist 3 | types 4 | node_modules 5 | packed/ 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 100, 5 | "semi": true, 6 | "singleQuote": false, 7 | "useTabs": false, 8 | "arrowParens": "avoid", 9 | "bracketSpacing": true, 10 | "endOfLine": "lf", 11 | "plugins": ["prettier-plugin-tailwindcss"] 12 | } -------------------------------------------------------------------------------- /.releaserc: -------------------------------------------------------------------------------- 1 | { 2 | "branches": [ 3 | "main", 4 | "master", 5 | "release", 6 | { 7 | "name": "staging", 8 | "prerelease": true 9 | } 10 | ], 11 | "plugins": [ 12 | [ 13 | "@semantic-release/commit-analyzer", 14 | { 15 | "preset": "conventionalcommits", 16 | "parserOpts": { 17 | "noteKeywords": [ 18 | "BREAKING CHANGE", 19 | "BREAKING CHANGES", 20 | "BREAKING" 21 | ] 22 | }, 23 | "releaseRules": [ 24 | { 25 | "breaking": true, 26 | "release": "major" 27 | }, 28 | { 29 | "type": "feat", 30 | "release": "minor" 31 | }, 32 | { 33 | "type": "fix", 34 | "release": "patch" 35 | }, 36 | { 37 | "type": "perf", 38 | "release": "patch" 39 | }, 40 | { 41 | "type": "revert", 42 | "release": "patch" 43 | }, 44 | { 45 | "type": "docs", 46 | "scope": "docs-*", 47 | "release": "minor" 48 | }, 49 | { 50 | "type": "docs", 51 | "release": false 52 | }, 53 | { 54 | "type": "style", 55 | "release": "patch" 56 | }, 57 | { 58 | "type": "refactor", 59 | "release": "patch" 60 | }, 61 | { 62 | "type": "test", 63 | "release": "patch" 64 | }, 65 | { 66 | "type": "build", 67 | "release": "patch" 68 | }, 69 | { 70 | "type": "ci", 71 | "scope": "ci-*", 72 | "release": "patch" 73 | }, 74 | { 75 | "type": "chore", 76 | "release": false 77 | }, 78 | { 79 | "type": "no-release", 80 | "release": false 81 | } 82 | ] 83 | } 84 | ], 85 | [ 86 | "@semantic-release/release-notes-generator", 87 | { 88 | "preset": "conventionalcommits", 89 | "parserOpts": { 90 | "noteKeywords": [ 91 | "BREAKING CHANGE", 92 | "BREAKING CHANGES", 93 | "BREAKING" 94 | ] 95 | }, 96 | "writerOpts": { 97 | "commitsSort": [ 98 | "subject", 99 | "scope" 100 | ] 101 | }, 102 | "presetConfig": { 103 | "types": [ 104 | { 105 | "type": "feat", 106 | "section": "🍕 Features" 107 | }, 108 | { 109 | "type": "feature", 110 | "section": "🍕 Features" 111 | }, 112 | { 113 | "type": "fix", 114 | "section": "🐛 Bug Fixes" 115 | }, 116 | { 117 | "type": "perf", 118 | "section": "🔥 Performance Improvements" 119 | }, 120 | { 121 | "type": "revert", 122 | "section": "⏩ Reverts" 123 | }, 124 | { 125 | "type": "docs", 126 | "section": "📝 Documentation" 127 | }, 128 | { 129 | "type": "style", 130 | "section": "🎨 Styles" 131 | }, 132 | { 133 | "type": "refactor", 134 | "section": "🧑💻 Code Refactoring" 135 | }, 136 | { 137 | "type": "test", 138 | "section": "✅ Tests" 139 | }, 140 | { 141 | "type": "build", 142 | "section": "🤖 Build System" 143 | }, 144 | { 145 | "type": "ci", 146 | "section": "🔁 Continuous Integration" 147 | } 148 | ] 149 | } 150 | } 151 | ], 152 | [ 153 | "@semantic-release/changelog", 154 | { 155 | "changelogTitle": "# 📦 Changelog \n[](https://conventionalcommits.org)\n[](https://semver.org)\n> All notable changes to this project will be documented in this file" 156 | } 157 | ], 158 | [ 159 | "@semantic-release/exec", 160 | { 161 | "prepareCmd": "./scripts/prepareCMD.sh ${nextRelease.version}", 162 | "publishCmd": "echo Publishing ${nextRelease.version}" 163 | } 164 | ], 165 | [ 166 | "@semantic-release/git", 167 | { 168 | "assets": [ 169 | "package.json", 170 | "LICENSE*", 171 | "CHANGELOG.md" 172 | ], 173 | "message": "chore(${nextRelease.type}): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" 174 | } 175 | ] 176 | ] 177 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # solid-three 2 | 3 | ## 0.0.3 4 | 5 | ### Patch Changes 6 | 7 | - c3ee88e: fix for typescript docs 8 | 9 | ## 0.0.2 10 | 11 | ### Patch Changes 12 | 13 | - 91678f0: add args support in three renderer 14 | - 5b261fc: fix tsconfig and bug fixes 15 | 16 | ## 0.0.1 17 | 18 | ### Patch Changes 19 | 20 | - 299db0f: fixed leva build and types 21 | -------------------------------------------------------------------------------- /CONTRIBUTION.md: -------------------------------------------------------------------------------- 1 | # Contributing to Solid Three 2 | 3 | :+1::tada: Thank you for checking out the project and wanting to contribute! :tada::+1: 4 | 5 | ## Contribution Process 6 | 7 | Solid Three strives to provide idiomatic Solid principles but also allow room for innovation and experimentation using modern ThreeJS and WebGL tools. In a growing community many opinions and patterns merge together to produce a de facto standard. Managing opinions and expectations can be difficult. As a result this project will inherit the Solid standard set out by `Solid Primitives` in November 2021, Solid Primitives implemented a ratification/approval tracking process roughly modelled on [TC39 Proposal Stage Process](https://tc39.es/process-document/). The following summarizes these stages briefly: 8 | 9 | | Stage | Description | 10 | | ----- | --------------------------- | 11 | | X | Deprecated or rejected | 12 | | 0 | Initial submission | 13 | | 1 | Demonstrations and examples | 14 | | 2 | General use (experimental) | 15 | | 3 | Pre-shipping (final effort) | 16 | | 4 | Accepted/shipped | 17 | 18 | Any feature Stage 0-1 should be used with caution and with the understanding that the design or implementation may change. Beyond Stage 2 we make an effort to mitigate changes. If a feature reaches Stage 2 it's likely to remain an official package with additional approvement until fully accepted and shipped. 19 | 20 | ## Design Maxims 21 | 22 | Other frameworks have large and extremely well established ecosystems. Notably React which has a vast array of component and hooks, such as `React Three Fiber` and `React Drie`. The amount of choice within the ecosystem is great but often these tools are built as one-offs resulting in often un-tested logic or are designed with narrow needs. Over time the less concise these building blocks are the more they tend to repeat themselves. Our goal with Solid Three is to bring the community together to contribute, evolve and utilize a powerful centralized ThreeJS library for SolidJS. 23 | 24 | All our work is meant to be consistent and sustain a level of quality. We guarantee that each is created with the utmost care. We strive to follow these design maxims: 25 | 26 | 1. Documented and follow a consistent style guide 27 | 2. Be well tested 28 | 3. Small, concise and practical as possible 29 | 4. A single Component for a single purpose 30 | 5. No dependencies or as few as possible 31 | 6. Wrap base level Browser APIs 32 | 7. Should be progressively improved for future features 33 | 8. Be focused on composition vs. isolation of logic 34 | 9. Community voice and needs guide road map and planning 35 | 10. Strong TypeScript support 36 | 11. Support for both CJS and ESM 37 | 12. Solid performance! 38 | 39 | ### Managing ThreeJS Complexity 40 | 41 | Solid Three is mostly about supplying 80-90% of the common-use cases of vanilla `ThreeJS` for the end-user. We prefer to be less prescriptive. The remaining 10-20% of complex use cases are likely not to be covered with this library. This is on purpose to limit the potential of bloat and extended complexity. This project strives to provide foundations and not cumulative solutions. We expect the broader ecosystem will fill the remaining need as further composition to this projects effort. This allows for just the right amount of prescription and opinion. 42 | 43 | ## NPM Release and Repository Structure 44 | 45 | Solid Three is a large and growing project and the way we manage and release updates has been setup to suit the projects scope. 46 | 47 | To that end we are currently using [`semantic-release`](https://github.com/semantic-release/semantic-release) to manage our packages and releases. 48 | 49 | There are a number of benefits to this including small download sizes, reducing bloat and not shipping experimental/unnecessary changes that users don't need or want locally. This also allows us to ship updates to individual packages as needed. 50 | 51 | ## Tooling 52 | 53 | ### Package Management 54 | 55 | This repository is a monorepo managed by [**pnpm workspaces**](https://pnpm.io/workspaces) which means that you need to install [**pnpm**](https://pnpm.io/installation) to work on it. If you don't have it installed, you can install it with `npm install -g pnpm`. 56 | 57 | If this is your first time pulling the repository onto a local branch, then run `pnpm install` to install all the dependencies and build all the local packages — this is important because all of the workspace packages are linked together. Furthermore, you should run `pnpm install` whenever you pull from the main branch. If you experience any further issues, try removing the `node_modules` folder (`rm -Force -Recurse .\node_modules\` or `rm -rf node_modules/`) and reinstalling the dependencies. 58 | 59 | ### Formatting and Linting 60 | 61 | We use [**eslint**](https://eslint.org/) and [**prettier**](https://prettier.io/) to lint and format the code. You can run `pnpm lint` to check for linting errors and `pnpm format` to format the code. 62 | 63 | Having them installed and enabled in your editor is not required but should help you in the development process. 64 | 65 | ### Operating System 66 | 67 | This repository should work on any operating system, but if any issues arise, you might try using [**Gitpod**](https://gitpod.io) to quickly spin up a fresh remote development environment. 68 | 69 | ### CLI Helpers 70 | 71 | > **Note**: Coming Soon 72 | 73 | ## Planned Features 74 | 75 | > **Note**: Coming Soon 76 | 77 | ## Acknowledgements 78 | 79 | Deeply inspired by the following projects: 80 | 81 | - [React Three Fiber](https://github.com/pmndrs/react-three-fiber) 82 | - [Solid Primitives](https://github.com/solidjs-community/solid-primitives) 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
;
49 | children?: any;
50 | ref?: T | ((instance: T) => void);
51 | // key?: React.Key;
52 | onUpdate?: (self: T) => void;
53 | }
54 |
55 | export type Node