Skip to content

Commit

Permalink
feat(butil): update code formatting of Butil #6355 (#6357)
Browse files Browse the repository at this point in the history
  • Loading branch information
msynk authored Dec 20, 2023
1 parent 03e7db3 commit 952e79f
Show file tree
Hide file tree
Showing 25 changed files with 274 additions and 286 deletions.
43 changes: 32 additions & 11 deletions src/Butil/Bit.Butil.Demo/Pages/ConsolePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,35 @@
}
</pre>

<h3>Open the DevTools</h3>

<div class="container">
<input @bind-value="_value" /><br />
<br /><button @onclick="@(() => console.Assert(false, "This is a test assert:", _value))">assert</button><br />
<br /><button @onclick="@(() => console.Count(_value))">count</button> <button @onclick="@(() => console.CountReset(_value))">countReset</button><br />
<br /><button @onclick="@(() => console.Error("This is a test error:", _value))">error</button><br />
<br /><button @onclick="@(() => console.Info("This is a test info:", _value))">info</button><br />
<br /><button @onclick="@(() => console.Log("This is a test log:", _value))">log</button><br />
<br /><button @onclick="@(() => console.Warn("This is a test warn:", _value))">warn</button><br />
</div>
<br />
<hr />

<h3>Open the DevTools and start clicking on buttons</h3>

<hr />
<br />

<span>Value:</span>
<input @bind-value="_value" />
<br />
<br />
<hr />
<br />
<button @onclick="@(() => console.Assert(false, "This is a test assert:", _value))">assert</button>
<br />
<br />
<button @onclick="@(() => console.Count(_value))">count</button>
<button @onclick="@(() => console.CountReset(_value))">countReset</button>
<br />
<br />
<button @onclick="@(() => console.Error("This is a test error:", _value))">error</button>
<br />
<br />
<button @onclick="@(() => console.Info("This is a test info:", _value))">info</button>
<br />
<br />
<button @onclick="@(() => console.Log("This is a test log:", _value))">log</button>
<br />
<br />
<button @onclick="@(() => console.Warn("This is a test warn:", _value))">warn</button>
<br />
6 changes: 4 additions & 2 deletions src/Butil/Bit.Butil.Demo/Pages/ElementPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

<br />
<hr />
<br />

<h4>Open the DevTools</h4>
<h4>Open the DevTools and start clicking on buttons</h4>

<hr />
<br />

<div style="background:blue;width:100px;height:100px" @ref="elementRef">Element</div>
<br />
<button @onclick="GetBoundingClientRect">GetBoundingClientRect</button>
Expand Down
6 changes: 4 additions & 2 deletions src/Butil/Bit.Butil.Demo/Pages/HistoryPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@

<br />
<hr />
<br />

<h4>Open the DevTools</h4>
<h4>Open the DevTools and start clicking on buttons</h4>

<hr />
<br />

<button @onclick="GetLength">Get length</button>
<br />
<button @onclick="GoBack">&lt; Back</button>
Expand Down
2 changes: 1 addition & 1 deletion src/Butil/Bit.Butil.Demo/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

<PageTitle>Index</PageTitle>

<h1>Hello, world!</h1>
<h1>Hello Butil users!</h1>
6 changes: 6 additions & 0 deletions src/Butil/Bit.Butil.Demo/Pages/KeyboardPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@
}
</pre>

<br />
<hr />

<h3>Open the DevTools console and start pressing F5 or Ctrl+Alt+F10</h3>

<hr />
<br />

@code {
protected override async Task OnInitializedAsync()
{
Expand Down
6 changes: 4 additions & 2 deletions src/Butil/Bit.Butil.Demo/Pages/NavigatorPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

<br />
<hr />
<br />

<h4>Open the DevTools</h4>
<h4>Open the DevTools and start clicking on buttons</h4>

<hr />
<br />

<button @onclick=GetUserAgent>Get UserAgent</button>


Expand Down
1 change: 0 additions & 1 deletion src/Butil/Bit.Butil.Demo/Pages/StoragePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
</pre>

<br />

<hr />

<h4>Open the DevTools and click on buttons</h4>
Expand Down
22 changes: 20 additions & 2 deletions src/Butil/Bit.Butil.Demo/Pages/WindowPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@

<br />
<hr />
<br />

<h4>Open the DevTools and start pressing keys on your keyboard</h4>
<h4>Open the DevTools and start pressing keys or clicking on buttons</h4>

<hr />
<br />

<button @onclick=AddEventListener>AddEventListener</button>&nbsp;<button @onclick=RemoveEventListener>RemoveEventListener</button>
<br />
<br />
Expand All @@ -37,6 +39,12 @@
<br />
<div>Is BeforeUnload Registered? @isBeforeUnloadRegistered</div>

<br />
<hr />
<br />

<button @onclick=GetInnerHeight>GetInnerHeight</button>&nbsp;<button @onclick=GetInnerWidth>GetInnerWidth</button>

@code {
private bool isKeyDownRegistered;
private bool isBeforeUnloadRegistered;
Expand Down Expand Up @@ -74,6 +82,16 @@
isBeforeUnloadRegistered = false;
}

private async Task GetInnerHeight()
{
await console.Log("Window InnerHeight =", await window.GetInnerHeight());
}

private async Task GetInnerWidth()
{
await console.Log("Window InnerWidth =", await window.GetInnerWidth());
}

public void Dispose()
{
if (isKeyDownRegistered)
Expand Down
11 changes: 4 additions & 7 deletions src/Butil/Bit.Butil/Internals/JsInterops/ConsoleJsInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ internal static async Task ConsoleInfo(this IJSRuntime js, params object?[]? arg
internal static async Task ConsoleLog(this IJSRuntime js, params object?[]? args)
=> await js.InvokeVoidAsync("BitButil.console.log", args);

internal static async Task ConsoleMemory(this IJSRuntime js)
=> await js.InvokeVoidAsync("BitButil.console.memory");
internal static async Task ConsoleProfile(this IJSRuntime js, string? name)
=> await js.InvokeVoidAsync("BitButil.console.profile", name);

internal static async Task ConsoleProfile(this IJSRuntime js)
=> await js.InvokeVoidAsync("BitButil.console.profile");

internal static async Task ConsoleProfileEnd(this IJSRuntime js)
=> await js.InvokeVoidAsync("BitButil.console.profileEnd");
internal static async Task ConsoleProfileEnd(this IJSRuntime js, string? name)
=> await js.InvokeVoidAsync("BitButil.console.profileEnd", name);

internal static async Task ConsoleTable(this IJSRuntime js, object? data, object? properties)
=> await js.InvokeVoidAsync("BitButil.console.table", data, properties);
Expand Down
4 changes: 2 additions & 2 deletions src/Butil/Bit.Butil/Internals/JsInterops/ElementJsInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ internal static async Task<string> ElementGetAttribute(this IJSRuntime js, Eleme
internal static async Task<string[]> ElementGetAttributeNames(this IJSRuntime js, ElementReference element)
=> await js.InvokeAsync<string[]>("BitButil.element.getAttribute", element);

internal static async Task<DomRect> ElementGetBoundingClientRect(this IJSRuntime js, ElementReference element)
=> await js.InvokeAsync<DomRect>("BitButil.element.getBoundingClientRect", element);
internal static async Task<Rect> ElementGetBoundingClientRect(this IJSRuntime js, ElementReference element)
=> await js.InvokeAsync<Rect>("BitButil.element.getBoundingClientRect", element);

internal static async Task<bool> ElementHasAttribute(this IJSRuntime js, ElementReference element, string name)
=> await js.InvokeAsync<bool>("BitButil.element.hasAttribute", element, name);
Expand Down
8 changes: 2 additions & 6 deletions src/Butil/Bit.Butil/Internals/JsInterops/EventsJsInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ internal static async Task AddEventListener(this IJSRuntime js,
object? options = null,
bool preventDefault = false,
bool stopPropagation = false)
{
await js.InvokeVoidAsync("BitButil.events.addEventListener",
=> await js.InvokeVoidAsync("BitButil.events.addEventListener",
elementName,
eventName,
methodName,
Expand All @@ -25,18 +24,15 @@ await js.InvokeVoidAsync("BitButil.events.addEventListener",
options,
preventDefault,
stopPropagation);
}

internal static async Task RemoveEventListener(this IJSRuntime js,
string elementName,
string eventName,
Guid[] listenerIds,
object? options = null)
{
await js.InvokeVoidAsync("BitButil.events.removeEventListener",
=> await js.InvokeVoidAsync("BitButil.events.removeEventListener",
elementName,
eventName,
listenerIds,
options);
}
}
8 changes: 2 additions & 6 deletions src/Butil/Bit.Butil/Internals/JsInterops/KeyboardJsInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ internal static async Task KeyboardAdd(this IJSRuntime js,
bool preventDefault = false,
bool stopPropagation = false,
bool repeat = false)
{
await js.InvokeVoidAsync("BitButil.keyboard.add",
=> await js.InvokeVoidAsync("BitButil.keyboard.add",
methodName,
listenerId,
code,
Expand All @@ -29,10 +28,7 @@ await js.InvokeVoidAsync("BitButil.keyboard.add",
preventDefault,
stopPropagation,
repeat);
}

internal static async Task KeyboardRemove(this IJSRuntime js, Guid[] ids)
{
await js.InvokeVoidAsync("BitButil.keyboard.remove", ids);
}
=> await js.InvokeVoidAsync("BitButil.keyboard.remove", ids);
}
Loading

0 comments on commit 952e79f

Please sign in to comment.