Skip to content

Commit 039b09a

Browse files
Merge pull request #500 from TimeWarpEngineering/Cramer/2024-10-20/Samples
Fix source gen bug to NOT specify an accessibility on the generated partial class.
2 parents b04ccf4 + bb2a6e7 commit 039b09a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1294
-130
lines changed

.ai/blog.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
destination: Documentation/Blogs/
3+
example post: D:\git\github\TheFreezeTeam\TheFreezeTeamBlog\Source\TheFreezeTeam.com\input\posts\steven-t-cramer\2023\07\2023-07-06.md
4+
---
5+
6+
# Blog
7+
8+
Information needed to generate blog posts.
9+
The destination is the folder where the blog posts will be generated.
10+
The example post is the path to the markdown file that will be used as a template for the blog post.

.aider.conf.yml

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ read:
272272
- .editorconfig
273273
- README.md
274274
- .ai/index.md
275+
- .ai/blog.md
275276
- .ai/ai-instructions.md
276277
- .ai/csharp-coding-standards.md
277278
- .ai/dotnet-conventions.md

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<!-- Set common properties regarding assembly information and nuget packages -->
33
<PropertyGroup>
4-
<TimeWarpStateVersion>11.0.0-beta.90+8.0.403</TimeWarpStateVersion>
4+
<TimeWarpStateVersion>11.0.0-beta.91+8.0.403</TimeWarpStateVersion>
55
<Authors>Steven T. Cramer</Authors>
66
<Product>TimeWarp State</Product>
77
<PackageVersion>$(TimeWarpStateVersion)</PackageVersion>

Documentation/Backlog/Overview.md

-12
This file was deleted.

Documentation/Backlog/toc.yml

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Enforcing State-Action Architecture with TimeWarp.State Analyzer
2+
3+
TimeWarp.State enforces a clean architectural pattern where Actions must be nested within their corresponding State types. This design decision helps maintain clear boundaries and relationships between States and their Actions. Let's explore how the TimeWarp.State Analyzer enforces this pattern through static code analysis.
4+
5+
## Why Nest Actions in States?
6+
7+
Nesting Actions within their State classes provides several benefits:
8+
9+
1. **Clear Ownership**: Each Action explicitly belongs to a specific State
10+
2. **Encapsulation**: Actions are tightly coupled with their State's implementation
11+
3. **Discoverability**: Developers can easily find all Actions that affect a State
12+
4. **Type Safety**: The compiler ensures Actions are properly scoped
13+
14+
## The Analyzer in Action
15+
16+
The TimeWarp.State Analyzer enforces this pattern through the `TW0001` diagnostic rule. Here are some examples:
17+
18+
### ✅ Valid Code
19+
20+
```csharp
21+
public class CounterState : IState
22+
{
23+
public int Count { get; private set; }
24+
25+
// Correctly nested Action
26+
public class IncrementAction : IAction { }
27+
}
28+
```
29+
30+
### ❌ Invalid Code
31+
32+
```csharp
33+
// Error TW0001: The Action 'IncrementAction' is not a nested type of its State
34+
public class IncrementAction : IAction { }
35+
```
36+
37+
## How It Works
38+
39+
The analyzer:
40+
41+
1. Identifies types implementing `IAction`
42+
2. Verifies they are nested within a type implementing `IState`
43+
3. Reports violations as compilation errors
44+
45+
This ensures architectural compliance at compile-time rather than runtime.
46+
47+
## Advanced Scenarios
48+
49+
The analyzer handles various scenarios:
50+
51+
### Record-based Actions
52+
```csharp
53+
public class WeatherState : IState
54+
{
55+
public record UpdateTemperatureAction(double Temperature) : IAction;
56+
}
57+
```
58+
59+
### Inherited Actions
60+
```csharp
61+
public class BaseState : IState
62+
{
63+
public abstract class BaseAction : IAction { }
64+
65+
public class ConcreteAction : BaseAction { }
66+
}
67+
```
68+
69+
## Best Practices
70+
71+
1. Name Actions clearly to indicate their purpose
72+
2. Keep Actions focused and specific to their parent State
73+
3. Use appropriate type declarations (class/record/struct) based on needs
74+
4. Consider inheritance for shared Action behavior
75+
76+
## Conclusion
77+
78+
The TimeWarp.State Analyzer helps maintain clean architecture by enforcing proper Action nesting. This design pattern promotes maintainable and discoverable code while preventing common architectural mistakes at compile-time.
79+
80+
For more information, check out the [TimeWarp.State documentation](https://timewarpengineering.github.io/timewarp-state/).

Documentation/Migrations/Migration10-11.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ title: Migrate From 10.X to 11.X
99

1010
Update your project to use .NET 8.0 or later.
1111

12-
Change AddBlazorState to AddTimeWarpState<YourState> in your Startup.cs.
12+
Change AddBlazorState to AddTimeWarpState<YourState>.

Documentation/Overview.md

+2-25
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,14 @@ title: TimeWarp.State Overview
44
---
55
[!include[Badges](Partials/Badges.md)]
66

7-
8-
# TimeWarp.State
9-
10-
Previously known as Blazor-State. [![nuget](https://img.shields.io/nuget/dt/Blazor-State?logo=nuget)](https://www.nuget.org/packages/Blazor-State/)
11-
12-
TimeWarp.State is a State Management architecture utilizing the MediatR pipeline.
13-
14-
If you are familiar with MediatR [^1], Redux [^2],
15-
or the Command Pattern [^3]
16-
you will feel right at home.
17-
All of the behaviors are written as middleware to the MediatR pipeline.
7+
[!include[Installation](Partials/Summary.md)]
188

199
Please see the **[GitHub Site](https://github.com/TimeWarpEngineering/timewarp-state)** for source and filing of issues.
2010

2111
[!include[Installation](Partials/Installation.md)]
2212

2313
[!include[Installation](Partials/GettingStarted.md)]
2414

25-
26-
### Tutorial
27-
28-
If you would like a basic step by step on building blazor app with TimeWarp.State then follow this [tutorial](xref:TimeWarp.State:00-StateActionHandler.md).
29-
30-
### TimeWarp Architecture Template
31-
32-
To create a distributed application that utilizes TimeWarp.State see the [timewarp-architecture template.](https://timewarpengineering.github.io/timewarp-architecture/TimeWarpBlazorTemplate/Overview.html)
33-
3415
## The TimeWarp.State Architecture
3516

3617
### Store 1..* State
@@ -56,7 +37,7 @@ or move the GetState functionality into your component
5637

5738
### Pipeline
5839

59-
TimeWarp.State utilizes the MediatR pipeline which allows for middleware integration
40+
**TimeWarp.State** utilizes the MediatR pipeline which allows for middleware integration
6041
by registering an interface with the dependency injection container [^4].
6142
TimeWarp.State provides the extension method [^5] , `AddTimeWarpState`, which registers behaviors on the pipeline.
6243

@@ -111,10 +92,6 @@ if the developer chose they could mark the Requests as such. For example **IActi
11192

11293
[!include[Acknowledgements](Partials/Acknowledgements.md)]
11394

114-
[!include[License](Partials/License.md)]
115-
116-
[!include[Contributing](Partials/Contributing.md)]
117-
11895
#### Footnotes:
11996

12097
[^1]: https://github.com/jbogard/MediatR

Documentation/Partials/Badges.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ title: Badges
1919
[![Twitter](https://img.shields.io/twitter/follow/StevenTCramer.svg)](https://twitter.com/intent/follow?screen_name=StevenTCramer)
2020
[![Twitter](https://img.shields.io/twitter/follow/TheFreezeTeam1.svg)](https://twitter.com/intent/follow?screen_name=TheFreezeTeam1)
2121

22-
![TimeWarp Logo](https://raw.githubusercontent.com/TimeWarpEngineering/timewarpengineering.github.io/refs/heads/master/images/LogoNoMarginNoShadow.svg)
22+
<img src="https://raw.githubusercontent.com/TimeWarpEngineering/timewarpengineering.github.io/refs/heads/master/images/LogoNoMarginNoShadow.svg" alt="logo" height="120" style="float: right" />

Documentation/Partials/GettingStarted.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ title: Getting Started
55

66
## Getting Started
77

8-
If you are just beginning with Blazor then I recommend you start at the [dotnet blazor site](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor).
8+
I recommend the [tutorial](xref:TimeWarp.State:00-StateActionHandler.md) for a step-by-step guide to building a Blazor app with TimeWarp.State.
99

10-
If you already know a bit about Blazor then I recommend the [tutorial](xref:TimeWarp.State:00-StateActionHandler.md)
10+
👉 Official [documentation](https://timewarpengineering.github.io/timewarp-state/).
1111

12-
![TimeWarpStateOneWayFlow.drawio.svg](https://raw.githubusercontent.com/TimeWarpEngineering/timewarp-state/refs/heads/master/Documentation/Images/TimeWarpStateOneWayFlow.drawio.svg)
12+
<img src="https://raw.githubusercontent.com/TimeWarpEngineering/timewarp-state/refs/heads/master/Documentation/Images/TimeWarpStateOneWayFlow.drawio.svg" alt="logo" height="400" style="" />

Documentation/Partials/Summary.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ title: Summary
55

66
# TimeWarp.State
77

8-
**TimeWarp.State** (previously known as Blazor-State) is a fully asynchronous state management library for Blazor applications, leveraging the MediatR pipeline to implement the Flux pattern. It handles both Reducers and Effects consistently using async Handlers, simplifying the management of asynchronous operations throughout your app.
8+
**TimeWarp.State** (previously known as Blazor-State [![nuget](https://img.shields.io/nuget/dt/Blazor-State?logo=nuget)](https://www.nuget.org/packages/Blazor-State/) )
9+
is a fully asynchronous state management library for Blazor applications,
10+
leveraging the MediatR pipeline to implement the Flux pattern.
11+
It handles both Reducers and Effects consistently using async Handlers,
12+
simplifying the management of asynchronous operations throughout your app.
913

10-
By utilizing the MediatR pipeline, TimeWarp.State enables a flexible, middleware-driven architecture for managing state, similar to the request-processing pipeline in ASP.NET. This approach allows developers to inject custom behaviors, such as logging, validation, and caching, directly into the state management flow.
14+
By utilizing the MediatR pipeline, TimeWarp.State enables a flexible,
15+
middleware-driven architecture for managing state,
16+
similar to the request-processing pipeline in ASP.NET.
17+
This approach allows developers to inject custom behaviors, such as logging,
18+
validation, and caching, directly into the state management flow.
1119

12-
In addition to the core library, we offer **[TimeWarp.State.Plus](/Source/TimeWarp.State.Plus)**, which extends the functionality with enhanced middleware, components, and tools to further streamline state management in complex Blazor applications.
20+
In addition to the core library, we offer **[TimeWarp.State.Plus](/Source/TimeWarp.State.Plus)**,
21+
which extends the functionality with enhanced middleware, components,
22+
and tools to further streamline state management in complex Blazor applications.
+64-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,64 @@
1-
---
2-
uid: BlazorState:Release.11.0.0.md
3-
title: Release 11.0.0
4-
---
5-
6-
## Release 11.0.0
7-
8-
### Breaking Changes
9-
10-
- `BlazorState` now requires .NET 8.0 or later. See [Migrations](xref:BlazorState:Migration10-11.md) for instructions on how to migrate from version 10.0 to 11.0.
11-
12-
### New Features
13-
14-
- Introducing `TimeWarp.State.Middleware` NuGet package:
15-
- **PersistentState**:
16-
- **Key Feature**: Automates the persistence of state in browser storage.
17-
- **Usage**: Annotate state classes with `[PersistentState]` attribute to enable.
18-
- **Storage Options**: Supports both `LocalStorage` and `SessionStorage` for storing state data.
19-
20-
> Note: If you are not ready to update to .NET 8.0, you should continue using BlazorState version 10.0.
21-
22-
See [Migrations](xref:BlazorState:Migration10-11.md) for instructions on how to migrate from version 10.0 to 11.0.
1+
---
2+
uid: TimeWarpState:Release.11.0.0.md
3+
title: Release 11.0.0
4+
---
5+
6+
## Release 11.0.0
7+
8+
### Major Changes
9+
10+
**Rebranding to TimeWarp.State**
11+
We're excited to announce that Blazor-State has been rebranded to TimeWarp.State.
12+
This change reflects our evolving vision and commitment to providing a robust state management solution for Blazor applications.
13+
14+
### Breaking Changes
15+
16+
See [Migrations](xref:BlazorState:Migration10-11.md) for instructions on how to migrate from version 10.0 to 11.0.
17+
18+
- `TimeWarp.State` now requires .NET 8.0 or later.
19+
- All references to `BlazorState` should be updated to `TimeWarp.State`.
20+
- The package name has changed from `Blazor-State` to `TimeWarp.State`.
21+
You'll need to update your package references and namespaces accordingly.
22+
23+
### New Features
24+
25+
- Enabled chained inherits from State<> - so users can make/use their own BaseState<>
26+
- Introduced `TimeWarp.State.Plus` NuGet package with additional features.
27+
- Added `TimeWarp.State.Policies` NuGet package for architecture policies.
28+
- Implemented ActionSet source generator for simplified action creation.
29+
- Added support for persistent state with `[PersistentState]` attribute.
30+
- Introduced `RenderSubscriptionContext` for improved render subscription management.
31+
- Added `ActionTrackingState` for better action tracking capabilities.
32+
33+
### Improvements
34+
35+
- Optimized CI/CD pipelines for better performance and reliability.
36+
- Enhanced caching mechanisms for NuGet packages in GitHub Actions.
37+
- Improved logging capabilities with new Logger implementation.
38+
- Updated to use the latest MediatR version.
39+
- Refactored and improved the test suite, including new E2E tests.
40+
41+
### Documentation
42+
43+
- Completely revamped documentation structure and content.
44+
- Added new tutorials and updated existing ones for TimeWarp.State.
45+
- Implemented automated documentation publishing workflow.
46+
47+
### Developer Experience
48+
49+
- Added support for central package management.
50+
- Improved developer tooling, including updated EditorConfig and coding standards.
51+
- Enhanced source generators for better development productivity.
52+
- Added TimeWarp.State.Analyzer for code analysis.
53+
- ActionAnalyzer.
54+
55+
### Other Changes
56+
57+
- Removed time travel debugging feature to optimize performance and reduce complexity.
58+
- Updated all dependencies to their latest stable versions.
59+
- Improved error handling and exception reporting throughout the library.
60+
- Added .ai folder to the repository for prompting AI-generated content.
61+
62+
### Migration Guide
63+
64+
For detailed instructions on how to migrate from Blazor-State to TimeWarp.State, please refer to our [Migration Guide](xref:BlazorState:Migration10-11.md).
File renamed without changes.

Kanban/Backlog/Scratch/Overview.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Scratch pad for Kanban board stuff.
File renamed without changes.
File renamed without changes.

Kanban/Backlog/_._

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Task: Fix ActionSetMethodGenerator Visibility Bug
2+
3+
## Description
4+
The ActionSetMethodGenerator is currently declaring the partial class with explicit public visibility, which conflicts with the original class's visibility when it's internal.
5+
6+
## Requirements
7+
- Remove explicit visibility modifier from the partial class declaration in the generator
8+
- Let the partial class inherit visibility from the original class declaration
9+
10+
## Implementation Notes
11+
- Issue found in ActionSetMethodGenerator.cs line 82
12+
- Currently declaring with explicit public visibility:
13+
```csharp
14+
public partial class {{parentClassName}}
15+
```
16+
- Should remove visibility modifier:
17+
```csharp
18+
partial class {{parentClassName}}
19+
```
20+
21+
## Files to Modify
22+
- Source/TimeWarp.State.SourceGenerator/ActionSetMethodGenerator.cs
23+
24+
## Checklist
25+
- [ ] Remove 'public' modifier from partial class declaration
26+
- [ ] Test with internal and public state classes

Kanban/Done/_._

Whitespace-only changes.

Kanban/InProgress/-.-

Whitespace-only changes.

0 commit comments

Comments
 (0)