Skip to content

Commit

Permalink
Merge pull request #160 from huntercfreeman/changes
Browse files Browse the repository at this point in the history
changes
  • Loading branch information
Luthetus authored May 5, 2024
2 parents 3982ea9 + 4bb99b0 commit 6fea923
Show file tree
Hide file tree
Showing 184 changed files with 5,680 additions and 3,855 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet-test-explorer.testProjectPath": "/home/hunter/Repos/Luthetus.Ide_Fork/Source/Tests/Ide/Luthetus.Ide.Tests.csproj"
}
7 changes: 0 additions & 7 deletions Luthetus.Ide.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.L
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Razor", "Source\Lib\CompilerServices\Razor\Luthetus.CompilerServices.Lang.Razor.csproj", "{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Terminal", "Source\Lib\CompilerServices\Terminal\Luthetus.CompilerServices.Lang.Terminal.csproj", "{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.TypeScript", "Source\Lib\CompilerServices\TypeScript\Luthetus.CompilerServices.Lang.TypeScript.csproj", "{FA133D31-0DCC-4737-A76F-8AF6D8755EDE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Xml", "Source\Lib\CompilerServices\Xml\Luthetus.CompilerServices.Lang.Xml.csproj", "{83C1B854-C3AD-4C1E-B2BC-799642039C3D}"
Expand Down Expand Up @@ -145,10 +143,6 @@ Global
{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Release|Any CPU.Build.0 = Release|Any CPU
{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Release|Any CPU.Build.0 = Release|Any CPU
{FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -257,7 +251,6 @@ Global
{F297E0E8-3582-41BE-AB48-14D89413B7E0} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{7348E3F2-3749-4D5F-AEA5-21C7D19FCC49} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{76F4AB6D-5249-4D0A-AAF8-D656E792AA34} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{FA133D31-0DCC-4737-A76F-8AF6D8755EDE} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{83C1B854-C3AD-4C1E-B2BC-799642039C3D} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84}
{4BC736B4-4A2D-43C7-AD2D-7B24F5E35518} = {ACC32A2F-DF9C-4B91-80AE-F0585CDD59EC}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Fluxor;
using Microsoft.JSInterop;
using System.Collections.Immutable;
using Luthetus.Common.RazorLib.JavaScriptObjects.Models;
using Luthetus.Common.RazorLib.Contexts.States;
using Luthetus.Common.RazorLib.Contexts.Models;
using Luthetus.Common.RazorLib.Keys.Models;
Expand Down
8 changes: 8 additions & 0 deletions Source/Lib/Common/FileSystems/Models/AncestorDirectory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
namespace Luthetus.Common.RazorLib.FileSystems.Models;

/// <summary>
/// This class exists alongside the <see cref="IAbsolutePath"/> type.
/// This is intentional, as if one treats an ancestor directory as an <see cref="IAbsolutePath"/>,
/// then far more "metadata" gets created.<br/><br/>
///
/// This class allows for tracking of ancestor directories efficiently,
/// and if there is one of interest, then choose to create an <see cref="IAbsolutePath"/> from it.
/// </summary>
public class AncestorDirectory
{
public AncestorDirectory(
Expand Down
17 changes: 17 additions & 0 deletions Source/Lib/Common/FileSystems/Models/IAbsolutePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,21 @@ public interface IAbsolutePath : IPath
{
public IFileSystemDrive? RootDrive { get; }
public bool IsRootDirectory { get; }

/// <summary>
/// One might prefer <see cref="IEnvironmentProvider.AbsolutePathFactory(string, bool)"/> instead
/// of this method.<br/><br/>
///
/// This version adds an extra function invocation for no reason. To use
/// <see cref="IEnvironmentProvider.AbsolutePathFactory(string, bool)"/> may be a negligible
/// optimization however.<br/><br/>
///
/// Keep this method here, it provides more clear documentation on how to create an instance
/// of <see cref="IAbsolutePath"/>. Having to invoke a method on the <see cref="IEnvironmentProvider"/>
/// is a bit hard to find.
/// </summary>
public static IAbsolutePath Factory(string path, bool isDirectory, IEnvironmentProvider environmentProvider)
{
return environmentProvider.AbsolutePathFactory(path, isDirectory);
}
}
17 changes: 17 additions & 0 deletions Source/Lib/Common/FileSystems/Models/IRelativePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,21 @@ public interface IRelativePath : IPath
/// Given "../../../Homework/math.txt". The count is 3.
/// </summary>
public int UpDirDirectiveCount { get; }

/// <summary>
/// One might prefer <see cref="IEnvironmentProvider.RelativePathFactory(string, bool)"/> instead
/// of this method.<br/><br/>
///
/// This version adds an extra function invocation for no reason. To use
/// <see cref="IEnvironmentProvider.RelativePathFactory(string, bool)"/> may be a negligible
/// optimization however.<br/><br/>
///
/// Keep this method here, it provides more clear documentation on how to create an instance
/// of <see cref="IRelativePath"/>. Having to invoke a method on the <see cref="IEnvironmentProvider"/>
/// is a bit hard to find.
/// </summary>
public static IRelativePath Factory(string path, bool isDirectory, IEnvironmentProvider environmentProvider)
{
return environmentProvider.RelativePathFactory(path, isDirectory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public ValueTask LocalStorageSetItem(string key, object? value)
value);
}

public ValueTask<object?> LocalStorageGetItem(string key)
public ValueTask<string?> LocalStorageGetItem(string key)
{
return _jsRuntime.InvokeAsync<object?>(
return _jsRuntime.InvokeAsync<string?>(
"luthetusCommon.localStorageGetItem",
key);
}
Expand Down
22 changes: 13 additions & 9 deletions Source/Lib/Common/Luthetus.Common.RazorLib.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -7,7 +7,7 @@
<Product>Luthetus Common</Product>
<Description>A repository containing Blazor Components I've made which I commonly use in other projects.</Description>
<PackageId>Luthetus.Common</PackageId>
<Version>1.5.0</Version>
<Version>2.0.0</Version>
<Authors>Hunter Freeman</Authors>
<Company />
<PackageTags>DotNet CSharp Blazor RazorComponents</PackageTags>
Expand All @@ -17,13 +17,17 @@
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0" />
<PackageReference Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
<PackageReference Condition="'$(TargetFramework)' == 'net5.0'" Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
<PackageReference Condition="'$(TargetFramework)' != 'net7.0' AND '$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net5.0'" Include="Microsoft.AspNetCore.Components.Web" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />

<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\External\Fluxor_fork\Source\Lib\Fluxor.Blazor.Web\Fluxor.Blazor.Web.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions Source/Lib/Common/Panels/Displays/PanelGroupDisplay.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
@inherits Fluxor.Blazor.Web.Components.FluxorComponent

@{
var panelsState = PanelsStateWrap.Value;
var panelState = PanelStateWrap.Value;

var panelGroup = panelsState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);
var panelGroup = panelState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);

IPanelTab? activePanelTab = null;

Expand Down Expand Up @@ -48,7 +48,7 @@
}
</div>

@if (PanelsStateWrap.Value.DragEventArgs is not null)
@if (PanelStateWrap.Value.DragEventArgs is not null)
{
<div class="luth_ide_panel-tab-dropzone luth_ide_panel-tab-dropzone-top"
@onmouseup:stopPropagation="true"
Expand Down
30 changes: 15 additions & 15 deletions Source/Lib/Common/Panels/Displays/PanelGroupDisplay.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Luthetus.Common.RazorLib.Panels.Displays;
public partial class PanelGroupDisplay : FluxorComponent
{
[Inject]
private IState<PanelsState> PanelsStateWrap { get; set; } = null!;
private IState<PanelState> PanelStateWrap { get; set; } = null!;
[Inject]
private IDispatcher Dispatcher { get; set; } = null!;
[Inject]
Expand Down Expand Up @@ -84,9 +84,9 @@ private string GetPanelPositionCssClass()

private async Task PassAlongSizeIfHiddenAsync()
{
var panelsState = PanelsStateWrap.Value;
var panelState = PanelStateWrap.Value;

var panelGroup = panelsState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);
var panelGroup = panelState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);

if (panelGroup is not null)
{
Expand Down Expand Up @@ -141,27 +141,27 @@ private string GetElementDimensionsStyleString(PanelGroup? panelGroup, IPanelTab

private Task TopDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)
{
var panelsState = PanelsStateWrap.Value;
var panelState = PanelStateWrap.Value;

var panelGroup = panelsState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);
var panelGroup = panelState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);

if (panelGroup is null)
return Task.CompletedTask;

var panelDragEventArgs = panelsState.DragEventArgs;
var panelDragEventArgs = panelState.DragEventArgs;

if (panelDragEventArgs is not null)
{
Dispatcher.Dispatch(new PanelsState.DisposePanelTabAction(
Dispatcher.Dispatch(new PanelState.DisposePanelTabAction(
panelDragEventArgs.Value.PanelGroup.Key,
panelDragEventArgs.Value.PanelTab.Key));

Dispatcher.Dispatch(new PanelsState.RegisterPanelTabAction(
Dispatcher.Dispatch(new PanelState.RegisterPanelTabAction(
panelGroup.Key,
panelDragEventArgs.Value.PanelTab,
true));

Dispatcher.Dispatch(new PanelsState.SetDragEventArgsAction(null));
Dispatcher.Dispatch(new PanelState.SetDragEventArgsAction(null));

Dispatcher.Dispatch(new DragState.WithAction(inState => inState with
{
Expand All @@ -175,27 +175,27 @@ private Task TopDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)

private Task BottomDropzoneOnMouseUp(MouseEventArgs mouseEventArgs)
{
var panelsState = PanelsStateWrap.Value;
var panelState = PanelStateWrap.Value;

var panelGroup = panelsState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);
var panelGroup = panelState.PanelGroupList.FirstOrDefault(x => x.Key == PanelGroupKey);

if (panelGroup is null)
return Task.CompletedTask;

var panelDragEventArgs = panelsState.DragEventArgs;
var panelDragEventArgs = panelState.DragEventArgs;

if (panelDragEventArgs is not null)
{
Dispatcher.Dispatch(new PanelsState.DisposePanelTabAction(
Dispatcher.Dispatch(new PanelState.DisposePanelTabAction(
panelDragEventArgs.Value.PanelGroup.Key,
panelDragEventArgs.Value.PanelTab.Key));

Dispatcher.Dispatch(new PanelsState.RegisterPanelTabAction(
Dispatcher.Dispatch(new PanelState.RegisterPanelTabAction(
panelGroup.Key,
panelDragEventArgs.Value.PanelTab,
false));

Dispatcher.Dispatch(new PanelsState.SetDragEventArgsAction(null));
Dispatcher.Dispatch(new PanelState.SetDragEventArgsAction(null));

Dispatcher.Dispatch(new DragState.WithAction(inState => inState with
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Lib/Common/Panels/Models/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public Task OnDragEndAsync(MouseEventArgs mouseEventArgs, IDropzone? dropzone)
{
if (panelGroup is not null)
{
Dispatcher.Dispatch(new PanelsState.DisposePanelTabAction(
Dispatcher.Dispatch(new PanelState.DisposePanelTabAction(
panelGroup.Key,
Key));
}
Expand All @@ -223,7 +223,7 @@ public Task OnDragEndAsync(MouseEventArgs mouseEventArgs, IDropzone? dropzone)
{
if (panelGroup is not null)
{
Dispatcher.Dispatch(new PanelsState.DisposePanelTabAction(
Dispatcher.Dispatch(new PanelState.DisposePanelTabAction(
panelGroup.Key,
Key));
}
Expand All @@ -242,7 +242,7 @@ public Task OnDragEndAsync(MouseEventArgs mouseEventArgs, IDropzone? dropzone)
? true
: false;

Dispatcher.Dispatch(new PanelsState.RegisterPanelTabAction(
Dispatcher.Dispatch(new PanelState.RegisterPanelTabAction(
panelGroupDropzone.PanelGroupKey,
this,
insertAtIndexZero));
Expand Down
12 changes: 6 additions & 6 deletions Source/Lib/Common/Panels/Models/PanelFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ public static class PanelFacts
public static readonly Key<PanelGroup> RightPanelGroupKey = Key<PanelGroup>.NewKey();
public static readonly Key<PanelGroup> BottomPanelGroupKey = Key<PanelGroup>.NewKey();

public static PanelGroup GetTopLeftPanelGroup(PanelsState panelsState)
public static PanelGroup GetTopLeftPanelGroup(PanelState panelState)
{
return panelsState.PanelGroupList.First(x => x.Key == LeftPanelGroupKey);
return panelState.PanelGroupList.First(x => x.Key == LeftPanelGroupKey);
}

public static PanelGroup GetTopRightPanelGroup(PanelsState panelsState)
public static PanelGroup GetTopRightPanelGroup(PanelState panelState)
{
return panelsState.PanelGroupList.First(x => x.Key == RightPanelGroupKey);
return panelState.PanelGroupList.First(x => x.Key == RightPanelGroupKey);
}

public static PanelGroup GetBottomPanelGroup(PanelsState panelsState)
public static PanelGroup GetBottomPanelGroup(PanelState panelState)
{
return panelsState.PanelGroupList.First(x => x.Key == BottomPanelGroupKey);
return panelState.PanelGroupList.First(x => x.Key == BottomPanelGroupKey);
}
}
6 changes: 3 additions & 3 deletions Source/Lib/Common/Panels/Models/PanelGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public Task OnClickAsync(ITab tab, MouseEventArgs mouseEventArgs)
return Task.CompletedTask;

if (GetIsActive(tab))
Dispatcher.Dispatch(new PanelsState.SetActivePanelTabAction(Key, Key<Panel>.Empty));
Dispatcher.Dispatch(new PanelState.SetActivePanelTabAction(Key, Key<Panel>.Empty));
else
Dispatcher.Dispatch(new PanelsState.SetActivePanelTabAction(Key, panelTab.Key));
Dispatcher.Dispatch(new PanelState.SetActivePanelTabAction(Key, panelTab.Key));

return Task.CompletedTask;
}
Expand All @@ -52,7 +52,7 @@ public Task CloseAsync(ITab tab)
if (tab is not IPanelTab panelTab)
return Task.CompletedTask;

Dispatcher.Dispatch(new PanelsState.DisposePanelTabAction(Key, panelTab.Key));
Dispatcher.Dispatch(new PanelState.DisposePanelTabAction(Key, panelTab.Key));
return Task.CompletedTask;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Lib/Common/Panels/States/PanelsState.Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Luthetus.Common.RazorLib.Panels.States;

public partial record PanelsState
public partial record PanelState
{
public record RegisterPanelAction(Panel Panel);
public record DisposePanelAction(Key<Panel> PanelKey);
Expand Down
4 changes: 2 additions & 2 deletions Source/Lib/Common/Panels/States/PanelsState.Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace Luthetus.Common.RazorLib.Panels.States;
/// TODO: SphagettiCode - The resizing and hiding/showing is a bit scuffed. (2023-09-19)
/// </summary>
[FeatureState]
public partial record PanelsState(
public partial record PanelState(
ImmutableArray<PanelGroup> PanelGroupList,
ImmutableArray<Panel> PanelList)
{
public PanelsState() : this(ImmutableArray<PanelGroup>.Empty, ImmutableArray<Panel>.Empty)
public PanelState() : this(ImmutableArray<PanelGroup>.Empty, ImmutableArray<Panel>.Empty)
{
var topLeftGroup = ConstructTopLeftGroup();
var topRightGroup = ConstructTopRightGroup();
Expand Down
Loading

0 comments on commit 6fea923

Please sign in to comment.