Skip to content

Commit

Permalink
Prep for release (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie authored Jan 10, 2023
1 parent 6596d1b commit d535e4b
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 200 deletions.
12 changes: 2 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@

## [unreleased]

- #1:

- don't install a tracker for non reactive atoms

- allow new options, fixing bug with clerk server

## 0.1.0

First real release!

- Added full complement of components
- Published fleshed-out documentation notebook at https://leva.mentat.org
First real release! Leva.cljs has compatibility with almost everything in Leva,
as explored in the interactive documentation notebook at https://leva.mentat.org.
63 changes: 54 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,71 @@
[![cljdoc badge](https://cljdoc.org/badge/org.mentat/leva.cljs)](https://cljdoc.org/d/org.mentat/leva.cljs/CURRENT)
[![Clojars Project](https://img.shields.io/clojars/v/org.mentat/leva.cljs.svg)](https://clojars.org/org.mentat/leva.cljs)

[Leva][LEVA] is TODO blurb!
[Leva][LEVA] is a JavaScript library for building declarative GUIs with many
different input types, like the one hovering on the right side of this page.
Supported inputs range from numeric sliders and color pickers to complex plugins
like this [Bezier curve
example](https://leva.pmnd.rs/?path=/story/plugins-bezier--default-bezier).

[Leva.cljs](https://github.com/mentat-collective/leva.cljs) extends
Leva with a [React][REACT] / [Reagent][REAGENT] component... TODO!
[Leva.cljs](https://github.com/mentat-collective/leva.cljs) extends Leva with a
set of [React][REACT] / [Reagent][REAGENT] components that make it easy to
synchronize the state of the GUI with a [ClojureScript
atom](https://clojure.org/reference/atoms).

<p align="center">
<img width="283" alt="image" src="https://user-images.githubusercontent.com/69635/211684081-b28bb03e-c6fe-43a3-ad9b-f802901667bb.png">
</p>

Think of your GUI like an interactive, beautiful view onto your page's state.

## Quickstart

Install `leva.cljs` into your Clojurescript project using the instructions at
Install `Leva.cljs` into your Clojurescript project using the instructions at
its Clojars page:

[![Clojars
Project](https://img.shields.io/clojars/v/org.mentat/leva.cljs.svg)](https://clojars.org/org.mentat/leva.cljs)
[![Clojars Project](https://img.shields.io/clojars/v/org.mentat/leva.cljs.svg)](https://clojars.org/org.mentat/leva.cljs)

Or grab the most recent code using a Git dependency:

```clj
;; deps
{io.github.mentat-collective/leva.cljs
{:git/sha "$GIT_SHA"}}
```

Require `leva.core` in your namespace:

```clj
(ns my-app
(:require [leva.core :as leva]))
(:require [leva.core :as leva]
[reagent.core :as reagent]))
```

Declare some state that you'd like to control with a GUI. Each entry's key
becomes its label, and Leva infers the correct input from the value's type.

```clj
(defonce !synced
(reagent/atom
{:number 10
:color {:r 10 :g 12 :b 4}
:string "Hi!"
:point {:x 1 :y 1}}))
```

Pass the atom to the `leva/Controls` component via the `:atom` key to add its
entries to the Leva panel hovering on the right, and bidirectionally bind its
state to the interactive state in the panel:

```clj
[leva/Controls
{:folder {:name "Quickstart"}
:atom !synced}]
```

TODO demo!
<p align="center">
<img width="500" alt="image" src="https://user-images.githubusercontent.com/69635/211684473-cb933085-4a33-41c6-aeab-d95051257501.gif">
</p>

See the project's [interactive documentation notebook](https://leva.mentat.org)
for more guides and examples.
Expand All @@ -40,7 +84,8 @@ you'd like to edit or play with the documentation, you'll need to install
- The [clojure command line tool](https://clojure.org/guides/install_clojure)
- [Babashka](https://github.com/babashka/babashka#installation)

Once this is done, run this command in one terminal window to build and serve the custom JS required by the notebook:
Once this is done, run this command in one terminal window to build and serve
the custom JS required by the notebook:

```
bb dev-notebook
Expand Down
Loading

0 comments on commit d535e4b

Please sign in to comment.