-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add startup & manifest for razor component modules. (#17)
- Loading branch information
1 parent
c39258c
commit d242dd5
Showing
30 changed files
with
309 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Modulight.Modules.Client.RazorComponents/RazorComponentClientModuleManifest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Modulight.Modules.Client.RazorComponents.UI; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Modulight.Modules.Client.RazorComponents | ||
{ | ||
/// <summary> | ||
/// Manifest for <see cref="RazorComponentClientModule"/>. | ||
/// </summary> | ||
public record RazorComponentClientModuleManifest | ||
{ | ||
/// <summary> | ||
/// Get module UI resources. | ||
/// </summary> | ||
public UIResource[] Resources { get; init; } = Array.Empty<UIResource>(); | ||
|
||
/// <summary> | ||
/// Get global components. | ||
/// </summary> | ||
public Type[] GlobalComponents { get; init; } = Array.Empty<Type>(); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Modulight.Modules.Client.RazorComponents/RazorComponentClientModuleManifestBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Modulight.Modules.Client.RazorComponents.UI; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Modulight.Modules.Client.RazorComponents | ||
{ | ||
/// <summary> | ||
/// Specifies the interface to build a module manifest. | ||
/// </summary> | ||
public interface IRazorComponentClientModuleManifestBuilder | ||
{ | ||
/// <summary> | ||
/// Get module UI resources. | ||
/// </summary> | ||
IList<UIResource> Resources { get; } | ||
|
||
/// <summary> | ||
/// Get global components. | ||
/// </summary> | ||
IList<Type> GlobalComponents { get; } | ||
|
||
/// <summary> | ||
/// Build the manifest. | ||
/// </summary> | ||
/// <returns></returns> | ||
RazorComponentClientModuleManifest Build(); | ||
} | ||
|
||
class DefaultRazorComponentClientModuleManifestBuilder : IRazorComponentClientModuleManifestBuilder | ||
{ | ||
public IList<UIResource> Resources { get; } = new List<UIResource>(); | ||
|
||
public IList<Type> GlobalComponents { get; } = new List<Type>(); | ||
|
||
public RazorComponentClientModuleManifest Build() | ||
{ | ||
return new RazorComponentClientModuleManifest | ||
{ | ||
GlobalComponents = GlobalComponents.ToArray(), | ||
Resources = Resources.ToArray() | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.