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

Commit fd8406e

Browse files
authored
Merge pull request #74 from agile-ts/develop
Develop
2 parents fde01c7 + 08742fa commit fd8406e

File tree

22 files changed

+1617
-242
lines changed

22 files changed

+1617
-242
lines changed

docs/Interfaces.md

Lines changed: 180 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export interface StorageMethodsInterface {
182182

183183
#### `get`
184184

185-
The get method of the storage. That means it gets items from the external storage.
185+
The `get` method of the storage. That means it gets items from the external storage.
186186
```ts
187187
myStorage.get("item1"); // Calls the here defined get method
188188
```
@@ -195,7 +195,7 @@ myStorage.get("item1"); // Calls the here defined get method
195195

196196
#### `set`
197197

198-
The set method of the storage. This means that it writes items into the external storage.
198+
The `set` method of the storage. This means that it writes items into the external storage.
199199
```ts
200200
myStorage.set("item1", {my: "value"}); // Calls the here defined set method
201201
```
@@ -208,7 +208,7 @@ myStorage.set("item1", {my: "value"}); // Calls the here defined set method
208208

209209
#### `remove`
210210

211-
The remove method from the storage. This means that it removes items from the external storage.
211+
The `remove` method from the storage. This means that it removes items from the external storage.
212212
```ts
213213
myStorage.remove("item1"); // Calls the here defined remove method
214214
```
@@ -229,7 +229,7 @@ myStorage.remove("item1"); // Calls the here defined remove method
229229

230230
## `StateIngestConfig`
231231

232-
This is the `StateIngestConfig` Interface, and it is used as config object in function like `set`, `undo`, .. of a State.
232+
This is the `StateIngestConfig` Interface, and it is used as configuration object in function like `set()`, `undo()`, ..
233233
Here is a Typescript Interface of the Object for quick reference,
234234
however each property will be explained in more detail below.
235235
```ts
@@ -366,7 +366,7 @@ Otherwise, it will be added to a que and performed whenever it is his turn.
366366

367367
## `PatchConfig`
368368

369-
This is the `PatchConfig` Interface, and it is used as config object in the `patch` function of a State.
369+
This is the `PatchConfig` Interface, and it is used as configuration object in the `patch()` function of a State.
370370
Here is a Typescript Interface of the Object for quick reference,
371371
however each property will be explained in more detail below.
372372
```ts
@@ -406,7 +406,7 @@ MY_STATE.value; // Returns {id: 1, name: "frank", location: "Germany"}
406406

407407
## `StatePersistentConfig`
408408

409-
This is the `StatePersistentConfig` Interface, and it is used as config object in the `persist` function of a State.
409+
This is the `StatePersistentConfig` Interface, and it is used as configuration object in the `persist()` function of a State.
410410
Here is a Typescript Interface of the Object for quick reference,
411411
however each property will be explained in more detail below.
412412
```ts
@@ -467,7 +467,7 @@ MY_STATE.persist({storageKeys: ['myCustomStorrage']}); // Stores value in 'myCus
467467

468468
## `GroupConfig`
469469

470-
This is the `GroupConfig` Interface, and it is used as config object in the creation of Groups.
470+
This is the `GroupConfig` Interface, and it is used as configuration object in the creation of Groups.
471471
Here is a Typescript Interface of the Object for quick reference,
472472
however each property will be explained in more detail below.
473473
```ts
@@ -509,7 +509,7 @@ If Group is initially a Placeholder.
509509

510510
## `SelectorConfig`
511511

512-
This is the `SelectorConfig` Interface, and it is used as config object in the creation of Selectors.
512+
This is the `SelectorConfig` Interface, and it is used as configuration object in the creation of Selectors.
513513
Here is a Typescript Interface of the Object for quick reference,
514514
however each property will be explained in more detail below.
515515
```ts
@@ -551,7 +551,7 @@ If Selector is initially a Placeholder.
551551

552552
## `CollectConfig`
553553

554-
This is the `CollectConfig` Interface, and it is used as config object in the `collect` method.
554+
This is the `CollectConfig` Interface, and it is used as configuration object in the `collect()` method of a Collection.
555555
Here is a Typescript Interface of the Object for quick reference,
556556
however each property will be explained in more detail below.
557557
```ts
@@ -665,16 +665,18 @@ MY_COLLECTION.getSelector(1); // Returns Selector that got just created
665665

666666
## `UpdateConfig`
667667

668-
This is the `UpdateConfig` Interface, and it is used as config object in the `update` method. Here is a Typescript
669-
Interface of the Object for quick reference, however each property will be explained in more detail below.
670-
668+
This is the `UpdateConfig` Interface, and it is used as configuration object in the `update()` method.
669+
Here is a Typescript Interface of the Object for quick reference,
670+
however each property will be explained in more detail below.
671671
```ts
672672
export interface UpdateConfigInterface {
673673
patch?: boolean | { addNewProperties?: boolean };
674674
background?: boolean;
675675
}
676676
```
677677

678+
<br/>
679+
678680
#### `patch`
679681

680682
If the update data object should be merged into the existing data or overwrite it completely.
@@ -721,15 +723,17 @@ MY_COLLECTION.update(1, {name: "frank"}, {background: true});
721723

722724
## `HasConfig`
723725

724-
This is the `HasConfig` Interface, and it is used as config object in methods like `hasGroup`, `hasSelector`, .. Here is a Typescript
725-
Interface of the Object for quick reference, however each property will be explained in more detail below.
726-
726+
This is the `HasConfig` Interface, and it is used as configuration object in methods like `hasGroup()`, `hasSelector()`, ..
727+
Here is a Typescript Interface of the Object for quick reference,
728+
however each property will be explained in more detail below.
727729
```ts
728730
export interface HasConfigInterface {
729731
notExisting?: boolean;
730732
}
731733
```
732734

735+
<br/>
736+
733737
#### `notExisting`
734738

735739
Should be set to `true`, if also not existing Instances should be returned, like `placeholder` Instances.
@@ -745,3 +749,164 @@ MY_COLLECTION.hasGroup('myPlaceholderGroup');
745749
| Type | Default | Required |
746750
|--------------------------|-----------|----------|
747751
| `boolean` | false | No |
752+
753+
754+
755+
<br/>
756+
757+
---
758+
759+
<br/>
760+
761+
762+
763+
## `AddSideEffectConfig`
764+
765+
This is the `AddSideEffectConfig` Interface, and it is used as configuration object in the `addSideEffect()` method.
766+
Here is a Typescript Interface of the Object for quick reference,
767+
however each property will be explained in more detail below.
768+
```ts
769+
export interface AddSideEffectConfigInterface {
770+
weight?: number;
771+
}
772+
```
773+
774+
<br/>
775+
776+
#### `weight`
777+
778+
Determines when the `sideEffect` callback should be executed,
779+
since some `sideEffects` has to be executed before others.
780+
The higher the `weigth` the earlier the `sideEffect` is executed.
781+
782+
```ts {3}
783+
MY_STATE.addSideEffect('mySideEffect', (state, config) => {
784+
// sideEffect callback
785+
}, {weigth: 10});
786+
```
787+
788+
789+
| Type | Default | Required |
790+
|--------------------------|-----------|----------|
791+
| `number` | 10 | No |
792+
793+
794+
795+
<br/>
796+
797+
---
798+
799+
<br/>
800+
801+
802+
803+
## `GroupAddConfig`
804+
805+
This is the `GroupAddConfig` Interface, and it is used as configuration object in functions like `put()` or `add()`.
806+
Here is a Typescript Interface of the Object for quick reference,
807+
however each property will be explained in more detail below.
808+
```ts
809+
export interface GroupAddConfig {
810+
method?: 'unshift' | 'push';
811+
overwrite?: boolean;
812+
background?: boolean;
813+
}
814+
```
815+
816+
<br/>
817+
818+
#### `method`
819+
820+
Defines which way the `itemKey` is added to the Group.
821+
- `unshift` adds the `itemKey` at the beginning of the array
822+
- `push` adds the `itemKey` at the end of the array
823+
824+
```ts
825+
const MY_GROUP = MY_COLLECTION.createGroup('group1', [1, 2, 5, 6]);
826+
MY_GROUP.add(3, {method: 'push'}); // Group value is '[1, 2, 5, 6, 3]'
827+
MY_GROUP.add(9, {method: 'unshift'}); // Group value is '[9, 1, 2, 5, 6, 3]'
828+
```
829+
830+
| Type | Default | Required |
831+
|--------------------------|-----------|----------|
832+
| `'unshift' \| 'push'` | 'push' | No |
833+
834+
<br/>
835+
836+
#### `overwrite`
837+
838+
If we add an `itemKey` twice to the Group,
839+
it normally doesn't do anything, since the `itemKey` already exists.
840+
```ts
841+
const MY_GROUP = MY_COLLECTION.createGroup('group1', [1, 2, 5, 6]);
842+
MY_GROUP.add(2); // Group value is '[1, 2, 5, 6]'
843+
```
844+
By overwriting the `itemKey` it simply removes the old `itemKey` and adds it again.
845+
```ts
846+
const MY_GROUP = MY_COLLECTION.createGroup('group1', [1, 2, 5, 6]);
847+
MY_GROUP.add(2, {overwrite: true}); // Group value is '[1, 5, 6, 2]'
848+
```
849+
850+
| Type | Default | Required |
851+
|--------------------------|-----------|----------|
852+
| `boolean` | false | No |
853+
854+
<br/>
855+
856+
#### `background`
857+
858+
Sometimes we want to add `itemKes` to our Group in background, so that no component rerender that has bound the
859+
Group to itself. Then this property might get handy.
860+
861+
```ts {5}
862+
// Causes rerender on Components
863+
MY_GROUP.add(1);
864+
865+
// Doesn't cause rerender on Comonents
866+
MY_GROUP.add(1, {background: true});
867+
```
868+
869+
| Type | Default | Required |
870+
|--------------------------|-----------|----------|
871+
| `boolean` | false | No |
872+
873+
874+
875+
<br/>
876+
877+
---
878+
879+
<br/>
880+
881+
882+
883+
## `UpdateItemKeyConfig`
884+
885+
This is the `UpdateItemKeyConfig` Interface, and it is used as configuration object the `updateItemKey` function.
886+
Here is a Typescript Interface of the Object for quick reference,
887+
however each property will be explained in more detail below.
888+
```ts
889+
export interface UpdateItemKeyConfigInterface {
890+
background?: boolean;
891+
}
892+
```
893+
894+
<br/>
895+
896+
#### `background`
897+
898+
Sometimes we want to update a `itemKes` in background, so that no component rerender that has bound the
899+
Collection to itself. Then this property might get handy.
900+
901+
```ts {5}
902+
// Causes rerender on Components
903+
MY_COLLECTION.updateItemKey(1, 3);
904+
905+
// Doesn't cause rerender on Comonents
906+
MY_COLLECTION.updateItemKey(1, 3, {background: true});
907+
```
908+
909+
| Type | Default | Required |
910+
|--------------------------|-----------|----------|
911+
| `boolean` | false | No |
912+

docs/packages/core/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ slug: /core
2222
## `core`
2323

2424
The `core` is the main package of AgileTs and includes the whole state management logic.
25-
Therefore, it can be seen as the brain of AgileTs that manages all your States.
25+
Therefore, it can be seen as the brain of AgileTs that manages all our States.
2626
It includes the main Instance of AgileTs, called [`Agile Class`](./features/agile-instance/Introduction.md).
2727
```ts
2828
const App = new Agile();
2929
```
30-
In summary, the most important tasks of the `Agile Class` are to
30+
In summary, the most important tasks of the `Agile Class` are to:
3131
- manage `Agile Sub Instances`, like [States](./features/state/Introduction.md), ..
3232
- ingest changes into the `runtime`
3333
- trigger rerender in Integrations like [React](../react/Introduction.md)

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ const App = new Agile({
112112
```
113113

114114

115-
## 🟦 Typescript
116-
117-
The `Agile Class` is almost 100% typesafe.
118-
119-
120115
## 🗺 Where to instantiate?
121116

122117
We can instantiate the `Agile Class` where ever we want.
123118
Directly in our Component, in a separate file, or on paper.
124119
It doesn't matter as long as we can work with it.
125-
There are a few [Style Guides](../../../../main/StyleGuide.md)
120+
There are a few [Style Guides](../../../../main/StyleGuide.md)
126121
which might help you with such hard decision.
122+
123+
124+
## 🟦 Typescript
125+
126+
The `Agile Class` is almost 100% typesafe.

0 commit comments

Comments
 (0)