├── .github
└── workflows
│ └── dotnet.yml
├── .gitignore
├── Bromix.MudBlazor.MaterialDesignIcons.sln
├── Bromix.MudBlazor.MaterialDesignIcons
└── Bromix.MudBlazor.MaterialDesignIcons.csproj
├── LICENSE
├── Logo.png
├── README.md
├── build.js
└── package.json
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | workflow_dispatch:
5 | pull_request:
6 | branches:
7 | - main
8 | - release
9 |
10 | env:
11 | VersionAppendix: -alpha-${{ github.run_number }}
12 |
13 | jobs:
14 | build:
15 |
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - uses: actions/checkout@v3
20 | - name: Setup node.js environment
21 | uses: actions/setup-node@v3.4.1
22 | with:
23 | node-version: 16.x
24 | - name: Install @mdi/svg
25 | run: npm install
26 | - name: Get @mdi/svg version
27 | run: |
28 | MDI_VERSION=$(node -p "require('./node_modules/@mdi/svg/package.json').version")
29 | echo "MDI_VERSION=$MDI_VERSION" >> $GITHUB_ENV
30 | - name: Set pre-release version
31 | run: echo "PACKAGE_VERSION=${{ env.MDI_VERSION }}-alpha-${{ github.run_number }}" >> $GITHUB_ENV
32 | if: github.base_ref == 'main'
33 | - name: Set release version
34 | run: echo "PACKAGE_VERSION=${{ env.MDI_VERSION }}.${{ github.run_number }}" >> $GITHUB_ENV
35 | if: github.base_ref == 'release'
36 | - name: Extract svg data
37 | run: npm run build
38 | - name: Setup .NET
39 | uses: actions/setup-dotnet@v2
40 | with:
41 | dotnet-version: 7.0.x
42 | - name: Restore dependencies
43 | run: dotnet restore
44 | - name: Build
45 | run: dotnet build -c Release -p:Version=${{ env.PACKAGE_VERSION }}
46 | - name: Pack
47 | run: dotnet pack -c Release -p:Version=${{ env.PACKAGE_VERSION }}
48 | - name: Push to nuget
49 | run: dotnet nuget push Bromix.MudBlazor.MaterialDesignIcons/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
50 | # - name: Provide download
51 | # uses: actions/upload-artifact@v3
52 | # with:
53 | # name: nugetpackage
54 | # path: '**/*.nupkg'
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | MaterialDesignIcons.*.cs
2 |
3 | .idea/
4 | bin/
5 | obj/
6 | package-lock.json
7 |
8 | # Logs
9 | logs
10 | *.log
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | lerna-debug.log*
15 | .pnpm-debug.log*
16 |
17 | # Diagnostic reports (https://nodejs.org/api/report.html)
18 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 | *.lcov
32 |
33 | # nyc test coverage
34 | .nyc_output
35 |
36 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
37 | .grunt
38 |
39 | # Bower dependency directory (https://bower.io/)
40 | bower_components
41 |
42 | # node-waf configuration
43 | .lock-wscript
44 |
45 | # Compiled binary addons (https://nodejs.org/api/addons.html)
46 | build/Release
47 |
48 | # Dependency directories
49 | node_modules/
50 | jspm_packages/
51 |
52 | # Snowpack dependency directory (https://snowpack.dev/)
53 | web_modules/
54 |
55 | # TypeScript cache
56 | *.tsbuildinfo
57 |
58 | # Optional npm cache directory
59 | .npm
60 |
61 | # Optional eslint cache
62 | .eslintcache
63 |
64 | # Optional stylelint cache
65 | .stylelintcache
66 |
67 | # Microbundle cache
68 | .rpt2_cache/
69 | .rts2_cache_cjs/
70 | .rts2_cache_es/
71 | .rts2_cache_umd/
72 |
73 | # Optional REPL history
74 | .node_repl_history
75 |
76 | # Output of 'npm pack'
77 | *.tgz
78 |
79 | # Yarn Integrity file
80 | .yarn-integrity
81 |
82 | # dotenv environment variable files
83 | .env
84 | .env.development.local
85 | .env.test.local
86 | .env.production.local
87 | .env.local
88 |
89 | # parcel-bundler cache (https://parceljs.org/)
90 | .cache
91 | .parcel-cache
92 |
93 | # Next.js build output
94 | .next
95 | out
96 |
97 | # Nuxt.js build / generate output
98 | .nuxt
99 | dist
100 |
101 | # Gatsby files
102 | .cache/
103 | # Comment in the public line in if your project uses Gatsby and not Next.js
104 | # https://nextjs.org/blog/next-9-1#public-directory-support
105 | # public
106 |
107 | # vuepress build output
108 | .vuepress/dist
109 |
110 | # vuepress v2.x temp and cache directory
111 | .temp
112 | .cache
113 |
114 | # Docusaurus cache and generated files
115 | .docusaurus
116 |
117 | # Serverless directories
118 | .serverless/
119 |
120 | # FuseBox cache
121 | .fusebox/
122 |
123 | # DynamoDB Local files
124 | .dynamodb/
125 |
126 | # TernJS port file
127 | .tern-port
128 |
129 | # Stores VSCode versions used for testing VSCode extensions
130 | .vscode-test
131 |
132 | # yarn v2
133 | .yarn/cache
134 | .yarn/unplugged
135 | .yarn/build-state.yml
136 | .yarn/install-state.gz
137 | .pnp.*
138 |
--------------------------------------------------------------------------------
/Bromix.MudBlazor.MaterialDesignIcons.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30114.105
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bromix.MudBlazor.MaterialDesignIcons", "Bromix.MudBlazor.MaterialDesignIcons\Bromix.MudBlazor.MaterialDesignIcons.csproj", "{F5330E83-DF7E-485C-B505-261C37B189F2}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(SolutionProperties) = preSolution
14 | HideSolutionNode = FALSE
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {F5330E83-DF7E-485C-B505-261C37B189F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18 | {F5330E83-DF7E-485C-B505-261C37B189F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
19 | {F5330E83-DF7E-485C-B505-261C37B189F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
20 | {F5330E83-DF7E-485C-B505-261C37B189F2}.Release|Any CPU.Build.0 = Release|Any CPU
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Bromix.MudBlazor.MaterialDesignIcons/Bromix.MudBlazor.MaterialDesignIcons.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | enable
6 | enable
7 | true
8 | true
9 | 11
10 |
11 |
12 |
13 | Bromix.MudBlazor.MaterialDesignIcons
14 | Material Design Icons for MudBlazor
15 | Copyright bromix
16 | bromix
17 | https://github.com/bromix/Bromix.MudBlazor.MaterialDesignIcons
18 | MIT
19 | README.md
20 | Blazor;MudBlazor;Material;Material Design;Material Design Icons
21 | Logo.png
22 | https://github.com/bromix/Bromix.MudBlazor.MaterialDesignIcons
23 | git
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Matthias Bromisch
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromix/Bromix.MudBlazor.MaterialDesignIcons/972c9f46009e02fb0db78d11e9acf80c78e7b855/Logo.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.nuget.org/packages/Bromix.MudBlazor.MaterialDesignIcons/) [](https://www.nuget.org/packages/Bromix.MudBlazor.MaterialDesignIcons/) [](https://github.com/bromix/Bromix.MudBlazor.MaterialDesignIcons/blob/main/LICENSE)
2 |
3 | > _Note:_ Please use the main [MaterialDesign](https://github.com/Templarian/MaterialDesign/issues) repo to report
4 | > issues. This repository is only for the creation and deployment of the package.
5 |
6 | # MaterialDesignIcons for [MudBlazor](https://github.com/Garderoben/MudBlazor)
7 |
8 | This package provides all icons as path data (svg) from [Material Design Icons](https://materialdesignicons.com). The
9 | icons are divided into Normal and Outline variants.
10 |
11 | ## Installation
12 |
13 | Just install the NuGet package.
14 |
15 | ```
16 | dotnet add package Bromix.MudBlazor.MaterialDesignIcons
17 | ```
18 |
19 | Add the following using statement in `_Imports.razor`.
20 |
21 | ```razor
22 | @using Bromix.MudBlazor.MaterialDesignIcons
23 | ```
24 |
25 | If your're using a `GlobalUsings.cs`, you can also add:
26 |
27 | ```c#
28 | using Bromix.MudBlazor.MaterialDesignIcons;
29 | ```
30 |
31 | ## Usage
32 |
33 | ```razor
34 |
35 |
36 | ```
37 |
38 | ## How does the package creation work?
39 |
40 | Using npm and the @mdi/svg module, the latest icons are downloaded as SVG. The meta.json is read in so that we have the
41 | names of the SVG files and the authors. The authors are mentioned for each icon in the comments (documentation). For
42 | each icon variant we create a separate partial class (e.g. MaterialDesignIcons.Normal.cs and
43 | MaterialDesignIcons.Outline.cs).
44 |
45 | ## Related Packages
46 |
47 | [NPM @MDI Organization](https://npmjs.com/org/mdi)
48 |
49 | - React: [MaterialDesign-React](https://github.com/Templarian/MaterialDesign-React)
50 | - SVG: [MaterialDesign-SVG](https://github.com/Templarian/MaterialDesign-SVG)
51 | - Webfont: [MaterialDesign-Webfont](https://github.com/Templarian/MaterialDesign-Webfont)
52 | - Font-Build: [MaterialDesign-Font-Build](https://github.com/Templarian/MaterialDesign-Font-Build)
53 | - Desktop Font: [MaterialDesign-Font](https://github.com/Templarian/MaterialDesign-Font)
54 |
55 | ## Learn More
56 |
57 | - [MudBlazor](https://github.com/Garderoben/MudBlazor)
58 | - [MaterialDesignIcons.com](https://materialdesignicons.com)
59 | - https://github.com/Templarian/MaterialDesign
60 |
--------------------------------------------------------------------------------
/build.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const path = require("path");
3 |
4 | /**
5 | * Helper function to parse the given json file.
6 | * @param {*} fileName
7 | */
8 | const loadJsonFile = (fileName) => {
9 | if (!fs.existsSync(fileName)) {
10 | console.error(`Package file ${fileName} not found`);
11 | }
12 | return JSON.parse(fs.readFileSync(fileName, "utf8"));
13 | };
14 |
15 | /**
16 | * Convert a snake case string to a camel case string.
17 | * @param {*} str
18 | * @returns
19 | */
20 | const SnakeCaseToCamelCase = (str) => str.toLowerCase().replace(/((^|[-_])[a-z0-9])/g, (group) => group.toUpperCase().replace("-", "").replace("_", ""));
21 |
22 | const writeSvg = (output, metaItem, indent = "\t") => {
23 | const regexSvgPath = //g;
24 | const regexReplaceQuotes = /\"/g;
25 | const svgFileName = path.join("node_modules", "@mdi", "svg", "svg", metaItem.fileName);
26 | const svgData = fs.readFileSync(svgFileName, "utf-8");
27 | if ((m = regexSvgPath.exec(svgData)) !== null) {
28 | const pathData = m[0].replace(regexReplaceQuotes, '""');
29 |
30 | output.push(`${indent}/// `);
31 | output.push(`${indent}/// Codepoint: ${metaItem.codepoint}
`);
32 | output.push(`${indent}/// Name: mdi-${metaItem.name}
`);
33 | output.push(`${indent}/// Author: ${metaItem.author}
`);
34 | output.push(`${indent}/// `);
35 | output.push(`${indent}public const string ${metaItem.iconName} = @"${pathData}";`);
36 | output.push("");
37 | } else {
38 | console.error(`Could not extract svg path from "${svgFileName}"`);
39 | }
40 | };
41 |
42 | const writeSvgCategory = (metaItems, category) => {
43 | console.info(`Writing ${metaItems.length} ${category} icons...`);
44 | const output = [];
45 | output.push("namespace Bromix.MudBlazor.MaterialDesignIcons;");
46 | output.push("");
47 | output.push("/// Collection of Material Design Icons");
48 | output.push("public static partial class MaterialDesignIcons");
49 | output.push("{");
50 | output.push(`\t/// ${category} variant of Material Design Icons`);
51 | output.push(`\tpublic static class ${category}`);
52 | output.push("\t\t{");
53 | for (var metaItem of metaItems) {
54 | writeSvg(output, metaItem, "\t\t");
55 | }
56 | output.push("\t\t}");
57 | output.push("}");
58 | const sourceFileName = path.join(`Bromix.MudBlazor.MaterialDesignIcons/MaterialDesignIcons.${category}.cs`);
59 | fs.writeFileSync(sourceFileName, output.join("\n"));
60 | };
61 |
62 | const packageFileName = path.join("node_modules", "@mdi", "svg", "package.json");
63 | const package = loadJsonFile(packageFileName);
64 | console.info(`Material Design Icon v${package.version}`);
65 |
66 | const metaFileName = path.join("node_modules", "@mdi", "svg", "meta.json");
67 | const meta = loadJsonFile(metaFileName);
68 |
69 | const normalIcons = meta
70 | .filter((item) => !item.name.endsWith("-outline"))
71 | .map((item) => {
72 | item.fileName = `${item.name}.svg`;
73 | item.iconName = SnakeCaseToCamelCase(item.name);
74 | return item;
75 | });
76 | writeSvgCategory(normalIcons, "Normal");
77 |
78 | const outlineIcons = meta
79 | .filter((item) => item.name.endsWith("-outline"))
80 | .map((item) => {
81 | item.fileName = `${item.name}.svg`;
82 | item.iconName = SnakeCaseToCamelCase(item.name.replace("-outline", ""));
83 | return item;
84 | });
85 | writeSvgCategory(outlineIcons, "Outline");
86 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mudblazor.materialdesignicons",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "build": "node build.js"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git@bromix.github.com:bromix/MudBlazor.MaterialDesignIcons.git"
12 | },
13 | "author": "Bromix",
14 | "license": "MIT",
15 | "dependencies": {
16 | "@mdi/svg": "7.4.47"
17 | }
18 | }
--------------------------------------------------------------------------------