Skip to content

Commit

Permalink
[docs] Use callouts for notes
Browse files Browse the repository at this point in the history
  • Loading branch information
nsk90 committed May 24, 2024
1 parent b15a371 commit 95b1be5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 28 deletions.
10 changes: 9 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ color_scheme: dark
mermaid:
# Version of mermaid library
# Pick an available version from https://cdn.jsdelivr.net/npm/mermaid/
version: "10.9.1"
version: "10.9.1"

callouts:
warning:
title: Warning
color: red
note:
title: Note
color: purple
10 changes: 5 additions & 5 deletions docs/pages/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ createStateMachine(scope) {
}
```

> [!NOTE]
> `PendingEventHandler` that does nothing will not let you process pending events (they will be dropped) as it
> leads to undefined machine state and mixed notifications.
{: .note }
`PendingEventHandler` that does nothing will not let you process pending events (they will be dropped) as it
leads to undefined machine state and mixed notifications.

## Event argument

Expand All @@ -94,8 +94,8 @@ val machine = createStateMachine(scope) {
machine.processEvent(TurnOn, 42)
```

> [!NOTE]
> Type of arguments is `Any?`, so it is not type safe ot use them.
{: .note }
Type of arguments is `Any?`, so it is not type safe ot use them.

## Do not

Expand Down
22 changes: 11 additions & 11 deletions docs/pages/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ The library supports export into PlantUML and Mermaid diagram drawing systems. T
Mermaid supports fewer features then PlantUML itself.
Please note that both of them have their own limitations and corner cases.

> [!NOTE]
> Transitions that use lambdas like `transitionConditionally()` and `transitionOn()` or `choiceState()` etc.,
> are not exported by default.
> You can enable their export with `unsafeCallConditionalLambdas` flag of `exportToPlantUml()`/`exportToMermaid()`
> functions.
> With `unsafeCallConditionalLambdas` flag set, user defined lambdas that are passed to the library to calculate next
> state would be called during export process. This will give more complete (still not full) export output,
> but may cause runtime errors depending on what the lambda actually do. As it may touch application data that is not
> valid when export is running, also `event` argument will be faked by unsafe cast, so touching it
> will cause `ClassCastException`
> That is why `unsafeCallConditionalLambdas` flag should be considered as debug/development tool only.
{: .note }
Transitions that use lambdas like `transitionConditionally()` and `transitionOn()` or `choiceState()` etc.,
are not exported by default.
You can enable their export with `unsafeCallConditionalLambdas` flag of `exportToPlantUml()`/`exportToMermaid()`
functions.
With `unsafeCallConditionalLambdas` flag set, user defined lambdas that are passed to the library to calculate next
state would be called during export process. This will give more complete (still not full) export output,
but may cause runtime errors depending on what the lambda actually do. As it may touch application data that is not
valid when export is running, also `event` argument will be faked by unsafe cast, so touching it
will cause `ClassCastException`
That is why `unsafeCallConditionalLambdas` flag should be considered as debug/development tool only.

## PlantUML

Expand Down
4 changes: 3 additions & 1 deletion docs/pages/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ Where `<Tag>` is a library version.
You can see official docs
about [dependencies on multiplatform libraries](https://kotlinlang.org/docs/multiplatform-add-dependencies.html#library-used-in-specific-source-sets)

## JitPack (deprecated)
## JitPack
Deprecated
{: .label .label-red }

Currently, `JitPack` does not support Kotlin multiplatform artifacts.
So versions starting from `0.22.0` are not available there, use `Maven Central` instead.
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/meta_information.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ This mechanism is extendable and users may add their own `MetaInfo` sub interfac
Currently, the only standard implementation is `UmlMetaInfo` which is useful for export feature.
See [controlling export output](https://kstatemachine.github.io/kstatemachine/pages/export.html#controlling-export-output).

> [!NOTE]
> `MetaInfo` considered to be immutable data by design
{: .note }
`MetaInfo` considered to be immutable data by design
7 changes: 4 additions & 3 deletions docs/pages/states/states.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ the first triggering.
state().onEntry(once = true) { /* ... */ }
```

> [!NOTE]
> It is safe to add and remove listeners from any machine callbacks, library protects its internal loops from such
> modifications.

{: .note }
It is safe to add and remove listeners from any machine callbacks, library protects its internal loops from such
modifications.

## Listen group of states

Expand Down
10 changes: 5 additions & 5 deletions docs/pages/transitions/transitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ greenState {
}
```

> [!NOTE]
> Such transitions are also called internal or self-targeted.
{: .note }
Such transitions are also called internal or self-targeted.

## Transition type

Expand Down Expand Up @@ -267,9 +267,9 @@ state("first") {
}
```

> [!NOTE]
> It is up to user to control that argument field is set from one listener. You can use some mutable data structure
> and fill it from multiple listeners.
{: .note }
It is up to user to control that argument field is set from one listener. You can use some mutable data structure
and fill it from multiple listeners.

## Inherit transitions by grouping states

Expand Down

0 comments on commit 95b1be5

Please sign in to comment.