Skip to content

Commit d0e0e6a

Browse files
authored
Merge branch 'master' into chromatic-more
2 parents 89d9aa7 + 563a6ce commit d0e0e6a

File tree

11 files changed

+731
-371
lines changed

11 files changed

+731
-371
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- run: corepack enable
6262
- uses: actions/setup-node@v4
6363
with:
64-
node-version-file: '.node-version'
64+
node-version-file: '.nvmrc'
6565
cache: 'yarn'
6666
- run: yarn install
6767
- run: yarn build

.node-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.12.0

.storybook/Setup.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Props = React.PropsWithChildren<
1414
cameraPosition?: Vector3
1515
controls?: boolean
1616
lights?: boolean
17+
backend?: 'webgpu' | 'webgl'
1718
}
1819
>
1920

@@ -23,21 +24,26 @@ export const Setup = ({
2324
cameraPosition = new Vector3(-5, 5, 5),
2425
controls = true,
2526
lights = true,
27+
backend,
2628
...restProps
27-
}: Props) => (
28-
<Canvas shadows camera={{ position: cameraPosition, fov: cameraFov }} {...restProps}>
29-
{children}
30-
{lights && (
31-
<>
32-
<ambientLight intensity={0.8 * Math.PI} />
33-
<pointLight intensity={1 * Math.PI} position={[0, 6, 0]} decay={0} />
34-
</>
35-
)}
36-
{controls && <OrbitControls makeDefault />}
29+
}: Props) => {
30+
console.log('Current backend in Setup:', backend)
3731

38-
{isChromatic() && <SayCheese />}
39-
</Canvas>
40-
)
32+
return (
33+
<Canvas shadows camera={{ position: cameraPosition, fov: cameraFov }} {...restProps}>
34+
{children}
35+
{lights && (
36+
<>
37+
<ambientLight intensity={0.8 * Math.PI} />
38+
<pointLight intensity={1 * Math.PI} position={[0, 6, 0]} decay={0} />
39+
</>
40+
)}
41+
{controls && <OrbitControls makeDefault />}
42+
43+
{isChromatic() && <SayCheese />}
44+
</Canvas>
45+
)
46+
}
4147

4248
/**
4349
* A helper component to wait and pause the frameloop

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { StorybookConfig } from '@storybook/react-vite'
2-
import { svg } from './favicon'
2+
import { svg } from './favicon.ts'
33

44
const config: StorybookConfig = {
55
staticDirs: ['./public'],

.storybook/preview.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ import './index.css'
77
seedrandom('deterministic-random-for-storybook', { global: true }) // deterministic Math.random()
88

99
const preview: Preview = {
10+
globalTypes: {
11+
backend: {
12+
description: 'Backend to use by the renderer',
13+
toolbar: {
14+
icon: 'cpu',
15+
items: [
16+
{ value: 'webgl', title: 'WebGL' },
17+
{ value: 'webgpu', title: 'WebGPU' },
18+
],
19+
},
20+
},
21+
},
22+
initialGlobals: {
23+
backend: 'webgl',
24+
},
25+
1026
parameters: {
1127
layout: 'fullscreen',
1228
},

.storybook/stories/Example.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default {
1010
title: 'Misc/Example',
1111
component: Example,
1212
decorators: [
13-
(Story) => (
14-
<Setup cameraPosition={new Vector3(1, 2, 4)} cameraFov={60}>
13+
(Story, context) => (
14+
<Setup cameraPosition={new Vector3(1, 2, 4)} cameraFov={60} backend={context.globals.backend}>
1515
<Story />
1616
</Setup>
1717
),

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,23 @@ https://pmndrs.github.io/drei
802802

803803
### INSTALL
804804

805+
Pre-requisites:
806+
807+
- Install [nvm](https://github.com/nvm-sh/nvm), then:
808+
```sh
809+
$ nvm install
810+
$ nvm use
811+
$ node -v # make sure your version satisfies package.json#engines.node
812+
```
813+
nb: if you want this node version to be your default nvm's one: `nvm alias default node`
814+
- Install yarn, with:
815+
```sh
816+
$ corepack enable
817+
$ corepack prepare --activate # it reads "packageManager"
818+
$ yarn -v # make sure your version satisfies package.json#engines.yarn
819+
```
820+
805821
```sh
806-
$ corepack enable
807822
$ yarn install
808823
```
809824

eslint.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
22
import typescriptEslint from '@typescript-eslint/eslint-plugin'
33
import react from 'eslint-plugin-react'
44
import reactHooks from 'eslint-plugin-react-hooks'
5+
import storybook from 'eslint-plugin-storybook'
56
import tsParser from '@typescript-eslint/parser'
67
import path from 'node:path'
78
import { fileURLToPath } from 'node:url'
@@ -20,7 +21,8 @@ export default [
2021
{
2122
ignores: ['.storybook/public', '**/dist/', '**/node_modules/', '**/storybook-static/'],
2223
},
23-
...fixupConfigRules(compat.extends('plugin:react-hooks/recommended', 'plugin:storybook/recommended', 'prettier')),
24+
...fixupConfigRules(compat.extends('plugin:react-hooks/recommended', 'prettier')),
25+
...storybook.configs['flat/recommended'],
2426
{
2527
plugins: {
2628
'@typescript-eslint': typescriptEslint,

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@babel/preset-env": "^7.26.0",
7979
"@babel/preset-react": "^7.25.9",
8080
"@babel/preset-typescript": "^7.26.0",
81-
"@chromatic-com/storybook": "^4.1.0",
81+
"@chromatic-com/storybook": "^4.1.3",
8282
"@eslint/compat": "^1.2.3",
8383
"@eslint/eslintrc": "^3.2.0",
8484
"@eslint/js": "^9.15.0",
@@ -88,8 +88,8 @@
8888
"@rollup/plugin-commonjs": "^19.0.0",
8989
"@rollup/plugin-json": "^4.1.0",
9090
"@rollup/plugin-node-resolve": "^13.0.0",
91-
"@storybook/addon-docs": "^9.1.2",
92-
"@storybook/react-vite": "^9.1.2",
91+
"@storybook/addon-docs": "^10.1.11",
92+
"@storybook/react-vite": "^10.1.11",
9393
"@types/react": "^19.0.2",
9494
"@types/react-dom": "^19.0.2",
9595
"@types/seedrandom": "^3",
@@ -105,7 +105,7 @@
105105
"eslint-config-prettier": "^9.1.0",
106106
"eslint-plugin-react": "^7.37.2",
107107
"eslint-plugin-react-hooks": "^5.0.0",
108-
"eslint-plugin-storybook": "^9.1.2",
108+
"eslint-plugin-storybook": "^10.1.11",
109109
"husky": "^9.1.7",
110110
"json": "^11.0.0",
111111
"prettier": "^3.3.3",
@@ -120,7 +120,7 @@
120120
"seedrandom": "^3.0.5",
121121
"semantic-release": "^24.2.0",
122122
"serve": "^14.2.4",
123-
"storybook": "^9.1.2",
123+
"storybook": "^10.1.11",
124124
"three": "^0.159.0",
125125
"ts-node": "^10.9.2",
126126
"typescript": "^5.6.3",

0 commit comments

Comments
 (0)