refactor to use hidden as the property for legacy and internal icons

This commit is contained in:
Niels Lyngsø
2025-01-29 13:55:01 +01:00
parent f2b337a0be
commit fccd203bdc
3 changed files with 6 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ const collectDictionaryIcons = async () => {
const icon = {
name: iconDef.name,
legacy: iconDef.legacy,
hidden: iconDef.legacy ?? iconDef.internal,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,

View File

@@ -13,7 +13,7 @@ export class UmbIconRegistryContext extends UmbContextBase<UmbIconRegistryContex
#manifestMap = new Map();
#icons = new UmbArrayState<UmbIconDefinition>([], (x) => x.name);
readonly icons = this.#icons.asObservable();
readonly approvedIcons = this.#icons.asObservablePart((icons) => icons.filter((x) => x.legacy !== true));
readonly approvedIcons = this.#icons.asObservablePart((icons) => icons.filter((x) => x.hidden !== true));
constructor(host: UmbControllerHost) {
super(host, UMB_ICON_REGISTRY_CONTEXT);

View File

@@ -5,7 +5,11 @@ export type * from './extensions/icons.extension.js';
export interface UmbIconDefinition<JsType = any> {
name: string;
path: JsLoaderProperty<JsType>;
/**
* @deprecated `legacy` is deprecated and will be removed in v.17. Use `hidden` instead.
*/
legacy?: boolean;
hidden?: boolean;
}
export type UmbIconDictionary = Array<UmbIconDefinition>;