Skip to content

Commit faf890e

Browse files
committed
Update dependencies, add prettier and eslint, fix build
1 parent b6f9e2a commit faf890e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4469
-2402
lines changed

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"bracketSameLine": true,
5+
"tabWidth": 2
6+
}

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<h1 align="center">solid-spring</h1>
32
<h3 align="center">A port of react-spring, for SolidJS</h3>
43

@@ -24,8 +23,8 @@ const styles = createSpring({
2423
The API is similar to what we have in react-spring, with small differences to make the library compatible with SolidJS
2524

2625
## Preview
27-
Click on the below gifs for exploring the code of each preview (ported from Poimandres examples).
2826

27+
Click on the below gifs for exploring the code of each preview (ported from Poimandres examples).
2928

3029
<p align="middle">
3130
<a href="https://codesandbox.io/s/spring-gestures-5xb9p8"><img src="https://i.imgur.com/qLKJod3.gif" width="400"/></a>
@@ -37,6 +36,7 @@ Click on the below gifs for exploring the code of each preview (ported from Poim
3736
```shell
3837
npm install solid-spring
3938
```
39+
4040
## Examples
4141

4242
[Hello (opacity animation)](https://codesandbox.io/s/hello-qe3eq5?file=/index.tsx)
@@ -48,10 +48,11 @@ npm install solid-spring
4848
## API
4949

5050
### `createSpring`
51+
5152
> Turns values into animated-values.
5253
5354
```jsx
54-
import { createSpring, animated } from "solid-spring";
55+
import { createSpring, animated } from 'solid-spring'
5556

5657
function ChainExample() {
5758
const styles = createSpring({
@@ -66,15 +67,19 @@ function ChainExample() {
6667
return <animated.div style={styles()}>I will fade in and out</animated.div>
6768
}
6869
```
70+
6971
`createSpring` also takes a function in case you want to pass a reactive value as a style!
72+
7073
```jsx
7174
const [disabled, setDisabled] = createSignal(false)
7275

7376
const styles = createSpring(() => ({
7477
pause: disabled(),
7578
}))
7679
```
80+
7781
### `createSprings`
82+
7883
> Creates multiple springs, each with its own config. Use it for static lists, etc.
7984
8085
Similar to `useSprings` in react-spring, It takes number or a function that returns a number (for reactivity) as the first argument, and a list of springs or a function that returns a spring as the second argument.

demo/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
node_modules
2-
dist
2+
dist

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

demo/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
"name": "vite-template-solid",
33
"version": "0.0.0",
44
"description": "",
5+
"license": "MIT",
56
"scripts": {
67
"start": "vite",
7-
"dev": "vite",
8+
"dev": "vite --clearScreen=false",
89
"build": "vite build",
9-
"serve": "vite preview"
10-
},
11-
"license": "MIT",
12-
"devDependencies": {
13-
"typescript": "^4.6.3",
14-
"vite": "^2.8.6",
15-
"vite-plugin-solid": "^2.2.6"
10+
"serve": "vite preview",
11+
"prettier": "prettier --write \"src/**/*.{js,json,ts,tsx,css,scss,html}\""
1612
},
1713
"dependencies": {
18-
"@react-spring/animated": "^9.4.4",
19-
"@react-spring/core": "^9.4.4",
20-
"solid-js": "^1.3.13",
21-
"solid-spring": "workspace:^0.1.0"
14+
"solid-js": "^1.7.8",
15+
"solid-spring": "workspace:^"
16+
},
17+
"devDependencies": {
18+
"prettier": "^3.0.0",
19+
"typescript": "^5.1.6",
20+
"vite": "^4.4.6",
21+
"vite-plugin-solid": "^2.7.0"
2222
}
2323
}

demo/src/App.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import {
2-
Component,
3-
createSignal,
4-
} from "solid-js";
5-
import { createSpring, animated, config } from "solid-spring";
1+
import { Component, createSignal } from 'solid-js'
2+
import { createSpring, animated, config } from 'solid-spring'
63

74
function ChainExample() {
8-
const [flip, set] = createSignal(false);
5+
const [flip, set] = createSignal(false)
96

107
const styles = createSpring(() => {
118
return {
@@ -16,16 +13,16 @@ function ChainExample() {
1613
delay: 200,
1714
config: config.molasses,
1815
onRest: () => {
19-
set(!flip());
16+
set(!flip())
2017
},
21-
};
22-
});
18+
}
19+
})
2320

24-
return <animated.h1 style={styles()}>hello</animated.h1>;
21+
return <animated.h1 style={styles()}>hello</animated.h1>
2522
}
2623

2724
const App: Component = () => {
28-
return <ChainExample />;
29-
};
25+
return <ChainExample />
26+
}
3027

31-
export default App;
28+
export default App

demo/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @refresh reload */
2-
import { render } from 'solid-js/web';
2+
import { render } from 'solid-js/web'
33

4-
import App from './App';
4+
import App from './App'
55

6-
render(() => <App />, document.getElementById('root') as HTMLElement);
6+
render(() => <App />, document.getElementById('root') as HTMLElement)

demo/vite.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { defineConfig } from 'vite';
2-
import solidPlugin from 'vite-plugin-solid';
1+
import { defineConfig } from 'vite'
2+
import solidPlugin from 'vite-plugin-solid'
33

44
export default defineConfig({
55
plugins: [solidPlugin()],
6+
server: {
7+
port: 3000,
8+
},
69
build: {
710
target: 'esnext',
8-
polyfillDynamicImport: false,
911
},
10-
});
12+
})

package.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
{
22
"name": "@monorepo/solid-spring",
33
"version": "0.0.0",
4+
"description": "Like react-spring, but for SolidJS",
5+
"info": "solid-spring is a spring-physics first animation library for SolidJS based on react-spring/core",
6+
"license": "MIT",
7+
"author": "M. Bagher Abiat",
8+
"contributors": [],
9+
"homepage": "https://github.com/aslemammad/solid-spring#readme",
410
"repository": {
511
"type": "git",
612
"url": "git+https://github.com/aslemammad/solid-spring.git"
713
},
8-
"license": "MIT",
914
"bugs": {
1015
"url": "https://github.com/aslemammad/solid-spring/issues"
1116
},
12-
"homepage": "https://github.com/aslemammad/solid-spring#readme",
13-
"description": "Like react-spring, but for SolidJS",
14-
"info": "solid-spring is a spring-physics first animation library for SolidJS based on react-spring/core",
15-
"contributors": [],
16-
"scripts": {},
1717
"keywords": [
1818
"best_ecosystem",
1919
"solidhack",
2020
"react-spring",
2121
"solid"
2222
],
23-
"author": "M. Bagher Abiat",
24-
"license": "MIT",
23+
"scripts": {},
2524
"devDependencies": {
26-
"@rollup/plugin-alias": "^3.1.9",
27-
"@rollup/plugin-commonjs": "^21.0.2",
28-
"@rollup/plugin-json": "^4.1.0",
29-
"@rollup/plugin-node-resolve": "^13.1.3",
30-
"esbuild": "^0.14.27",
31-
"rollup-plugin-esbuild": "^4.8.2"
25+
"prettier": "^3.0.0"
3226
}
3327
}

0 commit comments

Comments
 (0)