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

Commit dff9f54

Browse files
authored
Merge pull request #92 from agile-ts/develop
Optimized docs
2 parents 6580884 + 992bec7 commit dff9f54

File tree

51 files changed

+925
-836
lines changed

Some content is hidden

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

51 files changed

+925
-836
lines changed

docs/Interfaces.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ During the overwrite process, the following properties are overwritten:
102102

103103
Whether to apply the State value changes to the corresponding external [Storage/s](packages/core/api/storage/Introduction.md).
104104
```ts {1}
105-
const MY_STATE = App.creacteState('jeff').persist('storageKey');
105+
const MY_STATE = createState('jeff').persist('storageKey');
106106
// Storage at 'storageKey': 'jeff'
107107
MY_STATE.set("hans", {storage: true});
108108
// Storage at 'storageKey': 'hans'
@@ -188,7 +188,7 @@ or _updating the persisted State value in the corresponding external Storage_.
188188

189189
When set to `true`, the Job is forced through the `runtime` no matter what happens.
190190
```ts {7}
191-
const MY_STATE = App.createState('myValue');
191+
const MY_STATE = createState('myValue');
192192

193193
// Won't be executed by the runtime because the State value hasn't changed
194194
MY_STATE.set('myValue');
@@ -275,7 +275,7 @@ export interface PatchConfigInterface extends StateIngestConfigInterface {
275275

276276
If `true`, new properties are added to the State value, although they might not yet be present there.
277277
```ts {2,4}
278-
const MY_STATE = App.createState({id: 1, name: "frank"});
278+
const MY_STATE = createState({id: 1, name: "frank"});
279279
MY_STATE.patch({location: "Germany"}, {addNewProperties: false});
280280
MY_STATE.value; // Returns {id: 1, name: "frank"}
281281
MY_STATE.patch({location: "Germany"}, {addNewProperties: true});
@@ -395,7 +395,7 @@ We recommend giving each Group a unique `key` since it has only advantages:
395395

396396
Defines whether the Group is a `placeholder`.
397397
```ts
398-
const MY_GROUP = App.createGroup([1, 2, 3], {
398+
const MY_GROUP = createGroup([1, 2, 3], {
399399
isPlaceholder: true
400400
});
401401

@@ -463,7 +463,7 @@ We recommend giving each Selector a unique `key` since it has only advantages:
463463

464464
Defines whether the Selector is a `placeholder`.
465465
```ts
466-
const MY_SELECTOR = App.creaateSelector(1, {
466+
const MY_SELECTOR = MY_COLLECTION.createSelector(1, {
467467
isPlaceholder: true
468468
});
469469

@@ -522,7 +522,7 @@ if we collect a data object with an already existing `primaryKey` in order to up
522522

523523
If `true`, the passed data object is merged into the found Item data instead of overwriting it entirely.
524524
```ts {6,9}
525-
const MY_COLLECTION = App.createCollection({
525+
const MY_COLLECTION = createCollection({
526526
initialData: [{id: 1, name: 'frank', age: 10}]
527527
});
528528

docs/examples/react/Introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ slug: /examples/react
2323

2424
## 👾 Performance
2525
- [Large State](./react/large-state)
26+
- [Large Collection](./react/large-collection)
2627
- [Frequent Updates](./react/frequent-updates)
2728

2829
You can get an overview of all performance examples in [this](https://github.com/agile-ts/performance-compare) repository
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: large-collection
3+
title: Large Collection
4+
sidebar_label: Large Collection
5+
slug: /examples/react/large-collection
6+
---
7+
8+
import {CodeSandBoxEmbed} from "../../../../src/components/docs/CodeSandBoxEmbed";
9+
10+
<CodeSandBoxEmbed uri={'agilets-large-collection-1kr4z'} />
11+
12+
[Back](../react)

docs/examples/react/examples/LargeState.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ slug: /examples/react/large-state
77

88
import {CodeSandBoxEmbed} from "../../../../src/components/docs/CodeSandBoxEmbed";
99

10-
<CodeSandBoxEmbed uri={'agilets-large-state-1kr4z'} />
10+
<CodeSandBoxEmbed uri={'agilets-large-state-pyo63'} />
1111

1212
[Back](../react)

docs/main/Installation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ Below you find quick start guides for already supported UI-Frameworks.
2121

2222
- [React / React-Native](../quick_start/React.md)
2323
- [Vue](../quick_start/Vue.md)
24-
- Angular (coming soon)
2524

2625
### 📁 Packages
2726

28-
Separate installation guides for single AgileTs packages.
27+
Separate installation guides for particular AgileTs packages.
2928

3029
- [@agile-ts/core](../packages/core/Installation.md)
3130
- [@agile-ts/react](../packages/react/Installation.md)

docs/main/Introduction.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ slug: /introduction/
2121
<br />
2222
<br />
2323

24+
:::info
25+
26+
Want to get a quick overview of AgileTs?
27+
Checkout the [AgileTs Introduction Blogpost](https://dev.to/bennodev19/createstate-introducing-agilets-a-flexible-state-manager-91f).
28+
29+
:::
30+
2431
## 👋 Introduction {#introduction}
2532

2633
AgileTs is a global State and Logic Library implemented in Typescript.
2734
It offers a reimagined API that focuses on **developer experience**
2835
and allows you to **easily** and **flexible** manage your application States.
2936
Besides [States](../packages/core/api/state/Introduction.md),
30-
AgileTs offers some other powerful APIs that make your life easier,
37+
AgileTs offers some other powerful and tree shakable APIs that make your life easier,
3138
such as [Collections](../packages/core/api/collection/Introduction.md)
3239
and [Computed States](../packages/core/api/computed/Introduction.md).
3340
The philosophy behind AgileTs is simple:
@@ -36,19 +43,19 @@ The philosophy behind AgileTs is simple:
3643

3744
Write minimalistic, boilerplate-free code that captures your intent.
3845
```ts
39-
// Create State with inital value 'frank'
46+
// Create State with the inital value 'frank'
4047
const MY_STATE = createState('frank');
4148

42-
// Update State value from 'frank' to 'jeff'
49+
// Update the State value from 'frank' to 'jeff'
4350
MY_STATE.set('jeff');
4451

45-
// Undo latest State value change
52+
// Undo the latest State value change
4653
MY_STATE.undo();
4754

48-
// Reset State value to its initial value
55+
// Reset the State value to its initial value
4956
MY_STATE.reset();
5057

51-
// Permanently store State value in an external Storage
58+
// Permanently store the State value in an external Storage
5259
MY_STATE.persist("storage-key");
5360
```
5461

@@ -111,7 +118,6 @@ It's only one click away. Just select your preferred UI-Framework below.
111118
- [React](https://codesandbox.io/s/agilets-first-state-f12cz)
112119
- [React-Native](https://snack.expo.io/@bennodev/agilets-first-state)
113120
- [Vue](https://codesandbox.io/s/agilets-first-state-i5xxs)
114-
- Angular (coming soon)
115121

116122
More examples can be found in the [Example section](../examples/Introduction.md).
117123

docs/main/StyleGuides.md

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Feel free to choose one of them and adapt it to your needs.
3737
## 🚀 Inspiration 1
3838

3939
The `Style Guide 1` is intended for **smaller and medium size applications**
40-
with about `1-3` entities. In AgileTs, `entities` are things with distinct
41-
and independent existence like users, posts, or todos.
40+
with about `1-3` entities. (In AgileTs, `entities` are things with distinct
41+
and independent existence like users, posts, or todos.)
4242
We put everything related to these entities
4343
into a single file of truth called `store.js` or `core.js`.
4444
In the end, the `core` file contains all the business logic of your application,
@@ -72,25 +72,20 @@ how it can be constructed.
7272

7373
### 📝 store.ts
7474

75-
In the `store.ts` file, we instantiate the Agile Instance (`Agile`)
76-
and define all [Agile Sub Instances](../main/Introduction.md#agile-sub-instance) (`MY_TODOS`).
77-
In addition, all actions (`updateTodo()`, `toogleTodo()`, ..)
78-
and if you are using Typescript interfaces (`TodoInterface`) are located here.
75+
In the `store.ts` file, we instantiate all [Agile Sub Instances](../main/Introduction.md#agile-sub-instance) (`MY_TODOS`),
76+
define all actions (`updateTodo()`, `toogleTodo()`, ..)
77+
and if you are using Typescript interfaces (`TodoInterface`) are located here too.
7978
```ts title="store.ts"
80-
import { Agile, assignSharedAgileInstance } from "@agile-ts/core";
81-
import reactIntegration from "@agile-ts/react";
79+
import { createCollection } from "@agile-ts/core";
8280

83-
export interface TodoInterface {
81+
export interface TodoItemInterface {
8482
id: number;
8583
text: string;
8684
done: boolean;
8785
}
8886

89-
// Create Agile Instance
90-
const App = new Agile().integrate(reactIntegration);
91-
9287
// Create Collection (a dynamic set of States)
93-
export const MY_TODOS = App.createCollection<TodoInterface>({
88+
export const MY_TODOS = createCollection<TodoItemInterface>({
9489
key: "todos"
9590
}).persist(); // perist does store the Collection in the Local Storage
9691

@@ -138,7 +133,7 @@ We can easily differentiate between global and local States in our UI-Components
138133

139134
The `Style Guide 2` is intended for **medium size and large applications**
140135
with more than `3` entities.
141-
In AgileTs, `entities` are things with distinct and independent existence like users, posts, or todos.
136+
(In AgileTs, `entities` are things with distinct and independent existence like users, posts, or todos.)
142137
At first glance, this way of organizing your application looks very boiler-late-ey.
143138
Each entity has its own directory with a bunch of files.
144139
However, there is a system behind it,
@@ -194,7 +189,6 @@ core
194189
| └── user.controller.ts
195190
| └── user.interfaces.ts
196191
| └── user.routes.ts
197-
|── app.ts
198192
|── index.ts
199193
.
200194
```
@@ -309,15 +303,15 @@ and contains the [Agile Sub Instances](../main/Introduction.md#agile-sub-instanc
309303
These Agile Sub Instances can and should then only be modified by the actions ([actions.ts](#1-actionsts))
310304
or bound to UI-Components in the UI-Layer for reactivity.
311305
```ts title="todo.controller.ts in 📁todo"
312-
import {App} from '../../app';
306+
import {createCollection, createComputed} from "@agile-ts/core";
313307
import {TodoInterface} from './todo.interfaces';
314308
import {CURRENT_USER} from '../user'
315309

316310
// Contains all existing TODO's
317-
export const TODOS = App.createCollection<TodoInterface>()();
311+
export const TODOS = createCollection<TodoInterface>()();
318312

319313
// Contains all TODO's that belong to the current logged in USER
320-
export const USER_TODOS = App.createComputed(() => {
314+
export const USER_TODOS = createComputed(() => {
321315
return TodosCollection.getGroup(CURRENT_USER.value.id).output;
322316
});
323317
```
@@ -377,33 +371,6 @@ export const ADD_TODO = async (payload: AddTodoPayloadInterface): Promise<TodoIn
377371
// ..
378372
```
379373

380-
## 📝 app.ts
381-
382-
:::note
383-
384-
If you decided to use the
385-
[shared Agile Instance](../packages/core/api/agile-instance/Introduction.md#-shared-agile-instance)
386-
you can skip this part.
387-
388-
:::
389-
390-
In the `app.ts` file, we create our main `Agile Instance` and configure it to meet our needs.
391-
For example, we determine here with which UI-Framework AgileTs should work together.
392-
393-
```ts title="app.ts"
394-
import {Agile, Logger, assignSharedAgileInstance} from "@agile-ts/core";
395-
import reactIntegration from "@agile-ts/react";
396-
397-
export const App = new Agile({
398-
logConfig: {
399-
level: Logger.level.WARN
400-
}
401-
}).integrate(reactIntegration);
402-
403-
// Assign created Agile Instance as shared Agile Instance
404-
assignSharedAgileInstance(App);
405-
```
406-
407374
## 📝 index.ts
408375

409376
Here we export our `core` entities, so that each entity

docs/packages/core/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ which includes, for example, handy classes like:
4444
that we need to remember globally at a later point in time.
4545
While offering a toolkit to use and mutate this _set_ of Information.
4646
```ts
47-
const MY_COLLECTION = App.createCollection();
47+
const MY_COLLECTION = createCollection();
4848

4949
// Add Data to Collection
5050
MY_COLLECTION.collect({id: 1, name: "frank"});
@@ -57,7 +57,7 @@ which includes, for example, handy classes like:
5757
A `Computed` is an extension of the `State Class` that computes
5858
its value from a specified function.
5959
```ts
60-
const MY_COMPUTED = App.createComputed(() => {
60+
const MY_COMPUTED = createComputed(() => {
6161
return MY_STATE_1.value + MY_STATE_2.value;
6262
});
6363
```

0 commit comments

Comments
 (0)