├── .eslintignore ├── .eslintrc.json ├── .github └── workflows │ ├── lint.yml │ └── npm-publish.yml ├── .gitignore ├── .npmignore ├── .size-snapshot.json ├── LICENSE ├── README.md ├── _screenshot.png ├── example ├── .npmignore ├── index.html ├── package.json ├── src │ ├── App.tsx │ ├── Badge.tsx │ ├── index.tsx │ └── styles.css ├── static │ ├── cube │ │ ├── nx.png │ │ ├── ny.png │ │ ├── nz.png │ │ ├── px.png │ │ ├── py.png │ │ └── pz.png │ └── suzanne.glb ├── tsconfig.json └── yarn.lock ├── package.json ├── src ├── data.ts ├── helpers.ts ├── index.ts ├── types.ts ├── useTweaks.ts └── utils.ts ├── tsconfig.json └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "react-app" 3 | } 4 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | types: [opened, synchronize] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* 15 | - run: yarn install --frozen-lockfile --check-files 16 | - uses: actions/cache@v1 17 | id: cache-build 18 | with: 19 | path: "." 20 | key: ${{ github.sha }} 21 | 22 | lint: 23 | runs-on: ubuntu-latest 24 | needs: build 25 | steps: 26 | - uses: actions/cache@v1 27 | id: restore-build 28 | with: 29 | path: "." 30 | key: ${{ github.sha }} 31 | - run: yarn eslint 32 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Release 5 | 6 | on: 7 | push: 8 | tags: 9 | - "v*" 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Set up Git repository 16 | uses: actions/checkout@v2 17 | - name: Setup Node 18 | uses: actions/setup-node@v1 19 | with: 20 | node-version: 12 21 | registry-url: https://registry.npmjs.org/ 22 | - name: Install deps and build 23 | run: yarn 24 | - name: Create a new release 25 | id: create_release 26 | uses: actions/create-release@v1.1.1 27 | env: 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | with: 30 | tag_name: ${{ github.ref }} 31 | release_name: ${{ github.ref }} 32 | body: | 33 | # Changes 34 | - TODO 35 | draft: true 36 | prerelease: false 37 | - name: Publish to NPM 38 | run: npm publish 39 | env: 40 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules/ 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | build/ 13 | dist/ 14 | .cache/ 15 | .parcel-cache/ 16 | 17 | # misc 18 | .DS_Store 19 | .env.local 20 | .env.development.local 21 | .env.test.local 22 | .env.production.local 23 | 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | example/ 4 | dist/ 5 | build/ 6 | Thumbs.db 7 | ehthumbs.db 8 | Desktop.ini 9 | $RECYCLE.BIN/ 10 | .DS_Store 11 | .vscode 12 | .docz/ 13 | package-lock.json 14 | coverage/ 15 | .idea 16 | yarn-error.log 17 | .size-snapshot.json 18 | pnpm-debug.log 19 | .parcel-cache 20 | pnpm-lock.yaml -------------------------------------------------------------------------------- /.size-snapshot.json: -------------------------------------------------------------------------------- 1 | { 2 | "index.js": { 3 | "bundled": 5666, 4 | "minified": 2810, 5 | "gzipped": 1163, 6 | "treeshaked": { 7 | "rollup": { 8 | "code": 1286, 9 | "import_statements": 107 10 | }, 11 | "webpack": { 12 | "code": 2424 13 | } 14 | } 15 | }, 16 | "index.cjs.js": { 17 | "bundled": 7679, 18 | "minified": 4114, 19 | "gzipped": 1447 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Poimandres 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | [](https://www.npmjs.com/package/use-tweaks)  [](https://discord.gg/ZZjjNvJ) 3 | 4 | Use [Tweakpane](http://cocopon.github.io/tweakpane/) in React apps 5 | 6 | ## Try it here on [Codesandbox](https://codesandbox.io/s/use-tweaks-example-ekqv2) 7 | 8 | ``` 9 | npm install tweakpane use-tweaks 10 | ``` 11 | 12 | ## Basic example 13 | 14 | ```jsx 15 | import { useTweaks } from "use-tweaks" 16 | 17 | function MyComponent() { 18 | const { speed, factor } = useTweaks({ 19 | speed: 1, 20 | factor: { value: 1, min: 10, max: 100 }, 21 | }); 22 | 23 | return ( 24 |
>
16 | }
17 |
18 | export const makeDirectory = makeFolder
19 |
20 | export function makeButton(title: string, onClick: () => void): Record