add it back to the toolkit
Some checks failed
Spell checking / Check Spelling (push) Has been cancelled
Spell checking / Update PR (push) Has been cancelled
Spell checking / Report (Push) (push) Has been cancelled
Spell checking / Report (PR) (push) Has been cancelled

This commit is contained in:
Mike Griese 2025-08-20 06:57:56 -05:00
commit ae6b7ac68c
3 changed files with 33 additions and 38 deletions

View File

@ -229,42 +229,4 @@ internal sealed partial class SampleListPage : ListPage
{ "hmm?", null },
};
}
/// <summary>
/// Represents an icon that is a font glyph.
/// This is used for icons that are defined by a specific font face,
/// such as Wingdings.
///
/// Note that Command Palette will default to using the Segoe Fluent Icons,
/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe
/// UI for any other glyphs. This class is only needed if you want a non-Segoe
/// font icon.
///
/// WHY ISN'T THIS IN THE TOOLKIT: I have NO idea why, but if you put this
/// in the toolkit, and not in your extension code, we 100% fail to cast
/// the `Dictionary` to an IDictionary. The error was in
/// `IExtendedAttributesProvider:Do_Abi_GetProperties_0`
/// </summary>
internal sealed partial class FontIconData : IconData, IExtendedAttributesProvider
{
private string FontFamily { get; set; }
// LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the
// backing store for Properties. A regular `Dictionary<string, object>`
// will not work across the ABI
private readonly Windows.Foundation.Collections.ValueSet _properties;
public IDictionary<string, object> GetProperties() => _properties;
public FontIconData(string glyph, string fontFamily)
: base(glyph)
{
FontFamily = fontFamily;
_properties = new Windows.Foundation.Collections.ValueSet()
{
{ "FontFamily", FontFamily },
};
}
}
}

View File

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.Foundation.Collections;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
/// <summary>
/// Represents an icon that is a font glyph.
/// This is used for icons that are defined by a specific font face,
/// such as Wingdings.
///
/// Note that Command Palette will default to using the Segoe Fluent Icons,
/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe
/// UI for any other glyphs. This class is only needed if you want a non-Segoe
/// font icon.
/// </summary>
public partial class FontIconData : IconData, IExtendedAttributesProvider
{
public string FontFamily { get; set; }
public FontIconData(string glyph, string fontFamily)
: base(glyph)
{
FontFamily = fontFamily;
}
public IDictionary<string, object>? GetProperties() => new ValueSet()
{
{ "FontFamily", FontFamily },
};
}

View File

@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
using Windows.Storage.Streams;
namespace Microsoft.CommandPalette.Extensions.Toolkit;