Skip to content

Commit

Permalink
Merge pull request #18162 from umbraco/v15/feature/hide-icons
Browse files Browse the repository at this point in the history
Feature: hide icons
  • Loading branch information
nielslyngsoe authored Jan 31, 2025
2 parents 50ff23b + e124ce9 commit 341534c
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 461 deletions.
9 changes: 7 additions & 2 deletions src/Umbraco.Web.UI.Client/devops/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const collectDictionaryIcons = async () => {

const icon = {
name: iconDef.name,
legacy: iconDef.legacy,
legacy: iconDef.legacy, // TODO: Deprecated, remove in v.17.
hidden: iconDef.legacy ?? iconDef.internal,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
Expand Down Expand Up @@ -137,9 +138,11 @@ const collectDiskIcons = async (icons) => {

// Only append not already defined icons:
if (!icons.find((x) => x.name === iconName)) {
// remove legacy for v.17 (Deprecated)
const icon = {
name: iconName,
legacy: true,
hidden: true,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
Expand Down Expand Up @@ -172,11 +175,13 @@ const generateJS = (icons) => {
const JSPath = `${moduleDirectory}/icons.ts`;

const iconDescriptors = icons.map((icon) => {
// remove legacy for v.17 (Deprecated)
return `{
name: "${icon.name}",
${icon.legacy ? 'legacy: true,' : ''}
${icon.hidden ? 'hidden: true,' : ''}
path: () => import("./icons/${icon.fileName}.js"),
}`.replace(/\t/g, ''); // Regex removes white space [NL]
}`.replace(/\t/g, '').replace(/^\s*[\r\n]/gm, ''); // Regex removes white space [NL] // + regex that removes empty lines. [NL]
});

const content = `export default [${iconDescriptors.join(',')}];`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@
{
"name": "icon-document-dashed-line",
"file": "file.svg",
"missing": "TODO:"
"missing": "TODO: Legacy until se have made a custom",
"legacy": true
},
{
"name": "icon-document",
Expand Down Expand Up @@ -2360,6 +2361,11 @@
},
{
"name": "icon-umb-manifest",
"file": "puzzle.svg",
"internal": true
},
{
"name": "icon-puzzle-piece",
"file": "puzzle.svg"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 341534c

Please sign in to comment.