18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
27 | @code{
28 | [CascadingParameter]
29 | private HttpContext? HttpContext { get; set; }
30 |
31 | private string? RequestId { get; set; }
32 | private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
33 |
34 | protected override void OnInitialized() =>
35 | RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
36 | }
37 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/Components/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using System.Net.Http.Json
3 | @using Microsoft.AspNetCore.Components.Forms
4 | @using Microsoft.AspNetCore.Components.Routing
5 | @using Microsoft.AspNetCore.Components.Web
6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode
7 | @using Microsoft.AspNetCore.Components.Web.Virtualization
8 | @using Microsoft.JSInterop
9 | @using ComponentBuilder.Doc
10 | @using ComponentBuilder.Doc.Client
11 | @using ComponentBuilder.Doc.Components
12 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/Program.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Doc.Client.Pages;
2 | using ComponentBuilder.Doc.Components;
3 | using ComponentBuilder;
4 |
5 | var builder = WebApplication.CreateBuilder(args);
6 |
7 | // Add services to the container.
8 | builder.Services.AddRazorComponents()
9 | .AddInteractiveServerComponents()
10 | .AddInteractiveWebAssemblyComponents();
11 | builder.Services.AddComponentBuilder();
12 | var app = builder.Build();
13 |
14 | // Configure the HTTP request pipeline.
15 | if (app.Environment.IsDevelopment())
16 | {
17 | app.UseWebAssemblyDebugging();
18 | }
19 | else
20 | {
21 | app.UseExceptionHandler("/Error", createScopeForErrors: true);
22 | }
23 |
24 | app.UseStaticFiles();
25 | app.UseAntiforgery();
26 |
27 | app.MapRazorComponents()
28 | .AddInteractiveServerRenderMode()
29 | .AddInteractiveWebAssemblyRenderMode()
30 | .AddAdditionalAssemblies(typeof(ComponentBuilder.Doc.Client._Imports).Assembly);
31 |
32 | app.Run();
33 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:56930",
8 | "sslPort": 0
9 | }
10 | },
11 | "profiles": {
12 | "http": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "launchBrowser": true,
16 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
17 | "applicationUrl": "http://localhost:5168",
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "IIS Express": {
23 | "commandName": "IISExpress",
24 | "launchBrowser": true,
25 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teacher-zhou/ComponentBuilder/81bf547d1b030ae4612fc56d50f17f0f002f2fe5/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/favicon.png
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/diff.js:
--------------------------------------------------------------------------------
1 | /*! `diff` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar = (function () {
3 | 'use strict';
4 |
5 | /*
6 | Language: Diff
7 | Description: Unified and context diff
8 | Author: Vasily Polovnyov
9 | Website: https://www.gnu.org/software/diffutils/
10 | Category: common
11 | */
12 |
13 | /** @type LanguageFn */
14 | function diff(hljs) {
15 | const regex = hljs.regex;
16 | return {
17 | name: 'Diff',
18 | aliases: [ 'patch' ],
19 | contains: [
20 | {
21 | className: 'meta',
22 | relevance: 10,
23 | match: regex.either(
24 | /^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,
25 | /^\*\*\* +\d+,\d+ +\*\*\*\*$/,
26 | /^--- +\d+,\d+ +----$/
27 | )
28 | },
29 | {
30 | className: 'comment',
31 | variants: [
32 | {
33 | begin: regex.either(
34 | /Index: /,
35 | /^index/,
36 | /={3,}/,
37 | /^-{3}/,
38 | /^\*{3} /,
39 | /^\+{3}/,
40 | /^diff --git/
41 | ),
42 | end: /$/
43 | },
44 | { match: /^\*{15}$/ }
45 | ]
46 | },
47 | {
48 | className: 'addition',
49 | begin: /^\+/,
50 | end: /$/
51 | },
52 | {
53 | className: 'deletion',
54 | begin: /^-/,
55 | end: /$/
56 | },
57 | {
58 | className: 'addition',
59 | begin: /^!/,
60 | end: /$/
61 | }
62 | ]
63 | };
64 | }
65 |
66 | return diff;
67 |
68 | })();
69 | ;
70 | export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/diff.min.js:
--------------------------------------------------------------------------------
1 | /*! `diff` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar=(()=>{"use strict";return e=>{const a=e.regex;return{
3 | name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,
4 | match:a.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)
5 | },{className:"comment",variants:[{
6 | begin:a.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),
7 | end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{
8 | className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,
9 | end:/$/}]}}})();export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/http.min.js:
--------------------------------------------------------------------------------
1 | /*! `http` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar=(()=>{"use strict";return e=>{const a="HTTP/([32]|1\\.[01])",n={
3 | className:"attribute",
4 | begin:e.regex.concat("^",/[A-Za-z][A-Za-z0-9-]*/,"(?=\\:\\s)"),starts:{
5 | contains:[{className:"punctuation",begin:/: /,relevance:0,starts:{end:"$",
6 | relevance:0}}]}},s=[n,{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}
7 | }];return{name:"HTTP",aliases:["https"],illegal:/\S/,contains:[{
8 | begin:"^(?="+a+" \\d{3})",end:/$/,contains:[{className:"meta",begin:a},{
9 | className:"number",begin:"\\b\\d{3}\\b"}],starts:{end:/\b\B/,illegal:/\S/,
10 | contains:s}},{begin:"(?=^[A-Z]+ (.*?) "+a+"$)",end:/$/,contains:[{
11 | className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{
12 | className:"meta",begin:a},{className:"keyword",begin:"[A-Z]+"}],starts:{
13 | end:/\b\B/,illegal:/\S/,contains:s}},e.inherit(n,{relevance:0})]}}})()
14 | ;export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/json.min.js:
--------------------------------------------------------------------------------
1 | /*! `json` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar=(()=>{"use strict";return e=>{
3 | const a=["true","false","null"],r={scope:"literal",beginKeywords:a.join(" ")}
4 | ;return{name:"JSON",keywords:{literal:a},contains:[{className:"attr",
5 | begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,
6 | className:"punctuation",relevance:0
7 | },e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],
8 | illegal:"\\S"}}})();export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/plaintext.js:
--------------------------------------------------------------------------------
1 | /*! `plaintext` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar = (function () {
3 | 'use strict';
4 |
5 | /*
6 | Language: Plain text
7 | Author: Egor Rogov (e.rogov@postgrespro.ru)
8 | Description: Plain text without any highlighting.
9 | Category: common
10 | */
11 |
12 | function plaintext(hljs) {
13 | return {
14 | name: 'Plain text',
15 | aliases: [
16 | 'text',
17 | 'txt'
18 | ],
19 | disableAutodetect: true
20 | };
21 | }
22 |
23 | return plaintext;
24 |
25 | })();
26 | ;
27 | export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/plaintext.min.js:
--------------------------------------------------------------------------------
1 | /*! `plaintext` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar=(()=>{"use strict";return t=>({name:"Plain text",
3 | aliases:["text","txt"],disableAutodetect:!0})})();export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/shell.js:
--------------------------------------------------------------------------------
1 | /*! `shell` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar = (function () {
3 | 'use strict';
4 |
5 | /*
6 | Language: Shell Session
7 | Requires: bash.js
8 | Author: TSUYUSATO Kitsune
9 | Category: common
10 | Audit: 2020
11 | */
12 |
13 | /** @type LanguageFn */
14 | function shell(hljs) {
15 | return {
16 | name: 'Shell Session',
17 | aliases: [
18 | 'console',
19 | 'shellsession'
20 | ],
21 | contains: [
22 | {
23 | className: 'meta.prompt',
24 | // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
25 | // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
26 | // echo /path/to/home > t.exe
27 | begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
28 | starts: {
29 | end: /[^\\](?=\s*$)/,
30 | subLanguage: 'bash'
31 | }
32 | }
33 | ]
34 | };
35 | }
36 |
37 | return shell;
38 |
39 | })();
40 | ;
41 | export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/languages/shell.min.js:
--------------------------------------------------------------------------------
1 | /*! `shell` grammar compiled for Highlight.js 11.9.0 */
2 | var hljsGrammar=(()=>{"use strict";return s=>({name:"Shell Session",
3 | aliases:["console","shellsession"],contains:[{className:"meta.prompt",
4 | begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,
5 | subLanguage:"bash"}}]})})();export default hljsGrammar;
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/es/package.json:
--------------------------------------------------------------------------------
1 | { "type": "module" }
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/diff.min.js:
--------------------------------------------------------------------------------
1 | /*! `diff` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var e=(()=>{"use strict";return e=>{const a=e.regex;return{name:"Diff",
3 | aliases:["patch"],contains:[{className:"meta",relevance:10,
4 | match:a.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)
5 | },{className:"comment",variants:[{
6 | begin:a.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),
7 | end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{
8 | className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,
9 | end:/$/}]}}})();hljs.registerLanguage("diff",e)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/http.min.js:
--------------------------------------------------------------------------------
1 | /*! `http` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var e=(()=>{"use strict";return e=>{const n="HTTP/([32]|1\\.[01])",a={
3 | className:"attribute",
4 | begin:e.regex.concat("^",/[A-Za-z][A-Za-z0-9-]*/,"(?=\\:\\s)"),starts:{
5 | contains:[{className:"punctuation",begin:/: /,relevance:0,starts:{end:"$",
6 | relevance:0}}]}},s=[a,{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}
7 | }];return{name:"HTTP",aliases:["https"],illegal:/\S/,contains:[{
8 | begin:"^(?="+n+" \\d{3})",end:/$/,contains:[{className:"meta",begin:n},{
9 | className:"number",begin:"\\b\\d{3}\\b"}],starts:{end:/\b\B/,illegal:/\S/,
10 | contains:s}},{begin:"(?=^[A-Z]+ (.*?) "+n+"$)",end:/$/,contains:[{
11 | className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{
12 | className:"meta",begin:n},{className:"keyword",begin:"[A-Z]+"}],starts:{
13 | end:/\b\B/,illegal:/\S/,contains:s}},e.inherit(a,{relevance:0})]}}})()
14 | ;hljs.registerLanguage("http",e)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/json.min.js:
--------------------------------------------------------------------------------
1 | /*! `json` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var e=(()=>{"use strict";return e=>{const a=["true","false","null"],n={
3 | scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",keywords:{
4 | literal:a},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,
5 | relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0
6 | },e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],
7 | illegal:"\\S"}}})();hljs.registerLanguage("json",e)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/plaintext.js:
--------------------------------------------------------------------------------
1 | /*! `plaintext` grammar compiled for Highlight.js 11.9.0 */
2 | (function(){
3 | var hljsGrammar = (function () {
4 | 'use strict';
5 |
6 | /*
7 | Language: Plain text
8 | Author: Egor Rogov (e.rogov@postgrespro.ru)
9 | Description: Plain text without any highlighting.
10 | Category: common
11 | */
12 |
13 | function plaintext(hljs) {
14 | return {
15 | name: 'Plain text',
16 | aliases: [
17 | 'text',
18 | 'txt'
19 | ],
20 | disableAutodetect: true
21 | };
22 | }
23 |
24 | return plaintext;
25 |
26 | })();
27 |
28 | hljs.registerLanguage('plaintext', hljsGrammar);
29 | })();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/plaintext.min.js:
--------------------------------------------------------------------------------
1 | /*! `plaintext` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var t=(()=>{"use strict";return t=>({name:"Plain text",
3 | aliases:["text","txt"],disableAutodetect:!0})})()
4 | ;hljs.registerLanguage("plaintext",t)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/shell.js:
--------------------------------------------------------------------------------
1 | /*! `shell` grammar compiled for Highlight.js 11.9.0 */
2 | (function(){
3 | var hljsGrammar = (function () {
4 | 'use strict';
5 |
6 | /*
7 | Language: Shell Session
8 | Requires: bash.js
9 | Author: TSUYUSATO Kitsune
10 | Category: common
11 | Audit: 2020
12 | */
13 |
14 | /** @type LanguageFn */
15 | function shell(hljs) {
16 | return {
17 | name: 'Shell Session',
18 | aliases: [
19 | 'console',
20 | 'shellsession'
21 | ],
22 | contains: [
23 | {
24 | className: 'meta.prompt',
25 | // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
26 | // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
27 | // echo /path/to/home > t.exe
28 | begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
29 | starts: {
30 | end: /[^\\](?=\s*$)/,
31 | subLanguage: 'bash'
32 | }
33 | }
34 | ]
35 | };
36 | }
37 |
38 | return shell;
39 |
40 | })();
41 |
42 | hljs.registerLanguage('shell', hljsGrammar);
43 | })();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/shell.min.js:
--------------------------------------------------------------------------------
1 | /*! `shell` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var s=(()=>{"use strict";return s=>({name:"Shell Session",
3 | aliases:["console","shellsession"],contains:[{className:"meta.prompt",
4 | begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,
5 | subLanguage:"bash"}}]})})();hljs.registerLanguage("shell",s)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/languages/wasm.min.js:
--------------------------------------------------------------------------------
1 | /*! `wasm` grammar compiled for Highlight.js 11.9.0 */
2 | (()=>{var e=(()=>{"use strict";return e=>{e.regex;const a=e.COMMENT(/\(;/,/;\)/)
3 | ;return a.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,
4 | keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]
5 | },contains:[e.COMMENT(/;;/,/$/),a,{match:[/(?:offset|align)/,/\s*/,/=/],
6 | className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{
7 | match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{
8 | begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",
9 | 3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,
10 | className:"type"},{className:"keyword",
11 | match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/
12 | },{className:"number",relevance:0,
13 | match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/
14 | }]}}})();hljs.registerLanguage("wasm",e)})();
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/styles/vs.css:
--------------------------------------------------------------------------------
1 | pre code.hljs {
2 | display: block;
3 | overflow-x: auto;
4 | padding: 1em
5 | }
6 | code.hljs {
7 | padding: 3px 5px
8 | }
9 | /*
10 |
11 | Visual Studio-like style based on original C# coloring by Jason Diamond
12 |
13 | */
14 | .hljs {
15 | background: white;
16 | color: black
17 | }
18 | .hljs-comment,
19 | .hljs-quote,
20 | .hljs-variable {
21 | color: #008000
22 | }
23 | .hljs-keyword,
24 | .hljs-selector-tag,
25 | .hljs-built_in,
26 | .hljs-name,
27 | .hljs-tag {
28 | color: #00f
29 | }
30 | .hljs-string,
31 | .hljs-title,
32 | .hljs-section,
33 | .hljs-attribute,
34 | .hljs-literal,
35 | .hljs-template-tag,
36 | .hljs-template-variable,
37 | .hljs-type,
38 | .hljs-addition {
39 | color: #a31515
40 | }
41 | .hljs-deletion,
42 | .hljs-selector-attr,
43 | .hljs-selector-pseudo,
44 | .hljs-meta {
45 | color: #2b91af
46 | }
47 | .hljs-doctag {
48 | color: #808080
49 | }
50 | .hljs-attr {
51 | color: #f00
52 | }
53 | .hljs-symbol,
54 | .hljs-bullet,
55 | .hljs-link {
56 | color: #00b0e8
57 | }
58 | .hljs-emphasis {
59 | font-style: italic
60 | }
61 | .hljs-strong {
62 | font-weight: bold
63 | }
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/styles/vs.min.css:
--------------------------------------------------------------------------------
1 | pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#fff;color:#000}.hljs-comment,.hljs-quote,.hljs-variable{color:green}.hljs-built_in,.hljs-keyword,.hljs-name,.hljs-selector-tag,.hljs-tag{color:#00f}.hljs-addition,.hljs-attribute,.hljs-literal,.hljs-section,.hljs-string,.hljs-template-tag,.hljs-template-variable,.hljs-title,.hljs-type{color:#a31515}.hljs-deletion,.hljs-meta,.hljs-selector-attr,.hljs-selector-pseudo{color:#2b91af}.hljs-doctag{color:grey}.hljs-attr{color:red}.hljs-bullet,.hljs-link,.hljs-symbol{color:#00b0e8}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}
--------------------------------------------------------------------------------
/doc/ComponentBuilder.Doc/ComponentBuilder.Doc/wwwroot/highlight/styles/vs2015.min.css:
--------------------------------------------------------------------------------
1 | pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#1e1e1e;color:#dcdcdc}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-symbol{color:#569cd6}.hljs-link{color:#569cd6;text-decoration:underline}.hljs-built_in,.hljs-type{color:#4ec9b0}.hljs-class,.hljs-number{color:#b8d7a3}.hljs-meta .hljs-string,.hljs-string{color:#d69d85}.hljs-regexp,.hljs-template-tag{color:#9a5334}.hljs-formula,.hljs-function,.hljs-params,.hljs-subst,.hljs-title{color:#dcdcdc}.hljs-comment,.hljs-quote{color:#57a64a;font-style:italic}.hljs-doctag{color:#608b4e}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-tag{color:#9b9b9b}.hljs-template-variable,.hljs-variable{color:#bd63c5}.hljs-attr,.hljs-attribute{color:#9cdcfe}.hljs-section{color:gold}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-bullet,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-selector-tag{color:#d7ba7d}.hljs-addition{background-color:#144212;display:inline-block;width:100%}.hljs-deletion{background-color:#600;display:inline-block;width:100%}
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-18_16_16_41_072.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ComponentBuilder
8 | {
9 | internal class BlazorComponentBase
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-18_16_18_12_123.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
11 | {
12 | void IBlazorComponent.NotifyRefresh()
13 | {
14 | base.StateHasChanged();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-18_16_20_08_982.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace ComponentBuilder
10 | {
11 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
12 | {
13 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
14 |
15 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-18_16_20_17_442.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Threading.Tasks;
4 |
5 | namespace ComponentBuilder
6 | {
7 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
8 | {
9 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
10 |
11 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-18_16_20_44_444.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Threading.Tasks;
4 |
5 | namespace ComponentBuilder
6 | {
7 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
8 | {
9 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
10 |
11 | public string BuildCssClassString()
12 | {
13 | throw new System.NotImplementedException();
14 | }
15 |
16 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-19_10_45_55_801.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 |
6 | namespace ComponentBuilder
7 | {
8 | ///
9 | /// Provides a base class for component that can build css class quickly.
10 | ///
11 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
12 | {
13 | #region Injection
14 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
15 | #endregion
16 |
17 |
18 | #region Parameters
19 | [Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary Attributes { get; set; } = new Dictionary();
20 | #endregion
21 |
22 | ///
23 | /// Build the css class for component by settings.
24 | ///
25 | /// Ignore all settings when class value of attribute in element is set.
26 | ///
27 | ///
28 | ///
29 | public string BuildCssClassString()
30 | {
31 | if (Attributes.TryGetValue("class", out object value))
32 | {
33 | return value.ToString();
34 | }
35 | }
36 |
37 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-19_10_48_01_049.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 |
6 | namespace ComponentBuilder
7 | {
8 | ///
9 | /// Provides a base class for component that can build css class quickly.
10 | ///
11 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
12 | {
13 | #region Injection
14 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
15 | #endregion
16 |
17 |
18 | #region Parameters
19 | [Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary Attributes { get; set; } = new Dictionary();
20 | #endregion
21 |
22 | ///
23 | /// Build the css class for component by settings.
24 | ///
25 | /// Ignore all settings when class value of attribute in element is set.
26 | ///
27 | ///
28 | ///
29 | public string BuildCssClassString()
30 | {
31 | if (Attributes.TryGetValue("class", out object value))
32 | {
33 | return value.ToString();
34 | }
35 |
36 | return CssBuilder.Build();
37 | }
38 |
39 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-19_10_49_04_592.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 |
6 | namespace ComponentBuilder
7 | {
8 | ///
9 | /// Provides a base class for component that can build css class quickly.
10 | ///
11 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
12 | {
13 | #region Properties
14 | #region Injection
15 | [Inject] protected ICssClassBuilder CssBuilder { get; set; }
16 | #endregion
17 |
18 |
19 | #region Parameters
20 | [Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary Attributes { get; set; } = new Dictionary();
21 | #endregion
22 | #endregion
23 |
24 | #region Method
25 | #region Public
26 | ///
27 | /// Build the css class for component by settings.
28 | ///
29 | /// Ignore all settings when class value of attribute in element is set.
30 | ///
31 | ///
32 | ///
33 | public string BuildCssClassString()
34 | {
35 | if (Attributes.TryGetValue("class", out object value))
36 | {
37 | return value.ToString();
38 | }
39 |
40 | return CssBuilder.Build();
41 | }
42 |
43 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
44 | #endregion
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/BlazorComponentBase.cs/2021-11-19_10_51_21_676.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.AspNetCore.Components;
3 | using System.Collections.Generic;
4 | using System.Threading.Tasks;
5 |
6 | namespace ComponentBuilder
7 | {
8 | ///
9 | /// Provides a base class for component that can build css class quickly.
10 | ///
11 | public abstract class BlazorComponentBase : ComponentBase, IBlazorComponent
12 | {
13 | #region Properties
14 | #region Injection
15 | [Inject] ICssClassBuilder CssBuilder { get; set; }
16 | #endregion
17 |
18 |
19 | #region Parameters
20 | [Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary Attributes { get; set; } = new Dictionary();
21 | #endregion
22 | #endregion
23 |
24 | #region Method
25 |
26 | #region Public
27 | ///
28 | /// Build the css class for component by settings.
29 | ///
30 | /// Ignore all settings when class value of attribute in element is set.
31 | ///
32 | ///
33 | ///
34 | public string BuildCssClassString()
35 | {
36 | if (Attributes.TryGetValue("class", out object value))
37 | {
38 | return value.ToString();
39 | }
40 |
41 | return CssBuilder.Build();
42 | }
43 |
44 | public Task NotifyStateChanged() => InvokeAsync(StateHasChanged);
45 | #endregion
46 |
47 | #region Protected
48 | #endregion
49 |
50 | #region Private
51 | #endregion
52 |
53 | #endregion
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilder.csproj/2021-11-18_16_05_57_990.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilder.csproj/2021-11-18_16_14_36_608.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilder.csproj/2021-11-19_16_35_38_386.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilder.csproj/2021-11-19_16_36_42_415.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 8
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderDependencyInjectionExtentions.cs/2021-11-19_13_46_15_771.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ComponentBuilder
8 | {
9 | internal class ComponentBuilderDependencyInjectionExtentions
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderDependencyInjectionExtentions.cs/2021-11-19_13_47_31_823.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace ComponentBuilder
10 | {
11 | public static class ComponentBuilderDependencyInjectionExtentions
12 | {
13 | public static IServiceCollection AddComponentBuilder(this IServiceCollection services)
14 | {
15 | services.AddScoped()
16 | .AddScoped();
17 | return services;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderDependencyInjectionExtentions.cs/2021-11-19_13_47_36_430.cs:
--------------------------------------------------------------------------------
1 | using ComponentBuilder.Abstrations;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace ComponentBuilder
5 | {
6 | public static class ComponentBuilderDependencyInjectionExtentions
7 | {
8 | public static IServiceCollection AddComponentBuilder(this IServiceCollection services)
9 | {
10 | services.AddScoped()
11 | .AddScoped();
12 | return services;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_11_05_55_522.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ComponentBuilder
8 | {
9 | internal class BlazorComponentExtensions
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_11_08_18_164.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_11_32_55_592.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetField(enumType.Name);
33 |
34 | if (enumMember.GetCustomAttribute<>)
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_11_33_31_584.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetField(enumType.Name);
33 |
34 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
35 | {
36 | return cssClassAttribute.Css;
37 | }
38 | return enumMember.Name;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_11_40_33_685.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetField(enumType.Name);
33 |
34 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
35 | {
36 | return cssClassAttribute.Css;
37 | }
38 | return enumMember.Name.ToLower();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_33_11_524.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetTypeInfo().GetDeclaredField(@enum.ToString());
33 |
34 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
35 | {
36 | return cssClassAttribute.Css;
37 | }
38 | return enumMember.Name.ToLower();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_33_43_298.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetField(@enum.ToString());
33 |
34 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
35 | {
36 | return cssClassAttribute.Css;
37 | }
38 | return enumMember.Name.ToLower();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_34_17_089.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | public static class BlazorComponentExtensions
11 | {
12 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
13 | {
14 | attribute = type.GetCustomAttribute();
15 | return attribute != null;
16 | }
17 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
18 | {
19 | attribute = field.GetCustomAttribute();
20 | return attribute != null;
21 | }
22 |
23 | public static string GetEnumCssClass(this object @enum, bool original = default)
24 | {
25 | if (@enum is not Enum)
26 | {
27 | throw new InvalidOperationException($"This type is not a Enum type");
28 | }
29 |
30 | var enumType = @enum.GetType();
31 |
32 | var enumMember = enumType.GetField(@enum.ToString());
33 |
34 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
35 | {
36 | return cssClassAttribute.Css;
37 | }
38 | return original ? enumMember.Name : enumMember.Name.ToLower();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_34_28_371.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ComponentBuilder
9 | {
10 | ///
11 | /// The extensions of blazor component.
12 | ///
13 | public static class BlazorComponentExtensions
14 | {
15 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
16 | {
17 | attribute = type.GetCustomAttribute();
18 | return attribute != null;
19 | }
20 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
21 | {
22 | attribute = field.GetCustomAttribute();
23 | return attribute != null;
24 | }
25 |
26 | public static string GetEnumCssClass(this object @enum, bool original = default)
27 | {
28 | if (@enum is not Enum)
29 | {
30 | throw new InvalidOperationException($"This type is not a Enum type");
31 | }
32 |
33 | var enumType = @enum.GetType();
34 |
35 | var enumMember = enumType.GetField(@enum.ToString());
36 |
37 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
38 | {
39 | return cssClassAttribute.Css;
40 | }
41 | return original ? enumMember.Name : enumMember.Name.ToLower();
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_34_31_840.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace ComponentBuilder
5 | {
6 | ///
7 | /// The extensions of blazor component.
8 | ///
9 | public static class BlazorComponentExtensions
10 | {
11 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
12 | {
13 | attribute = type.GetCustomAttribute();
14 | return attribute != null;
15 | }
16 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
17 | {
18 | attribute = field.GetCustomAttribute();
19 | return attribute != null;
20 | }
21 |
22 | public static string GetEnumCssClass(this object @enum, bool original = default)
23 | {
24 | if (@enum is not Enum)
25 | {
26 | throw new InvalidOperationException($"This type is not a Enum type");
27 | }
28 |
29 | var enumType = @enum.GetType();
30 |
31 | var enumMember = enumType.GetField(@enum.ToString());
32 |
33 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
34 | {
35 | return cssClassAttribute.Css;
36 | }
37 | return original ? enumMember.Name : enumMember.Name.ToLower();
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ComponentBuilderExtensions.cs/2021-11-19_13_34_53_431.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace ComponentBuilder
5 | {
6 | ///
7 | /// The extensions of component builder.
8 | ///
9 | public static class ComponentBuilderExtensions
10 | {
11 | public static bool TryGetAttribute(this Type type, out TAttribute attribute) where TAttribute : Attribute
12 | {
13 | attribute = type.GetCustomAttribute();
14 | return attribute != null;
15 | }
16 | public static bool TryGetAttribute(this FieldInfo field, out TAttribute attribute) where TAttribute : Attribute
17 | {
18 | attribute = field.GetCustomAttribute();
19 | return attribute != null;
20 | }
21 |
22 | public static string GetEnumCssClass(this object @enum, bool original = default)
23 | {
24 | if (@enum is not Enum)
25 | {
26 | throw new InvalidOperationException($"This type is not a Enum type");
27 | }
28 |
29 | var enumType = @enum.GetType();
30 |
31 | var enumMember = enumType.GetField(@enum.ToString());
32 |
33 | if (enumMember.TryGetAttribute(out var cssClassAttribute))
34 | {
35 | return cssClassAttribute.Css;
36 | }
37 | return original ? enumMember.Name : enumMember.Name.ToLower();
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_35_59_286.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ComponentBuilder
8 | {
9 | internal class CssClassAttribute
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_37_04_789.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
6 | public class CssClassAttribute : Attribute
7 | {
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_37_21_369.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
6 | public class CssClassAttribute : Attribute
7 | {
8 | public CssClassAttribute(string name)
9 | {
10 | Name = name;
11 | }
12 |
13 | public string Name { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_37_35_462.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
6 | public class CssClassAttribute : Attribute
7 | {
8 | public CssClassAttribute(string name)
9 | {
10 | Name = name;
11 | }
12 |
13 | public string Name { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_50_53_955.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Declare a value of css class to build.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
9 | public class CssClassAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class by given css class name.
13 | ///
14 | ///
15 | public CssClassAttribute(string css)
16 | {
17 | Name = css;
18 | }
19 |
20 | public string Name { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_50_58_810.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Declare a value of css class to build.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
9 | public class CssClassAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class by given css class name.
13 | ///
14 | ///
15 | public CssClassAttribute(string css)
16 | {
17 | Css = css;
18 | }
19 |
20 | public string Css { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_51_07_323.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Declare a value of css class to build.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
9 | public class CssClassAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class by given css class name.
13 | ///
14 | ///
15 | public CssClassAttribute(string css)
16 | {
17 | Css = css;
18 | }
19 |
20 | ///
21 | /// Gets css class value.
22 | ///
23 | public string Css { get; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_51_22_179.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Declare a value of css class to build.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
9 | public class CssClassAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class by given css class name.
13 | ///
14 | ///
15 | public CssClassAttribute(string css)
16 | {
17 | Css = css ?? throw new ArgumentNullException(nameof(css));
18 | }
19 |
20 | ///
21 | /// Gets css class value.
22 | ///
23 | public string Css { get; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/CssClassAttribute.cs/2021-11-18_16_51_30_996.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Declare a value of css class to build.
7 | ///
8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
9 | public class CssClassAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class by given css class name.
13 | ///
14 | /// The css class value.
15 | public CssClassAttribute(string css)
16 | {
17 | Css = css ?? throw new ArgumentNullException(nameof(css));
18 | }
19 |
20 | ///
21 | /// Gets css class value.
22 | ///
23 | public string Css { get; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ElementTagAttribute.cs/2021-11-19_14_27_36_676.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ComponentBuilder
8 | {
9 | internal class HtmlElement
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ElementTagAttribute.cs/2021-11-19_14_28_34_495.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
6 | public class HtmlElementAttribute : Attribute
7 | {
8 | public HtmlElementAttribute(string elementName)
9 | {
10 | ElementName = elementName;
11 | }
12 |
13 | public string ElementName { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ElementTagAttribute.cs/2021-11-19_15_07_54_648.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
6 | public class ElementTagAttribute : Attribute
7 | {
8 | public ElementTagAttribute(string name)
9 | {
10 | ElementName = name;
11 | }
12 |
13 | public string ElementName { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ElementTagAttribute.cs/2021-11-19_15_08_02_770.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
6 | public class ElementTagAttribute : Attribute
7 | {
8 | public ElementTagAttribute(string name)
9 | {
10 | Name = name;
11 | }
12 |
13 | public string Name { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/ElementTagAttribute.cs/2021-11-19_15_09_21_891.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ComponentBuilder
4 | {
5 | ///
6 | /// Provides html element name for component to render.
7 | ///
8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
9 | public class ElementTagAttribute : Attribute
10 | {
11 | ///
12 | /// Initializes a new instance of class.
13 | ///
14 | /// Element tag name.
15 | public ElementTagAttribute(string name)
16 | {
17 | Name = name;
18 | }
19 |
20 | public string Name { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_16_28_347.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 |
3 | namespace ComponentBuilder
4 | {
5 | public interface IBlazorComponent : IComponent
6 | {
7 | void StateHasChanged();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_17_16_119.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 |
3 | namespace ComponentBuilder
4 | {
5 | public interface IBlazorComponent : IComponent
6 | {
7 | void StateHasChanged();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_18_11_789.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 |
3 | namespace ComponentBuilder
4 | {
5 | public interface IBlazorComponent : IComponent
6 | {
7 | void NotifyRefresh();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_19_05_393.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System.Threading.Tasks;
3 |
4 | namespace ComponentBuilder
5 | {
6 | public interface IBlazorComponent : IComponent
7 | {
8 | Task NotifyStateChanged();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_20_32_443.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System.Threading.Tasks;
3 |
4 | namespace ComponentBuilder
5 | {
6 | public interface IBlazorComponent : IComponent
7 | {
8 | Task NotifyStateChanged();
9 |
10 | string BuildCssClassString();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_35_20_296.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System.Threading.Tasks;
3 |
4 | namespace ComponentBuilder
5 | {
6 | ///
7 | /// Represents a blazor component.
8 | ///
9 | public interface IBlazorComponent : IComponent
10 | {
11 | ///
12 | /// Notify component's state has been changed.
13 | ///
14 | ///
15 | Task NotifyStateChanged();
16 |
17 | ///
18 | /// Build all css class as string.
19 | ///
20 | ///
21 | string BuildCssClassString();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_35_36_802.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System.Threading.Tasks;
3 |
4 | namespace ComponentBuilder
5 | {
6 | ///
7 | /// Represents a blazor component.
8 | ///
9 | public interface IBlazorComponent : IComponent
10 | {
11 | ///
12 | /// Notify component's state has been changed.
13 | ///
14 | ///
15 | Task NotifyStateChanged();
16 |
17 | ///
18 | /// Build all css class as string.
19 | ///
20 | /// A string seperated by space for each item.
21 | string BuildCssClassString();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/.vshistory/IBlazorComponent.cs/2021-11-18_16_53_49_316.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components;
2 | using System.Threading.Tasks;
3 |
4 | namespace ComponentBuilder
5 | {
6 | ///
7 | /// Represents a blazor component.
8 | ///
9 | public interface IBlazorComponent : IComponent
10 | {
11 | ///
12 | /// Notify component's state has been changed.
13 | ///
14 | ///
15 | Task NotifyStateChanged();
16 |
17 | ///
18 | /// Build all css class as string.
19 | ///
20 | /// A string separated by space for each item.
21 | string BuildCssClassString();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Abstractions/IBlazorComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// Represents a blazor component.
5 | ///
6 | public interface IBlazorComponent : IHasAdditionalAttributes, IComponent, IDisposable
7 | {
8 | ///
9 | /// Gets the child components.
10 | ///
11 | BlazorComponentCollection ChildComponents { get; }
12 |
13 | ///
14 | /// Asynchronously notifies the component that its state has changed and renders the component.
15 | ///
16 | Task NotifyStateChanged();
17 |
18 | ///
19 | /// Returns the properties of the component.
20 | ///
21 | /// Key/value pairs containing HTML attributes.
22 | IEnumerable> GetAttributes();
23 | }
24 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Abstractions/StyleProperty.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// Generate css style.
5 | ///
6 | public class StyleProperty : Dictionary
7 | {
8 | ///
9 | ///
10 | ///
11 | public StyleProperty()
12 | {
13 | }
14 |
15 | ///
16 | ///
17 | ///
18 | public StyleProperty(IDictionary dictionary) : base(dictionary)
19 | {
20 | }
21 |
22 | ///
23 | ///
24 | ///
25 | public StyleProperty(IEnumerable> collection) : base(collection)
26 | {
27 | }
28 |
29 | ///
30 | /// Convert style string with semi-comma(;) for each item.
31 | ///
32 | public override string ToString() => string.Join(";", this.Where(m => m.Value switch
33 | {
34 | bool value => value,
35 | object value => value is not null
36 | }).Select(m => $"{m.Key}:{m.Value}"));
37 |
38 | ///
39 | /// Convert style string(key1:value1;key2:value2...) to class.
40 | ///
41 | public static implicit operator StyleProperty(string? styleString)
42 | {
43 | ArgumentException.ThrowIfNullOrEmpty(styleString, nameof(styleString));
44 |
45 | var dic = styleString.Trim().Split(';').Select(key =>
46 | {
47 | var name = key.Split(":")[0].Trim();
48 | var value = key.Split(":")[1].Trim();
49 |
50 | return new KeyValuePair(name, value);
51 | });
52 | return new(dic);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Attributes/BooleanCssClassAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// Apply to parameter of component weither to use CSS when true or false.
5 | ///
6 | ///
7 | /// Apply specified CSS string when parameter value is true.
8 | /// Apply specified CSS string when parameter value is false. It can be default string.
9 | [AttributeUsage(AttributeTargets.Property)]
10 | public class BooleanCssClassAttribute(string trueClass, string? falseClass = default) : CssClassAttribute
11 | {
12 | ///
13 | /// Gets the CSS string when parameter is true.
14 | ///
15 | public string TrueClass { get; } = trueClass;
16 | ///
17 | /// Gets the CSS string when parameter is false.
18 | ///
19 | public string? FalseClass { get; } = falseClass;
20 | }
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Attributes/HtmlTagAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace ComponentBuilder;
4 |
5 | ///
6 | /// Defines the HTML tag name for component to generate.
7 | ///
8 | /// The name of HTML tag.
9 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
10 | public class HtmlTagAttribute([NotNull] string name) : Attribute
11 | {
12 |
13 | ///
14 | /// Gets the name of HTML tag.
15 | ///
16 | public string Name { get; } = name ?? throw new ArgumentNullException(nameof(name));
17 | }
18 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Attributes/NullCssClassAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace ComponentBuilder;
4 |
5 | ///
6 | /// Specified parameter a CSS string to generate when value is null.
7 | ///
8 | /// The CSS class string when parameter value is null.
9 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
10 | public class NullCssClassAttribute([NotNull]string cssClass) : CssClassAttribute(cssClass){}
11 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Attributes/ParentComponentAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// Represents component is parent component, and automatically creating a cascading parameter for this component.
5 | ///
6 | /// The name of cascading value.
7 | [AttributeUsage(AttributeTargets.Class)]
8 | public class ParentComponentAttribute(string? name = default) : Attribute
9 | {
10 | ///
11 | /// Gets the name of cascading value.
12 | ///
13 | public string? Name => name;
14 | ///
15 | /// Gets or sets a vlaue wheither the value of cascading is fixed.
16 | ///
17 | public bool IsFixed { get; set; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Builder/DefaultStyleBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Builder;
2 |
3 | ///
4 | /// Default implementation.
5 | ///
6 | internal class DefaultStyleBuilder : IStyleBuilder
7 | {
8 | private readonly ICollection _styles;
9 |
10 | ///
11 | /// Initializes a new instance of the class.
12 | ///
13 | public DefaultStyleBuilder()
14 | {
15 | _styles = new List();
16 | }
17 |
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 | public IStyleBuilder Append(string? value)
24 | {
25 | if (string.IsNullOrEmpty(value))
26 | {
27 | return this;
28 | }
29 |
30 | _styles.Add(value);
31 | return this;
32 | }
33 |
34 |
35 | ///
36 | /// Clear css class string in container.
37 | ///
38 | public void Clear() => _styles.Clear();
39 |
40 | ///
41 | ///
42 | ///
43 | ///
44 | public override string ToString() => string.Join(";", _styles);
45 | }
46 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Builder/IStyleBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// Provides a container for generating styles.
5 | ///
6 | public interface IStyleBuilder
7 | {
8 | ///
9 | /// Append a new style value to the generator.
10 | ///
11 | /// The style value.
12 | IStyleBuilder Append(string? value);
13 | ///
14 | /// Clear all styles.
15 | ///
16 | void Clear();
17 | ///
18 | /// Converts a string to a style and concatenates all values in this builder.
19 | ///
20 | /// Each entry is composed of semicolons (;) A delimited series of strings.
21 | string ToString();
22 | }
23 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/ComponentBuilder.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | An automation framework to build Blazor Component Library faster and easily. Both supports the razor component or RenderTreeBuilder fragment building modes.
6 |
7 | Blazor Component Razor Automation Framework
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/Buttons/ButtonComponentBase.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | namespace ComponentBuilder.Definitions;
5 |
6 | ///
7 | /// Defines a button component with basic parameters.
8 | ///
9 | [HtmlTag("button")]
10 | public abstract class ButtonComponentBase : BlazorComponentBase, IHasButtonComponent
11 | {
12 | ///
13 | [Parameter][HtmlAria("disable")]public bool Disabled { get; set; }
14 |
15 | ///
16 | [Parameter]public RenderFragment? ChildContent { get; set; }
17 |
18 | ///
19 | /// HTML type of button. Default is .
20 | ///
21 | [Parameter][HtmlAttribute("type")] public ButtonHtmlType HtmlType { get; set; } = ButtonHtmlType.Button;
22 | ///
23 | [Parameter]public EventCallback OnClick { get; set; }
24 | ///
25 | [Parameter]public bool Active { get; set; }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/Buttons/ButtonHtmlType.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// The HTML type of button.
5 | ///
6 | public enum ButtonHtmlType
7 | {
8 | ///
9 | /// A normal button.
10 | ///
11 | Button,
12 | ///
13 | /// A submit button can trigger form onsubmit event.
14 | ///
15 | Submit,
16 | ///
17 | /// Reset and clear the value of input controls in form.
18 | ///
19 | Reset,
20 | }
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/Buttons/IHasButtonComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Defines a button component with <button> HTML tag.
5 | ///
6 | [HtmlTag("button")]
7 | public interface IHasButtonComponent : IBlazorComponent, IHasDisabled, IHasChildContent, IHasActive
8 | {
9 | ///
10 | /// HTML type of button. Default is .
11 | ///
12 | [HtmlAttribute("type")] public ButtonHtmlType HtmlType { get; set; }
13 | ///
14 | /// Performs a callback action when clicking the button.
15 | ///
16 | [HtmlAttribute("onclick")] EventCallback OnClick { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/IAnchorComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Provide generative < a> Hyperlinked component of the element.
4 | ///
5 | [HtmlTag("a")]
6 | public interface IAnchorComponent
7 | {
8 | ///
9 | /// The href link of anchor.
10 | ///
11 | [HtmlAttribute] public string? Href { get; set; }
12 | ///
13 | /// Specify where to open the linked document.
14 | ///
15 | [HtmlAttribute] public AnchorTarget Target { get; set; }
16 | }
17 |
18 | ///
19 | /// Anchor (< a>) target of the element.
20 | ///
21 | public enum AnchorTarget
22 | {
23 | ///
24 | /// This is the default value. It opens linked documents in the same frame.
25 | ///
26 | [HtmlAttribute(value: "_self")] Self = 0,
27 | ///
28 | /// It opens the link in a new window.
29 | ///
30 | [HtmlAttribute(value: "_blank")] Blank = 1,
31 | ///
32 | /// It opens the linked document in the parent frame set.
33 | ///
34 | [HtmlAttribute(value: "_parant")] Parent = 2,
35 | ///
36 | /// It opens the linked document in the entire body of the window.
37 | ///
38 | [HtmlAttribute(value: "_top")] Top = 3
39 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/IContainerComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Indicates that components that implement the interface are automatically added as containers. This interface is used for container components that are required by components during dynamic service invocation.
5 | ///
6 | public interface IContainerComponent:IComponent
7 | {
8 | }
9 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/IFormComponent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provides components to support forms and validation.
5 | ///
6 | [HtmlTag("form")]
7 | public interface IFormComponent : IHasEditContext, IHasChildContent
8 | {
9 | ///
10 | /// Specifies the top-level model object for the form. An editing context is constructed for the model.
11 | ///
12 | object? Model { get; set; }
13 | ///
14 | /// The callback that will be invoked when the form is submitted.
15 | ///
16 | EventCallback OnSubmit { get; set; }
17 |
18 | ///
19 | /// Gets a bool value represents form is submitting.
20 | ///
21 | public bool IsSubmitting { get; set; }
22 | }
23 |
24 | ///
25 | /// The arguments when submit the form.
26 | ///
27 | /// The edit context.
28 | /// A bool value represents validation result of form.
29 | public class FormEventArgs(EditContext context,bool valid) : EventArgs
30 | {
31 | ///
32 | /// Gets the instance of class.
33 | ///
34 | public EditContext EditContext => context;
35 | ///
36 | /// Gets a bool value represents form validation result.
37 | ///
38 | public bool Valid => valid;
39 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Components/IHasNavLinkComponent.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Components.Routing;
2 |
3 | namespace ComponentBuilder.Definitions;
4 |
5 | ///
6 | /// Provides navigation links for components.
7 | ///
8 | public interface IHasNavLinkComponent : IHasChildContent
9 | {
10 | ///
11 | /// Gets or sets the behavior of a matching navigation link.
12 | ///
13 | NavLinkMatch Match { get; set; }
14 |
15 | ///
16 | /// Gets a Boolean value indicating that the link matches the url.
17 | ///
18 | bool IsActive { get; set; }
19 |
20 | ///
21 | /// Gets the CSS string when the uri link matches.
22 | ///
23 | string? ActiveCssClass => "active";
24 | }
25 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasActive.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provides a parameter of component can be actived.
5 | ///
6 | public interface IHasActive
7 | {
8 | ///
9 | /// Represents a status of component is actived.
10 | ///
11 | [CssClass("active")] bool Active { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasAdditionalAttributes.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Define an additional attribute for the component to catch unmatched html attribute values.
4 | ///
5 | public interface IHasAdditionalAttributes
6 | {
7 | ///
8 | /// Gets or sets an additional property in an element that automatically catches unmatched html property values.
9 | ///
10 | IDictionary AdditionalAttributes { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasAdditionalClass.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Provides additional CSS classes for the components to append.
4 | ///
5 | public interface IHasAdditionalClass
6 | {
7 | ///
8 | /// Gets or sets the string of additional CSS classes to append.
9 | ///
10 | /// Typically, this value is appended to the end of all CSS parameters after they have been built.
11 | ///
12 | ///
13 | string? AdditionalClass { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasAdditionalStyle.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Provides additional styles for the component to append.
4 | ///
5 | public interface IHasAdditionalStyle
6 | {
7 | ///
8 | /// Gets or sets additional style strings to append.
9 | ///
10 | /// Typically, this value is appended to the end of all style parameters after they have been built.
11 | ///
12 | ///
13 | StyleProperty? AdditionalStyle { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasChildContent.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provide UI fragments for components to support child content.
5 | ///
6 | public interface IHasChildContent
7 | {
8 | ///
9 | /// Gets or sets a fragment of UI content.
10 | ///
11 | RenderFragment? ChildContent { get; set; }
12 | }
13 |
14 | ///
15 | /// Provide UI fragments for components to support child content with specified value.
16 | ///
17 | /// The type of value。
18 | public interface IHasChildContent
19 | {
20 | ///
21 | /// Gets or sets a fragment of UI content with type of value.
22 | ///
23 | RenderFragment? ChildContent { get; set; }
24 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasDisabled.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Defines a parameter that has disabled HTML attribute.
5 | ///
6 | public interface IHasDisabled
7 | {
8 | ///
9 | /// Set true to generate HTML 'disabled' attribute.
10 | ///
11 | [HtmlAttribute] bool Disabled { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasEditContext.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provides a component with an edit context.
5 | ///
6 | public interface IHasEditContext
7 | {
8 | ///
9 | /// Gets or sets the editing context.
10 | ///
11 | EditContext? EditContext { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasEventCallback.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Represents a parameter with a callback event.
5 | ///
6 | public interface IHasEventCallback : IBlazorComponent
7 | {
8 | }
9 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasInputValue.cs:
--------------------------------------------------------------------------------
1 | using System.Linq.Expressions;
2 |
3 | namespace ComponentBuilder.Definitions;
4 | ///
5 | /// A binding value that represents the interaction with the user.
6 | ///
7 | /// This interface simplifies the interaction of input components.
8 | ///
9 | ///
10 | /// The type of the bound value.
11 | public interface IHasInputValue : IHasValueBound
12 | {
13 | ///
14 | /// Gets the cascade parameter from Form.
15 | ///
16 | EditContext? CascadedEditContext { get; }
17 |
18 | ///
19 | /// Gets or sets an expression that identifies the bound value.
20 | ///
21 | Expression>? ValueExpression { get; set; }
22 | }
23 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasOnActive.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Provides a parameter that the component has a callback event that can be activated.
4 | ///
5 | public interface IHasOnActive : IHasActive, IHasEventCallback
6 | {
7 | ///
8 | /// A callback function that is executed when the component state is activated.
9 | ///
10 | EventCallback OnActive { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasOnDisabled.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provides a component with deactivated events.
5 | ///
6 | public interface IHasOnDisabled : IHasDisabled, IHasEventCallback
7 | {
8 | ///
9 | /// A callback function when a component is disabled.
10 | ///
11 | EventCallback OnDisabled { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasOnSwitch.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Provides components with switchable events.
4 | ///
5 | public interface IHasOnSwitch : IHasSwitch, IHasEventCallback
6 | {
7 | ///
8 | /// Specifies the switchable callback method for the component index.
9 | ///
10 | EventCallback OnSwitch { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasSwitch.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 | ///
3 | /// Indicates that you can switch between components.
4 | ///
5 | public interface IHasSwitch
6 | {
7 | ///
8 | /// Gets or sets the switching component index.
9 | ///
10 | int? SwitchIndex { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Definitions/Parameters/IHasValueBound.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.Definitions;
2 |
3 | ///
4 | /// Provides bidirectional binding for components.
5 | ///
6 | /// The value type.
7 | public interface IHasValueBound:IBlazorComponent
8 | {
9 | ///
10 | /// Gets or sets the value to bind.
11 | ///
12 | ///
13 | /// @bind-Value="model.PropertyName"
14 | ///
15 | TValue? Value { get; set; }
16 | ///
17 | /// Gets or sets the callback method for updating the binding value.
18 | ///
19 | EventCallback ValueChanged { get; set; }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Enumeration.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// An abstract class that represents an enumeration pattern.
5 | ///
6 | public abstract class Enumeration
7 | {
8 | ///
9 | /// Initializes a new instance of the class.
10 | ///
11 | /// The value.
12 | protected Enumeration(string value) => Value = value;
13 |
14 | ///
15 | /// Gets the value of the enumeration.
16 | ///
17 | public string Value { get; }
18 |
19 | ///
20 | /// Gets the enumeration member.
21 | ///
22 | /// An array of strings.
23 | public IEnumerable GetMembers()
24 | => GetType().GetFields(System.Reflection.BindingFlags.Static).Select(m => ((Enumeration?)m.GetValue(this))?.Value);
25 | }
26 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Extensions/ParseExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 | ///
3 | /// The extensions to parse value.
4 | ///
5 | public static class ParseExtensions
6 | {
7 | ///
8 | /// Parse any value to specified value type.
9 | ///
10 | /// The type of value.
11 | /// The value to parse.
12 | /// Return default value if parse failed.
13 | /// true to throw exception when parsing failed.
14 | ///
15 | public static TValue? Parse(this object? value, TValue? defaultValue = default, bool throwIfFailed=default)
16 | {
17 | if (value is null)
18 | {
19 | return defaultValue;
20 | }
21 |
22 | var valueType = typeof(TValue);
23 |
24 | try
25 | {
26 | var nullableValueType = Nullable.GetUnderlyingType(valueType);
27 | if (nullableValueType is null)
28 | {
29 | return (TValue?)Convert.ChangeType(value, valueType);
30 | }
31 |
32 | return (TValue?)Convert.ChangeType(value, nullableValueType);
33 | }
34 | catch
35 | {
36 | if (throwIfFailed)
37 | {
38 | throw;
39 | }
40 | return defaultValue;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/Extensions/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder;
2 |
3 | ///
4 | /// The extensions of string.
5 | ///
6 | public static class StringExtensions
7 | {
8 | ///
9 | /// Indicates whether the specified string is not null or an empty string ("").
10 | ///
11 | /// The string to test.
12 | /// true if the value parameter is not null or an empty string (""); otherwise, false.
13 | public static bool IsNotNullOrEmpty(this string? value) => !string.IsNullOrEmpty(value);
14 | ///
15 | /// Indicates whether a specified string is not null, empty, or consists only of white-space characters.
16 | ///
17 | /// The string to test.
18 | /// true if the value parameter is not null or System.String.Empty, or if value consists exclusively of white-space characters.
19 | public static bool IsNotNullOrWhiteSpace(this string? value) => !string.IsNullOrWhiteSpace(value);
20 | }
21 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/FluentClass/IFluentClassProvider.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.FluentClass;
2 | ///
3 | /// A provider that provides smooth CSS classes from parameters.
4 | ///
5 | public interface IFluentClassProvider
6 | {
7 | ///
8 | /// Create a series of strings for the CSS class.
9 | ///
10 | /// A collection of strings representing a CSS class.
11 | IEnumerable Create();
12 | }
13 |
--------------------------------------------------------------------------------
/src/ComponentBuilder/FluentRenderTree/IFluentCloseBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.FluentRenderTree;
2 | ///
3 | /// Provides a constructor that closes the flag.
4 | ///
5 | public interface IFluentCloseBuilder : IDisposable
6 | {
7 | ///
8 | /// Mark a previously attached region, element, or component as closed.
9 | /// Call this method when must with previous Element(), Component() or Region() match.
10 | ///
11 | IFluentOpenBuilder Close();
12 | }
13 |
14 | ///
15 | /// Provides a constructor to close component tags.
16 | ///
17 | /// Component type.
18 | public interface IFluentCloseBuilder : IFluentCloseBuilder, IDisposable where TComponent : IComponent
19 | {
20 | ///
21 | /// Mark a previously attached region, or component as closed.
22 | /// Call this method when must with previous Component() or Region() match.
23 | ///
24 | new IFluentOpenComponentBuilder Close();
25 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/FluentRenderTree/IFluentContentBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.FluentRenderTree;
2 |
3 | ///
4 | /// A constructor that provides the content of an element.
5 | ///
6 | public interface IFluentContentBuilder :IFluentOpenBuilder, IFluentCloseBuilder
7 | {
8 | ///
9 | /// Add fragment content to this element or component.
10 | ///
11 | /// The content fragment to insert the inner element.
12 | IFluentContentBuilder Content(RenderFragment? fragment);
13 | }
14 |
15 | ///
16 | /// Provides a constructor that adds subcontent for the specified component type.
17 | ///
18 | /// Component type.
19 | public interface IFluentContentBuilder : IFluentContentBuilder,IFluentOpenComponentBuilder
20 | where TComponent : IComponent
21 | {
22 | ///
23 | /// Add an arbitrary code snippet to the component's ChildContent parameter.
24 | ///
25 | /// The content fragment to insert the inner element.
26 | IFluentAttributeBuilder ChildContent(RenderFragment? fragment);
27 | }
--------------------------------------------------------------------------------
/src/ComponentBuilder/FluentRenderTree/IFluentFrameBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace ComponentBuilder.FluentRenderTree;
2 |
3 | ///
4 | /// Constructors that provide additional features of the render tree.
5 | ///
6 | public interface IFluentFrameBuilder: IFluentContentBuilder, IFluentCloseBuilder
7 | {
8 | ///
9 | /// Assigns the specified key value to the current element or component.
10 | ///
11 | /// The key value.
12 | IFluentAttributeBuilder Key(object? value);
13 |
14 | ///
15 | /// Captures a reference to an element or component.
16 | ///
17 | /// Actions that capture an element or component reference after rendering the component.
18 | IFluentAttributeBuilder Ref(Action