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

build-storybook based on built package #2215

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { StorybookConfig } from '@storybook/react-vite'
import { svg } from './favicon'
import path from 'path'

const config: StorybookConfig = {
staticDirs: ['./public'],
Expand Down Expand Up @@ -32,6 +33,18 @@ const config: StorybookConfig = {
},
},
},

viteFinal: async (config) => {
config.resolve ??= {}
config.resolve.alias = {
...(config.resolve.alias || {}),
'@react-three/drei':
process.env.STORYBOOK_ENV === 'production'
? path.resolve(__dirname, '../dist')
: path.resolve(__dirname, '../src'),
}
return config
},
}

export default config
2 changes: 1 addition & 1 deletion .storybook/stories/AccumulativeShadows.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { useGLTF, AccumulativeShadows, RandomizedLight, OrbitControls, Environment } from '../../src'
import { useGLTF, AccumulativeShadows, RandomizedLight, OrbitControls, Environment } from '@react-three/drei'

export default {
title: 'Staging/AccumulativeShadows',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Adaptive.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { useGLTF, AdaptiveDpr, AdaptiveEvents, OrbitControls } from '../../src'
import { useGLTF, AdaptiveDpr, AdaptiveEvents, OrbitControls } from '@react-three/drei'

import type { GLTF } from 'three-stdlib'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/ArcballControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { ComponentProps, useRef, useState } from 'react'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { ArcballControls, Box, PerspectiveCamera, Plane, useFBO } from '../../src'
import { ArcballControls, Box, PerspectiveCamera, Plane, useFBO } from '@react-three/drei'

import { Scene, type OrthographicCamera, type PerspectiveCamera as PerspectiveCameraType } from 'three'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/BBAnchor.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Icosahedron, Sphere, Html, BBAnchor, OrbitControls, useHelper } from '../../src'
import { Icosahedron, Sphere, Html, BBAnchor, OrbitControls, useHelper } from '@react-three/drei'
import { BoxHelper } from 'three'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Billboard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Billboard, Plane, Box, Cone, OrbitControls, Text } from '../../src'
import { Billboard, Plane, Box, Cone, OrbitControls, Text } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Bvh.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'
import { Setup } from '../Setup'
import { MeshBVHHelper } from 'three-mesh-bvh'

import { useHelper, Bvh, TorusKnot, OrbitControls } from '../../src'
import { useHelper, Bvh, TorusKnot, OrbitControls } from '@react-three/drei'
import { useFrame, useThree } from '@react-three/fiber'
import { Group, Mesh, Raycaster, Vector3 } from 'three'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CameraControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Scene } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Box, CameraControls, PerspectiveCamera, Plane, useFBO } from '../../src'
import { Box, CameraControls, PerspectiveCamera, Plane, useFBO } from '@react-three/drei'

export default {
title: 'Controls/CameraControls',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CameraShake.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { CameraShake, OrbitControls } from '../../src'
import { CameraShake, OrbitControls } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Center.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'
import { Setup } from '../Setup'
import { useTurntable } from '../useTurntable'

import { Box, Center, useGLTF } from '../../src'
import { Box, Center, useGLTF } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Cloud.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Cloud, OrbitControls } from '../../src'
import { Cloud, OrbitControls } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/ContactShadows.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { ContactShadows, Sphere, Plane } from '../../src'
import { ContactShadows, Sphere, Plane } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CubeCamera.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Box, CubeCamera } from '../../src'
import { Box, CubeCamera } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CubeTexture.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { CubeTexture, Icosahedron } from '../../src'
import { CubeTexture, Icosahedron } from '@react-three/drei'

export default {
title: 'Abstractions/CubeTexture',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/CurveModifier.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { extend, useFrame, useLoader } from '@react-three/fiber'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { CurveModifier, CurveModifierRef } from '../../src'
import { CurveModifier, CurveModifierRef } from '@react-three/drei'

extend({ StdText: TextGeometry })

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Decal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Sampler, Decal, useTexture, useSurfaceSampler, PerspectiveCamera, OrbitControls } from '../../src'
import { Sampler, Decal, useTexture, useSurfaceSampler, PerspectiveCamera, OrbitControls } from '@react-three/drei'
import { Euler, InstancedBufferAttribute, Matrix4, Quaternion, Vector3 } from 'three'
import { ComponentProps } from 'react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Detailed.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Detailed, Icosahedron, OrbitControls } from '../../src'
import { Detailed, Icosahedron, OrbitControls } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/DetectGPU.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { DetectGPU, Text } from '../../src'
import { DetectGPU, Text } from '@react-three/drei'

export default {
title: 'Misc/DetectGPU',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/DeviceOrientationControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { DeviceOrientationControls, Box } from '../../src'
import { DeviceOrientationControls, Box } from '@react-three/drei'

export default {
title: 'Controls/DeviceOrientationControls',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/DragControls.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import * as THREE from 'three'
import { Box } from '../../src'
import { Box } from '@react-three/drei'
import { Setup } from '../Setup'
import { DragControls } from '../../src/web/DragControls'
import { Meta, StoryObj } from '@storybook/react'
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Environment.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Environment, ContactShadows, PerspectiveCamera, OrbitControls } from '../../src'
import { Environment, ContactShadows, PerspectiveCamera, OrbitControls } from '@react-three/drei'

import { presetsObj } from '../../src/helpers/environment-assets'
import { ComponentProps } from 'react'
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Example.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Example, ExampleApi } from '../../src'
import { Example, ExampleApi } from '@react-three/drei'

export default {
title: 'Misc/Example',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Extrude.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'
import { Setup } from '../Setup'
import { useTurntable } from '../useTurntable'

import { Extrude } from '../../src'
import { Extrude } from '@react-three/drei'

export default {
title: 'Shapes/Extrude',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/FaceControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { FaceLandmarker, FaceControls, Box } from '../../src'
import { FaceLandmarker, FaceControls, Box } from '@react-three/drei'
import { ComponentProps } from 'react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Facemesh.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Facemesh, FacemeshDatas } from '../../src'
import { Facemesh, FacemeshDatas } from '@react-three/drei'

export default {
title: 'Shapes/Facemesh',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Fbo.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Fbo, TorusKnot, Box, PerspectiveCamera } from '../../src'
import { Fbo, TorusKnot, Box, PerspectiveCamera } from '@react-three/drei'

export default {
title: 'Misc/Fbo',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Fbx.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Fbx, useCubeTexture } from '../../src'
import { Fbx, useCubeTexture } from '@react-three/drei'

export default {
title: 'Loaders/Fbx',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/FirstPersonControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Box, FirstPersonControls } from '../../src'
import { Box, FirstPersonControls } from '@react-three/drei'

export default {
title: 'Controls/FirstPersonControls',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Float.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Float } from '../../src'
import { Float } from '@react-three/drei'

export default {
title: 'Staging/Float',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/FlyControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Box, FlyControls } from '../../src'
import { Box, FlyControls } from '@react-three/drei'

export default {
title: 'Controls/FlyControls',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/GizmoHelper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { GizmoHelper, OrbitControls, useGLTF, GizmoViewcube, GizmoViewport } from '../../src'
import { GizmoHelper, OrbitControls, useGLTF, GizmoViewcube, GizmoViewport } from '@react-three/drei'
import { Setup } from '../Setup'
import { ComponentProps } from 'react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Gltf.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Gltf } from '../../src'
import { Gltf } from '@react-three/drei'

export default {
title: 'Loaders/Gltf',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Vector3 } from 'three'
import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'
import { Grid, Box } from '../../src'
import { Grid, Box } from '@react-three/drei'

export default {
title: 'Gizmos/Grid',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/HTML.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as THREE from 'three'
import { Setup } from '../Setup'
import { useTurntable } from '../useTurntable'

import { Icosahedron, Html, OrthographicCamera } from '../../src'
import { Icosahedron, Html, OrthographicCamera } from '@react-three/drei'
import { HtmlProps, CalculatePosition } from '../../src/web/Html'
import { useFrame, useThree } from '@react-three/fiber'
import { Meta, StoryObj } from '@storybook/react'
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Helper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BoxHelper, CameraHelper } from 'three'
import { VertexNormalsHelper } from 'three-stdlib'
import { Meta, StoryObj } from '@storybook/react'

import { Helper, PerspectiveCamera, Sphere } from '../../src'
import { Helper, PerspectiveCamera, Sphere } from '@react-three/drei'
import { Setup } from '../Setup'
import { ComponentProps } from 'react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Image.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Image, useTexture } from '../../src'
import { Image, useTexture } from '@react-three/drei'

export default {
title: 'Abstractions/Image',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Instances.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Euler, MathUtils, Mesh, ShaderMaterial, Vector3 } from 'three'
// import { StoryObj } from '@storybook/react'
import { Setup } from '../Setup'

import { useGLTF, Instances, Instance, createInstances, InstancedAttribute } from '../../src'
import { useGLTF, Instances, Instance, createInstances, InstancedAttribute } from '@react-three/drei'
import { useFrame } from '@react-three/fiber'
import { clamp } from 'maath/misc'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/KeyboardControls.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useFrame } from '@react-three/fiber'
import * as React from 'react'
import { useRef } from 'react'
import { MathUtils, Mesh, Vector3 } from 'three'
import { Cone, KeyboardControls, useKeyboardControls } from '../../src'
import { Cone, KeyboardControls, useKeyboardControls } from '@react-three/drei'
import { Setup } from '../Setup'
import { Meta, StoryObj } from '@storybook/react'

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Ktx2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Box, Ktx2 } from '../../src'
import { Box, Ktx2 } from '@react-three/drei'

export default {
title: 'Loaders/Ktx2',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Lathe.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'
import { Setup } from '../Setup'
import { useTurntable } from '../useTurntable'

import { Lathe } from '../../src'
import { Lathe } from '@react-three/drei'

export default {
title: 'Shapes/Lathe',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Line.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Line, OrbitControls, QuadraticBezierLine, CubicBezierLine, CatmullRomLine } from '../../src'
import { Line, OrbitControls, QuadraticBezierLine, CubicBezierLine, CatmullRomLine } from '@react-three/drei'

const points = GeometryUtils.hilbert3D(new Vector3(0), 5).map((p) => [p.x, p.y, p.z]) as [number, number, number][]

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Loader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'

import { Setup } from '../Setup'

import { Html, useGLTF, Loader } from '../../src'
import { Html, useGLTF, Loader } from '@react-three/drei'

export default {
title: 'Misc/Loader',
Expand Down
Loading