Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/ImJimmi/JIVE

The ultimate JUCE extension for building GUIs
https://github.com/ImJimmi/JIVE

cmake cpp17 declarative-ui gui juce no-dependencies reactive tdd ui

Last synced: about 1 month ago
JSON representation

The ultimate JUCE extension for building GUIs

Lists

README

        

![JIVE](.github/assets/banner.svg)


License: MIT










GitHub Repo stars


- [About](#about)
- [🧑‍💻 Improved Developer Experience](#-improved-developer-experience)
- [👷 Improved Architecture](#-improved-architecture)
- [Approach](#approach)
- [🧩 Layouts](#-layouts)
- [🎨 Style Sheets](#-style-sheets)
- [Integration](#integration)
- [CMake](#cmake)
- [Projucer](#projucer)
- [Getting Started](#getting-started)
- [Contributing](#contributing)

## About

JIVE is a bundle of [JUCE](https://github.com/juce-framework/JUCE) modules centered around the desire to have a more modern approach to UI development.

This approach is inspired by web front-ends where we write declarative markup (HTML) to define what components we have, style those components using style sheets (CSS), and then dynamically update those components at runtime using imperitive code (JavaScript). With JIVE however, all three of these layers are done using tools already available in JUCE - [`juce::ValueTree`](https://docs.juce.com/master/classValueTree.html) for markup, [`juce::var`](https://docs.juce.com/master/classvar.html)/[`juce::DynamicObject`](https://docs.juce.com/master/classDynamicObject.html) for style sheets, and regular old C++ for dynamically updating.

### 🧑‍💻 Improved Developer Experience

- Write less UI code than in a typical JUCE project.
- Write _better_ UI code that's more declarative and uses common terminology with other UI frameworks.
- Build ideas faster, with much shorter iterations between one design to another.
- No additional dependencies - built purely from the tools provided by JUCE.
- Less boilerplate and therefore less time wasted (and maybe even fewer bugs) when developing UI features.
- Easier onboarding for any team members unfamiliar with the querks and complexities of developing GUIs in JUCE.

### 👷 Improved Architecture

- Encourages the separation of the UI from the business logic that controls it.
- Encapsulates the JUCE backend enabling applications to interact with the UI through common data structures like value-trees and JSON documents.
- Specifically built to fit the [Model-view-presenter](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter) pattern - although flexible enough to suit any architecture.
- Inspired by front-end web libraries to more easily build design systems and share components.

## Approach

There are two main constituents to JIVE - [`jive_layouts`](jive_layouts/) and [`jive_style_sheets`](jive_style_sheets/). When used together, these modules completely overhaul the experience of building GUIs in JUCE by removing the boilerplate involved in writing [`Component`](https://docs.juce.com/master/classComponent.html) classes.

### 🧩 Layouts

`jive_layouts` addresses the hierarchy and layout of GUIs by allowing developers to describe their UI using value-trees.

Unlike in a typical JUCE application where most of your UI code is spent describing _how_ components are shown on the screen, JIVE's approach is inspired by HTML where we simply describe _what_ is on the screen.

Example

Example XML file that could be parsed to a `juce::ValueTree`

_Note that `juce::ValueTree` doesn't support inline text elements so these will need to be converted to `text` properties before parsing to a `juce::ValueTree`._

```xml


Welcome to JIVE!
The ultimate JUCE extension for building GUIs.



Home


About


Contact

```

### 🎨 Style Sheets

`jive_style_sheets` addresses the styling of GUIs by allowing developers to apply common style properties using JSON documents.

Inspired by CSS, JIVE's style sheets allow common styling properties like background colours, text colours, and font size to be set on any UI element, removing the need to use [`juce::Graphics`](https://docs.juce.com/master/classGraphics.html) for the majority of components.

Example

Example JSON document that could be parsed to a `jive::Object` and set as the top-level window's `style` property.

```json
{
"background": "#202020",
"foreground": "#EEEEEE",
"font-family": "Helvetica",

"#title": {
"font-size": "45",
"font-style": "bold",
},
"#subtitle": {
"font-size": "25",
"font-style": "italic",
},

"Button": {
"background": "#303030",
"border": "#FF3077",
},
}
```

## Integration

The simplest way to intergrate JIVE with your JUCE project is with [CPM](https://github.com/cpm-cmake/CPM.cmake):

```cmake
CPMAddPackage("gh:ImJimmi/JIVE@main")
```

If not using CPM, you should add JIVE as a submodule to your git repository:

```bash
git submodule add [email protected]:ImJimmi/JIVE.git
```

Or simply clone JIVE to use across multiple projects:

```bash
git clone [email protected]:ImJimmi/JIVE.git
```

### CMake

![CMake](https://img.shields.io/static/v1?logo=cmake&label=&message=CMake&style=for-the-badge&color=064F8C)

```cmake
add_subdirectory(path/to/JUCE)

# Recommended
CPMAddPackage("gh:ImJimmi/JIVE@main")

# If not using CPM
add_subdirectory(path/to/JIVE)

target_link_libraries(my_juce_project
PRIVATE
jive::jive_layouts
jive::jive_style_sheets
)

# Recommended if using both jive_layouts and jive_style_sheets
target_compile_definitions(my_juce_project
PRIVATE
JIVE_GUI_ITEMS_HAVE_STYLE_SHEETS=1
)
```

### Projucer

![Projucer](https://img.shields.io/static/v1?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAJLklEQVRIiYWXeXRU1R3HP+/NnkyWmUlCyEoWwhK2oICsYS1EKVBFliKKgFtrPXqqlVq1xbprq7VHAalG69IiKkIVCFsUZAk5kBAggaxk3zOZmcz6Zt7tHwOBWk/7O+e+d8697/w+5937W75XEkLlmgkECEACCXlwvslx5pY6+4lb2wcqJ3Z76rNc/i4bCMz6+L74iKz6RPOos1mWqfuHxU7+/rovFSFAkkBCGvQl/RhQksKwC117f36q9aOHKzq/njoQGCDBNpS0xHFYIlORJAm7u4XGtnN097URoYtg7JBbS6ck3/XO+CFLPwBQhfr/gOFFj2JP2XVp09+KG95daNDquTlpJXnpS0jU5xJokJB9ehAgTAEM2TKtAxWcb91LaccO3H4P+enrvr195MsbogxD6sNe+XEgSHQMXJq57czKr2v6KqLXjlvHwqzHgVzUVjjy/Df0NLcRDPrDO4GG9IkjmPHsXDBBK70c6XqVAydeJTMmx7fxph3LUqMnFN0IlW+EdXlqpv7p5PyjXe6K6FfmbyczppBtJ7IRQMeFCs4cKIYoBa1FRmuTwaxQcehbelxuuNJM0hM7WNv9G36x7BBdoUbjmyfm7m8fqJzDDVsqCxGG+YIu25bS5d96lFbeXLSPZvtGbtpSwoOFe9hwsJakhWMYMS0bv8uHpJGQJAnFp5A8MxdLQiSOXz9N0+ub6V22iqkHRvHI/DLcWjfvnF5yZCDQkwoSQoAsSWH67stP767urdBvnlNIWesipm4pRq9xkp2bSOHhaqqQKdg4C1eXE0kKA729A6TdNhlNRxMDZZcwzcvHHw0da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FhMXeuc8/6483vP3qha+/YQEghPnIEQ2NmE21IAsAV6KDDWUKn6yw6WUNuwqKq6an3vpWXeMfW8JmpV1X8/xDC1543Sv06+4n5dfbjt7W7Kif0eOpT3UpfLECEzuqIixjWkmgeVZ5lmbZvuHXW/uu+1BuuDdeB/wY8E3EZBoAa3AAAAABJRU5ErkJggg==&label=&message=Projucer&style=for-the-badge&color=555555)

Add modules to the project by clicking the "+" icon in the "Modules" panel and choosing "Add a module from a specified folder...".

## Getting Started

See [Getting Started](./docs/Getting%20Started.md) for a detailed guide on getting started with JIVE once you have it integrated in your project.

## Contributing

All contributions are welcome!

Please see the [Contribution Guidelines](./CONTRIBUTING.md) before submitting a PR. Be sure to check the [Issues Tab](https://github.com/ImJimmi/JIVE/issues) to avoid duplicates and to contribute to any ongoing conversation.