Skip to content

v2.0.0

Compare
Choose a tag to compare
@BattlefieldDuck BattlefieldDuck released this 08 Mar 13:39
· 58 commits to main since this release
eaa3615

Overview

  • Update @xterm/xterm to v5.4.0
  • Support Input, AttachCustomWheelEventHandler and SetCustomWheelEventHandler
  • Rename AttachCustomKeyEventHandlerEvaluate to SetCustomKeyEventHandler

Improvements

  • Optimized XtermBlazor.min.css and XtermBlazor.min.js, significantly reducing their file sizes.
  • Enhanced the way addons are invoked, making it more efficient and user-friendly.

Upgrade to v2.0.0

This document provides instructions on how to upgrade your code to version 2.0.0.

Changes in HTML

Replace the stylesheet link in your HTML file as follows:

<!-- Before v2.0.0 -->
<link href="_content/XtermBlazor/XtermBlazor.css" rel="stylesheet" />

<!-- After v2.0.0 -->
<link href="_content/XtermBlazor/XtermBlazor.min.css" rel="stylesheet" />

The old xterm and xterm-* packages are now deprecated and will no longer be maintained.
Please use the new scoped @xterm/* packages instead.

<!-- Before v2.0.0 -->
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.7.0/lib/xterm-addon-fit.min.js"></script>

<!-- After v2.0.0 (Blazor Server) -->
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-fit@0.9.0/lib/addon-fit.min.js"></script>

<!-- After v2.0.0 (Blazor WebAssembly) -->
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.9.0/lib/addon-fit.min.js"></script>
<!-- Before v2.0.0 -->
<script>XtermBlazor.registerAddons({"xterm-addon-fit": new FitAddon.FitAddon()});</script>

<!-- After v2.0.0 -->
<script>XtermBlazor.registerAddons({"addon-fit": new FitAddon.FitAddon()});</script>

Changes in Razor

Update your Razor file to reflect the following changes:

  <!-- Before v2.0.0 -->
- <Xterm @ref="_terminal" Options="_options" AddonIds="_addonIds" OnFirstRender="@OnFirstRender" />

  @code {
      private Xterm _terminal;
  
      private TerminalOptions _options = new TerminalOptions
      {
          CursorBlink = true,
          CursorStyle = CursorStyle.Bar,
      };
      
-     private string[] _addonIds = new string[]
      {
-         "xterm-addon-fit",
      };
      
      private async Task OnFirstRender()
      {
          // Invoke fit() function
-         await _terminal.InvokeAddonFunctionVoidAsync("xterm-addon-fit", "fit");
      }
  }

  <!-- After v2.0.0 -->
+ <Xterm @ref="_terminal" Options="_options" Addons="_addons" OnFirstRender="@OnFirstRender" />

  @code {
      private Xterm _terminal;
  
      private TerminalOptions _options = new TerminalOptions
      {
          CursorBlink = true,
          CursorStyle = CursorStyle.Bar,
      };

+     private HashSet<string> _addons = new HashSet<string>()
      {
+         "addon-fit",
      };

      private async Task OnFirstRender()
      {
          // Invoke fit() function
+         await _terminal.Addon("addon-fit").InvokeVoidAsync("fit");
      }
  }

Changes in C#

Update your C# code to reflect the following changes: (#22)

// Before v2.0.0
private async Task OnKey(KeyboardEventArgs args)
{
    
}

// After v2.0.0
private async Task OnKey(KeyEventArgs args)
{
    
}

What's Changed

  • Bump Microsoft.AspNetCore.Components.WebAssembly and Microsoft.AspNetCore.Components.Web in /XtermBlazor by @dependabot in #18
  • Add EventCallback with Key from Xterm by @PetterRein in #22
  • Bump Microsoft.AspNetCore.Components.WebAssembly.DevServer from 8.0.1 to 8.0.2 in /XtermBlazor by @dependabot in #19
  • Bump typescript from 5.3.3 to 5.4.2 in /XtermBlazor/src by @dependabot in #24
  • Bump webpack from 5.90.1 to 5.90.3 in /XtermBlazor/src by @dependabot in #23
  • Bump Microsoft.AspNetCore.Components.WebAssembly and Microsoft.AspNetCore.Components.Web in /XtermBlazor by @dependabot in #25
  • Bump esbuild-loader from 4.0.3 to 4.1.0 in /XtermBlazor/src by @dependabot in #26

New Contributors

Full Changelog: v1.10.2...v2.0.0