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

Commit 103651b

Browse files
authored
Merge pull request #76 from agile-ts/develop
Develop
2 parents af9afa5 + 65680ba commit 103651b

File tree

19 files changed

+606
-102
lines changed

19 files changed

+606
-102
lines changed

docs/Interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ export interface UpdateConfigInterface {
681681

682682
If the update data object should be merged into the existing data or overwrite it completely.
683683
In case we want to merge the data into the existing data,
684-
we can decide wether new properties are added to the data object or not.
684+
we can decide whether new properties are added to the data object or not.
685685
```ts {2}
686686
MY_COLLECTION.collect({id: 1, name: "jeff"});
687687
MY_COLLECTION.update(1, {name: "hans", age: 12}, {patch: {addNewProperties: false}}); // Item at '1' has value '{name: "hans"}'

docs/main/Introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ and [PulseJs](https://github.com/pulse-framework/pulse).
156156

157157
## 💬 What others say
158158

159-
Actually nothing, hehe
159+
Actually nothing, yet. If you want to be the first one, don't mind tweeting what ever you think about AgileTs.
160+
But don't forget to tag [@AgileFramework](https://twitter.com/AgileFramework), otherwise we can't find your tweet.
160161

161162

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ since there the `localStorage` doesn't exists. With `App.registerStorage()` we c
103103

104104
#### `waitForMount`
105105

106-
This flag declares wether AgileTs should wait until unmounted
106+
This flag declares whether AgileTs should wait until unmounted
107107
components get mounted before rerendering them.
108108
```ts
109109
const App = new Agile({

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

Lines changed: 67 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Here all methods of the `Agile Instance` are described.
1515
## `createState()`
1616

1717
Creates a new [State](../state/Introduction.md),
18-
which gets automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
18+
which is automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
1919
```ts
2020
const State = App.createState('jeff', {
2121
key: 'dummyState',
@@ -30,6 +30,10 @@ const State = App.createState('jeff', {
3030
| `config` | [StateConfigInterface](../../../../Interfaces.md#stateconfig) | {} | Configuration | No |
3131

3232
### 📄 Return
33+
34+
```ts
35+
State
36+
```
3337
Returns a fresh [State](../state/Introduction.md).
3438

3539

@@ -45,7 +49,7 @@ Returns a fresh [State](../state/Introduction.md).
4549
## `createCollection()`
4650

4751
Creates a new [Collection](../collection/Introduction.md),
48-
which gets automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
52+
which is automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
4953
```ts {1-4,8-13}
5054
const Collection = App.createCollection({
5155
key: 'dummyCollection',
@@ -70,6 +74,10 @@ const Collection2 = App.createCollection((collection) => ({
7074

7175

7276
### 📄 Return
77+
78+
```ts
79+
Collection
80+
```
7381
Returns a fresh [Collection](../collection/Introduction.md).
7482

7583

@@ -85,7 +93,7 @@ Returns a fresh [Collection](../collection/Introduction.md).
8593
## `createComputed()`
8694

8795
Creates a new [Computed](../computed/Introduction.md),
88-
which gets automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
96+
which is automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
8997
```ts {1,5-7}
9098
const Computed = App.createComputed(() => {/* Computed Method */}, [/* hard coded deps */])
9199

@@ -105,6 +113,10 @@ const ComputedWithConfig = App.createComputed(() => {/* Computed Method */}, {
105113
| `deps` | Array<Observer \| State \| Event \| Group\> | [] | Dependencies of Computed | No |
106114

107115
### 📄 Return
116+
117+
```ts
118+
Computed
119+
```
108120
Returns a fresh [Computed](../computed/Introduction.md).
109121

110122

@@ -120,7 +132,7 @@ Returns a fresh [Computed](../computed/Introduction.md).
120132
## `createEvent()`
121133

122134
Creates a new [Event](../event/Introduction.md),
123-
which gets automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
135+
which is automatically bound to the [Agile Instance](../agile-instance/Introduction.md) it was created from.
124136
```ts
125137
const Event = App.createEvent({
126138
key: 'dummyEvent',
@@ -135,6 +147,10 @@ const Event = App.createEvent({
135147

136148

137149
### 📄 Return
150+
151+
```ts
152+
Event
153+
```
138154
Returns a fresh [Event](../event/Introduction.md).
139155

140156

@@ -149,10 +165,18 @@ Returns a fresh [Event](../event/Introduction.md).
149165

150166
## `integrate()`
151167

152-
Allows us to integrate AgileTs into nearly any [Framework/Integration](../integration/Introduction.md).
153-
For instance in case of [React](https://reactjs.org/), AgileTs offers a [React Integration](../integration/Introduction.md),
154-
which allows us to integrate it into AgileTs.
155-
```ts {29}
168+
With `integrate()` we can integrate any Framework [Integration](../integration/Introduction.md) into AgileTs.
169+
An Integration simply tells AgileTs, howto mutate a particular Component,
170+
whenever a State changes. To bind States to Components and thus be reactive,
171+
any Framework using AgileTs needs an Integration for AgileTs.
172+
For example, to use AgileTs in a [React](https://reactjs.org/) environment,
173+
we have to register a React Integration to AgileTs.
174+
```ts
175+
App.integrate(reactIntegration);
176+
```
177+
To give you some reference, how such an Integration might look like.
178+
Here is the React Integration:
179+
```ts
156180
const reactIntegration = new Integration<typeof React, AgileReactComponent>({
157181
key: 'react',
158182
frameworkInstance: React,
@@ -177,11 +201,7 @@ const reactIntegration = new Integration<typeof React, AgileReactComponent>({
177201
});
178202

179203
// Each initialIntegraion gets integrated into AgileTs automatically during initialation
180-
// Note: Only useful if you create your own integration
181204
Agile.initialIntegrations.push(reactIntegration);
182-
183-
// Or we integrate it manually (mostly the case if the auto integration doesn't work)
184-
App.integrate(reactIntegration);
185205
```
186206

187207
### 📭 Props
@@ -191,6 +211,10 @@ App.integrate(reactIntegration);
191211
| `integration` | [Integration](../integration/Introduction.md) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
192212

193213
### 📄 Return
214+
215+
```ts
216+
Agile
217+
```
194218
Returns the [Agile Instance](./Introduction.md) it was called from
195219

196220

@@ -204,10 +228,14 @@ Returns the [Agile Instance](./Introduction.md) it was called from
204228

205229

206230
## `hasIntegration()`
231+
207232
Checks if AgileTs has any registered [Integration](../integration/Introduction.md).
208233

209234
### 📄 Return
210-
`boolean`
235+
236+
```ts
237+
boolean
238+
```
211239

212240

213241

@@ -221,7 +249,9 @@ Checks if AgileTs has any registered [Integration](../integration/Introduction.m
221249

222250
## `createStorage()`
223251

224-
Creates a new [Storage](../storage/Introduction.md).
252+
Creates a new [Storage](../storage/Introduction.md) Interface for AgileTs,
253+
that allows AgileTs to work with the Storage that the Interface represents.
254+
The Interface allows AgileTs to permanently store States in the Storage.
225255
```ts
226256
const Storage = App.createStorage({
227257
key: 'dummyStorage',
@@ -232,7 +262,8 @@ const Storage = App.createStorage({
232262
}
233263
})
234264
```
235-
To register a newly created Storage, we use the [registerStorage](#registerstorage) function.
265+
Such Storage can be registered in AgileTs with the [registerStorage()](#registerstorage) method.
266+
After a successful registration we can store/[persist](../state/Methods.md#persist) any State in the Storage.
236267

237268
### 📭 Props
238269

@@ -242,6 +273,10 @@ To register a newly created Storage, we use the [registerStorage](#registerstora
242273
| `methods` | [StorageMethodsInterface](../../../../Interfaces.md#storagemethods) | {} | Methods with which the Storage get mutated | Yes |
243274

244275
### 📄 Return
276+
277+
```ts
278+
Storage
279+
```
245280
Returns a fresh [Storage](../storage/Introduction.md).
246281

247282

@@ -256,12 +291,13 @@ Returns a fresh [Storage](../storage/Introduction.md).
256291

257292
## `registerStorage()`
258293

259-
Adds a new [Storage](../storage/Introduction.md) to AgileTs,
260-
which later can store persisted Instances (`.persist()`).
261-
The [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage) is registered by default.
294+
Registers a new [Storage](../storage/Introduction.md) Interface to AgileTs.
295+
It is used to permanently store persisted Instances ([`.persist()`](../state/Methods.md)) in the Storage that the Interface represents.
296+
By default, the [Local Storage](https://developer.mozilla.org/de/docs/Web/API/Window/localStorage) is registered.
297+
Below you can see how the `localStorage` is registered internally.
262298
```ts {13}
263-
// Here we create our Storage
264-
const _localStorage = new Storage({
299+
// create localStorage Interface with help of the Agile Storage
300+
const _localStorage = App.createStorage({
265301
key: 'localStorage',
266302
async: false,
267303
methods: {
@@ -271,7 +307,7 @@ const _localStorage = new Storage({
271307
},
272308
});
273309

274-
// Here we register our Storage
310+
// Register Storage to current Agile Instance (App)
275311
App.register(_localStorage, { default: true });
276312
```
277313

@@ -282,6 +318,10 @@ App.register(_localStorage, { default: true });
282318
| `integration` | [Integration](../integration/Introduction.md) | undefined | Integration that gets registered/integrated into AgileTs | Yes |
283319

284320
### 📄 Return
321+
322+
```ts
323+
Agile
324+
```
285325
Returns the [Agile Instance](./Introduction.md) it was called from
286326

287327

@@ -295,8 +335,12 @@ Returns the [Agile Instance](./Introduction.md) it was called from
295335

296336

297337
## `hasStorage()`
338+
298339
Checks if AgileTs has any registered [Storage](../storage/Introduction.md).
299-
If AgileTs couldn't find any Storage, we aren't able to use the `.persist()` functionality in any Agile Sub Instance.
340+
If AgileTs couldn't find any Storage, the `.persist()` method can not store any value permanently.
300341

301342
### 📄 Return
302-
`boolean`
343+
344+
```ts
345+
boolean
346+
```

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ Here useful properties of the `Agile Instance` are described.
1313

1414
## `logger`
1515

16-
The `logger` is a static property of the `Agile Class`.
17-
It is an Instance of a handy Class that gets used to Log something in the console, like warnings, errors.
18-
Feel free to use the Agile Logger in your Application for logging too,
19-
it is pretty handy.
16+
The `logger` is a static property of the `Agile Class`,
17+
which is internally used to Log warnings, errors, messages, .. into the console.
2018
```ts
2119
Agile.logger.warn("This is a Warning");
2220
Agile.logger.log("This is a normal Log");
2321
Agile.logger.if.tag(["render"]).warn("Logs this Warning if the Logger has the Tag 'rerender' active");
2422
```
23+
![Log Custom Styles Example](../../../../../static/img/docs/logger_example.png)
24+
It can be configured during the creation of the `Agile Class`.
25+
```ts
26+
const App = new Agile({
27+
logConfig: {
28+
level: Logger.level.WARN,
29+
active: true,
30+
timestamp: true
31+
}
32+
})
33+
```
2534

0 commit comments

Comments
 (0)