Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist
package-lock.json
coverage
.tgz
.changelog

# Differs on each engine
yalc.lock
Expand Down
227 changes: 187 additions & 40 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ const MY_FIRST_STATE = App.createState("Hello Friend!");
// And wolla, it's reactive. Everytime the State mutates the Component rerenders
const myFirstState = useAgile(MY_FIRST_STATE); // Returns value of State ("Hello Friend!")
```
To learn out more, check out our [Quick Start Guides](https://agile-ts.org/docs/Installation.md).
Want to learn more? Check out our [Quick Start Guides](https://agile-ts.org/docs/Installation.md).

### ⛳️ Sandbox
Test AgileTs yourself in a [codesandbox](https://codesandbox.io/s/agilets-first-state-f12cz).
It's only one click away. Just select your preferred Framework below.

- [React](https://codesandbox.io/s/agilets-first-state-f12cz)
- [React-Native](https://snack.expo.io/@bennodev/agilets-first-state)
- Vue (coming soon)
- [Vue](https://codesandbox.io/s/agilets-first-state-i5xxs)
- Angular (coming soon)

More examples can be found in the [Example Section](https://agile-ts.org/docs/examples).
Expand All @@ -76,22 +76,23 @@ More examples can be found in the [Example Section](https://agile-ts.org/docs/ex
<img src="https://raw.githubusercontent.com/agile-ts/agile/master/static/why_should_i_use_agile.png" alt="Why should I use AgileTs?"/>

AgileTs is a global, simple, well-tested State Management Framework implemented in Typescript.
It offers a reimagined API that focuses on **developer experience** and allows you to **quickly** and **easily** manage your States.
It offers a reimagined API that focuses on **developer experience**
and allows you to **easily** manage your States.
Besides States, AgileTs offers some other powerful APIs that make your life easier.
The philosophy behind AgileTs is simple:

### 🚅 Straightforward
Write minimalistic, boilerplate-free code that captures your intent.
```ts
MY_STATE.set('jeff'); // Update State value
MY_STATE.undo(); // Undo latest State value change
MY_STATE.is({hello: "jeff"}); // Check if State has the value '{hello: "jeff"}'
MY_STATE.watch((value) => {console.log(value);}); // Watch on State changes
```

**Some straightforward syntax examples:**
**Some more straightforward syntax examples:**

- Mutate and Check States with simple Functions
```ts
MY_STATE.undo(); // Undo latest change
MY_STATE.is({hello: "jeff"}); // Check if State has the Value '{hello: "jeff"}'
MY_STATE.watch((value) => {console.log(value);}); // Watch on State changes
```
- Store State in any Storage, like [Local Storage](https://www.w3schools.com/html/html5_webstorage.asp)
- Store State in any Storage, like the [Local Storage](https://www.w3schools.com/html/html5_webstorage.asp)
```ts
MY_STATE.persist("storage-key");
```
Expand All @@ -117,12 +118,12 @@ Write minimalistic, boilerplate-free code that captures your intent.
### ⛳️ Centralize

AgileTs is designed to take all business logic out of UI-Components and put them in a central place, often called `core`.
The benefit of keeping logic separate to UI-Components is to make your code more decoupled, portable, and above all, easily testable.
The benefit of keeping logic separate to UI-Components is to make your code more decoupled, portable, scalable, and above all, easily testable.

### 🎯 Easy to Use

Learn the powerful tools of AgileTs in a short amount of time. An excellent place to start are
our [Quick Start](https://agile-ts.org/docs/Installation) Guides, or if you don't like to follow any tutorials,
our [Quick Start Guides](https://agile-ts.org/docs/Installation), or if you don't like to follow any tutorials,
you can jump straight into our [Example](https://agile-ts.org/docs/examples/Introduction) Section.


Expand All @@ -132,14 +133,16 @@ you can jump straight into our [Example](https://agile-ts.org/docs/examples/Intr
<br />
<img src="https://raw.githubusercontent.com/agile-ts/agile/master/static/installation_header.png" alt="Installation"/>

To properly use AgileTs, in a UI-Framework, we need to install **two** packages.
In order to properly use AgileTs, in a UI-Framework, we need to install **two** packages.

- The _Core Package_, which acts as the brain of AgileTs and manages all your States
- The [`core`](https://agile-ts.org/docs/core) package, which contains the State Management Logic of AgileTs
and therefore offers powerful classes such as the [`State Class`](https://agile-ts.org/docs/core/state).
```
npm install @agile-ts/core
```

- and a _fitting Integration_ for your preferred UI-Framework. In my case, the [React Integration](https://www.npmjs.com/package/@agile-ts/react).
- And on the other hand, a _fitting Integration_ for your preferred UI-Framework.
In my case, the [React Integration](https://www.npmjs.com/package/@agile-ts/react).
Check [here](https://agile-ts.org/docs/frameworks) if your desired Framework is supported, too.
```
npm install @agile-ts/react
Expand All @@ -155,7 +158,7 @@ To properly use AgileTs, in a UI-Framework, we need to install **two** packages.
Sounds AgileTs interesting to you?
Checkout our **[documentation](https://agile-ts.org/docs/introduction)**, to learn more.
And I promise you. You will be able to use AgileTs in no time.
In case you have any further questions, don't hesitate to join our [Community Discord](https://discord.gg/T9GzreAwPH).
If you have any further questions, don't hesitate to join our [Community Discord](https://discord.gg/T9GzreAwPH).


<br />
Expand All @@ -165,7 +168,7 @@ In case you have any further questions, don't hesitate to join our [Community Di
<img src="https://raw.githubusercontent.com/agile-ts/agile/master/static/contribute_header.png" alt="Contribute"/>

Get a part of AgileTs and start contributing. We welcome any meaningful contribution. 😀
To find out more, check out the [CONTRIBUTING.md](https://github.com/agile-ts/agile/blob/master/CONTRIBUTING.md).
To find out more about contributing, check out the [CONTRIBUTING.md](https://github.com/agile-ts/agile/blob/master/CONTRIBUTING.md).

<a href="https://codeclimate.com/github/agile-ts/agile/coverage.svg">
<img src="https://codeclimate.com/github/agile-ts/agile/badges/gpa.svg" alt="Maintainability"/>
Expand All @@ -182,6 +185,7 @@ To find out more, check out the [CONTRIBUTING.md](https://github.com/agile-ts/ag
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| [@agile-ts/core](/packages/core) | [![badge](https://img.shields.io/npm/v/@agile-ts/core.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/core) | State Manager |
| [@agile-ts/react](/packages/react) | [![badge](https://img.shields.io/npm/v/@agile-ts/react.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/react) | React Integration |
| [@agile-ts/vue](/packages/vue) | [![badge](https://img.shields.io/npm/v/@agile-ts/vue.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/vue) | Vue Integration |
| [@agile-ts/api](/packages/api) | [![badge](https://img.shields.io/npm/v/@agile-ts/api.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/api) | Promise based API |
| [@agile-ts/multieditor](/packages/multieditor) | [![badge](https://img.shields.io/npm/v/@agile-ts/multieditor.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/multieditor) | Simple Form Manager |
| [@agile-ts/event](/packages/event) | [![badge](https://img.shields.io/npm/v/@agile-ts/event.svg?style=flat-square)](https://www.npmjs.com/package/@agile-ts/event) | Handy class for emitting UI Events |
Expand Down
23 changes: 23 additions & 0 deletions examples/vue/develop/my-project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
24 changes: 24 additions & 0 deletions examples/vue/develop/my-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# my-project

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Lints and fixes files
```
yarn lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions examples/vue/develop/my-project/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
45 changes: 45 additions & 0 deletions examples/vue/develop/my-project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "my-project",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"install:agile": "yalc add @agile-ts/core @agile-ts/vue & yarn install"
},
"dependencies": {
"@agile-ts/core": "file:.yalc/@agile-ts/core",
"@agile-ts/vue": "file:.yalc/@agile-ts/vue",
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Binary file not shown.
17 changes: 17 additions & 0 deletions examples/vue/develop/my-project/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
44 changes: 44 additions & 0 deletions examples/vue/develop/my-project/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png" />
<p>myState: {{ sharedState.myState }}</p>
<button v-on:click="changeMyState">Change State</button>
<HelloWorld msg="Welcome to Your Vue.js App with AgileTs!" />
</div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue';
import { MY_STATE } from '@/core';
import { generateId } from '@agile-ts/core';

export default {
name: 'App',
components: {
HelloWorld,
},
data: function () {
return {
...this.bindAgileInstances({
myState: MY_STATE,
}),
};
},
methods: {
changeMyState: function () {
MY_STATE.set(generateId());
},
},
};
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions examples/vue/develop/my-project/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h3>Simple TODO List</h3>
<input type='text' v-model='currentInput'>
<input type='submit' value='Add' @click='addTodo'>
<div v-for='todo in sharedState.todos' v-bind:key='todo.id' class='todoItem'>
<div>{{todo.name}}</div>
<button @click='removeTodo(todo.id)'>Remove</button>
</div>

</div>
</template>

<script>
import { TODOS } from '@/core';
import { generateId } from '@agile-ts/core';

export default {
name: 'HelloWorld',
props: {
msg: String
},
data: function () {
return {
...this.bindAgileInstances({
todos: TODOS
}),
currentInput: ''
};
},
methods: {
addTodo: function(){
if (this.currentInput === "") return;

// Add new Todo to the Collection based on the current Input
TODOS.collect({ id: generateId(), name: this.currentInput }, [], {
method: "unshift" // to add todo at the beginning of the Collection
});

this.currentInput = '';
},
removeTodo: function(id) {
// Remove Todo at specific primary Key
TODOS.remove(id).everywhere();
}
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 10px 0;
}

.todoItem {
margin-bottom: 10px;
}
</style>
15 changes: 15 additions & 0 deletions examples/vue/develop/my-project/src/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Agile, Logger } from '@agile-ts/core';
import vueIntegration from '@agile-ts/vue';

// Create Agile Instance
export const App = new Agile({
logConfig: { level: Logger.level.DEBUG },
}).integrate(vueIntegration);

// Create State
export const MY_STATE = App.createState('Hello World');

// Create Collection
export const TODOS = App.createCollection({
initialData: [{ id: 1, name: 'Clean Bathroom' }],
}).persist('todos');
8 changes: 8 additions & 0 deletions examples/vue/develop/my-project/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Vue from 'vue';
import App from './App.vue';

Vue.config.productionTip = false;

export default new Vue({
render: (h) => h(App),
}).$mount('#app');
Loading