Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit adea6d1

Browse files
authored
Merge pull request #26 from agile-ts/develop
Develop
2 parents 38cd6d0 + 22dbc59 commit adea6d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2601
-1325
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SKIP_PREFLIGHT_CHECK=true
2+
BROWSER=chrome

docs/Interfaces.md

Lines changed: 396 additions & 147 deletions
Large diffs are not rendered by default.

docs/examples/react/All.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/examples/react/All.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: all
3+
title: React Examples
4+
sidebar_label: All
5+
slug: /examples/react
6+
---
7+
8+
:::warning
9+
10+
WIP Docs!
11+
12+
:::
13+
14+
export const CodeSandBoxEmbed = ({ uri, height }) => (
15+
<iframe
16+
src={`https://codesandbox.io/embed/${uri}?fontsize=14&hidenavigation=0&theme=dark&view=preview`}
17+
title={"Code Sandbox"}
18+
style={{width: "100%", height: height || 500, borderRadius: 4, borderColor: "#6c69a0", overflow: "hidden"}}
19+
allow={
20+
"geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
21+
}
22+
sandbox={
23+
"allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
24+
}
25+
/>
26+
);
27+
28+
## 😎 First State
29+
30+
<CodeSandBoxEmbed uri={"agilets-first-state-f12cz"}/>
31+
32+
33+
## 📝 Multieditor
34+
35+
<CodeSandBoxEmbed uri={"multieditor-yxt4x"} height={800}/>

docs/main/Installation.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,23 @@ slug: /installation
77

88
AgileTs is essentially a set of npm [packages](https://github.com/agile-ts/agile/tree/master/packages) that can be installed over [npm](https://www.npmjs.com/).
99

10-
## 🔑 Requirements
10+
### 🔑 Requirements
1111

1212
- [Node.js](https://nodejs.org/en/) version >= 10.15.1 or above (which can be checked by running `node -v`)
1313

14-
<br />
15-
16-
---
17-
18-
<br />
19-
20-
## 🚀 Quick Start
14+
### 🚀 Quick Start
2115

2216
To make your start as easy as possible, we have created some quick guides.
23-
You can follow these guides to get AgileTs up and running in your environment
24-
without wasting time.
17+
You can follow these to get AgileTs up and running in your environment
18+
without wasting any time.
2519

2620
- [React](../quick_start/React.md)
2721
- Vue (coming soon)
2822
- Angular (coming soon)
2923

30-
<br />
31-
32-
---
33-
34-
<br />
35-
36-
## 🗂 Packages
24+
### 🗂 Packages
3725

38-
Here are links to the separate installation guides for all AgileTs packages.
26+
Here are links to separate installation guides for all AgileTs packages.
3927

4028
- [Core](../packages/core/Installation.md)
4129
- [React](../packages/react/Installation.md)

docs/main/Introduction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ The philosophy behind AgileTs is simple:
3737
Write minimalistic, boilerplate free code that captures your intent.
3838

3939
**Some straightforward syntax examples:**
40-
- Store State in the Local Storage
40+
- Store State in any Storage, like [Local Storage](https://www.w3schools.com/html/html5_webstorage.asp)
4141
```ts
4242
MY_STATE.persist("storage-key")
4343
```
44-
- Create reactive Collection of States
44+
- Create reactive Array of States
4545
```ts
4646
const MY_COLLECTION = App.Collection();
4747
MY_COLLECTION.collect({id: 1, name: "Frank"});
@@ -60,8 +60,8 @@ Write minimalistic, boilerplate free code that captures your intent.
6060
- Has **no** external dependencies
6161

6262
### 🌌 Centralize
63-
Manage your Application Logic in a central place outside any UI-Framework.
64-
This makes your code more decoupled, portable, and above all, easily testable.
63+
Manage your Application Logic in a central place outside of any UI-Framework.
64+
This makes your code more decoupled, portable, and above all easy testable.
6565

6666
### 🎯 Easy to Use
6767
Learn the powerful tools of AgileTs in a short amount of time.

docs/main/StyleGuide.md

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ slug: /style-guide
77

88
:::note
99

10-
**AgileTs isn't bound to any specific Style-Guide**, but there are some you may get inspiration from.
10+
**AgileTs isn't bound to any specific Style-Guide**, but there are some you may get inspired from.
1111

1212
:::
1313

14-
To give you an idea of possible structures of applications using AgileTs as a state management framework,
15-
we have prepared some inspirations for you.
16-
Feel free to pick and tweak one to your needs.
14+
To give you an idea of possible structures for applications using AgileTs as a state management framework,
15+
we have prepared some inspiration guides for you.
16+
Feel free to choose one of them and adapt it to your needs.
1717

1818
## 🚀 Inspiration 1
1919

20-
In this Style-Guide, we have a so-called `core` at the top level of our `src` folder beside our UI-Components.
21-
This `core` is thought to be the brain of our application and should contain all business logic
22-
and logic, in general, that isn't specifically bound to a Component.
23-
This outsourcing of our Logic makes our code more decoupled,
24-
portable, and above all, easily testable.
20+
In this Style-Guide, we have a so-called `core` at the top-level of our `src` folder beside our UI-Components.
21+
The `core` is thought to be the brain of our application and should contain all business logic
22+
and logic in general, that isn't specifically bound to a Component.
23+
This outsourcing of our logic makes our code more decoupled,
24+
portable, and above all easy testable.
2525

26-
Below you can see where our `core` might be located.
26+
Below you can see where our `core` should be located.
2727

2828
```js {3} title="MyApp"
2929
my-app
@@ -33,9 +33,9 @@ my-app
3333
.
3434
```
3535

36-
To represent the `core` visually, I use one of a simple **TODO-Application**.
37-
Which has two main [Entities](#📁-entities), that can be handled by AgileTs.
38-
The **User** and of course the **TODO**-Item. These two parts are mapped in our `core`.
36+
To represent the `core` for a better understanding visual, I use one of a TODO application.
37+
This application has two main [Entities](#📁-entities), that can be handled by AgileTs.
38+
The **User** and of course the **TODO-Item**. These two parts are mapped in our `core`.
3939

4040
```js title="TodoList-Core"
4141
core
@@ -58,6 +58,7 @@ core
5858
|── index.ts
5959
.
6060
```
61+
Each property that you can find in the above shown graph, is described in detail below ⬇️.
6162

6263
## 📁 api
6364

@@ -95,7 +96,7 @@ A _User Entity_ should only treat the whole logic of the User and shouldn't do r
9596
### 📝 index.ts
9697

9798
Here we just export all [actions](#📝-.action.ts), [routes](#📝-.routes.ts), [interfaces](#📝-.interface.ts) and
98-
the [controller](#📝-.controller.ts). To properly import them in the UI-Layer later.
99+
the [controller](#📝-.controller.ts). To properly import them in our UI-Layer later.
99100

100101
```ts title="index.ts in 📁todo"
101102
import * as actions from "./todo.actions";
@@ -167,7 +168,7 @@ If you are a [Typescript](https://www.typescriptlang.org/) user, you properly wa
167168
These interfaces belonging to this entity should be defined here.
168169

169170
**For instance** <br />
170-
In case of the TODO-Entity, it should contain a _TodoInterface_.
171+
In case of the TODO-Entity, it contains a _TodoInterface_.
171172

172173
```ts title="todo.interface.ts in 📁todo"
173174
export interface TodoInterface {
@@ -181,9 +182,9 @@ export interface TodoInterface {
181182
### 📝 .routes.ts
182183

183184
To communicate to our server, we have to create [rest calls](https://en.wikipedia.org/wiki/Representational_state_transfer).
184-
For better maintainability, the rest calls should be provided here in function form.
185-
These function shaped rest calls should only be used in [actions](#📝-.action.ts).
186-
It's not recommended calling them from outside the Entity.
185+
For better maintainability, these rest calls are provided here in function shape
186+
and should only be used in [actions](#📝-.action.ts) of the Entity.
187+
It's not recommended calling them from outside the corresponding Entity.
187188

188189
```ts title="todo.routes.ts in 📁todo"
189190
import {TodoInterface} from "./todo.interface";
@@ -207,8 +208,8 @@ export const ADD_TODO = async (payload: AddTodoPayloadInterface): Promise<TodoIn
207208

208209
In this file, we create our main `Agile Instance` and configure it to meet our needs.
209210
For example, we determine here with which UI framework AgileTs works together.
210-
States, Collections, etc. can then be created from this `Agile Instance`.
211-
**It's not recommended having multiple main Agile Instances in one Application.**
211+
States, Collections, etc. then can be created with help of this Instance.
212+
**It's not recommended having multiple `Agile Instances` in one Application!!**
212213

213214
```ts title="app.ts"
214215
import {Agile} from "@agile-ts/core";
@@ -219,8 +220,9 @@ export const App = new Agile({logJobs: true}).use(reactIntegration);
219220

220221
## 📝 index.ts
221222

222-
Here we export our `core` entities so that we can reach each entity without any problems.
223-
Now we are able to just import our `core` and mutate each entity from it like `core.todo.addTodo(/**/)`.
223+
Here we export our `core` entities so that each entity can be reached without any detours.
224+
For instance, we might import the `core` in our UI-Layer.
225+
There we than just import our `core` and mutate each entity from it like `core.todo.addTodo(/* */)`.
224226

225227
```ts title="index.ts"
226228
import todo from "./controllers/todo";
@@ -236,4 +238,23 @@ const core = {
236238
globalBind("__core__", core);
237239

238240
export default core;
239-
```
241+
```
242+
243+
244+
245+
<br />
246+
247+
---
248+
249+
<br />
250+
251+
252+
253+
## 🚀 Inspiration 2
254+
255+
:::note
256+
257+
Feel free to share your own structure here.
258+
Every contribution is welcome. :D
259+
260+
:::

docs/packages/core/Introduction.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ slug: /core
2323

2424
The `core` package is the brain of AgileTs.
2525
Nearly everything that is related to AgileTs depends on this package.
26-
The main reason for this is that it includes the main Instance of AgileTs,
26+
It includes the main Instance of AgileTs,
2727
the `Agile Class` here called `App`.
2828
```ts
2929
const App = new Agile();
@@ -32,10 +32,11 @@ In summary, the main tasks of the `Agile Class` are to
3232
- manage and store our Agile Sub Instances ([State](./features/state/Introduction.md), ..)
3333
- ingest changes into the Runtime
3434
- trigger rerender on Integrations like [React](../react/Introduction.md)
35+
- Store values in any [Storage](./features/storage/Introduction.md)
3536

3637
As you can guess each application uses AgileTs has to install
37-
the `core` package and instantiate such an `Agile Class`.
38-
To get some inspiration where to instantiate our `Agile Class`, checkout the [style guide](../../main/StyleGuide.md).
38+
this package and instantiate such an `Agile Class`.
39+
To get some inspiration where to instantiate the `Agile Class`, checkout the [style guide](../../main/StyleGuide.md).
3940
Beside the `Agile Class` the `core` holds some other useful classes which are
4041
listed below. But each of these classes depends in some kind on the `Agile Class`.
4142

@@ -57,7 +58,7 @@ MY_COLLECTION.remove(1).everywhere(); // Remove Data at primary Key '1' from Col
5758
```
5859

5960
### 🤖 [Computed](./features/state/Introduction.md)
60-
A Computed is an extension of the State Class, it does auto compute its value depending on other Instances.
61+
A Computed is an extension of the `State Class`, it does automatically compute its value depending on other Instances.
6162
```ts
6263
const MY_COMPUTED = App.createComputed(() => (MY_STATE_1.value + MY_STATE_2.value));
6364
```

docs/packages/core/features/agile-instance/Introduction.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ WIP docs!
1111

1212
:::
1313

14-
The `Agile Class` is the foundation of AgileTs,
15-
nearly everything related to AgileTs depends in some kind on it.
14+
The `Agile Class` is the foundation of AgileTs, everything related to AgileTs depends on this class in different ways.
1615
```ts
1716
const App = new Agile();
1817
```
19-
Each created Agile Instance should be unique to our application,
20-
and we should avoid having multiple from these in one application.
21-
The Agile Instance can be seen as the store, which offers many powerful features
22-
to mutate and work with the stored Instances.
23-
Such Instances can be created with help of the Agile Instance and get automatically stored in it.
18+
It can be seen as the store of your application, because each `Agile Sub Instance` (ASI) gets stored and manged by it.
19+
The `Agile Class` doesn't contain these ASI's internally, but each ASI contains a reference to the main `Agile Class`.
20+
Here are some examples of Agile Sub Instances (ASI):
21+
2422
- [State](../state/Introduction.md)
2523
```ts
2624
const MY_STATE = App.createState("Hello there");
@@ -37,10 +35,19 @@ Such Instances can be created with help of the Agile Instance and get automatica
3735
```ts
3836
const MY_EVENT = App.createEvent();
3937
```
38+
39+
These ASI's are created with the help of an `Agile Instance` and get automatically bound to it.
40+
In summary, the main tasks of an instantiated `Agile Class` (Agile Instance) are to:
41+
- manage and store Agile Sub Instances ([State](../state/Introduction.md), ..)
42+
- ingest changes into the Runtime
43+
- trigger rerender on Integrations like [React](../../../react/Introduction.md)
44+
- permanently save values in any [Storage](../storage/Introduction.md)
45+
46+
Be aware that each application using AgileTs should only have **one** `Agile Instance`.
4047

4148
## 📭 Props
4249

43-
`Agile` takes an optional configuration object as its only parameter.
50+
The `Agile Class` takes an optional configuration object as its only parameter.
4451
```ts
4552
const App = new Agile({
4653
logConfig: {
@@ -64,8 +71,6 @@ export interface CreateAgileConfigInterface {
6471
The `logConfig` is thought to configure the Logger of AgileTs.
6572
The Agile Logger simply logs important events in the console, like warnings or errors,
6673
but it also logs runtime events if this is desired.
67-
So for instance here we can configure if we want to log all messages or
68-
only warnings.
6974
```ts
7075
const App = new Agile({
7176
logConfig: {
@@ -79,8 +84,8 @@ To find out more about possible configuration options, checkout the [CreateLogge
7984

8085
### `localStorage`
8186

82-
Defines whether AgileTs creates an interface to the `localStorage` for us.
83-
If we have decided to use the local storage, each Agile Sub Instance we
87+
Defines whether AgileTs should create an interface to the `localStorage` for us or not.
88+
If we have decided to use the [Local Storage](https://www.w3schools.com/html/html5_webstorage.asp), each Agile Sub Instance we
8489
persist, gets stored into the `localStorage` by default.
8590
```ts
8691
const App = new Agile({
@@ -89,14 +94,14 @@ const App = new Agile({
8994
```
9095
Of course, we aren't limited to the `localStorage`.
9196
We are able to create an Interface to any [Storage](../storage/Introduction.md) we want.
92-
For instance is this necessary in the Mobile Environment, because there
93-
the `localStorage` doesn't exists. With `App.registerStorage()` we can register our own [Storage](../storage/Introduction.md).
97+
For instance is this necessary in a Mobile Environment,
98+
because there the `localStorage` doesn't exists. With `App.registerStorage()` we can register our own [Storage](../storage/Introduction.md).
9499

95100
### `waitForMount`
96101

97-
With this flag we can determine
98-
whether AgileTs should wait until unmounted
99-
components are mounted before rerendering them.
102+
With this flag we can determine,
103+
if AgileTs should wait until unmounted
104+
components get mounted before rerendering them.
100105
```ts
101106
const App = new Agile({
102107
waitForMount: false // default true
@@ -108,9 +113,10 @@ const App = new Agile({
108113

109114
The `Agile Class` is almost 100% typesafe.
110115

116+
111117
## 🗺 Where to instantiate?
112118

113-
We can instantiate the Agile Instance of our application where ever we want.
119+
We can instantiate the `Agile Class` where ever we want.
114120
Directly in our Component, in a separate file or on paper.
115121
It doesn't matter as long as we can work with it.
116-
There are a few [Style Guides](../../../../main/StyleGuide.md) which might help us with such hard decision.
122+
There are a few [Style Guides](../../../../main/StyleGuide.md) which might help us with such hard decision.

0 commit comments

Comments
 (0)