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

Commit 16cd174

Browse files
committed
optimized docs
1 parent 84e42b1 commit 16cd174

File tree

8 files changed

+93
-27
lines changed

8 files changed

+93
-27
lines changed

docs/packages/core/features/collection/Introduction.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ WIP docs!
1212
:::
1313

1414
A Collection holds a set of Information that we need to remember at a later point in time.
15-
It is designed for arrays of data objects following the same structure.
16-
Be aware that each collected Data needs an **unique primaryKey** to properly identify it later.
15+
It is designed for arrays of data objects following the same pattern.
16+
Be aware that each collected Data needs an **unique primaryKey** to get properly identified later.
1717
We instantiate a Collection with help of an [Agile Instance](../agile-instance/Introduction.md) here called `App`.
1818
By doing this the Collection gets automatically bound to the Agile Instance it was created from.
1919
```ts
@@ -25,11 +25,11 @@ but there we have to pass the `Agile Instance`, to which the Collection should g
2525
const MY_COLLECTION = new Collection(App);
2626
```
2727
Both instantiations lead to the same result, but we recommend using the former way.
28-
After we have successfully created our Collection, we can dynamically manipulate and work with it.
28+
After we have successfully created our Collection, we can work with it dynamically and easily.
2929
```ts
3030
MY_COLLECTION.collect({id: 1, name: "jeff"}); // Add Item to Collection
31-
MY_COLLECTION.remove(1).everywhere(); // Remove Item from everywhere
32-
MY_COLLECTION.persist(); // Persists Collection Value into the Storage
31+
MY_COLLECTION.remove(1).everywhere(); // Remove Item from Collection
32+
MY_COLLECTION.persist(); // Persists Collection Value into a Storage
3333
```
3434
Most methods we use to modify, mutate and access the Collection are chainable.
3535
```ts
@@ -38,36 +38,42 @@ MY_COLLECTION.collect({id: 1, name: "jeff"}).persist().removeGroup('myGroup').re
3838

3939
## 🔹 Item
4040

41-
Each Data we have added to the Collection, like with the `collect` method,
42-
gets applied to an Item and stored as such in our Collection.
41+
Each Data Object we add to our Collection, for example with the `collect` method,
42+
gets transformed to an Item. This Item than gets stored in our Collection.
43+
We can simply access each Item with the `getItem` method and the correct primary Key.
4344
```ts
4445
MY_COLLECTION.getItem(/* primary Key */); // Returns Item at the primary Key
4546
```
46-
An Item is an extension of the State Class and offers the same powerful features.
47+
The cool thing about Items is, they are an extension of the `State Class`.
48+
This means that they have the same powerful tools like a State.
4749
```ts
48-
const myItem = MY_COLLECTION.getItem(1);
50+
MY_COLLECTION.collect({id: 1, name: "jeff"}); // Collect Data
51+
const myItem = MY_COLLECTION.getItem(1); // Returns Item at primaryKey '1'
52+
myItem.value; // Returns '{id: 1, name: "jeff"}'
4953
myItem.patch({name: "frank"}); // Update property 'name' in Item
54+
myItem.undo(); // Undo latest change
5055
```
5156

5257
## 👨‍👧‍👦 [Group](./group/Introduction.md)
5358

5459
Often applications need to categorize and preserve ordering of structured data and
55-
in AgileTs Groups are the cleanest way to reach this goal. They allow us to
60+
in AgileTs Groups are the right way to reach this goal. They allow us to
5661
cluster together data from a Collection as an array of primary Keys.
57-
We might use a Group, if we want to have an array of 'Today Todos' from
58-
a Todo Collection or Posts that belong to the logged-in User from the Post Collection.
5962
```ts
6063
MY_COLLECTION.createGroup("groupName", [/*initial Items*/]);
6164
```
62-
We are able to create as many Groups as we want, and the Collection won't lose
63-
its redundant behaviour, since the Items are still stored in the Collection, and
64-
the Groups are only like an interface to it.
65+
We might use a Group, if we want to have an array of 'Today Todos' from
66+
a Todo Collection or Posts that belong to the logged-in User from the Post Collection.
67+
68+
In our Collection we are able to create as many Groups as we want, and the Collection won't lose
69+
its redundant behaviour. This is due to the fact, that each Item gets stored in the Collection itself and not in the Group.
70+
You can imagine a Group like an interface to the Collection Data.
6571
```ts
6672
MY_COLLECTION.createGroup("group1", [1, 2, 3]);
6773
MY_COLLECTION.createGroup("group2", [2, 5, 8]);
6874
MY_COLLECTION.createGroup("group5000", [1, 10, 500, 5]);
6975
```
70-
A Group is an extension of the State Class and offers the same powerful features.
76+
Also, a Group is an extension of the `State Class` and offers the same powerful features.
7177
```ts
7278
MY_STATE.undo(); // Undo latest change
7379
MY_GROUP.reset(); // Reset Group to its intial Value
@@ -77,23 +83,31 @@ But be aware that the `value` might not be the output you expect.
7783
```ts
7884
MY_GROUP.value; // Returns '[8, 5, 30, 1]'
7985
```
80-
It holds the primary Keys of the Items the Group represent.
81-
To get the right value to the primary Keys just use `output` property.
86+
Because this property doesn't hold the Item Values, it contains the primary Keys the Group represents.
87+
To get the Item Value to each primary Keys, just use the `output` property.
8288
```ts
8389
MY_GROUP.output; // Returns '[{ id: 8, name: 'jeff' }, ...]'
8490
```
8591

8692
## 🔮 [Selector](./selector/Introduction.md)
8793

88-
Selectors allow us to _select_ an Item from a Collection.
94+
Selectors allow us to _select_ a specific Item from our Collection.
95+
```ts
96+
MY_COLLECTION.createSelector("selectorName", /*to select Item Key*/);
97+
```
8998
We might use the Selector, if we want to select a 'current User' from our User Collection or
9099
the 'current viewing Post' from our Post Collection.
100+
101+
A Selector is also able to select a not existing Item, then it holds
102+
a reference to this Item. But be aware that the Value of the Selector is
103+
`undefined` during this period of time, since we do not know your desired Item.
91104
```ts
92-
MY_COLLECTION.createGroup("selectorName", /*to select Item Key*/);
105+
MY_SELECTOR.select("notExistingItem");
106+
MY_SELECTOR.value; // Returns 'undefined' until it the Item got added to the Collection
93107
```
94-
A Selector is an extension of the State Class and offers the same powerful features.
108+
Beside the Group, a Selector is also an extension of the State Class and offers the same powerful features.
95109
```ts
96-
MY_STATE.undo(); // Undo latest change
110+
MY_SELECTOR.undo(); // Undo latest change
97111
```
98112
But be aware that by mutating the Selector we won't modify the
99113
selected Item in the Collection. To do that we have to modify the Item directly.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: properties
3+
title: Properties
4+
sidebar_label: Properties
5+
slug: /core/collection/properties
6+
---
7+
8+
:::warning
9+
10+
WIP docs!
11+
12+
:::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: properties
3+
title: Properties
4+
sidebar_label: Properties
5+
slug: /core/collection/group/properties
6+
---
7+
8+
:::warning
9+
10+
WIP docs!
11+
12+
:::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: properties
3+
title: Properties
4+
sidebar_label: Properties
5+
slug: /core/collection/selector/properties
6+
---
7+
8+
:::warning
9+
10+
WIP docs!
11+
12+
:::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: properties
3+
title: Properties
4+
sidebar_label: Properties
5+
slug: /core/computed/properties
6+
---
7+
8+
:::warning
9+
10+
WIP docs!
11+
12+
:::

docs/packages/core/features/state/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ but there we have to pass the `Agile Instance`, to which the State should get bo
2424
const MY_STATE = new State(App, "Hello World");
2525
```
2626
Both instantiations lead to the same result, but we recommend using the former way.
27-
After we have successfully created our State, we can dynamically manipulate and work with it.
27+
After we have successfully created our State, we can work with it dynamically and easily.
2828
```ts
2929
MY_STATE.set("Hello There"); // Set State Value to "Hello There"
3030
MY_STATE.undo(); // Undo latest change
3131
MY_STATE.is("Hello World"); // Check if State has a specific Value
32-
MY_STATE.persist(); // Persist State Value into Storage
32+
MY_STATE.persist(); // Persist State Value into a Storage
3333
```
3434
Most methods we use to modify, mutate and access the State are chainable.
3535
```ts

docs/quick_start/React.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ MY_FIRST_STATE.set(`Hello World ${++helloWorldCount}`);
149149
To bring some life into our small Application we update the State with the `set` function
150150
in which we just pass our desired new value.
151151

152+
To find out more about States, checkout our [State](../packages/core/features/state/Introduction.md) docs.
153+
152154
<br />
153155

154156
---
@@ -253,6 +255,7 @@ Be aware that hooks can only be used in React Components!
253255
To add new Data to our Collection, we cann use the `collect` function.
254256
In this case we add the _currentInput_ to our Collection, with a random Id as primaryKey.
255257

258+
To find out more about Collections, checkout our [Collection](../packages/core/features/collection/Introduction.md) docs.
256259

257260
## 🔍 More
258261

sidebars.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,23 @@ module.exports = {
4242
items: [
4343
"packages/core/features/collection/introduction",
4444
"packages/core/features/collection/methods",
45+
"packages/core/features/collection/properties",
4546
{
4647
type: 'category',
4748
label: 'Group',
48-
items: ["packages/core/features/collection/group/introduction", "packages/core/features/collection/group/methods"]
49+
items: ["packages/core/features/collection/group/introduction", "packages/core/features/collection/group/methods", "packages/core/features/collection/group/properties"]
4950
},
5051
{
5152
type: 'category',
5253
label: 'Selector',
53-
items: ["packages/core/features/collection/selector/introduction", "packages/core/features/collection/selector/methods"]
54+
items: ["packages/core/features/collection/selector/introduction", "packages/core/features/collection/selector/methods", "packages/core/features/collection/selector/properties"]
5455
},
5556
]
5657
},
5758
{
5859
type: 'category',
5960
label: 'Computed',
60-
items: ["packages/core/features/computed/introduction", "packages/core/features/computed/methods"]
61+
items: ["packages/core/features/computed/introduction", "packages/core/features/computed/methods", "packages/core/features/computed/properties"]
6162
},
6263
{
6364
type: 'category',

0 commit comments

Comments
 (0)