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

Commit 222dd0f

Browse files
committed
fixed typos
1 parent 28b9951 commit 222dd0f

File tree

3 files changed

+85
-56
lines changed

3 files changed

+85
-56
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ WIP docs!
1414
A Group categorizes and preserves the ordering of structured data in a Collection.
1515
They allow us to cluster together data from a Collection as an array of `primary Keys`.
1616
A Group doesn't store the actual Items. It only keeps track of the `primary Keys`
17-
and retrieves the fitting Items from the Collection later when needed.
17+
and retrieves the fitting Items from the Collection when needed.
1818
```ts
1919
// The actual Collection
2020
Collection
@@ -96,7 +96,7 @@ Test the Group yourself. It's only one click away. Just select your preferred Fr
9696
## 📭 Props
9797

9898
### `initialItems`
99-
The first `itemKeys` assigned to the Group.
99+
The `itemKeys` of the initial Items, the Group represents.
100100
```ts {1}
101101
const MY_GROUP = MY_COLLECTION.createGroup([1, 2, 3]);
102102
MY_GROUP.value; // Returns '[1, 2, 3]'
@@ -153,16 +153,18 @@ MY_GROUP.exists(); // false
153153
```
154154
Groups are, for example, `placeholder` when AgileTs needs to hold a reference to them,
155155
although they aren't instantiated yet.
156-
This might be the case by using `getGroupWithReference()`,
157-
where AgileTs returns a `placeholder` Group, if the Group doesn't exist,
158-
to hold a reference to the not existing Group.
156+
This might be the case by using `getGroupWithReference()`,
157+
which returns a `placeholder` Group, if the Group doesn't exist,
158+
to hold a reference to it.
159159
```ts
160-
useAgile(getGroupWithReference(1));
160+
const myGroup = useAgile(MY_COLLECTION.getGroupWithReference("group1")); // Causes rerender if Group got created
161+
const myGroup2 = useAgile(MY_COLLECTION.getGroup("group2")); // Doesn't Causes rerender if Group got created
161162
```
162-
This reference is important to rerender the Component,
163+
164+
This reference is essential to rerender the Component,
163165
whenever the Group got instantiated.
164166

165167

166168
## 🟦 Typescript
167169

168-
The `Group Class` is almost 100% typesafe.
170+
The `Group Class` is almost 100% typesafe.

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ WIP docs!
1111

1212
:::
1313

14-
A Selector is an extension of the `State Class` and can represent one specific,
15-
selected [Item](../Introduction.md#-item) from a Collection.
14+
A Selector represent one specific, selected [Item](../Introduction.md#-item) from a Collection.
1615
We instantiate a Selector with the help of an existing [Collection](../Introduction.md).
1716
By doing so, the Selector is automatically bound to the Collection it was created from
1817
and has access to its data.
@@ -30,7 +29,7 @@ MY_COLLECTION.createSelector("selectorName", /*to select Item Key*/);
3029
```
3130
It is also possible to select a not existing Item. Then the Selector will hold
3231
a reference to this Item until it got collected. Be aware that the `value` of the Selector is
33-
`undefined` during this period of time, since AgileTs doesn't know the desired Item value.
32+
`undefined` during this period since AgileTs doesn't know the desired Item value.
3433
```ts
3534
MY_SELECTOR.select("notExistingItem");
3635
MY_SELECTOR.value; // Returns 'undefined' until the Item got added to the Collection
@@ -59,15 +58,15 @@ We might use the Selector, if we want to select the current logged-in User from
5958
```ts
6059
const CURRENT_USER = USERS.select(/* current logged-in userId */);
6160
```
62-
And if the User logs out, and a new User logs in,
63-
we can simply change the `primaryKey`, the Selector represents.
61+
And if the user logs out and a new user logs in,
62+
we can simply change the `primaryKey`, the Selector represents.
6463
```ts
6564
CURRENT_USER.select(/* another userId */);
6665
```
6766

6867

6968
## ⛳️ Sandbox
70-
Test the Selector yourself, it's only one click away. Just select your preferred Framework below.
69+
Test the Selector yourself. It's only one click away. Just select your preferred Framework below.
7170
- [React](https://codesandbox.io/s/agilets-first-state-f12cz)
7271
- Vue (coming soon)
7372
- Angular (coming soon)
@@ -76,9 +75,11 @@ Test the Selector yourself, it's only one click away. Just select your preferred
7675
## 📭 Props
7776

7877
### `itemKey`
79-
The `itemKey` of the Item the Selector represents
80-
```ts {1}
78+
The `itemKey` of the Item the Selector represents.
79+
```ts {2}
80+
MY_COLLECTION.collect({id: 1, name: 'hans'});
8181
const MY_SELECTOR = MY_COLLECTION.createSelector(1);
82+
MY_SELECTOR.value; // Returns '{id: 1, name: 'hans'}'
8283
```
8384

8485
### `config`
@@ -130,21 +131,20 @@ const MY_SELECTOR = App.creaateSelector(1, {
130131

131132
MY_SELECTOR.exists(); // false
132133
```
133-
Selector are, for example, `placeholder` when AgileTs needs to hold a reference to them,
134+
Selectors are, for example, `placeholder` when AgileTs needs to hold a reference to them,
134135
although they aren't instantiated yet.
135136
This might be the case by using `getSelectorWithReference()`,
136-
where AgileTs returns a `placeholder` Selector, if the Selector doesn't exist,
137-
to hold a reference to the not existing Selector.
137+
which returns a `placeholder` Selector, if the Selector doesn't exist,
138+
to hold a reference to it.
138139
```ts
139-
useAgile(getSelectorWithReference(1));
140+
const mySeleector = useAgile(MY_COLLECTION.getSelectorWithReference("selector1")); // Causes rerender if Selector got created
141+
const mySeleector2 = useAgile(MY_COLLECTION.getSelector("selector2")); // Doesn't Causes rerender if Selector got created
140142
```
141-
This reference is important to rerender the Component,
143+
144+
This reference is essential to rerender the Component,
142145
whenever the Selector got instantiated.
143146

144147

145148
## 🟦 Typescript
146149

147-
The `Selector Class` is almost 100% typesafe.
148-
149-
150-
150+
The `Selector Class` is almost 100% typesafe.

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

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ Here are valuable properties of the `State Class` listed.
1212
:::
1313

1414
## `agileInstance`
15-
Agile Instance to which the State belongs
15+
16+
The [`agileInstance`](../agile-instance/Introduction.md) to which the State belongs.
1617
```ts
1718
MY_STATE.agileInstance(); // Returns a Agile Instance
1819
```
19-
Note that it is stored as a function in the State, to avoid endless deep classes.
20+
Be aware that the `agileInstance` property is of the type function,
21+
to avoid endless deep classes.
2022

2123

2224

@@ -29,10 +31,16 @@ Note that it is stored as a function in the State, to avoid endless deep classes
2931

3032

3133
## `key`
32-
Current key/name of the State.
33-
It is used to uniquely identify the State.
34-
Besides getting the `key`, we can also assign a new `key` with help of this property.
35-
```ts
34+
35+
The current `key/name` of the State,
36+
which is used to uniquely identify the State.
37+
```ts {2}
38+
const MY_STATE = App.createState(123, {key: 'jeffKey'});
39+
MY_STATE.key; // Returns 'jeffKey'
40+
```
41+
Besides, accessing the `key`,
42+
we can also assign a new `key` through this property to the State.
43+
```ts {1}
3644
MY_STATE.key = "myCoolState";
3745
MY_STATE.key; // Returns 'myCoolState'
3846
```
@@ -48,13 +56,14 @@ MY_STATE.key; // Returns 'myCoolState'
4856

4957

5058
## `valueType`
51-
Current type of the value.
59+
60+
Represents the current `type` of the State value.
5261
```ts {2}
5362
MY_STATE.type(String);
5463
MY_STATE.valueType; // Returns 'string'
5564
```
56-
This property is only useful if you are using Javascript,
57-
because for Typescript there are better solutions, like generic types.
65+
This property is thought to help Javascript users to get a basic type safety.
66+
In Typescript, we recommend using generic types to reach such goal.
5867
```ts
5968
App.createState<string>("see generic types are sick");
6069
```
@@ -70,7 +79,8 @@ App.createState<string>("see generic types are sick");
7079

7180

7281
## `isSet`
73-
If the current State Value differ from the initial State Value.
82+
83+
Is `ture`, if the current State value differs from the initial State value.
7484
```ts {2,4}
7585
const MY_STATE = App.createState("jeff");
7686
MY_STATE.isSet; // Returns false
@@ -89,18 +99,22 @@ MY_STATE.isSet; // Returns true
8999

90100

91101
## `isPlaceholder`
92-
If the State is a placeholder.
102+
103+
Determines if the State is a `placeholder`.
93104
```ts
94105
MY_STATE.isPlaceholder; // Returns 'false'
95106
```
96-
For instance, it might be a placeholder if it hasn't been instantiated yet, but AgileTs needs to hold a reference to it.
97-
This is the case if we bind a maybe not existing Group with the `getGroupWithReference` function to a Component.
98-
Then AgileTs creates a placeholder Group for us, to ensure that the Component rerender whenever
99-
the real Group got created.
107+
States are, for example, `placeholder` when AgileTs needs to hold a reference to them,
108+
although they aren't instantiated yet.
109+
This might be the case by using `getGroupWithReference()`,
110+
which returns a `placeholder` Group (extension of State), if the Group doesn't exist,
111+
to hold a reference to it.
100112
```ts
101113
const myGroup = useAgile(MY_COLLECTION.getGroupWithReference("group1")); // Causes rerender if Group got created
102114
const myGroup2 = useAgile(MY_COLLECTION.getGroup("group2")); // Doesn't Causes rerender if Group got created
103115
```
116+
This reference is essential to rerender the Component,
117+
whenever the Group got instantiated.
104118

105119

106120

@@ -113,7 +127,9 @@ const myGroup2 = useAgile(MY_COLLECTION.getGroup("group2")); // Doesn't Causes r
113127

114128

115129
## `initialStateValue`
116-
The first Value which got firstly assigned to the State.
130+
131+
The initial `value` of the State,
132+
so the `value` that got firstly assigned to it.
117133
```ts {4}
118134
const MY_STATE = App.createState("jeff");
119135
MY_STATE.set("frank");
@@ -132,11 +148,17 @@ MY_STATE.initialStateValue; // Returns 'jeff'
132148

133149

134150
## `value`
135-
The current Value of the State.
136-
Besides getting the `value`, we can also assign a new `value` with help of this property.
137-
```ts
138-
MY_STATE.value = "myCoolValue";
139-
MY_STATE.value; // Returns 'myCoolValue'
151+
152+
The current `value` of the State.
153+
```ts {2}
154+
const MY_STATE = App.createState(123);
155+
MY_STATE.key; // Returns '123'
156+
```
157+
Besides, accessing the `value`,
158+
we can also assign a new `value` through this property to the State.
159+
```ts {1}
160+
MY_STATE.value = 9999;
161+
MY_STATE.value; // Returns '9999'
140162
```
141163

142164

@@ -150,7 +172,8 @@ MY_STATE.value; // Returns 'myCoolValue'
150172

151173

152174
## `previousStateValue`
153-
The State Value, which has been assigned to the State, before the current active Value.
175+
176+
The State `value` that got assigned previously.
154177
```ts
155178
const MY_STATE = App.createState("hello");
156179
MY_STATE.set("bye");
@@ -168,18 +191,21 @@ MY_STATE.previousState; // Returns 'hello'
168191

169192

170193
## `nextStateValue`
171-
The State Value, which will be assigned to the State as next.
172-
Often this is the current Value, because AgileTs is pretty fast in assigning new Values 🚀.
194+
195+
The State `value` that will be assigned next to the State as current `value`.
196+
Often it is the current `value`, because AgileTs assigns new `values` pretty fast 🚀.
173197
```ts {2}
174198
MY_STATE.set(1);
175199
MY_STATE.nextStateValue; // Returns '1'
200+
MY_STATE.value; // Returns '1'
176201
```
177-
The `nextStateValue` will be used as next value, if we ingest the State without any specific new value into the runtime.
202+
The `nextStateValue` will be used as the next `value`,
203+
if the State got ingested into the `runtime` without any specific new `value`.
178204
```ts {2}
179-
const MY_ARRAY = App.State([1, 2, 3]);
180-
MY_ARRAY.nextState.push(4);
181-
MY_ARRAY.ingest();
182-
MY_STATE.value; // Returns '[1, 2, 3, 4]'
205+
const MY_STATE = App.State('hans');
206+
MY_STATE.nextStateValue = 'jeff';
207+
MY_STATE.ingest();
208+
MY_STATE.value; // Returns 'jeff'
183209
```
184210

185211

@@ -193,9 +219,10 @@ MY_STATE.value; // Returns '[1, 2, 3, 4]'
193219

194220

195221
## `isPersisted`
196-
If the State Value got successfully persisted into an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
222+
223+
If the State `value` is stored into an external Storage like the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage).
197224
```ts {1,3}
198225
MY_STATE.isPersisted; // Returns 'false'
199226
MY_STATE.persist();
200-
MY_STATE.isPersisted; // Returns 'true'
227+
MY_STATE.isPersisted; // Returns 'true' if the persist was successful
201228
```

0 commit comments

Comments
 (0)