Skip to content

Commit d5d3c47

Browse files
committed
init version
1 parent 3d30a93 commit d5d3c47

Some content is hidden

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

44 files changed

+1916
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: OpenSilver.ControlsKit Build
2+
env:
3+
next-release-version: '2.0.1'
4+
opensilver-package-source: 'https://www.myget.org/F/opensilver/api/v3/index.json'
5+
suffix: 'preview'
6+
on:
7+
push:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
inputs:
12+
opensilver-version:
13+
description: 'OpenSilver package version'
14+
default: 'latest'
15+
required: true
16+
jobs:
17+
OpenSilver-ControlsKit-Build:
18+
#We should not run these steps on the forks by default.
19+
if: github.repository_owner == 'OpenSilver'
20+
runs-on: windows-latest
21+
steps:
22+
- name: Add msbuild to PATH
23+
uses: microsoft/[email protected]
24+
- name: Inject slug/short variables
25+
uses: rlespinasse/[email protected]
26+
- name: Install DotNet
27+
uses: actions/setup-dotnet@v3
28+
with:
29+
dotnet-version: '7.0.x'
30+
- name: Clone repo
31+
uses: actions/checkout@v3
32+
with:
33+
ref: ${{ github.ref }}
34+
- name: Fill vars
35+
id: vars
36+
run: |
37+
$version = "${{ github.event.inputs.opensilver-version }}"
38+
$source = "${{ env.opensilver-package-source }}"
39+
if ($version -eq "latest" -or $version -eq "") {
40+
$version = nuget list -Source $source -Prerelease | ? { $_ -match "^OpenSilver\s+(.*)" } | ForEach { $_.split(" ")[1] }
41+
}
42+
echo "Version: $version"
43+
echo "opensilver-version=$version" >> $env:GITHUB_OUTPUT
44+
echo "package-version=${{ env.next-release-version }}-${{ env.suffix }}-$(date +'%Y-%m-%d-%H%M%S')-${{ env.GITHUB_SHA_SHORT }}" >> $env:GITHUB_OUTPUT
45+
- name: Replace OpenSilver PackageVersion
46+
run: |
47+
sed -i 's/<OpenSilverPackageVersion>[^<]*</<OpenSilverPackageVersion>${{ steps.vars.outputs.opensilver-version }}</g' src\Directory.Build.targets
48+
- name: Build the FastControls package
49+
working-directory: src\FastControls\build
50+
run: |
51+
./build-nuget-package.bat ${{ steps.vars.outputs.package-version }}
52+
- name: Upload artifacts
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: FastControls
56+
path: src\FastControls\bin\Release\*.nupkg
57+
- name: Upload packages to MyGet
58+
run: |
59+
dotnet nuget push "src\FastControls\bin\Release\*.nupkg" -k ${{ secrets.MYGET_TOKEN }} -s ${{ secrets.MYGET_PUBLIC_FEED }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,4 @@ MigrationBackup/
348348

349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351+
src/build/temp

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# OpenSilver.ControlsKit
2-
The ControlsKit is a collection of additional libraries, controls, and helpers that developers can use directly in their OpenSilver projects, to complement the built-in controls.
2+
The ControlsKit is a collection of additional libraries, controls, and helpers that developers can use directly in their OpenSilver projects, to complement the built-in controls.

src/.editorconfig

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
[*.{cs,vb}]
2+
#### Naming styles ####
3+
4+
# Naming rules
5+
6+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
7+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
8+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
9+
10+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
11+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
12+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
13+
14+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
15+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
16+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
17+
18+
# Symbol specifications
19+
20+
dotnet_naming_symbols.interface.applicable_kinds = interface
21+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
22+
dotnet_naming_symbols.interface.required_modifiers =
23+
24+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
25+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
26+
dotnet_naming_symbols.types.required_modifiers =
27+
28+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
29+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
30+
dotnet_naming_symbols.non_field_members.required_modifiers =
31+
32+
# Naming styles
33+
34+
dotnet_naming_style.begins_with_i.required_prefix = I
35+
dotnet_naming_style.begins_with_i.required_suffix =
36+
dotnet_naming_style.begins_with_i.word_separator =
37+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
38+
39+
dotnet_naming_style.pascal_case.required_prefix =
40+
dotnet_naming_style.pascal_case.required_suffix =
41+
dotnet_naming_style.pascal_case.word_separator =
42+
dotnet_naming_style.pascal_case.capitalization = pascal_case
43+
44+
dotnet_naming_style.pascal_case.required_prefix =
45+
dotnet_naming_style.pascal_case.required_suffix =
46+
dotnet_naming_style.pascal_case.word_separator =
47+
dotnet_naming_style.pascal_case.capitalization = pascal_case
48+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
49+
tab_width = 4
50+
indent_size = 4
51+
end_of_line = crlf
52+
dotnet_style_coalesce_expression = true:suggestion
53+
dotnet_style_null_propagation = true:suggestion
54+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
55+
dotnet_style_prefer_auto_properties = true:silent
56+
dotnet_style_object_initializer = true:suggestion
57+
dotnet_style_collection_initializer = true:suggestion
58+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
59+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
60+
dotnet_style_prefer_conditional_expression_over_return = true:silent
61+
dotnet_style_explicit_tuple_names = true:suggestion
62+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
63+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
64+
dotnet_style_prefer_compound_assignment = true:suggestion
65+
dotnet_style_prefer_simplified_interpolation = true:suggestion
66+
dotnet_style_namespace_match_folder = true:suggestion
67+
dotnet_style_readonly_field = true:suggestion
68+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
69+
dotnet_style_predefined_type_for_member_access = true:silent
70+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
71+
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
72+
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
73+
dotnet_code_quality_unused_parameters = all:suggestion
74+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
75+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
76+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
77+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
78+
dotnet_style_qualification_for_property = false:silent
79+
dotnet_style_qualification_for_field = false:silent
80+
dotnet_style_qualification_for_method = false:silent
81+
dotnet_style_qualification_for_event = false:silent
82+
83+
[*.cs]
84+
csharp_indent_labels = one_less_than_current
85+
csharp_using_directive_placement = outside_namespace:silent
86+
csharp_prefer_simple_using_statement = true:suggestion
87+
csharp_prefer_braces = true:silent
88+
csharp_style_namespace_declarations = block_scoped:silent
89+
csharp_style_prefer_method_group_conversion = true:silent
90+
csharp_style_prefer_top_level_statements = true:silent
91+
csharp_style_expression_bodied_methods = false:silent
92+
csharp_style_expression_bodied_constructors = false:silent
93+
csharp_style_expression_bodied_operators = false:silent
94+
csharp_style_expression_bodied_properties = true:silent
95+
csharp_style_expression_bodied_indexers = true:silent
96+
csharp_style_expression_bodied_accessors = true:silent
97+
csharp_style_expression_bodied_lambdas = true:silent
98+
csharp_style_expression_bodied_local_functions = false:silent
99+
csharp_style_throw_expression = true:suggestion
100+
csharp_space_around_binary_operators = before_and_after
101+
csharp_style_prefer_null_check_over_type_check = true:suggestion
102+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
103+
csharp_prefer_simple_default_expression = true:suggestion
104+
csharp_style_prefer_range_operator = true:suggestion
105+
csharp_style_prefer_index_operator = true:suggestion
106+
csharp_style_prefer_tuple_swap = true:suggestion
107+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
108+
csharp_style_prefer_utf8_string_literals = true:suggestion
109+
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
110+
csharp_style_deconstructed_variable_declaration = true:suggestion
111+
csharp_style_inlined_variable_declaration = true:suggestion
112+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
113+
csharp_prefer_static_local_function = true:suggestion
114+
csharp_style_prefer_readonly_struct = true:suggestion
115+
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
116+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
117+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
118+
csharp_style_conditional_delegate_call = true:suggestion
119+
csharp_style_prefer_switch_expression = true:suggestion
120+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
121+
csharp_style_prefer_pattern_matching = true:silent
122+
csharp_style_prefer_not_pattern = true:suggestion
123+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
124+
csharp_style_prefer_extended_property_pattern = true:suggestion
125+
csharp_style_var_for_built_in_types = false:silent
126+
csharp_style_var_when_type_is_apparent = false:silent
127+
csharp_style_var_elsewhere = false:silent

src/Directory.Build.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<PropertyGroup>
3+
<OpenSilverPackageVersion>2.1.0-preview-2023-10-24-151123-d105dd0c</OpenSilverPackageVersion>
4+
<EnableAdditionalMetadataAttributes>true</EnableAdditionalMetadataAttributes>
5+
<LangVersion>latest</LangVersion>
6+
</PropertyGroup>
7+
</Project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using Microsoft.AspNetCore.Components;
2+
using Microsoft.AspNetCore.Components.CompilerServices;
3+
using Microsoft.AspNetCore.Components.Rendering;
4+
using Microsoft.AspNetCore.Components.Routing;
5+
6+
namespace FastControls.TestApp.Browser
7+
{
8+
public class App : ComponentBase
9+
{
10+
protected override void BuildRenderTree(RenderTreeBuilder builder)
11+
{
12+
builder.OpenComponent<Router>(0);
13+
builder.AddAttribute(1, "AppAssembly", RuntimeHelpers.TypeCheck(
14+
typeof(Program).Assembly
15+
));
16+
builder.AddAttribute(2, "PreferExactMatches", RuntimeHelpers.TypeCheck(
17+
true
18+
));
19+
builder.AddAttribute(3, "Found", (RenderFragment<RouteData>)(routeData => builder2 =>
20+
{
21+
builder2.OpenComponent<RouteView>(4);
22+
builder2.AddAttribute(5, "RouteData", RuntimeHelpers.TypeCheck(
23+
routeData
24+
));
25+
builder2.CloseComponent();
26+
}
27+
));
28+
builder.AddAttribute(7, "NotFound", (RenderFragment)(builder2 =>
29+
{
30+
builder2.OpenComponent<LayoutView>(8);
31+
builder2.AddAttribute(9, "ChildContent", (RenderFragment)(builder3 =>
32+
{
33+
builder3.AddMarkupContent(10, "<p>Sorry, there\'s nothing at this address.</p>");
34+
}
35+
));
36+
builder2.CloseComponent();
37+
}
38+
));
39+
builder.CloseComponent();
40+
}
41+
}
42+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<NoXamlPreprocessor>True</NoXamlPreprocessor>
6+
<OpenSilverType>6</OpenSilverType>
7+
<PublishTrimmed>true</PublishTrimmed>
8+
<!-- Uncomment to enable AOT compilation when publishing -->
9+
<!--<RunAOTCompilation>true</RunAOTCompilation>-->
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
14+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
15+
<PackageReference Include="OpenSilver" Version="2.2.0" />
16+
</ItemGroup>
17+
18+
<PropertyGroup>
19+
<DisableImplicitNamespaceImports>True</DisableImplicitNamespaceImports>
20+
</PropertyGroup>
21+
22+
<ItemGroup>
23+
<ProjectReference Include="..\FastControls.TestApp\FastControls.TestApp.csproj" />
24+
</ItemGroup>
25+
26+
</Project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using DotNetForHtml5;
2+
using Microsoft.JSInterop;
3+
using Microsoft.JSInterop.WebAssembly;
4+
5+
namespace FastControls.TestApp.Browser.Interop
6+
{
7+
public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler
8+
{
9+
private const string MethodName = "callJSUnmarshalled_v2";
10+
private readonly WebAssemblyJSRuntime _runtime;
11+
12+
public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime)
13+
{
14+
_runtime = runtime as WebAssemblyJSRuntime;
15+
}
16+
17+
public void ExecuteJavaScript(string javaScriptToExecute)
18+
{
19+
_runtime.InvokeUnmarshalled<string, object>(MethodName, javaScriptToExecute);
20+
}
21+
22+
public object ExecuteJavaScriptWithResult(string javaScriptToExecute)
23+
{
24+
return _runtime.InvokeUnmarshalled<string, object>(MethodName, javaScriptToExecute);
25+
}
26+
27+
public TResult InvokeUnmarshalled<T0, TResult>(string identifier, T0 arg0)
28+
{
29+
return _runtime.InvokeUnmarshalled<T0, TResult>(identifier, arg0);
30+
}
31+
32+
public TResult InvokeUnmarshalled<T0, T1, TResult>(string identifier, T0 arg0, T1 arg1)
33+
{
34+
return _runtime.InvokeUnmarshalled<T0, T1, TResult>(identifier, arg0, arg1);
35+
}
36+
37+
public TResult InvokeUnmarshalled<T0, T1, T2, TResult>(string identifier, T0 arg0, T1 arg1, T2 arg2)
38+
{
39+
return _runtime.InvokeUnmarshalled<T0, T1, T2, TResult>(identifier, arg0, arg1, arg2);
40+
}
41+
}
42+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using DotNetForHtml5;
2+
using FastControls.TestApp.Browser.Interop;
3+
using Microsoft.AspNetCore.Components;
4+
using Microsoft.AspNetCore.Components.Rendering;
5+
using Microsoft.JSInterop;
6+
using System.Threading.Tasks;
7+
using System;
8+
9+
namespace FastControls.TestApp.Browser.Pages
10+
{
11+
[Route("/")]
12+
public class Index : ComponentBase
13+
{
14+
protected override void BuildRenderTree(RenderTreeBuilder __builder)
15+
{
16+
}
17+
18+
protected async override Task OnInitializedAsync()
19+
{
20+
await base.OnInitializedAsync();
21+
22+
if (!await JSRuntime.InvokeAsync<bool>("getOSFilesLoadedPromise"))
23+
{
24+
throw new InvalidOperationException("Failed to initialize OpenSilver. Check your browser's console for error details.");
25+
}
26+
27+
Cshtml5Initializer.Initialize(new UnmarshalledJavaScriptExecutionHandler(JSRuntime));
28+
Program.RunApplication();
29+
}
30+
31+
[Inject]
32+
private IJSRuntime JSRuntime { get; set; }
33+
}
34+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2+
using Microsoft.Extensions.DependencyInjection;
3+
using System;
4+
using System.Net.Http;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
8+
namespace FastControls.TestApp.Browser
9+
{
10+
public class Program
11+
{
12+
public static async Task Main(string[] args)
13+
{
14+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
15+
builder.RootComponents.Add<App>("#app");
16+
17+
builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
18+
19+
var host = builder.Build();
20+
await host.RunAsync();
21+
}
22+
23+
public static void RunApplication()
24+
{
25+
Application.RunApplication(() =>
26+
{
27+
var app = new FastControls.TestApp.App();
28+
});
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)