Skip to content

Commit

Permalink
Remove deprecated jsxBracketSameLine (pmndrs#273)
Browse files Browse the repository at this point in the history
* Remove deprecated jsxBracketSameLine and run prettier (Fixes pmndrs#272)

* Try bracketSameLine
bjornstar authored Nov 23, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a8b2465 commit d4f630b
Showing 32 changed files with 117 additions and 116 deletions.
9 changes: 9 additions & 0 deletions .changeset/spotty-chefs-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'demo': patch
'leva': patch
'@leva-ui/plugin-bezier': patch
'@leva-ui/plugin-plot': patch
'@leva-ui/plugin-spring': patch
---

Removed deprecated prettier config: jsxBracketSameLine
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.changeset/
.codesandbox/
.github/
.husky/
.storybook/
.vscode/
.yarn/
dist/
node_modules/
patches/
storybook-static/
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

<a href=""><img src="https://raw.githubusercontent.com/gsimone/leva/master/hero.png" /></a>
<br />

<div align="center"><strong>A GUI you are going to lava.</strong></div>
<div align="center"> Customizable, extensible and beautiful by default.</div>
<br />
@@ -37,12 +38,16 @@ npm i leva
Simply call the `useControls` hook from anywhere in your app:

```jsx
import { useControls } from "leva"
import { useControls } from 'leva'

function MyComponent() {
const { name, aNumber } = useControls({ name: "World", aNumber: 0 })

return <div>Hey {name}, hello! {aNumber}</div>
const { name, aNumber } = useControls({ name: 'World', aNumber: 0 })

return (
<div>
Hey {name}, hello! {aNumber}
</div>
)
}
```

@@ -56,7 +61,6 @@ function MyComponent() {
- [Advanced: Controlled Inputs](/docs/advanced/controlled-inputs.md)
- [Advanced: Creating Plugins](/docs/advanced/creating-plugins.md)


## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
33 changes: 16 additions & 17 deletions code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
@@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
@@ -107,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
@@ -119,15 +118,15 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
[https://www.contributor-covenant.org/faq][faq]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
3 changes: 1 addition & 2 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

{
"baseUrl": "http://localhost:5000",
"defaultCommandTimeout": 10000,
"video": false
}
}
2 changes: 1 addition & 1 deletion cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
}
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@testing-library/cypress/add-commands';
import '@testing-library/cypress/add-commands'
4 changes: 2 additions & 2 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
// require('./commands')
6 changes: 2 additions & 4 deletions demo/serve.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"rewrites": [
{ "source": "/*", "destination": "/index.html" }
]
}
"rewrites": [{ "source": "/*", "destination": "/index.html" }]
}
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-advanced-panels/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-busy/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-custom-plugin/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-minimal/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-plugin-bezier/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
3 changes: 0 additions & 3 deletions demo/src/sandboxes/leva-plugin-bezier/src/App.tsx
Original file line number Diff line number Diff line change
@@ -6,9 +6,6 @@ import './style.css'
export default function App() {
const { curve } = useControls({ curve: bezier() })

//const a = [...curve]
console.log(...curve)

return (
<div className="App">
<div className="bezier-animated" style={{ animationTimingFunction: curve.cssEasing }} />
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-plugin-plot/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-plugin-spring/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-scroll/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-theme/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-transient/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 1 addition & 3 deletions demo/src/sandboxes/leva-ui/public/index.html
Original file line number Diff line number Diff line change
@@ -23,9 +23,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
4 changes: 2 additions & 2 deletions docs/advanced/creating-plugins.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Creating Plugins

@TODO
@TODO
This page will contain info on how to create custom plugins,
what even qualifies as a plugin, and an idea of what kinds of plugins could be included and maintained in this repo
what even qualifies as a plugin, and an idea of what kinds of plugins could be included and maintained in this repo
18 changes: 8 additions & 10 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -6,22 +6,20 @@ You can configure Leva by using the `<Leva>` component anywhere in your App:
import { Leva } from 'leva'

export default function MyApp() {

return (
<>
<Leva
theme={myTheme} // you can pass a custom theme (see the styling section)
fill // default = false, true makes the pane fill the parent dom node it's rendered in
flat // default = false, true removes border radius and shadow
oneLineLabels // default = false, alternative layout for labels, with labels and fields on separate rows
hideTitleBar // default = false, hides the GUI header
collapsed // default = false, when true the GUI is collpased
hidden // default = false, when true the GUI is hidden
theme={myTheme} // you can pass a custom theme (see the styling section)
fill // default = false, true makes the pane fill the parent dom node it's rendered in
flat // default = false, true removes border radius and shadow
oneLineLabels // default = false, alternative layout for labels, with labels and fields on separate rows
hideTitleBar // default = false, hides the GUI header
collapsed // default = false, when true the GUI is collpased
hidden // default = false, when true the GUI is hidden
/>
</>
)

}
```

- TODO // Add default config for LevaPanel as well
- TODO // Add default config for LevaPanel as well
2 changes: 1 addition & 1 deletion docs/special-inputs.md
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@

### Button

### Monitor
### Monitor
2 changes: 1 addition & 1 deletion docs/styling.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Customizing Style

@todo
@todo
Talk about how to use themes to customize styles
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -97,10 +97,10 @@
"typescript": "4.5.2"
},
"prettier": {
"bracketSameLine": true,
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"jsxBracketSameLine": true,
"tabWidth": 2,
"printWidth": 120
}
2 changes: 1 addition & 1 deletion packages/leva/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ export function createPlugin<Input, Value, InternalSettings>(plugin: Plugin<Inpu
const type = getUniqueType()
Plugins[type] = plugin
return (input?: PluginInput<Input>) => {
return ({ type, __customInput: input } as unknown) as CustomInput<Value>
return { type, __customInput: input } as unknown as CustomInput<Value>
}
}

30 changes: 17 additions & 13 deletions packages/leva/stories/inputs/Boolean.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
import React from 'react';
import { Story, Meta } from '@storybook/react';
import React from 'react'
import { Story, Meta } from '@storybook/react'

import Reset from '../components/decorator-reset'

import { useControls } from '../../src';
import { useControls } from '../../src'

export default {
title: 'Inputs/Boolean',
decorators: [Reset]
} as Meta;
decorators: [Reset],
} as Meta

const Template: Story<any> = (args) => {
const values = useControls({
foo: args,
})

return <div><pre>{JSON.stringify(values, null, ' ')}</pre></div>;

return (
<div>
<pre>{JSON.stringify(values, null, ' ')}</pre>
</div>
)
}

export const Default = Template.bind({});
export const Default = Template.bind({})
Default.args = {
value: false
};
value: false,
}

export const Checked = Template.bind({});
export const Checked = Template.bind({})
Checked.args = {
value: true
};
value: true,
}
24 changes: 14 additions & 10 deletions packages/leva/stories/inputs/String.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import React from 'react';
import { Story, Meta } from '@storybook/react';
import React from 'react'
import { Story, Meta } from '@storybook/react'

import Reset from '../components/decorator-reset'

import { useControls } from '../../src';
import { useControls } from '../../src'

export default {
title: 'Inputs/String',
decorators: [Reset]
} as Meta;
decorators: [Reset],
} as Meta

const Template: Story<any> = (args) => {
const values = useControls({
foo: args,
})

return <div><pre>{JSON.stringify(values, null, ' ')}</pre></div>;

return (
<div>
<pre>{JSON.stringify(values, null, ' ')}</pre>
</div>
)
}

export const Simple = Template.bind({});
export const Simple = Template.bind({})
Simple.args = {
value: "Leva is awesome"
};
value: 'Leva is awesome',
}
8 changes: 4 additions & 4 deletions packages/plugin-bezier/README.md
Original file line number Diff line number Diff line change
@@ -9,22 +9,22 @@ npm i @leva-ui/plugin-plot
### Quick start

```jsx
import { useControls } from "leva"
import { bezier } from "@leva-ui/plugin-bezier"
import { useControls } from 'leva'
import { bezier } from '@leva-ui/plugin-bezier'

function MyComponent() {
const { curve } = useControls({ curve: bezier() })
// or
const { curve } = useControls({ curve: bezier([0.54, 0.05, 0.6, 0.98]) })
// or
const { curve } = useControls({ curve: bezier('in-out-quadratic') })
// or
// or
const { curve } = useControls({ curve: bezier({ handles: [0.54, 0.05, 0.6, 0.98], graph: false }) })

// built-in function evaluation
console.log(curve.evaluate(0.3))

// inside a css like animation-timing-function
return <div style={{animationTimingFunction: value.cssEasing}} />
return <div style={{ animationTimingFunction: value.cssEasing }} />
}
```
6 changes: 3 additions & 3 deletions packages/plugin-plot/README.md
Original file line number Diff line number Diff line change
@@ -9,11 +9,11 @@ npm i @leva-ui/plugin-plot
### Quick start

```jsx
import { useControls } from "leva"
import { plot } from "@leva-ui/plugin-plot"
import { useControls } from 'leva'
import { plot } from '@leva-ui/plugin-plot'

function MyComponent() {
const { y } = useControls({ y: plot({ expression: 'cos(x)', graph: true, boundsX: [-10,10], boundsY: [0, 100] }) })
const { y } = useControls({ y: plot({ expression: 'cos(x)', graph: true, boundsX: [-10, 10], boundsY: [0, 100] }) })
return y(Math.PI)
}
```
4 changes: 2 additions & 2 deletions packages/plugin-spring/README.md
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ npm i @leva-ui/plugin-spring
### Quick start

```jsx
import { useControls } from "leva"
import { spring } from "@leva-ui/plugin-spring"
import { useControls } from 'leva'
import { spring } from '@leva-ui/plugin-spring'

function MyComponent() {
const { mySpring } = useControls({ mySpring: spring({ tension: 100, friction: 30, mass: 1 }) })

0 comments on commit d4f630b

Please sign in to comment.