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

Commit ee2e97e

Browse files
authored
Merge pull request #80 from agile-ts/develop
Develop
2 parents a55b7c2 + a8554c0 commit ee2e97e

25 files changed

+792
-374
lines changed

docs/Interfaces.md

Lines changed: 338 additions & 171 deletions
Large diffs are not rendered by default.

docs/packages/api/Installation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Be aware that this is no standalone package!
1717
npm install @agile-ts/api
1818
```
1919

20-
The `api` package is an extension of AgileTs and doesn't work without the [`core` package](../core/Introduction.md),
20+
The `api` package is an extension of AgileTs and doesn't work without the [`core`](../core/Introduction.md) package,
2121
which functions as the brain of AgileTs and is indispensable.
2222
Unfortunately, we can't combine each `core` with `api` version.
2323
Therefore, we have created a table which shows which versions fit together without restrictions.
2424

25-
| @agile-ts/api | @agile-ts/core | NPM Version | Supported React versions |
26-
| ----------------------| ----------------------- | ------------------------ | -------------------------|
27-
| v0.0.7+ | v0.0.7+ | v6+ | 16.8+ |
28-
| v0.0.6 | v0.0.3 - v0.0.6 | v6+ | 16.8+ |
25+
| @agile-ts/api | @agile-ts/core | NPM Version |
26+
| ----------------------| ----------------------- | ------------------------ |
27+
| v0.0.7+ | v0.0.7+ | v6+ |
28+
| v0.0.6 | v0.0.3 - v0.0.6 | v6+ |
2929
_Other Versions aren't supported anymore_

docs/packages/core/Introduction.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,12 @@ it automatically computes its value depending on other Agile Sub Instances like
6363
const MY_COMPUTED = App.createComputed(() => (MY_STATE_1.value + MY_STATE_2.value));
6464
```
6565

66-
### 🚌 [Event](./features/event/Introduction.md)
67-
Events are handy for emitting UI updates and passing data with them.
68-
```ts
69-
const MY_EVENT = App.createEvent();
70-
MY_EVENT.on((data) => {console.log("hello there " + data.name)}); // Print 'hello there jeff' if Event gets triggered
71-
MY_EVENT.trigger({name: "jeff"}); // Trigger Event
72-
```
73-
7466
## 🚀 Quick Links
7567
- [Installation](./Installation.md)
7668
- [Agile-Instance](./features/agile-instance/Introduction.md)
7769
- [State](./features/state/Introduction.md)
7870
- [Collection](./features/collection/Introduction.md)
7971
- [Computed](./features/computed/Introduction.md)
80-
- [Event](./features/event/Introduction.md)
8172
- [Group](./features/collection/group/Introduction.md)
8273
- [Selector](./features/collection/selector/Introduction.md)
8374
- [Storage](./features/storage/Introduction.md)

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ sidebar_label: Introduction
55
slug: /core/agile-instance
66
---
77

8-
:::warning
9-
10-
WIP docs!
11-
12-
:::
13-
14-
158
The `Agile Class` is the main Instance of AgileTs and should be unique to our application.
169
```ts
1710
const App = new Agile();
@@ -34,10 +27,6 @@ For reference here are some `Agile Sub Instances` (ASI) created with an `Agile I
3427
```ts
3528
const MY_COMPUTED = App.createComputed(() => {});
3629
```
37-
- [Event](../event/Introduction.md)
38-
```ts
39-
const MY_EVENT = App.createEvent();
40-
```
4130

4231
In summary the main tasks of the `AgileClass` are to:
4332
- queuing `Agile Sub Instance` changes in the `runtime` and preventing race conditions
@@ -120,4 +109,4 @@ which might help you with such hard decision.
120109

121110
## 🟦 Typescript
122111

123-
The `Agile Class` is almost 100% typesafe.
112+
The `Agile Class` is almost 100% typesafe.

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -129,40 +129,6 @@ Returns a fresh [Computed](../computed/Introduction.md).
129129

130130

131131

132-
## `createEvent()`
133-
134-
Creates a new [Event](../event/Introduction.md),
135-
which is automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
136-
```ts
137-
const Event = App.createEvent({
138-
key: 'dummyEvent',
139-
})
140-
```
141-
142-
### 📭 Props
143-
144-
| Prop | Type | Default | Description | Required |
145-
|-----------------|-------------------------------------------------------------------|-----------|----------------------------------------------------|----------|
146-
| `config` | [CreateEventConfig](../../../../Interfaces.md#createeventconfig) | {} | Configuration | No |
147-
148-
149-
### 📄 Return
150-
151-
```ts
152-
Event
153-
```
154-
Returns a fresh [Event](../event/Introduction.md).
155-
156-
157-
158-
<br />
159-
160-
---
161-
162-
<br />
163-
164-
165-
166132
## `integrate()`
167133

168134
With `integrate()` we can integrate any Framework [Integration](../integration/Introduction.md) into AgileTs.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ sidebar_label: Introduction
55
slug: /core/collection
66
---
77

8-
:::warning
9-
10-
WIP docs!
11-
12-
:::
13-
148
A Collection is a _set_ of Information we need to remember at a later point in time.
159
It is designed for arrays of `data objects` following the same pattern.
1610
Each of these objects must have a **unique `primaryKey`** to be correctly identified later.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ MY_STATE.key; // Returns 'myCoolState'
5656

5757
## `size`
5858

59-
Represents how many Items are currently stored in the Collection.
59+
Returns how many Items the Collection stores.
6060
```ts {3}
6161
MY_COLLECTION.collect({id: 1, name: "jeff"});
6262
MY_COLLECTION.collect({id: 5, name: "frank"});
63-
MY_COLLECTION.size; // Returns 2
63+
MY_COLLECTION.size; // Returns '2'
6464
```
6565
Placeholder Items doesn't get counted.
6666

@@ -76,7 +76,7 @@ Placeholder Items doesn't get counted.
7676

7777
## `data`
7878

79-
The `data` object holds all Items of the Collection.
79+
Stores all Items of the Collection.
8080
```ts {3}
8181
MY_COLLECTION.collect({id: 1, name: "jeff"});
8282
MY_COLLECTION.collect({id: 5, name: "frank"});
@@ -126,7 +126,7 @@ MY_COLLECTION.isPersisted; // Returns 'true' if the persist was successful
126126

127127
## `groups`
128128

129-
All [Groups](./group/Introduction.md) of the Collection are stored in the `groups` property.
129+
Stores all [Groups](./group/Introduction.md) of the Collection.
130130
```ts {3}
131131
MY_COLLECTION.createGroup("group1", [1, 2, 3]);
132132
MY_COLLECTION.createGroup("group2", [1, 7, 4]);
@@ -157,7 +157,7 @@ MY_COLLECTION.groups[1]; // Bad pattern
157157

158158
## `selectors`
159159

160-
All [Selectors](./selector/Introduction.md) of the Collection are stored in the `selectors` property.
160+
Stores [Selectors](./selector/Introduction.md) of the Collection.
161161
```ts {3}
162162
MY_COLLECTION.createSelector("selector1", 1);
163163
MY_COLLECTION.createSelector("selector2", 7);
@@ -166,7 +166,7 @@ MY_COLLECTION.selectors; // Returns (see below)
166166
// selector1: Selector(1),
167167
// selector2: Selector(7)
168168
// }
169-
```
169+
```__
170170
We do not recommend accessing the `selectors` object directly in your code,
171171
as it is intended for internal use and shouldn't be used outside the AgileTs codebase.
172172
The Collection provides all the methods to access the `selectors` object without further thinking.

docs/packages/core/features/collection/group/Methods.md

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,173 @@ sidebar_label: Methods
55
slug: /core/collection/group/methods
66
---
77

8+
:::info
9+
10+
Here are valuable methods of the `Group Class` listed,
11+
which aren't directly related to the [`State Class`](../../state/Introduction.md).
12+
13+
The Group is an extension of the [`State Class`](../../state/Introduction.md)
14+
and offers the same methods and properties as a normal State.
15+
These State related methods aren't described in this Section.
16+
To find out more about specific State methods,
17+
checkout the [State docs](../../state/Introduction.md).
18+
19+
:::
20+
21+
## `has()`
22+
23+
Checks if the Group value contains one specific Item at `itemKey`.
24+
```ts {2,3}
25+
const MY_GROUP = MY_COLLECTION.createGroup('myGroup', [1, 2, 3]);
26+
MY_GROUP.has(1); // Returns 'true'
27+
MY_GROUP.has(99); // Returns 'false'
28+
```
29+
30+
### 📄 Return
31+
32+
```ts
33+
boolean
34+
```
35+
36+
37+
38+
<br />
39+
40+
---
41+
42+
<br />
43+
44+
45+
46+
## `remove()`
47+
48+
With `remove()` we can remove a certain Item from the Group.
49+
```ts {2}
50+
const MY_GROUP = MY_COLLECTION.createGroup('myGroup', [1, 2, 3]);
51+
MY_GROUP.remove(1);
52+
MY_GROUP.value; // Returns '[2, 3]'
53+
```
54+
55+
### 📭 Props
56+
57+
| Prop | Type | Default | Description | Required |
58+
|----------------------|-----------------------------------------------------------------------------------|------------|-----------------------------------------------------------------------------------------------|----------|
59+
| `itemKeys` | number \| string | Array<number \| string\> | undefined | itemKey/s that get removed | Yes |
60+
| `config` | [GroupRemoveConfigInterface](../../../../../Interfaces.md#groupremoveconfig) | {} | Configuration | No |
61+
62+
### 📄 Return
63+
64+
```ts
65+
Group
66+
```
67+
Returns the [Group](./Introduction.md) it was called on.
68+
69+
70+
71+
<br />
72+
73+
---
74+
75+
<br />
76+
77+
78+
79+
## `add()`
80+
81+
We use the `add()` method to add `itemKey/s` to the Group.
82+
```ts {2}
83+
const MY_GROUP = MY_COLLECTION.createGroup('myGroup', [1, 2, 3]);
84+
MY_GROUP.add(7);
85+
MY_GROUP.value; // Returns '[1, 2, 3, 7]'
86+
```
87+
By default, the `itemKey` will be added at the end of Group value array.
88+
We can configure this behavior by changing the `method` property in the configuration object.
89+
```ts
90+
MY_GROUP.add(9, {method: 'unshift'});
91+
MY_GROUP.value; // Returns '[9, 1, 2, 3, 7]'
92+
```
93+
94+
### 🌎 Existing itemKey
95+
In case we add an already existing `itemKey`,
96+
the existing `itemKey` won't be overwritten by default.
97+
```ts {3}
98+
MY_GROUP.add(2);
99+
MY_GROUP.value; // Returns '[9, 1, 2, 3, 7]'
100+
MY_GROUP.add(2, {overwrite: true});
101+
MY_GROUP.value; // Returns '[9, 1, 3, 7, 2]'
102+
```
103+
104+
### 📭 Props
105+
106+
| Prop | Type | Default | Description | Required |
107+
|----------------------|-----------------------------------------------------------------------------------|------------|-----------------------------------------------------------------------------------------------|----------|
108+
| `itemKeys` | number \| string | Array<number \| string\> | undefined | itemKey/s that get added | Yes |
109+
| `config` | [GroupAddConfigInterface](../../../../../Interfaces.md#groupaddconfig) | {} | Configuration | No |
110+
111+
### 📄 Return
112+
113+
```ts
114+
Group
115+
```
116+
Returns the [Group](./Introduction.md) it was called on.
117+
118+
119+
120+
<br />
121+
122+
---
123+
124+
<br />
125+
126+
127+
128+
## `replace()`
129+
130+
Replaces existing `itemKey` with a new `itemKey`.
131+
```ts {2}
132+
const MY_GROUP = MY_COLLECTION.createGroup('myGroup', [1, 2, 3]);
133+
MY_GROUP.replace(2, 10);
134+
MY_GROUP.value; // Returns '[1, 10, 3]'
135+
```
136+
137+
### 📭 Props
138+
139+
| Prop | Type | Default | Description | Required |
140+
|----------------------|-----------------------------------------------------------------------------------|------------|-----------------------------------------------------------------------------------------------|----------|
141+
| `oldItemKey` | number \| string | undefined | Old ItemKey | Yes |
142+
| `newItemKey` | number \| string | undefined | Old ItemKey | Yes |
143+
| `config` | [StateRuntimeJobConfig](../../../../../Interfaces.md#stateruntimejobconfig) | {} | Configuration | No |
144+
145+
### 📄 Return
146+
147+
```ts
148+
Group
149+
```
150+
Returns the [Group](./Introduction.md) it was called on.
151+
152+
153+
154+
<br />
155+
156+
---
157+
158+
<br />
159+
160+
161+
162+
## `rebuild()`
163+
8164
:::warning
9165

10-
WIP docs!
166+
This function is mainly thought for internal use.
11167

12168
:::
169+
170+
Rebuilds the `output` of the Group.
171+
172+
### 📄 Return
173+
174+
```ts
175+
Group
176+
```
177+
Returns the [Group](./Introduction.md) it was called on.

0 commit comments

Comments
 (0)