Skip to content

Commit 341534c

Browse files
authored
Merge pull request #18162 from umbraco/v15/feature/hide-icons
Feature: hide icons
2 parents 50ff23b + e124ce9 commit 341534c

File tree

10 files changed

+207
-461
lines changed

10 files changed

+207
-461
lines changed

src/Umbraco.Web.UI.Client/devops/icons/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const collectDictionaryIcons = async () => {
4646

4747
const icon = {
4848
name: iconDef.name,
49-
legacy: iconDef.legacy,
49+
legacy: iconDef.legacy, // TODO: Deprecated, remove in v.17.
50+
hidden: iconDef.legacy ?? iconDef.internal,
5051
fileName: iconFileName,
5152
svg,
5253
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
@@ -137,9 +138,11 @@ const collectDiskIcons = async (icons) => {
137138

138139
// Only append not already defined icons:
139140
if (!icons.find((x) => x.name === iconName)) {
141+
// remove legacy for v.17 (Deprecated)
140142
const icon = {
141143
name: iconName,
142144
legacy: true,
145+
hidden: true,
143146
fileName: iconFileName,
144147
svg,
145148
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
@@ -172,11 +175,13 @@ const generateJS = (icons) => {
172175
const JSPath = `${moduleDirectory}/icons.ts`;
173176

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

182187
const content = `export default [${iconDescriptors.join(',')}];`;

src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-dictionary.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@
641641
{
642642
"name": "icon-document-dashed-line",
643643
"file": "file.svg",
644-
"missing": "TODO:"
644+
"missing": "TODO: Legacy until se have made a custom",
645+
"legacy": true
645646
},
646647
{
647648
"name": "icon-document",
@@ -2360,6 +2361,11 @@
23602361
},
23612362
{
23622363
"name": "icon-umb-manifest",
2364+
"file": "puzzle.svg",
2365+
"internal": true
2366+
},
2367+
{
2368+
"name": "icon-puzzle-piece",
23632369
"file": "puzzle.svg"
23642370
},
23652371
{

src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-registry.context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class UmbIconRegistryContext extends UmbContextBase<UmbIconRegistryContex
1313
#manifestMap = new Map();
1414
#icons = new UmbArrayState<UmbIconDefinition>([], (x) => x.name);
1515
readonly icons = this.#icons.asObservable();
16-
readonly approvedIcons = this.#icons.asObservablePart((icons) => icons.filter((x) => x.legacy !== true));
16+
readonly approvedIcons = this.#icons.asObservablePart((icons) => icons.filter((x) => x.hidden !== true));
1717

1818
constructor(host: UmbControllerHost) {
1919
super(host, UMB_ICON_REGISTRY_CONTEXT);

0 commit comments

Comments
 (0)