Merge pull request #18162 from umbraco/v15/feature/hide-icons

Feature: hide icons
This commit is contained in:
Niels Lyngsø
2025-01-31 12:40:16 +01:00
committed by GitHub
10 changed files with 207 additions and 461 deletions

View File

@@ -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`,
@@ -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`,
@@ -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(',')}];`;

View File

@@ -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",
@@ -2360,6 +2361,11 @@
},
{
"name": "icon-umb-manifest",
"file": "puzzle.svg",
"internal": true
},
{
"name": "icon-puzzle-piece",
"file": "puzzle.svg"
},
{

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

@@ -1,4 +1,4 @@
export default `<!-- @license lucide-static v0.460.0 - ISC -->
export default `<!-- @license lucide-static v0.471.0 - ISC -->
<svg
class="lucide lucide-clipboard-copy"
xmlns="http://www.w3.org/2000/svg"

View File

@@ -1,4 +1,4 @@
export default `<!-- @license lucide-static v0.460.0 - ISC -->
export default `<!-- @license lucide-static v0.471.0 - ISC -->
<svg
class="lucide lucide-clipboard"
xmlns="http://www.w3.org/2000/svg"

View File

@@ -1,4 +1,4 @@
export default `<!-- @license lucide-static v0.460.0 - ISC -->
export default `<!-- @license lucide-static v0.471.0 - ISC -->
<svg
class="lucide lucide-clipboard-paste"
xmlns="http://www.w3.org/2000/svg"

View File

@@ -1,4 +1,4 @@
export default `<!-- @license lucide-static v0.460.0 - ISC -->
export default `<!-- @license lucide-static v0.471.0 - ISC -->
<svg
class="lucide lucide-clipboard"
xmlns="http://www.w3.org/2000/svg"

View File

@@ -0,0 +1,14 @@
export default `<!-- @license lucide-static v0.471.0 - ISC -->
<svg
class="lucide lucide-puzzle"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.75"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z" />
</svg>
`;

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>;