Skip to content

Commit 695461c

Browse files
docs: make snippet langs consistent & fix example indent (#140)
1 parent 263e8b4 commit 695461c

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
44

55
### Installation
66

7-
```
7+
```shell
88
$ yarn
99
```
1010

1111
### Local Development
1212

13-
```
13+
```shell
1414
$ yarn start
1515
```
1616

1717
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
1818

1919
### Build
2020

21-
```
21+
```shell
2222
$ yarn build
2323
```
2424

@@ -28,13 +28,13 @@ This command generates static content into the `build` directory and can be serv
2828

2929
Using SSH:
3030

31-
```
31+
```shell
3232
$ USE_SSH=true yarn deploy
3333
```
3434

3535
Not using SSH:
3636

37-
```
37+
```shell
3838
$ GIT_USER=<Your GitHub username> yarn deploy
3939
```
4040

docs/docs/with-data-service.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,38 +45,38 @@ Once the store is defined, it gives its consumers numerous signals and methods t
4545
```typescript
4646
@Component(...)
4747
export class FlightSearchSimpleComponent {
48-
private store = inject(SimpleFlightBookingStore);
48+
private store = inject(SimpleFlightBookingStore);
4949

50-
from = this.store.filter.from;
51-
to = this.store.filter.to;
52-
flights = this.store.entities;
53-
selected = this.store.selectedEntities;
54-
selectedIds = this.store.selectedIds;
50+
from = this.store.filter.from;
51+
to = this.store.filter.to;
52+
flights = this.store.entities;
53+
selected = this.store.selectedEntities;
54+
selectedIds = this.store.selectedIds;
5555

56-
loading = this.store.loading;
56+
loading = this.store.loading;
5757

58-
canUndo = this.store.canUndo;
59-
canRedo = this.store.canRedo;
58+
canUndo = this.store.canUndo;
59+
canRedo = this.store.canRedo;
6060

61-
async search() {
62-
this.store.load();
63-
}
61+
async search() {
62+
this.store.load();
63+
}
6464

65-
undo(): void {
66-
this.store.undo();
67-
}
65+
undo(): void {
66+
this.store.undo();
67+
}
6868

69-
redo(): void {
70-
this.store.redo();
71-
}
69+
redo(): void {
70+
this.store.redo();
71+
}
7272

73-
updateCriteria(from: string, to: string): void {
74-
this.store.updateFilter({ from, to });
75-
}
73+
updateCriteria(from: string, to: string): void {
74+
this.store.updateFilter({ from, to });
75+
}
7676

77-
updateBasket(id: number, selected: boolean): void {
78-
this.store.updateSelected(id, selected);
79-
}
77+
updateBasket(id: number, selected: boolean): void {
78+
this.store.updateSelected(id, selected);
79+
}
8080

8181
}
8282
```

docs/docs/with-feature-factory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ define the entity type. Alongside `withEntityLoader`, there's another feature,
126126
Due to [certain TypeScript limitations](https://ngrx.io/guide/signals/signal-store/custom-store-features#known-typescript-issues),
127127
the following code will not compile:
128128

129-
```ts
129+
```typescript
130130
function withEntityLoader<T>() {
131131
return signalStoreFeature(
132132
type<{
@@ -170,7 +170,7 @@ signalStore(
170170

171171
Again, `withFeatureFactory` can solve this issue by replacing the input constraint with a function parameter:
172172

173-
```ts
173+
```typescript
174174
function withEntityLoader<T>(loader: (id: number) => Promise<T>) {
175175
return signalStoreFeature(
176176
withState({

docs/docs/with-immutable-state.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ a runtime error.
99
The protection is not limited to changes within the
1010
SignalStore but also outside of it.
1111

12-
```ts
12+
```typescript
1313
const initialState = { user: { id: 1, name: 'Konrad' } };
1414

1515
const UserStore = signalStore(
@@ -28,7 +28,7 @@ const UserStore = signalStore(
2828

2929
If `mutateState` is called, a runtime error will be thrown.
3030

31-
```ts
31+
```typescript
3232
class SomeComponent {
3333
userStore = inject(UserStore);
3434

@@ -40,15 +40,15 @@ class SomeComponent {
4040

4141
The same is also true, when `initialState` is changed:
4242

43-
```ts
43+
```typescript
4444
initialState.user.id = 2; // 🔥 throws an error
4545
```
4646

4747
Finally, it could also happen, if third-party libraries or the Angular API does mutations to the state.
4848

4949
A common example is the usage in template-driven forms:
5050

51-
```ts
51+
```typescript
5252
@Component({
5353
template: ` <input [(ngModel)]="userStore.user().id" /> `,
5454
})
@@ -61,6 +61,6 @@ By default, `withImmutableState` is only active in development mode.
6161

6262
There is a way to enable it in production mode as well:
6363

64-
```ts
64+
```typescript
6565
const UserStore = signalStore({ providedIn: 'root' }, withImmutableState(initialState, { enableInProduction: true }));
6666
```

docs/docs/with-storage-sync.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ As Web Storage only works in browser environments it will fallback to a stub imp
1010

1111
Example:
1212

13-
```ts
13+
```typescript
1414
const SyncStore = signalStore(
1515
withStorageSync<User>({
1616
key: 'synced', // key used when writing to/reading from storage
@@ -23,7 +23,7 @@ const SyncStore = signalStore(
2323
);
2424
```
2525

26-
```ts
26+
```typescript
2727
@Component(...)
2828
public class SyncedStoreComponent {
2929
private syncStore = inject(SyncStore);

docs/docs/with-undo-redo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: withUndoRedo()
66

77
Example:
88

9-
```ts
9+
```typescript
1010
const SyncStore = signalStore(
1111
withUndoRedo({
1212
maxStackSize: 100, // limit of undo/redo steps - `100` by default
@@ -17,7 +17,7 @@ const SyncStore = signalStore(
1717
);
1818
```
1919

20-
```ts
20+
```typescript
2121
@Component(...)
2222
public class UndoRedoComponent {
2323
private syncStore = inject(SyncStore);

0 commit comments

Comments
 (0)