Skip to content

Commit 26de425

Browse files
committed
React2Shell Vulnerability Update
1 parent dbadf97 commit 26de425

27 files changed

Lines changed: 9531 additions & 5834 deletions

package-lock.json

Lines changed: 8782 additions & 5811 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,65 @@
11
{
22
"name": "r3dy",
33
"private": false,
4-
"version": "1.1.0",
5-
"main": "dist/index.js",
4+
"version": "1.2.0",
5+
"type": "module",
6+
"main": "./dist/r3dy.umd.cjs",
7+
"module": "./dist/r3dy.js",
8+
"exports": {
9+
".": {
10+
"import": "./dist/r3dy.js",
11+
"require": "./dist/r3dy.umd.cjs"
12+
}
13+
},
614
"scripts": {
715
"dev": "vite",
8-
"prebuild": "rimraf dist",
9-
"build": "vite build && tsc",
16+
"build": "tsc && vite build",
1017
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11-
"preview": "vite preview"
18+
"preview": "vite preview",
19+
"test": "jest",
20+
"prepublishOnly": "npm run build"
1221
},
13-
"license": "MIT",
14-
"author": "Alec Jessen, Garrett Woo, Bryan Trang, Nick King, Corso Rosati",
15-
"keywords": ["3D, Component Library, React"],
1622
"dependencies": {
17-
"@react-spring/three": "^9.7.3",
18-
"@react-three/drei": "^9.77.7",
19-
"@react-three/fiber": "^8.13.4",
23+
"@babel/plugin-syntax-jsx": "^7.22.5",
24+
"@babel/preset-env": "^7.22.7",
25+
"@babel/preset-react": "^7.22.5",
26+
"@babel/preset-typescript": "^7.22.5",
27+
"@react-spring/three": "^10.0.3",
28+
"@react-three/fiber": "^9.0.0-rc.10",
29+
"@react-three/drei": "^9.121.2-canary-test01.1",
30+
"@testing-library/jest-dom": "^5.16.5",
2031
"@use-gesture/react": "^10.2.27",
21-
"three": "^0.154.0"
32+
"@vitejs/plugin-react": "^4.0.3",
33+
"babel-jest": "^29.6.1",
34+
"core-js": "^3.31.1",
35+
"jest-environment-jsdom": "^29.6.1",
36+
"leva": "^0.9.35",
37+
"react": "^19.0.0-rc",
38+
"react-dom": "^19.0.0-rc",
39+
"resize-observer-polyfill": "^1.5.1",
40+
"three": "^0.170.0",
41+
"ts-jest": "^29.1.1"
2242
},
2343
"peerDependencies": {
24-
"react": "^18.2.0",
25-
"react-dom": "^18.2.0"
44+
"react": ">=18.0",
45+
"react-dom": ">=18.0",
46+
"@react-three/fiber": ">=8.0"
47+
},
48+
"devDependencies": {
49+
"@react-three/test-renderer": "^8.1.5",
50+
"@testing-library/react": "^14.0.0",
51+
"@types/react": "^18.3.0",
52+
"@types/react-dom": "^18.3.0",
53+
"@types/three": "^0.170.0",
54+
"@typescript-eslint/eslint-plugin": "^5.59.0",
55+
"@typescript-eslint/parser": "^5.59.0",
56+
"@vitejs/plugin-react-swc": "^3.0.0",
57+
"eslint": "^8.38.0",
58+
"eslint-plugin-react-hooks": "^4.6.0",
59+
"eslint-plugin-react-refresh": "^0.3.4",
60+
"jest": "^29.6.1",
61+
"r3f-perf": "^7.1.2",
62+
"typescript": "^5.0.2",
63+
"vite": "^4.3.9"
2664
}
2765
}

src/components/Button.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ReactElement } from 'react';
2+
type ButtonProps = {
3+
scale?: number;
4+
color?: string;
5+
activeColor?: string;
6+
font?: string;
7+
text?: string;
8+
fontSize?: number;
9+
fontColor?: string;
10+
handleClick?: any;
11+
position?: [number, number, number];
12+
};
13+
export default function Button(props: ButtonProps): ReactElement;
14+
export {};

src/components/Button.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2+
import { useState, useRef } from 'react';
3+
import { RoundedBox, Text } from "@react-three/drei";
4+
import { useSpring, animated, config } from '@react-spring/three';
5+
export default function Button(props) {
6+
const buttonRef = useRef();
7+
const [hover, setHover] = useState(false);
8+
const position = props.position || [0, 0, 0];
9+
const scale = props.scale || 2;
10+
const color = props.color || '#3F37C9';
11+
const activeColor = props.activeColor || '#272275';
12+
const text = props.text || 'BUTTON';
13+
const fontSize = props.fontSize || .5;
14+
const fontColor = props.fontColor || '#ffffff';
15+
const handleClick = props.handleClick || undefined;
16+
const font = props.font || undefined;
17+
const buttonWidth = text.length * fontSize * 1.1;
18+
const buttonHeight = fontSize * 2.7;
19+
const { rotationY, rotationX } = useSpring({
20+
rotationX: hover ? -0.15 : 0,
21+
rotationY: hover ? -0.25 : 0,
22+
config: config.wobbly,
23+
});
24+
if (buttonRef.current) {
25+
buttonRef.current.position.x = position[0];
26+
buttonRef.current.position.y = position[1];
27+
buttonRef.current.position.z = position[2];
28+
}
29+
return _jsx(_Fragment, { children: _jsxs("group", { ref: buttonRef, children: [_jsx("ambientLight", { intensity: 1 }), _jsxs(animated.group, { scale: scale, onPointerDown: () => setHover(true), onPointerUp: () => setHover(false), onClick: handleClick, "rotation-y": rotationY, "rotation-x": rotationX, children: [_jsx("mesh", { children: _jsx(RoundedBox, { args: [buttonWidth, buttonHeight, .5], radius: .2, children: _jsx("meshStandardMaterial", { color: hover ? activeColor : color }) }) }), _jsxs(Text, { font: font, fontSize: fontSize, color: fontColor, "position-z": .3, children: [_jsx("meshBasicMaterial", { toneMapped: false }), text] })] })] }) });
30+
}

src/components/ChipLoader.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type LoaderProps = {
2+
color?: string;
3+
scale?: number;
4+
rotationAxis?: 'y' | 'x' | 'z';
5+
rotationDirection?: 'positive' | 'negative';
6+
easeAnimation?: boolean;
7+
speed?: number;
8+
theme?: 'dark' | 'light';
9+
material?: any;
10+
wireframe?: boolean;
11+
matcapIndex?: number;
12+
matcapSize?: 64 | 128 | 256 | 512 | 1024;
13+
position?: [number, number, number];
14+
};
15+
export default function ChipLoader(props: LoaderProps): import("react/jsx-runtime").JSX.Element;
16+
export {};

src/components/ChipLoader.js

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/FlickSwitch.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type SwitchProps = {
2+
color?: string;
3+
size?: number;
4+
callback?: any;
5+
positionX?: number;
6+
positionY?: number;
7+
positionZ?: number;
8+
};
9+
export default function FlickSwitch({ color, size, callback, positionX, positionY, positionZ }: SwitchProps): import("react/jsx-runtime").JSX.Element;
10+
export {};

src/components/FlickSwitch.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2+
import { useRef, useState } from 'react';
3+
import { useSpring, animated } from '@react-spring/three';
4+
import { MeshStandardMaterial } from 'three';
5+
export default function FlickSwitch({ color, size, callback, positionX, positionY, positionZ }) {
6+
const [active, setActive] = useState(false);
7+
const cube = useRef(null);
8+
const group = useRef(null);
9+
const metallicMaterial = new MeshStandardMaterial({
10+
color: color ? color : 'silver',
11+
metalness: 1,
12+
roughness: .41,
13+
});
14+
const metallicMaterial2 = new MeshStandardMaterial({
15+
color: color ? color : 'silver',
16+
metalness: 1,
17+
roughness: .2,
18+
});
19+
const animation = useSpring({
20+
'rotation-x': active ? Math.PI / 5 : -Math.PI / 5,
21+
config: { tension: 900, friction: 45 }
22+
});
23+
function clicked() {
24+
if (callback) {
25+
setActive(!active);
26+
if (!active) {
27+
callback();
28+
}
29+
}
30+
if (!callback) {
31+
setActive(!active);
32+
}
33+
}
34+
return (_jsxs(_Fragment, { children: [_jsx("ambientLight", { intensity: 1 }), _jsx("directionalLight", { castShadow: true, position: [2, 8, 5], intensity: 1, "shadow-mapSize": 1024 }), _jsx("directionalLight", { castShadow: true, position: [-5, 5, 2], intensity: 1, "shadow-mapSize": 1024 }), _jsx("directionalLight", { castShadow: true, position: [5, -5, 2], intensity: 1 }), _jsxs(animated.group, { ref: group, "rotation-x": animation['rotation-x'], "position-z": positionZ ? positionZ - .2 : -.2, "position-x": positionX ? positionX : 0, "position-y": positionY ? positionY : 0, scale: size ? size : 1, children: [_jsx(animated.mesh, { onClick: clicked, ref: cube, rotation: [Math.PI / 2, 0, Math.PI], position: [0, 0, 1.5], material: metallicMaterial, receiveShadow: true, castShadow: true, children: _jsx("capsuleGeometry", { args: [.35, 2.75, 7, 40] }) }), _jsx(animated.mesh, { rotation: [Math.PI / 2, 0, Math.PI], position: [0, 0, 1.5], material: metallicMaterial, receiveShadow: true, castShadow: true, children: _jsx("cylinderGeometry", { args: [.35, .357, 3, 40] }) }), _jsx(animated.mesh, { material: metallicMaterial, receiveShadow: true, castShadow: true, children: _jsx("sphereGeometry", { args: [.65, 32, 32] }) })] }), _jsx("mesh", { material: metallicMaterial, scale: size ? size : 1, receiveShadow: true, castShadow: true, "position-z": positionZ ? positionZ : 0, "position-x": positionX ? positionX : 0, "position-y": positionY ? positionY : 0, children: _jsx("torusGeometry", { args: [1.1, .4, 4, 200] }) }), _jsxs("mesh", { scale: size ? size * 2 : 2, "position-z": positionZ ? positionZ + .01 : .01, "position-x": positionX ? positionX : 0, "position-y": positionY ? positionY : 0, material: metallicMaterial2, children: [_jsx("planeGeometry", {}), _jsx("meshBasicMaterial", { color: 'grey' })] })] }));
35+
}

src/components/HexagonLoader.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type LoaderProps = {
2+
color?: string;
3+
scale?: number;
4+
rotationAxis?: 'y' | 'x' | 'z';
5+
rotationDirection?: 'positive' | 'negative';
6+
easeAnimation?: boolean;
7+
speed?: number;
8+
theme?: 'dark' | 'light';
9+
material?: any;
10+
wireframe?: boolean;
11+
matcapIndex?: number;
12+
matcapSize?: 64 | 128 | 256 | 512 | 1024;
13+
position?: [number, number, number];
14+
};
15+
export default function HexagonLoader(props: LoaderProps): import("react/jsx-runtime").JSX.Element;
16+
export {};

0 commit comments

Comments
 (0)