XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESystem

【Rust】XFE系统,基于Rust和汇编

公开
关注 0 Fork 0 Star 0
UTF-8
namespace XFESystem.Desktop;

public sealed class DesktopWindow
{
    public int Id { get; internal set; }
    public DesktopApplication Application { get; internal set; }
    public DesktopBounds Bounds { get; internal set; }
    public DesktopBounds RestoreBounds { get; internal set; }
    public bool IsMinimized { get; internal set; }
    public bool IsMaximized { get; internal set; }
    public bool IsSnapped { get; internal set; }
    public DesktopChromeAnimation ChromeAnimation { get; } = new();
    public string Title { get; internal set; } = "";
    public string Location { get; internal set; } = "";
    public string Content { get; internal set; } = "";
    public string Status { get; internal set; } = "";
    public bool IsDirty { get; internal set; }
    public int Caret { get; internal set; }
    public int ScrollLine { get; internal set; }
    public XFESystem.Console.TerminalSnapshot? Terminal { get; internal set; }
    public IInteractiveBrowserSession? BrowserSession { get; internal set; }
    public bool IsEditorPreparing => EditorPreparation is not null;
    public long EditorPreparationGeneration { get; internal set; }
    internal IEditorPreparationOperation? EditorPreparation { get; set; }
    internal long EditorPreparationStarted { get; set; }
    internal long EditorSourcePresentedGeneration { get; set; }
    internal long EditorInputVersion { get; set; }
    internal bool BrowserContentFocused { get; set; }
    internal double BrowserScroll { get; set; }
    internal int HorizontalScroll { get; set; }
    internal bool AddressSelected { get; set; }
    internal string? MeasuredContent { get; set; }
    internal int MeasuredHorizontalScroll { get; set; }
    internal int MeasuredViewportWidth { get; set; }
    internal int MeasuredContentWidth { get; set; }
    internal int AppearanceFocus { get; set; }
    internal int AppearancePreset { get; set; }
    internal string AppearanceAccentText { get; set; } = "";
    internal bool AppearanceAccentSelected { get; set; }
}

public readonly record struct BrowserPage(string Address, string Title, string Text);

/// <summary>A real document/JS engine must be supplied by the runtime adapter.</summary>
public interface IBrowserService
{
    BrowserPage Navigate(string address);
    string ExecuteJavaScript(string source);
    string PreviewMarkdown(string markdown);
}

/// <summary>Local code previews must receive a fresh environment, without a previously visited page's DOM.</summary>
public interface IJavaScriptPreviewService : IBrowserService
{
    string PreviewJavaScript(string source);
}