├── .gitattributes ├── .gitignore ├── BlazorAnimation.png ├── BlazorAnimation.sln ├── BlazorAnimation.sln.DotSettings ├── BlazorAnimation ├── Animation.razor ├── AnimationOptions.cs ├── BlazorAnimation.csproj ├── CssClass.cs ├── Delay.cs ├── Effect.cs ├── Speed.cs ├── _Imports.razor └── wwwroot │ ├── animate.css │ └── blazorAnimationInterop.js ├── BlazorAnimation2.gif ├── LICENSE ├── README.md ├── Sample ├── App.razor ├── Data │ ├── WeatherForecast.cs │ └── WeatherForecastService.cs ├── Pages │ ├── Counter.razor │ ├── Error.razor │ ├── FetchData.razor │ ├── Index.razor │ ├── InputPassword.razor │ └── _Host.cshtml ├── Program.cs ├── Properties │ ├── Annotations.cs │ ├── PublishProfiles │ │ └── FolderProfile.pubxml │ └── launchSettings.json ├── Sample.csproj ├── Shared │ ├── MainLayout.razor │ └── NavMenu.razor ├── Startup.cs ├── _Imports.razor ├── appsettings.Development.json ├── appsettings.json └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ └── favicon.ico ├── inputpassword1.gif └── inputpassword2.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /BlazorAnimation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/BlazorAnimation.png -------------------------------------------------------------------------------- /BlazorAnimation.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAnimation", "BlazorAnimation\BlazorAnimation.csproj", "{F349E011-EE43-43F0-B2B0-EBA6FD33C83F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample", "Sample\Sample.csproj", "{8F5EA6B9-A262-4536-AF82-6FFC9048EE98}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F349E011-EE43-43F0-B2B0-EBA6FD33C83F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {F349E011-EE43-43F0-B2B0-EBA6FD33C83F}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {F349E011-EE43-43F0-B2B0-EBA6FD33C83F}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {F349E011-EE43-43F0-B2B0-EBA6FD33C83F}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {8F5EA6B9-A262-4536-AF82-6FFC9048EE98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {8F5EA6B9-A262-4536-AF82-6FFC9048EE98}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {8F5EA6B9-A262-4536-AF82-6FFC9048EE98}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {8F5EA6B9-A262-4536-AF82-6FFC9048EE98}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {6F97D3A0-5F56-4D0C-9968-CBE5867698E4} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /BlazorAnimation.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /BlazorAnimation/Animation.razor: -------------------------------------------------------------------------------- 1 | @using Microsoft.Extensions.Options 2 | @using Microsoft.JSInterop 3 | @inject IJSRuntime JsRuntime 4 | @inject IOptionsSnapshot OptionsSnapshot 5 | 6 |
7 | @ChildContent 8 |
9 | 10 | @code { 11 | 12 | protected override void OnParametersSet() => ApplyConfiguration(); 13 | 14 | protected override void OnAfterRender(bool firstRender) { 15 | if (firstRender) { 16 | var dotNetReference = DotNetObjectReference.Create(this); 17 | JsRuntime.InvokeVoidAsync("AnimatedComponent.animationend", DivElementReference, dotNetReference); 18 | } 19 | } 20 | 21 | private ElementReference DivElementReference; 22 | 23 | private string Animate => Enabled ? "animate__animated" : string.Empty; 24 | 25 | private string AnimationType => Enabled ? "animate__" + Effect?.Name : string.Empty; 26 | 27 | [Parameter] public RenderFragment ChildContent { get; set; } 28 | 29 | [Parameter] public bool Enabled 30 | { 31 | get => _enabled ?? true; 32 | set => _enabled = value; 33 | } 34 | 35 | [Parameter] public string OptionsName { get; set; } = Options.DefaultName; 36 | 37 | [Parameter] public AnimationEffect Effect { get; set; } 38 | 39 | [Parameter] public TimeSpan Delay { 40 | get => _delay ?? BlazorAnimation.Delay.None; 41 | set => _delay = value; 42 | } 43 | 44 | [Parameter] public TimeSpan Speed 45 | { 46 | get => _speed ?? BlazorAnimation.Speed.Slow; 47 | set => _speed = value; 48 | } 49 | 50 | [Parameter] public string Class { get; set; } = string.Empty; 51 | 52 | [Parameter] public string Style { get; set; } = string.Empty; 53 | 54 | [Parameter] 55 | public int IterationCount 56 | { 57 | get => _iterationCount is null 58 | ? 1 59 | : _iterationCount < 0 ? int.MaxValue : _iterationCount.Value; 60 | set => _iterationCount = value; 61 | } 62 | 63 | [Parameter(CaptureUnmatchedValues = true)] 64 | public Dictionary AdditionalAttributes { get; set; } 65 | 66 | [JSInvokable("OnAnimationEnd")] 67 | public async void AnimationEnd() => await _animationEnd.InvokeAsync(this); 68 | 69 | private EventCallback _animationEnd; 70 | private int? _iterationCount; 71 | private bool? _enabled; 72 | private TimeSpan? _speed; 73 | private TimeSpan? _delay; 74 | 75 | [CascadingParameter(Name = "OnAnimationEnd")] 76 | private EventCallback CascadingOnAnimationEnd 77 | { 78 | set => _animationEnd = value; 79 | } 80 | 81 | [Parameter] 82 | public EventCallback OnAnimationEnd 83 | { 84 | set => _animationEnd = value; 85 | } 86 | 87 | private void ApplyConfiguration() 88 | { 89 | var options = OptionsSnapshot.Get(OptionsName); 90 | if (options == null) return; 91 | Effect ??= options.Effect; 92 | if (options.Delay is not null && Delay == BlazorAnimation.Delay.None) 93 | Delay = options.Delay.Value; 94 | if (options.Speed is not null && Speed == BlazorAnimation.Speed.Slow) 95 | Speed = options.Speed.Value; 96 | if (options.IterationCount is not null && _iterationCount is null) 97 | IterationCount = options.IterationCount.Value; 98 | if (options.Enabled is not null && _enabled is null) 99 | Enabled = options.Enabled.Value; 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /BlazorAnimation/AnimationOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorAnimation 4 | { 5 | public class AnimationOptions 6 | { 7 | public AnimationEffect Effect { get; set; } 8 | public TimeSpan? Delay { get; set; } 9 | public TimeSpan? Speed { get; set; } 10 | public int? IterationCount { get; set; } 11 | public bool? Enabled { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /BlazorAnimation/BlazorAnimation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 3.0 6 | latest 7 | 2.3.0 8 | True 9 | Aurelien BOUDOUX 10 | a Blazor component based on animate.css to easly animate your content 11 | MIT 12 | https://github.com/aboudoux/BlazorAnimation 13 | BlazorAnimation.png 14 | 15 | Allows parameters to override options 16 | Blazor Animation Animate Html Content 17 | https://github.com/aboudoux/BlazorAnimation 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | PreserveNewest 30 | 31 | 32 | PreserveNewest 33 | 34 | 35 | 36 | 37 | 38 | 39 | True 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /BlazorAnimation/CssClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorAnimation 4 | { 5 | public class CssClass : IEquatable 6 | { 7 | public string Name { get; } 8 | 9 | public CssClass(string name) 10 | { 11 | Name = name; 12 | } 13 | 14 | public bool Equals(CssClass other) 15 | { 16 | if (ReferenceEquals(null, other)) return false; 17 | if (ReferenceEquals(this, other)) return true; 18 | return Name == other.Name; 19 | } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | if (ReferenceEquals(null, obj)) return false; 24 | if (ReferenceEquals(this, obj)) return true; 25 | if (obj.GetType() != this.GetType()) return false; 26 | return Equals((CssClass) obj); 27 | } 28 | 29 | public override int GetHashCode() 30 | { 31 | return (Name != null ? Name.GetHashCode() : 0); 32 | } 33 | 34 | public static bool operator ==(CssClass left, CssClass right) { 35 | if (left is null) 36 | return right is null; 37 | return left.Equals(right); 38 | } 39 | 40 | public static bool operator !=(CssClass left, CssClass right) => !(left == right); 41 | } 42 | } -------------------------------------------------------------------------------- /BlazorAnimation/Delay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorAnimation 4 | { 5 | public static class Delay 6 | { 7 | public static TimeSpan None => TimeSpan.Zero; 8 | public static TimeSpan OneSecond => TimeSpan.FromSeconds(1); 9 | public static TimeSpan TwoSeconds => TimeSpan.FromSeconds(2); 10 | public static TimeSpan ThreeSeconds => TimeSpan.FromSeconds(3); 11 | public static TimeSpan FourSeconds => TimeSpan.FromSeconds(4); 12 | public static TimeSpan FiveSeconds => TimeSpan.FromSeconds(5); 13 | } 14 | } -------------------------------------------------------------------------------- /BlazorAnimation/Effect.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorAnimation { 2 | public static class Effect 3 | { 4 | public static AnimationEffect Bounce => new AnimationEffect("bounce"); 5 | public static AnimationEffect Flash => new AnimationEffect("flash"); 6 | public static AnimationEffect Pulse => new AnimationEffect("pulse"); 7 | public static AnimationEffect RubberBand => new AnimationEffect("rubberBand"); 8 | public static AnimationEffect Shake => ShakeX; // v3.7.2 compatibility 9 | public static AnimationEffect ShakeX => new AnimationEffect("shakeX"); 10 | public static AnimationEffect ShakeY => new AnimationEffect("shakeY"); 11 | public static AnimationEffect HeadShake => new AnimationEffect("headShake"); 12 | public static AnimationEffect Swing => new AnimationEffect("swing"); 13 | public static AnimationEffect Tada => new AnimationEffect("tada"); 14 | public static AnimationEffect Wobble => new AnimationEffect("wobble"); 15 | public static AnimationEffect Jello => new AnimationEffect("jello"); 16 | public static AnimationEffect BounceIn => new AnimationEffect("bounceIn"); 17 | public static AnimationEffect BounceInDown => new AnimationEffect("bounceInDown"); 18 | public static AnimationEffect BounceInLeft => new AnimationEffect("bounceInLeft"); 19 | public static AnimationEffect BounceInRight => new AnimationEffect("bounceInRight"); 20 | public static AnimationEffect BounceInUp => new AnimationEffect("bounceInUp"); 21 | public static AnimationEffect BounceOut => new AnimationEffect("bounceOut"); 22 | public static AnimationEffect BounceOutDown => new AnimationEffect("bounceOutDown"); 23 | public static AnimationEffect BounceOutLeft => new AnimationEffect("bounceOutLeft"); 24 | public static AnimationEffect BounceOutRight => new AnimationEffect("bounceOutRight"); 25 | public static AnimationEffect BounceOutUp => new AnimationEffect("bounceOutUp"); 26 | public static AnimationEffect FadeIn => new AnimationEffect("fadeIn"); 27 | public static AnimationEffect FadeInDown => new AnimationEffect("fadeInDown"); 28 | public static AnimationEffect FadeInDownBig => new AnimationEffect("fadeInDownBig"); 29 | public static AnimationEffect FadeInLeft => new AnimationEffect("fadeInLeft"); 30 | public static AnimationEffect FadeInLeftBig => new AnimationEffect("fadeInLeftBig"); 31 | public static AnimationEffect FadeInRight => new AnimationEffect("fadeInRight"); 32 | public static AnimationEffect FadeInRightBig => new AnimationEffect("fadeInRightBig"); 33 | public static AnimationEffect FadeInUp => new AnimationEffect("fadeInUp"); 34 | public static AnimationEffect FadeInUpBig => new AnimationEffect("fadeInUpBig"); 35 | public static AnimationEffect FadeOut => new AnimationEffect("fadeOut"); 36 | public static AnimationEffect FadeOutDown => new AnimationEffect("fadeOutDown"); 37 | public static AnimationEffect FadeOutDownBig => new AnimationEffect("fadeOutDownBig"); 38 | public static AnimationEffect FadeOutLeft => new AnimationEffect("fadeOutLeft"); 39 | public static AnimationEffect FadeOutLeftBig => new AnimationEffect("fadeOutLeftBig"); 40 | public static AnimationEffect FadeOutRight => new AnimationEffect("fadeOutRight"); 41 | public static AnimationEffect FadeOutRightBig => new AnimationEffect("fadeOutRightBig"); 42 | public static AnimationEffect FadeOutUp => new AnimationEffect("fadeOutUp"); 43 | public static AnimationEffect FadeOutUpBig => new AnimationEffect("fadeOutUpBig"); 44 | public static AnimationEffect FlipInX => new AnimationEffect("flipInX"); 45 | public static AnimationEffect FlipInY => new AnimationEffect("flipInY"); 46 | public static AnimationEffect FlipOutX => new AnimationEffect("flipOutX"); 47 | public static AnimationEffect FlipOutY => new AnimationEffect("flipOutY"); 48 | public static AnimationEffect LightSpeedIn => LightSpeedInRight; // v3.7.2 compatibility 49 | public static AnimationEffect LightSpeedOut => LightSpeedOutRight; // v3.7.2 compatibility 50 | public static AnimationEffect LightSpeedInRight => new AnimationEffect("lightSpeedInRight"); 51 | public static AnimationEffect LightSpeedInLeft => new AnimationEffect("lightSpeedInLeft"); 52 | public static AnimationEffect LightSpeedOutRight => new AnimationEffect("lightSpeedOutRight"); 53 | public static AnimationEffect LightSpeedOutLeft => new AnimationEffect("lightSpeedOutLeft"); 54 | public static AnimationEffect RotateIn => new AnimationEffect("rotateIn"); 55 | public static AnimationEffect RotateInDownLeft => new AnimationEffect("rotateInDownLeft"); 56 | public static AnimationEffect RotateInDownRight => new AnimationEffect("rotateInDownRight"); 57 | public static AnimationEffect RotateInUpLeft => new AnimationEffect("rotateInUpLeft"); 58 | public static AnimationEffect RotateInUpRight => new AnimationEffect("rotateInUpRight"); 59 | public static AnimationEffect RotateOut => new AnimationEffect("rotateOut"); 60 | public static AnimationEffect RotateOutDownLeft => new AnimationEffect("rotateOutDownLeft"); 61 | public static AnimationEffect RotateOutDownRight => new AnimationEffect("rotateOutDownRight"); 62 | public static AnimationEffect RotateOutUpLeft => new AnimationEffect("rotateOutUpLeft"); 63 | public static AnimationEffect RotateOutUpRight => new AnimationEffect("rotateOutUpRight"); 64 | public static AnimationEffect Hinge => new AnimationEffect("hinge"); 65 | public static AnimationEffect JackInTheBox => new AnimationEffect("jackInTheBox"); 66 | private static AnimationEffect RollIn => new AnimationEffect("rollIn"); 67 | public static AnimationEffect RollOut => new AnimationEffect("rollOut"); 68 | public static AnimationEffect ZoomIn => new AnimationEffect("zoomIn"); 69 | public static AnimationEffect ZoomInDown => new AnimationEffect("zoomInDown"); 70 | public static AnimationEffect ZoomInLeft => new AnimationEffect("zoomInLeft"); 71 | public static AnimationEffect ZoomInRight => new AnimationEffect("zoomInRight"); 72 | public static AnimationEffect ZoomInUp => new AnimationEffect("zoomInUp"); 73 | public static AnimationEffect ZoomOut => new AnimationEffect("zoomOut"); 74 | public static AnimationEffect ZoomOutDown => new AnimationEffect("zoomOutDown"); 75 | public static AnimationEffect ZoomOutLeft => new AnimationEffect("zoomOutLeft"); 76 | public static AnimationEffect ZoomOutRight => new AnimationEffect("zoomOutRight"); 77 | public static AnimationEffect ZoomOutUp => new AnimationEffect("zoomOutUp"); 78 | public static AnimationEffect SlideInDown => new AnimationEffect("slideInDown"); 79 | public static AnimationEffect SlideInLeft => new AnimationEffect("slideInLeft"); 80 | public static AnimationEffect SlideInRight => new AnimationEffect("slideInRight"); 81 | public static AnimationEffect SlideInUp => new AnimationEffect("slideInUp"); 82 | public static AnimationEffect SlideOutDown => new AnimationEffect("slideOutDown"); 83 | public static AnimationEffect SlideOutLeft => new AnimationEffect("slideOutLeft"); 84 | public static AnimationEffect SlideOutRight => new AnimationEffect("slideOutRight"); 85 | public static AnimationEffect SlideOutUp => new AnimationEffect("slideOutUp"); 86 | public static AnimationEffect HeartBeat => new AnimationEffect("heartBeat"); 87 | public static AnimationEffect FadeInTopLeft => new AnimationEffect("fadeInTopLeft"); 88 | public static AnimationEffect FadeInTopRight => new AnimationEffect("fadeInTopRight"); 89 | public static AnimationEffect FadeInBottomLeft => new AnimationEffect("fadeInBottomLeft"); 90 | public static AnimationEffect FadeInBottomRight => new AnimationEffect("fadeInBottomRight"); 91 | public static AnimationEffect FadeOutTopLeft => new AnimationEffect("fadeOutTopLeft"); 92 | public static AnimationEffect FadeOutTopRight => new AnimationEffect("fadeOutTopRight"); 93 | public static AnimationEffect FadeOutBottomRight => new AnimationEffect("fadeOutBottomRight"); 94 | public static AnimationEffect FadeOutBottomLeft => new AnimationEffect("fadeOutBottomLeft"); 95 | public static AnimationEffect BackOutDown => new AnimationEffect("backOutDown"); 96 | public static AnimationEffect BackOutLeft => new AnimationEffect("backOutLeft"); 97 | public static AnimationEffect BackOutRight => new AnimationEffect("backOutRight"); 98 | public static AnimationEffect BackOutUp => new AnimationEffect("backOutUp"); 99 | } 100 | 101 | public class AnimationEffect : CssClass 102 | { 103 | public AnimationEffect(string name) : base(name) 104 | { 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /BlazorAnimation/Speed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorAnimation 4 | { 5 | public static class Speed 6 | { 7 | public static TimeSpan Slow => TimeSpan.FromSeconds(2); 8 | public static TimeSpan Slower => TimeSpan.FromSeconds(3); 9 | public static TimeSpan Fast => TimeSpan.FromMilliseconds(800); 10 | public static TimeSpan Faster => TimeSpan.FromMilliseconds(500); 11 | } 12 | } -------------------------------------------------------------------------------- /BlazorAnimation/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Components.Web 2 | -------------------------------------------------------------------------------- /BlazorAnimation/wwwroot/blazorAnimationInterop.js: -------------------------------------------------------------------------------- 1 | document.getElementsByTagName("head")[0].insertAdjacentHTML( 2 | "beforeend", 3 | ""); 4 | 5 | 6 | 7 | var AnimatedComponent = AnimatedComponent || {}; 8 | AnimatedComponent.animationend = function (element, dotNet) { 9 | element.addEventListener('animationend', function(e) { 10 | if(e.target === this)dotNet.invokeMethodAsync("OnAnimationEnd") 11 | }); 12 | }; -------------------------------------------------------------------------------- /BlazorAnimation2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/BlazorAnimation2.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Aurélien BOUDOUX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BlazorAnimation 2 | 3 | a Blazor component based on animate.css to easly animate your content 4 | 5 | ![BlazorAnimation animation](BlazorAnimation2.gif) 6 | 7 | ## Quick Start 8 | 9 | To animate a component, wrap it inside Animation component and use the Effect parameter to define the animation: 10 | 11 | ``` 12 | 13 |

Hello, world!

14 |
15 | ``` 16 | 17 | ## Getting Started 18 | 19 | Few steps are required in order to use the library. 20 | 21 | #### Add NuGet 22 | 23 | ```csharp 24 | Install-Package BlazorAnimation 25 | ``` 26 | 27 | #### Configure _Imports.razor 28 | 29 | ``` 30 | ... 31 | @using BlazorAnimation 32 | ``` 33 | 34 | #### Add JS interop into _Host.cshtml 35 | 36 | ``` 37 | 38 | ``` 39 | 40 | #### If you notice any error in blazor wasm, add a configuration in program.cs 41 | ``` 42 | ... 43 | builder.Services.Configure(Guid.NewGuid().ToString(),c=>{}); 44 | ``` 45 | 46 | #### Use the Animation component 47 | 48 | ``` 49 | 50 |

Hello, world!

51 |
52 | ``` 53 | 54 | ## Sample 55 | 56 | For a sample, please view http://blazoranimation.boudoux.fr 57 | 58 | ## Parameters 59 | 60 | Here's are the parameters to configure the component 61 | 62 | |Parameter Name| Abstract | Default | 63 | |--|--|--| 64 | | [Effect](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#effect) | Define the effect to use for animate the component. | @Effect.Bounce | 65 | | [Delay](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#delay) | The time to wait before the animation begin. | @Delay.None 66 | | [Speed](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#speed) | The total animation duration. | @Speed.Slow 67 | | [IterationCount](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#iterationcount) | the number of times the animation will be played. For an infinite loop, you can set a negative number. | 1 68 | | [Enabled](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#enabled) | You can enable or disable the animation component by code with this parameters. Very convenient in certain situations| True 69 | | [OnAnimationEnd](https://github.com/aboudoux/BlazorAnimation/blob/master/README.md#onanimationend) | Call a method when the animation end. | null 70 | | Class | Append some css classes to the component | string.Empty 71 | | Style | Append some css styles to the component | string.Empty 72 | 73 | ### Effect 74 | Define the effect to use for animate the component. 75 | 76 | You can use one of the 90 animations provided by the [animate.css class](https://animate.style/). Just use the `@Effect` into the `Effect` parameters to list them all. 77 | 78 | Example 79 | ``` 80 | 81 |

Hello !

82 |
83 | ``` 84 | ### Delay 85 | The time to wait before the animation begin. 86 | 87 | You can use one of the 6 predefined delay by using the `@Delay` enumeration that contains : 88 | 89 | - None 90 | - OneSecond 91 | - TwoSeconds 92 | - ThreeSeconds 93 | - FourSeconds 94 | - FiveSeconds 95 | 96 | Example : 97 | ``` 98 | 99 |

Hello !

100 |
101 | ``` 102 | 103 | Or just define your own time manualy with a `TimeSpan` like below : 104 | 105 | Example with custom time : 106 | ``` 107 | 108 |

Hello !

109 |
110 | ``` 111 | 112 | ### Speed 113 | 114 | the total time of the animation from the time when the delay has elapsed. 115 | 116 | You can use one of the 4 predefined speed by using the `@Speed` enumeration that contains : 117 | 118 | - Slow (2s) 119 | - Slower (3s) 120 | - Fast (800ms) 121 | - Faster (500ms) 122 | 123 | ``` 124 | 125 |

Hello !

126 |
127 | ``` 128 | Or just define your own time manualy with a `TimeSpan` like below : 129 | 130 | Example with custom time : 131 | ``` 132 | 133 |

Hello !

134 |
135 | ``` 136 | ### IterationCount 137 | the number of times the animation will be played. For an infinite loop, you can set a negative number. 138 | 139 | Example : 140 | ``` 141 | 142 |

Hello !

143 |
144 | ``` 145 | Exemple with infinite loop : 146 | ``` 147 | 148 |

Hello !

149 |
150 | ``` 151 | 152 | > Notice that an IterationCount defined to 0 do not play the animation. 153 | 154 | ### Enabled 155 | Provide a way to enable or disable animation by code. This can be useful for certain scenarios like animating based on events (mouse, keyboard, ...) or to react to actions in a flux architectural pattern. 156 | 157 | Example 158 | ``` 159 | 160 |

Hello, world!

161 |
162 | 163 | @code{ 164 | 165 | private bool RunAnimation = false; 166 | private void MouseOver() => RunAnimation = true; 167 | private void MouseOut() => RunAnimation = false; 168 | } 169 | ``` 170 | 171 | ### OnAnimationEnd 172 | Call a method when the animation end. 173 | 174 | Example 175 | ``` 176 | 177 |

Hello, world!

178 |
179 | 180 | @code{ 181 | 182 | private bool RunAnimation = false; 183 | private void MouseOver() => RunAnimation = true; 184 | private void AnimationEnd() => RunAnimation = false; 185 | } 186 | ``` 187 | This property can be accessed with ```CascadingValue``` 188 | 189 | For example, imagine you create an ```InputPassword``` component like this : 190 | ``` 191 | 192 | 193 | 194 | 195 | @code { 196 | 197 | [Parameter] 198 | public bool Shake { get; set; } 199 | public string Password { get; set; } 200 | } 201 | ``` 202 | and you use it in a page : 203 | 204 | ``` 205 | 206 | 207 | 208 | @code { 209 | InputPassword inputPassword; 210 | bool NotifyBadPassword = false; 211 | private void OkClicked() 212 | { 213 | if (inputPassword.Password != "test") 214 | NotifyBadPassword = true; 215 | } 216 | } 217 | ``` 218 | The expected behavior is to shake the input when the password is wrong. But when you run the application, you notice that the animation run only the first time. 219 | 220 | ![InputPassword animation](inputpassword1.gif) 221 | 222 | The best way to resolve this issue is to pass the ```NotifyBadPassword ``` to false when the animation end. This can be achieved with a cascading value like this : 223 | 224 | ``` 225 | 226 | 227 | 228 | 229 | 230 | @code { 231 | InputPassword inputPassword; 232 | bool NotifyBadPassword = false; 233 | 234 | private void OkClicked() 235 | { 236 | if (inputPassword.Password != "test") 237 | NotifyBadPassword = true; 238 | } 239 | 240 | private void AnimationEnd() 241 | { 242 | NotifyBadPassword = false; 243 | } 244 | } 245 | ``` 246 | ![InputPassword2 animation](inputpassword2.gif) 247 | 248 | ## Named configurations 249 | 250 | BlazorAnimation supports named animation settings through the ASP.NET Core's named options. Here's an example where two configurations are provided, one without a name (the defaults) and one with a name: 251 | 252 | ``` 253 | services.Configure("bounce", o => 254 | { 255 | o.Effect = Effect.BounceInLeft; 256 | o.Speed = Speed.Faster; 257 | o.Delay = TimeSpan.FromMilliseconds(200); 258 | o.IterationCount = 2; 259 | }); 260 | 261 | services.Configure(o => { 262 | o.Effect = Effect.FadeOutDown; 263 | o.Speed = Speed.Slow; 264 | }); 265 | ``` 266 | 267 | To use a named configuration, provide the OptionsName parameter: 268 | 269 | ``` 270 | 271 |

Hello, world!

272 |
273 | ``` 274 | ## Authors 275 | 276 | BlazorAnimation is created by [Aurelien BOUDOUX](http://aurelien.boudoux.fr). 277 | 278 | Contributions are welcome! 279 | 280 | ## License 281 | 282 | BlazorAnimation is MIT licensed. The library uses the following other libraries: 283 | 284 | * [Animate.css](https://github.com/daneden/animate.css): MIT-license 285 | 286 | ## ChangeLog 287 | 288 | 2 january 2023 - v 2.2 289 | - `OnAnimationEnd` is triggered for element only 290 | 291 | 2 december 2021 - v 2.1 292 | - Add `Class` and `Style` Attributes 293 | - `Effect` can be compared by using equal sign (==) 294 | 295 | 7 may 2020 - v 2.0 296 | - Upgrade to animate.css v4 -------------------------------------------------------------------------------- /Sample/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Sorry, there's nothing at this address.

8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /Sample/Data/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Sample.Data { 4 | public class WeatherForecast { 5 | public DateTime Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int) (TemperatureC / 0.5556); 10 | 11 | public string Summary { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sample/Data/WeatherForecastService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | namespace Sample.Data { 6 | public class WeatherForecastService { 7 | private static readonly string[] Summaries = new[] 8 | { 9 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 10 | }; 11 | 12 | public Task GetForecastAsync(DateTime startDate) { 13 | var rng = new Random(); 14 | return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast { 15 | Date = startDate.AddDays(index), 16 | TemperatureC = rng.Next(-20, 55), 17 | Summary = Summaries[rng.Next(Summaries.Length)] 18 | }).ToArray()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |

Counter

4 | 5 |

Current count: @currentCount

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | @code { 16 | 17 | InputPassword inputPassword; 18 | bool NotifyBadPassword = false; 19 | 20 | private void OkClicked() 21 | { 22 | if (inputPassword.Password != "test") 23 | NotifyBadPassword = true; 24 | } 25 | 26 | private void AnimationEnd() 27 | { 28 | NotifyBadPassword = false; 29 | } 30 | 31 | 32 | private int currentCount = 0; 33 | 34 | private void IncrementCount() { 35 | currentCount++; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sample/Pages/Error.razor: -------------------------------------------------------------------------------- 1 | @page "/error" 2 | 3 | 4 |

Error.

5 |

An error occurred while processing your request.

6 | 7 |

Development Mode

8 |

9 | Swapping to Development environment will display more detailed information about the error that occurred. 10 |

11 |

12 | The Development environment shouldn't be enabled for deployed applications. 13 | It can result in displaying sensitive information from exceptions to end users. 14 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 15 | and restarting the app. 16 |

-------------------------------------------------------------------------------- /Sample/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 | @using Sample.Data 4 | @inject WeatherForecastService ForecastService 5 | 6 |

Weather forecast

7 | 8 |

This component demonstrates fetching data from a service.

9 | 10 | @if (forecasts == null) 11 | { 12 |

Loading...

13 | } 14 | else 15 | { 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | @foreach (var forecast in forecasts) 27 | { 28 | 29 | 30 | 31 | 32 | 33 | 34 | } 35 | 36 |
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
37 | } 38 | 39 | @code { 40 | private WeatherForecast[] forecasts; 41 | 42 | protected override async Task OnInitializedAsync() 43 | { 44 | forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Sample/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using System.ComponentModel 3 | @using System.Reflection 4 | @using System.Runtime.CompilerServices 5 | @using Sample.Annotations 6 | @implements IDisposable 7 | 8 | 14 |

Blazor Animation !

15 |
16 | 17 | 18 |
19 | 20 | 21 | 22 | @foreach (var member in typeof(Effect).GetProperties(BindingFlags.Static | BindingFlags.Public)) { 23 | var cssClass = member.GetValue(null) as AnimationEffect; 24 | if (!CompatibilityEffects.Contains(@member.Name)) 25 | { 26 | 27 | } 28 | } 29 | 30 | 31 |
32 | 33 |
34 | 35 |
36 |
37 | 38 | @if (ShowManualDelay) { 39 | 40 | 41 | 42 | 43 | 44 | } 45 | else { 46 | 47 | 48 | @foreach (var member in typeof(Delay).GetProperties(BindingFlags.Static | BindingFlags.Public)) { 49 | var cssClass = member.GetValue(null).ToString(); 50 | 51 | } 52 | 53 | 54 | 55 | } 56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 | 64 |
65 | 66 |
67 |
68 | 69 | @if (ShowManualSpeed) { 70 | 71 | 72 | 73 | } 74 | else { 75 | 76 | 77 | @foreach (var member in typeof(Speed).GetProperties(BindingFlags.Static | BindingFlags.Public)) { 78 | var cssClass = member.GetValue(null).ToString(); 79 | 80 | } 81 | 82 | 83 | } 84 |
85 |
86 | 87 |
88 |
89 |
90 | 91 |
92 | 93 | 94 |
95 | 96 |
97 | 98 |
99 | 100 |
101 | 102 | @code 103 | { 104 | 105 | protected override void OnParametersSet() 106 | { 107 | Model.PropertyChanged += OnChange; 108 | } 109 | 110 | private HashSet CompatibilityEffects = new HashSet() 111 | { 112 | nameof(Effect.Shake), 113 | nameof(Effect.LightSpeedIn), 114 | nameof(Effect.LightSpeedOut), 115 | }; 116 | 117 | private static string DefaultEffect = "bounce"; 118 | private static TimeSpan DefaultDelay = TimeSpan.Zero; 119 | private static TimeSpan DefaultSpeed = Speed.Slow; 120 | private static int DefaultIterationCount = 1; 121 | 122 | private bool ShowManualDelay = false; 123 | private bool ShowManualDelayEnabled = false; 124 | private bool ShowManualSpeed = false; 125 | private bool ShowManualSpeedEnabled = false; 126 | 127 | protected void ShowManualDelayClicked() 128 | { 129 | ShowManualDelay = !ShowManualDelay; 130 | ShowManualDelayEnabled = true; 131 | } 132 | 133 | protected void ShowManualSpeedClicked() 134 | { 135 | ShowManualSpeed = !ShowManualSpeed; 136 | ShowManualSpeedEnabled = true; 137 | } 138 | 139 | private bool IsActive { get; set; } = true; 140 | private AnimationEffect SelectedEffect { get; set; } = new AnimationEffect(DefaultEffect); 141 | 142 | private TimeSpan SelectedDelay { get; set; } = DefaultDelay; 143 | private TimeSpan SelectedSpeed { get; set; } = DefaultSpeed; 144 | private int SelectedIterationCount { get; set; } = DefaultIterationCount; 145 | 146 | private void End() { 147 | IsActive = false; 148 | StateHasChanged(); 149 | } 150 | 151 | private void Submit() { 152 | SelectedEffect = new AnimationEffect(Model.Effect); 153 | SelectedDelay = TimeSpan.Parse(Model.Delay); 154 | SelectedSpeed = TimeSpan.Parse(Model.Speed); 155 | SelectedIterationCount = Model.IterationCount; 156 | IsActive = true; 157 | StateHasChanged(); 158 | } 159 | 160 | public DemoModel Model = new DemoModel(DefaultEffect, DefaultDelay.ToString(), DefaultSpeed.ToString(), DefaultIterationCount); 161 | public class DemoModel : INotifyPropertyChanged 162 | { 163 | private string _effect; 164 | private string _delay; 165 | private string _speed; 166 | 167 | public DemoModel(string effect, string delay, string speed, int iterationCount) { 168 | Effect = effect; 169 | Delay = delay; 170 | Speed = speed; 171 | IterationCount = iterationCount; 172 | } 173 | 174 | public int IterationCount { get; set; } 175 | 176 | public string Effect 177 | { 178 | get => _effect; 179 | set 180 | { 181 | _effect = value; 182 | OnPropertyChanged(); 183 | } 184 | } 185 | 186 | public string Delay 187 | { 188 | get => _delay; 189 | set 190 | { 191 | _delay = value; 192 | OnPropertyChanged(); 193 | } 194 | } 195 | 196 | public string Speed 197 | { 198 | get => _speed; 199 | set 200 | { 201 | _speed = value; 202 | OnPropertyChanged(); 203 | } 204 | } 205 | 206 | 207 | public int Delay2 208 | { 209 | get => (int) TimeSpan.Parse(Delay).TotalMilliseconds; 210 | set => Delay = TimeSpan.FromMilliseconds(value).ToString(); 211 | } 212 | 213 | public int Speed2 214 | { 215 | get => (int) TimeSpan.Parse(Speed).TotalMilliseconds; 216 | set => Speed = TimeSpan.FromMilliseconds(value).ToString(); 217 | } 218 | 219 | public event PropertyChangedEventHandler PropertyChanged; 220 | 221 | [NotifyPropertyChangedInvocator] 222 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) 223 | { 224 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 225 | } 226 | } 227 | 228 | private void OnChange(object sender, object args) => Submit(); 229 | 230 | public void Dispose() 231 | { 232 | Model.PropertyChanged -= OnChange; 233 | } 234 | } 235 | -------------------------------------------------------------------------------- /Sample/Pages/InputPassword.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | @code { 6 | 7 | [Parameter] 8 | public bool Shake { get; set; } 9 | 10 | public string Password { get; set; } 11 | } -------------------------------------------------------------------------------- /Sample/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace Sample.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @{ 5 | Layout = null; 6 | } 7 | 8 | 9 | 10 | 11 | 12 | 13 | Sample 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | An error has occurred. This application may no longer respond until reloaded. 26 | 27 | 28 | An unhandled exception has occurred. See browser dev tools for details. 29 | 30 | Reload 31 | 🗙 32 |
33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Sample/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Hosting; 10 | using Microsoft.Extensions.Logging; 11 | 12 | namespace Sample { 13 | public class Program { 14 | public static void Main(string[] args) { 15 | CreateHostBuilder(args).Build().Run(); 16 | } 17 | 18 | public static IHostBuilder CreateHostBuilder(string[] args) => 19 | Host.CreateDefaultBuilder(args) 20 | .ConfigureWebHostDefaults(webBuilder => { 21 | webBuilder.UseStartup(); 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sample/Properties/Annotations.cs: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | 3 | Copyright (c) 2016 JetBrains http://www.jetbrains.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. */ 22 | 23 | using System; 24 | // ReSharper disable InheritdocConsiderUsage 25 | 26 | #pragma warning disable 1591 27 | // ReSharper disable UnusedMember.Global 28 | // ReSharper disable MemberCanBePrivate.Global 29 | // ReSharper disable UnusedAutoPropertyAccessor.Global 30 | // ReSharper disable IntroduceOptionalParameters.Global 31 | // ReSharper disable MemberCanBeProtected.Global 32 | // ReSharper disable InconsistentNaming 33 | 34 | namespace Sample.Annotations 35 | { 36 | /// 37 | /// Indicates that the value of the marked element could be null sometimes, 38 | /// so checking for null is required before its usage. 39 | /// 40 | /// 41 | /// [CanBeNull] object Test() => null; 42 | /// 43 | /// void UseTest() { 44 | /// var p = Test(); 45 | /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' 46 | /// } 47 | /// 48 | [AttributeUsage( 49 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 50 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 51 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 52 | public sealed class CanBeNullAttribute : Attribute { } 53 | 54 | /// 55 | /// Indicates that the value of the marked element can never be null. 56 | /// 57 | /// 58 | /// [NotNull] object Foo() { 59 | /// return null; // Warning: Possible 'null' assignment 60 | /// } 61 | /// 62 | [AttributeUsage( 63 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 64 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 65 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 66 | public sealed class NotNullAttribute : Attribute { } 67 | 68 | /// 69 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task 70 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 71 | /// or of the Lazy.Value property can never be null. 72 | /// 73 | /// 74 | /// public void Foo([ItemNotNull]List<string> books) 75 | /// { 76 | /// foreach (var book in books) { 77 | /// if (book != null) // Warning: Expression is always true 78 | /// Console.WriteLine(book.ToUpper()); 79 | /// } 80 | /// } 81 | /// 82 | [AttributeUsage( 83 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 84 | AttributeTargets.Delegate | AttributeTargets.Field)] 85 | public sealed class ItemNotNullAttribute : Attribute { } 86 | 87 | /// 88 | /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task 89 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 90 | /// or of the Lazy.Value property can be null. 91 | /// 92 | /// 93 | /// public void Foo([ItemCanBeNull]List<string> books) 94 | /// { 95 | /// foreach (var book in books) 96 | /// { 97 | /// // Warning: Possible 'System.NullReferenceException' 98 | /// Console.WriteLine(book.ToUpper()); 99 | /// } 100 | /// } 101 | /// 102 | [AttributeUsage( 103 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 104 | AttributeTargets.Delegate | AttributeTargets.Field)] 105 | public sealed class ItemCanBeNullAttribute : Attribute { } 106 | 107 | /// 108 | /// Indicates that the marked method builds string by the format pattern and (optional) arguments. 109 | /// The parameter, which contains the format string, should be given in constructor. The format string 110 | /// should be in -like form. 111 | /// 112 | /// 113 | /// [StringFormatMethod("message")] 114 | /// void ShowError(string message, params object[] args) { /* do something */ } 115 | /// 116 | /// void Foo() { 117 | /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string 118 | /// } 119 | /// 120 | [AttributeUsage( 121 | AttributeTargets.Constructor | AttributeTargets.Method | 122 | AttributeTargets.Property | AttributeTargets.Delegate)] 123 | public sealed class StringFormatMethodAttribute : Attribute 124 | { 125 | /// 126 | /// Specifies which parameter of an annotated method should be treated as the format string 127 | /// 128 | public StringFormatMethodAttribute([NotNull] string formatParameterName) 129 | { 130 | FormatParameterName = formatParameterName; 131 | } 132 | 133 | [NotNull] public string FormatParameterName { get; } 134 | } 135 | 136 | /// 137 | /// Use this annotation to specify a type that contains static or const fields 138 | /// with values for the annotated property/field/parameter. 139 | /// The specified type will be used to improve completion suggestions. 140 | /// 141 | /// 142 | /// namespace TestNamespace 143 | /// { 144 | /// public class Constants 145 | /// { 146 | /// public static int INT_CONST = 1; 147 | /// public const string STRING_CONST = "1"; 148 | /// } 149 | /// 150 | /// public class Class1 151 | /// { 152 | /// [ValueProvider("TestNamespace.Constants")] public int myField; 153 | /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { } 154 | /// 155 | /// public void Test() 156 | /// { 157 | /// Foo(/*try completion here*/);// 158 | /// myField = /*try completion here*/ 159 | /// } 160 | /// } 161 | /// } 162 | /// 163 | [AttributeUsage( 164 | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, 165 | AllowMultiple = true)] 166 | public sealed class ValueProviderAttribute : Attribute 167 | { 168 | public ValueProviderAttribute([NotNull] string name) 169 | { 170 | Name = name; 171 | } 172 | 173 | [NotNull] public string Name { get; } 174 | } 175 | 176 | /// 177 | /// Indicates that the function argument should be a string literal and match one 178 | /// of the parameters of the caller function. For example, ReSharper annotates 179 | /// the parameter of . 180 | /// 181 | /// 182 | /// void Foo(string param) { 183 | /// if (param == null) 184 | /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol 185 | /// } 186 | /// 187 | [AttributeUsage(AttributeTargets.Parameter)] 188 | public sealed class InvokerParameterNameAttribute : Attribute { } 189 | 190 | /// 191 | /// Indicates that the method is contained in a type that implements 192 | /// System.ComponentModel.INotifyPropertyChanged interface and this method 193 | /// is used to notify that some property value changed. 194 | /// 195 | /// 196 | /// The method should be non-static and conform to one of the supported signatures: 197 | /// 198 | /// NotifyChanged(string) 199 | /// NotifyChanged(params string[]) 200 | /// NotifyChanged{T}(Expression{Func{T}}) 201 | /// NotifyChanged{T,U}(Expression{Func{T,U}}) 202 | /// SetProperty{T}(ref T, T, string) 203 | /// 204 | /// 205 | /// 206 | /// public class Foo : INotifyPropertyChanged { 207 | /// public event PropertyChangedEventHandler PropertyChanged; 208 | /// 209 | /// [NotifyPropertyChangedInvocator] 210 | /// protected virtual void NotifyChanged(string propertyName) { ... } 211 | /// 212 | /// string _name; 213 | /// 214 | /// public string Name { 215 | /// get { return _name; } 216 | /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } 217 | /// } 218 | /// } 219 | /// 220 | /// Examples of generated notifications: 221 | /// 222 | /// NotifyChanged("Property") 223 | /// NotifyChanged(() => Property) 224 | /// NotifyChanged((VM x) => x.Property) 225 | /// SetProperty(ref myField, value, "Property") 226 | /// 227 | /// 228 | [AttributeUsage(AttributeTargets.Method)] 229 | public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute 230 | { 231 | public NotifyPropertyChangedInvocatorAttribute() { } 232 | public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) 233 | { 234 | ParameterName = parameterName; 235 | } 236 | 237 | [CanBeNull] public string ParameterName { get; } 238 | } 239 | 240 | /// 241 | /// Describes dependency between method input and output. 242 | /// 243 | /// 244 | ///

Function Definition Table syntax:

245 | /// 246 | /// FDT ::= FDTRow [;FDTRow]* 247 | /// FDTRow ::= Input => Output | Output <= Input 248 | /// Input ::= ParameterName: Value [, Input]* 249 | /// Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} 250 | /// Value ::= true | false | null | notnull | canbenull 251 | /// 252 | /// If the method has a single input parameter, its name could be omitted.
253 | /// Using halt (or void/nothing, which is the same) for the method output 254 | /// means that the method doesn't return normally (throws or terminates the process).
255 | /// Value canbenull is only applicable for output parameters.
256 | /// You can use multiple [ContractAnnotation] for each FDT row, or use single attribute 257 | /// with rows separated by semicolon. There is no notion of order rows, all rows are checked 258 | /// for applicability and applied per each program state tracked by the analysis engine.
259 | ///
260 | /// 261 | /// 262 | /// [ContractAnnotation("=> halt")] 263 | /// public void TerminationMethod() 264 | /// 265 | /// 266 | /// [ContractAnnotation("null <= param:null")] // reverse condition syntax 267 | /// public string GetName(string surname) 268 | /// 269 | /// 270 | /// [ContractAnnotation("s:null => true")] 271 | /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() 272 | /// 273 | /// 274 | /// // A method that returns null if the parameter is null, 275 | /// // and not null if the parameter is not null 276 | /// [ContractAnnotation("null => null; notnull => notnull")] 277 | /// public object Transform(object data) 278 | /// 279 | /// 280 | /// [ContractAnnotation("=> true, result: notnull; => false, result: null")] 281 | /// public bool TryParse(string s, out Person result) 282 | /// 283 | /// 284 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] 285 | public sealed class ContractAnnotationAttribute : Attribute 286 | { 287 | public ContractAnnotationAttribute([NotNull] string contract) 288 | : this(contract, false) { } 289 | 290 | public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) 291 | { 292 | Contract = contract; 293 | ForceFullStates = forceFullStates; 294 | } 295 | 296 | [NotNull] public string Contract { get; } 297 | 298 | public bool ForceFullStates { get; } 299 | } 300 | 301 | /// 302 | /// Indicates whether the marked element should be localized. 303 | /// 304 | /// 305 | /// [LocalizationRequiredAttribute(true)] 306 | /// class Foo { 307 | /// string str = "my string"; // Warning: Localizable string 308 | /// } 309 | /// 310 | [AttributeUsage(AttributeTargets.All)] 311 | public sealed class LocalizationRequiredAttribute : Attribute 312 | { 313 | public LocalizationRequiredAttribute() : this(true) { } 314 | 315 | public LocalizationRequiredAttribute(bool required) 316 | { 317 | Required = required; 318 | } 319 | 320 | public bool Required { get; } 321 | } 322 | 323 | /// 324 | /// Indicates that the value of the marked type (or its derivatives) 325 | /// cannot be compared using '==' or '!=' operators and Equals() 326 | /// should be used instead. However, using '==' or '!=' for comparison 327 | /// with null is always permitted. 328 | /// 329 | /// 330 | /// [CannotApplyEqualityOperator] 331 | /// class NoEquality { } 332 | /// 333 | /// class UsesNoEquality { 334 | /// void Test() { 335 | /// var ca1 = new NoEquality(); 336 | /// var ca2 = new NoEquality(); 337 | /// if (ca1 != null) { // OK 338 | /// bool condition = ca1 == ca2; // Warning 339 | /// } 340 | /// } 341 | /// } 342 | /// 343 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] 344 | public sealed class CannotApplyEqualityOperatorAttribute : Attribute { } 345 | 346 | /// 347 | /// When applied to a target attribute, specifies a requirement for any type marked 348 | /// with the target attribute to implement or inherit specific type or types. 349 | /// 350 | /// 351 | /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement 352 | /// class ComponentAttribute : Attribute { } 353 | /// 354 | /// [Component] // ComponentAttribute requires implementing IComponent interface 355 | /// class MyComponent : IComponent { } 356 | /// 357 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 358 | [BaseTypeRequired(typeof(Attribute))] 359 | public sealed class BaseTypeRequiredAttribute : Attribute 360 | { 361 | public BaseTypeRequiredAttribute([NotNull] Type baseType) 362 | { 363 | BaseType = baseType; 364 | } 365 | 366 | [NotNull] public Type BaseType { get; } 367 | } 368 | 369 | /// 370 | /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), 371 | /// so this symbol will not be reported as unused (as well as by other usage inspections). 372 | /// 373 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 374 | public sealed class UsedImplicitlyAttribute : Attribute 375 | { 376 | public UsedImplicitlyAttribute() 377 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } 378 | 379 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) 380 | : this(useKindFlags, ImplicitUseTargetFlags.Default) { } 381 | 382 | public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) 383 | : this(ImplicitUseKindFlags.Default, targetFlags) { } 384 | 385 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 386 | { 387 | UseKindFlags = useKindFlags; 388 | TargetFlags = targetFlags; 389 | } 390 | 391 | public ImplicitUseKindFlags UseKindFlags { get; } 392 | 393 | public ImplicitUseTargetFlags TargetFlags { get; } 394 | } 395 | 396 | /// 397 | /// Can be applied to attributes, type parameters, and parameters of a type assignable from . 398 | /// When applied to an attribute, the decorated attribute behaves the same as . 399 | /// When applied to a type parameter or to a parameter of type , indicates that the corresponding type 400 | /// is used implicitly. 401 | /// 402 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)] 403 | public sealed class MeansImplicitUseAttribute : Attribute 404 | { 405 | public MeansImplicitUseAttribute() 406 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } 407 | 408 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) 409 | : this(useKindFlags, ImplicitUseTargetFlags.Default) { } 410 | 411 | public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) 412 | : this(ImplicitUseKindFlags.Default, targetFlags) { } 413 | 414 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 415 | { 416 | UseKindFlags = useKindFlags; 417 | TargetFlags = targetFlags; 418 | } 419 | 420 | [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; } 421 | 422 | [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; } 423 | } 424 | 425 | /// 426 | /// Specify the details of implicitly used symbol when it is marked 427 | /// with or . 428 | /// 429 | [Flags] 430 | public enum ImplicitUseKindFlags 431 | { 432 | Default = Access | Assign | InstantiatedWithFixedConstructorSignature, 433 | /// Only entity marked with attribute considered used. 434 | Access = 1, 435 | /// Indicates implicit assignment to a member. 436 | Assign = 2, 437 | /// 438 | /// Indicates implicit instantiation of a type with fixed constructor signature. 439 | /// That means any unused constructor parameters won't be reported as such. 440 | /// 441 | InstantiatedWithFixedConstructorSignature = 4, 442 | /// Indicates implicit instantiation of a type. 443 | InstantiatedNoFixedConstructorSignature = 8, 444 | } 445 | 446 | /// 447 | /// Specify what is considered to be used implicitly when marked 448 | /// with or . 449 | /// 450 | [Flags] 451 | public enum ImplicitUseTargetFlags 452 | { 453 | Default = Itself, 454 | Itself = 1, 455 | /// Members of entity marked with attribute are considered used. 456 | Members = 2, 457 | /// Entity marked with attribute and all its members considered used. 458 | WithMembers = Itself | Members 459 | } 460 | 461 | /// 462 | /// This attribute is intended to mark publicly available API 463 | /// which should not be removed and so is treated as used. 464 | /// 465 | [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] 466 | [AttributeUsage(AttributeTargets.All, Inherited = false)] 467 | public sealed class PublicAPIAttribute : Attribute 468 | { 469 | public PublicAPIAttribute() { } 470 | 471 | public PublicAPIAttribute([NotNull] string comment) 472 | { 473 | Comment = comment; 474 | } 475 | 476 | [CanBeNull] public string Comment { get; } 477 | } 478 | 479 | /// 480 | /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. 481 | /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. 482 | /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. 483 | /// 484 | [AttributeUsage(AttributeTargets.Parameter)] 485 | public sealed class InstantHandleAttribute : Attribute { } 486 | 487 | /// 488 | /// Indicates that a method does not make any observable state changes. 489 | /// The same as System.Diagnostics.Contracts.PureAttribute. 490 | /// 491 | /// 492 | /// [Pure] int Multiply(int x, int y) => x * y; 493 | /// 494 | /// void M() { 495 | /// Multiply(123, 42); // Waring: Return value of pure method is not used 496 | /// } 497 | /// 498 | [AttributeUsage(AttributeTargets.Method)] 499 | public sealed class PureAttribute : Attribute { } 500 | 501 | /// 502 | /// Indicates that the return value of the method invocation must be used. 503 | /// 504 | /// 505 | /// Methods decorated with this attribute (in contrast to pure methods) might change state, 506 | /// but make no sense without using their return value.
507 | /// Similarly to , this attribute 508 | /// will help detecting usages of the method when the return value in not used. 509 | /// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g. 510 | /// [MustUseReturnValue("Use the return value to...")]. 511 | ///
512 | [AttributeUsage(AttributeTargets.Method)] 513 | public sealed class MustUseReturnValueAttribute : Attribute 514 | { 515 | public MustUseReturnValueAttribute() { } 516 | 517 | public MustUseReturnValueAttribute([NotNull] string justification) 518 | { 519 | Justification = justification; 520 | } 521 | 522 | [CanBeNull] public string Justification { get; } 523 | } 524 | 525 | /// 526 | /// Indicates the type member or parameter of some type, that should be used instead of all other ways 527 | /// to get the value of that type. This annotation is useful when you have some "context" value evaluated 528 | /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. 529 | /// 530 | /// 531 | /// class Foo { 532 | /// [ProvidesContext] IBarService _barService = ...; 533 | /// 534 | /// void ProcessNode(INode node) { 535 | /// DoSomething(node, node.GetGlobalServices().Bar); 536 | /// // ^ Warning: use value of '_barService' field 537 | /// } 538 | /// } 539 | /// 540 | [AttributeUsage( 541 | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | 542 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)] 543 | public sealed class ProvidesContextAttribute : Attribute { } 544 | 545 | /// 546 | /// Indicates that a parameter is a path to a file or a folder within a web project. 547 | /// Path can be relative or absolute, starting from web root (~). 548 | /// 549 | [AttributeUsage(AttributeTargets.Parameter)] 550 | public sealed class PathReferenceAttribute : Attribute 551 | { 552 | public PathReferenceAttribute() { } 553 | 554 | public PathReferenceAttribute([NotNull, PathReference] string basePath) 555 | { 556 | BasePath = basePath; 557 | } 558 | 559 | [CanBeNull] public string BasePath { get; } 560 | } 561 | 562 | /// 563 | /// An extension method marked with this attribute is processed by code completion 564 | /// as a 'Source Template'. When the extension method is completed over some expression, its source code 565 | /// is automatically expanded like a template at call site. 566 | /// 567 | /// 568 | /// Template method body can contain valid source code and/or special comments starting with '$'. 569 | /// Text inside these comments is added as source code when the template is applied. Template parameters 570 | /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. 571 | /// Use the attribute to specify macros for parameters. 572 | /// 573 | /// 574 | /// In this example, the 'forEach' method is a source template available over all values 575 | /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: 576 | /// 577 | /// [SourceTemplate] 578 | /// public static void forEach<T>(this IEnumerable<T> xs) { 579 | /// foreach (var x in xs) { 580 | /// //$ $END$ 581 | /// } 582 | /// } 583 | /// 584 | /// 585 | [AttributeUsage(AttributeTargets.Method)] 586 | public sealed class SourceTemplateAttribute : Attribute { } 587 | 588 | /// 589 | /// Allows specifying a macro for a parameter of a source template. 590 | /// 591 | /// 592 | /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression 593 | /// is defined in the property. When applied on a method, the target 594 | /// template parameter is defined in the property. To apply the macro silently 595 | /// for the parameter, set the property value = -1. 596 | /// 597 | /// 598 | /// Applying the attribute on a source template method: 599 | /// 600 | /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] 601 | /// public static void forEach<T>(this IEnumerable<T> collection) { 602 | /// foreach (var item in collection) { 603 | /// //$ $END$ 604 | /// } 605 | /// } 606 | /// 607 | /// Applying the attribute on a template method parameter: 608 | /// 609 | /// [SourceTemplate] 610 | /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { 611 | /// /*$ var $x$Id = "$newguid$" + x.ToString(); 612 | /// x.DoSomething($x$Id); */ 613 | /// } 614 | /// 615 | /// 616 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] 617 | public sealed class MacroAttribute : Attribute 618 | { 619 | /// 620 | /// Allows specifying a macro that will be executed for a source template 621 | /// parameter when the template is expanded. 622 | /// 623 | [CanBeNull] public string Expression { get; set; } 624 | 625 | /// 626 | /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. 627 | /// 628 | /// 629 | /// If the target parameter is used several times in the template, only one occurrence becomes editable; 630 | /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, 631 | /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. 632 | /// 633 | public int Editable { get; set; } 634 | 635 | /// 636 | /// Identifies the target parameter of a source template if the 637 | /// is applied on a template method. 638 | /// 639 | [CanBeNull] public string Target { get; set; } 640 | } 641 | 642 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 643 | public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute 644 | { 645 | public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) 646 | { 647 | Format = format; 648 | } 649 | 650 | [NotNull] public string Format { get; } 651 | } 652 | 653 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 654 | public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute 655 | { 656 | public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) 657 | { 658 | Format = format; 659 | } 660 | 661 | [NotNull] public string Format { get; } 662 | } 663 | 664 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 665 | public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute 666 | { 667 | public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) 668 | { 669 | Format = format; 670 | } 671 | 672 | [NotNull] public string Format { get; } 673 | } 674 | 675 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 676 | public sealed class AspMvcMasterLocationFormatAttribute : Attribute 677 | { 678 | public AspMvcMasterLocationFormatAttribute([NotNull] string format) 679 | { 680 | Format = format; 681 | } 682 | 683 | [NotNull] public string Format { get; } 684 | } 685 | 686 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 687 | public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute 688 | { 689 | public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) 690 | { 691 | Format = format; 692 | } 693 | 694 | [NotNull] public string Format { get; } 695 | } 696 | 697 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 698 | public sealed class AspMvcViewLocationFormatAttribute : Attribute 699 | { 700 | public AspMvcViewLocationFormatAttribute([NotNull] string format) 701 | { 702 | Format = format; 703 | } 704 | 705 | [NotNull] public string Format { get; } 706 | } 707 | 708 | /// 709 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 710 | /// is an MVC action. If applied to a method, the MVC action name is calculated 711 | /// implicitly from the context. Use this attribute for custom wrappers similar to 712 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). 713 | /// 714 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 715 | public sealed class AspMvcActionAttribute : Attribute 716 | { 717 | public AspMvcActionAttribute() { } 718 | 719 | public AspMvcActionAttribute([NotNull] string anonymousProperty) 720 | { 721 | AnonymousProperty = anonymousProperty; 722 | } 723 | 724 | [CanBeNull] public string AnonymousProperty { get; } 725 | } 726 | 727 | /// 728 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area. 729 | /// Use this attribute for custom wrappers similar to 730 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). 731 | /// 732 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 733 | public sealed class AspMvcAreaAttribute : Attribute 734 | { 735 | public AspMvcAreaAttribute() { } 736 | 737 | public AspMvcAreaAttribute([NotNull] string anonymousProperty) 738 | { 739 | AnonymousProperty = anonymousProperty; 740 | } 741 | 742 | [CanBeNull] public string AnonymousProperty { get; } 743 | } 744 | 745 | /// 746 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is 747 | /// an MVC controller. If applied to a method, the MVC controller name is calculated 748 | /// implicitly from the context. Use this attribute for custom wrappers similar to 749 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String). 750 | /// 751 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 752 | public sealed class AspMvcControllerAttribute : Attribute 753 | { 754 | public AspMvcControllerAttribute() { } 755 | 756 | public AspMvcControllerAttribute([NotNull] string anonymousProperty) 757 | { 758 | AnonymousProperty = anonymousProperty; 759 | } 760 | 761 | [CanBeNull] public string AnonymousProperty { get; } 762 | } 763 | 764 | /// 765 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute 766 | /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, String). 767 | /// 768 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 769 | public sealed class AspMvcMasterAttribute : Attribute { } 770 | 771 | /// 772 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute 773 | /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, Object). 774 | /// 775 | [AttributeUsage(AttributeTargets.Parameter)] 776 | public sealed class AspMvcModelTypeAttribute : Attribute { } 777 | 778 | /// 779 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC 780 | /// partial view. If applied to a method, the MVC partial view name is calculated implicitly 781 | /// from the context. Use this attribute for custom wrappers similar to 782 | /// System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String). 783 | /// 784 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 785 | public sealed class AspMvcPartialViewAttribute : Attribute { } 786 | 787 | /// 788 | /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. 789 | /// 790 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 791 | public sealed class AspMvcSuppressViewErrorAttribute : Attribute { } 792 | 793 | /// 794 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. 795 | /// Use this attribute for custom wrappers similar to 796 | /// System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String). 797 | /// 798 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 799 | public sealed class AspMvcDisplayTemplateAttribute : Attribute { } 800 | 801 | /// 802 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template. 803 | /// Use this attribute for custom wrappers similar to 804 | /// System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String). 805 | /// 806 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 807 | public sealed class AspMvcEditorTemplateAttribute : Attribute { } 808 | 809 | /// 810 | /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template. 811 | /// Use this attribute for custom wrappers similar to 812 | /// System.ComponentModel.DataAnnotations.UIHintAttribute(System.String). 813 | /// 814 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 815 | public sealed class AspMvcTemplateAttribute : Attribute { } 816 | 817 | /// 818 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 819 | /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly 820 | /// from the context. Use this attribute for custom wrappers similar to 821 | /// System.Web.Mvc.Controller.View(Object). 822 | /// 823 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 824 | public sealed class AspMvcViewAttribute : Attribute { } 825 | 826 | /// 827 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 828 | /// is an MVC view component name. 829 | /// 830 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 831 | public sealed class AspMvcViewComponentAttribute : Attribute { } 832 | 833 | /// 834 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 835 | /// is an MVC view component view. If applied to a method, the MVC view component view name is default. 836 | /// 837 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 838 | public sealed class AspMvcViewComponentViewAttribute : Attribute { } 839 | 840 | /// 841 | /// ASP.NET MVC attribute. When applied to a parameter of an attribute, 842 | /// indicates that this parameter is an MVC action name. 843 | /// 844 | /// 845 | /// [ActionName("Foo")] 846 | /// public ActionResult Login(string returnUrl) { 847 | /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK 848 | /// return RedirectToAction("Bar"); // Error: Cannot resolve action 849 | /// } 850 | /// 851 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] 852 | public sealed class AspMvcActionSelectorAttribute : Attribute { } 853 | 854 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] 855 | public sealed class HtmlElementAttributesAttribute : Attribute 856 | { 857 | public HtmlElementAttributesAttribute() { } 858 | 859 | public HtmlElementAttributesAttribute([NotNull] string name) 860 | { 861 | Name = name; 862 | } 863 | 864 | [CanBeNull] public string Name { get; } 865 | } 866 | 867 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 868 | public sealed class HtmlAttributeValueAttribute : Attribute 869 | { 870 | public HtmlAttributeValueAttribute([NotNull] string name) 871 | { 872 | Name = name; 873 | } 874 | 875 | [NotNull] public string Name { get; } 876 | } 877 | 878 | /// 879 | /// Razor attribute. Indicates that the marked parameter or method is a Razor section. 880 | /// Use this attribute for custom wrappers similar to 881 | /// System.Web.WebPages.WebPageBase.RenderSection(String). 882 | /// 883 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 884 | public sealed class RazorSectionAttribute : Attribute { } 885 | 886 | /// 887 | /// Indicates how method, constructor invocation, or property access 888 | /// over collection type affects the contents of the collection. 889 | /// Use to specify the access type. 890 | /// 891 | /// 892 | /// Using this attribute only makes sense if all collection methods are marked with this attribute. 893 | /// 894 | /// 895 | /// public class MyStringCollection : List<string> 896 | /// { 897 | /// [CollectionAccess(CollectionAccessType.Read)] 898 | /// public string GetFirstString() 899 | /// { 900 | /// return this.ElementAt(0); 901 | /// } 902 | /// } 903 | /// class Test 904 | /// { 905 | /// public void Foo() 906 | /// { 907 | /// // Warning: Contents of the collection is never updated 908 | /// var col = new MyStringCollection(); 909 | /// string x = col.GetFirstString(); 910 | /// } 911 | /// } 912 | /// 913 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] 914 | public sealed class CollectionAccessAttribute : Attribute 915 | { 916 | public CollectionAccessAttribute(CollectionAccessType collectionAccessType) 917 | { 918 | CollectionAccessType = collectionAccessType; 919 | } 920 | 921 | public CollectionAccessType CollectionAccessType { get; } 922 | } 923 | 924 | /// 925 | /// Provides a value for the to define 926 | /// how the collection method invocation affects the contents of the collection. 927 | /// 928 | [Flags] 929 | public enum CollectionAccessType 930 | { 931 | /// Method does not use or modify content of the collection. 932 | None = 0, 933 | /// Method only reads content of the collection but does not modify it. 934 | Read = 1, 935 | /// Method can change content of the collection but does not add new elements. 936 | ModifyExistingContent = 2, 937 | /// Method can add new elements to the collection. 938 | UpdatedContent = ModifyExistingContent | 4 939 | } 940 | 941 | /// 942 | /// Indicates that the marked method is assertion method, i.e. it halts the control flow if 943 | /// one of the conditions is satisfied. To set the condition, mark one of the parameters with 944 | /// attribute. 945 | /// 946 | [AttributeUsage(AttributeTargets.Method)] 947 | public sealed class AssertionMethodAttribute : Attribute { } 948 | 949 | /// 950 | /// Indicates the condition parameter of the assertion method. The method itself should be 951 | /// marked by attribute. The mandatory argument of 952 | /// the attribute is the assertion type. 953 | /// 954 | [AttributeUsage(AttributeTargets.Parameter)] 955 | public sealed class AssertionConditionAttribute : Attribute 956 | { 957 | public AssertionConditionAttribute(AssertionConditionType conditionType) 958 | { 959 | ConditionType = conditionType; 960 | } 961 | 962 | public AssertionConditionType ConditionType { get; } 963 | } 964 | 965 | /// 966 | /// Specifies assertion type. If the assertion method argument satisfies the condition, 967 | /// then the execution continues. Otherwise, execution is assumed to be halted. 968 | /// 969 | public enum AssertionConditionType 970 | { 971 | /// Marked parameter should be evaluated to true. 972 | IS_TRUE = 0, 973 | /// Marked parameter should be evaluated to false. 974 | IS_FALSE = 1, 975 | /// Marked parameter should be evaluated to null value. 976 | IS_NULL = 2, 977 | /// Marked parameter should be evaluated to not null value. 978 | IS_NOT_NULL = 3, 979 | } 980 | 981 | /// 982 | /// Indicates that the marked method unconditionally terminates control flow execution. 983 | /// For example, it could unconditionally throw exception. 984 | /// 985 | [Obsolete("Use [ContractAnnotation('=> halt')] instead")] 986 | [AttributeUsage(AttributeTargets.Method)] 987 | public sealed class TerminatesProgramAttribute : Attribute { } 988 | 989 | /// 990 | /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, 991 | /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters 992 | /// of delegate type by analyzing LINQ method chains. 993 | /// 994 | [AttributeUsage(AttributeTargets.Method)] 995 | public sealed class LinqTunnelAttribute : Attribute { } 996 | 997 | /// 998 | /// Indicates that IEnumerable passed as a parameter is not enumerated. 999 | /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection. 1000 | /// 1001 | /// 1002 | /// static void ThrowIfNull<T>([NoEnumeration] T v, string n) where T : class 1003 | /// { 1004 | /// // custom check for null but no enumeration 1005 | /// } 1006 | /// 1007 | /// void Foo(IEnumerable<string> values) 1008 | /// { 1009 | /// ThrowIfNull(values, nameof(values)); 1010 | /// var x = values.ToList(); // No warnings about multiple enumeration 1011 | /// } 1012 | /// 1013 | [AttributeUsage(AttributeTargets.Parameter)] 1014 | public sealed class NoEnumerationAttribute : Attribute { } 1015 | 1016 | /// 1017 | /// Indicates that the marked parameter is a regular expression pattern. 1018 | /// 1019 | [AttributeUsage(AttributeTargets.Parameter)] 1020 | public sealed class RegexPatternAttribute : Attribute { } 1021 | 1022 | /// 1023 | /// Prevents the Member Reordering feature from tossing members of the marked class. 1024 | /// 1025 | /// 1026 | /// The attribute must be mentioned in your member reordering patterns. 1027 | /// 1028 | [AttributeUsage( 1029 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] 1030 | public sealed class NoReorderAttribute : Attribute { } 1031 | 1032 | /// 1033 | /// XAML attribute. Indicates the type that has ItemsSource property and should be treated 1034 | /// as ItemsControl-derived type, to enable inner items DataContext type resolve. 1035 | /// 1036 | [AttributeUsage(AttributeTargets.Class)] 1037 | public sealed class XamlItemsControlAttribute : Attribute { } 1038 | 1039 | /// 1040 | /// XAML attribute. Indicates the property of some BindingBase-derived type, that 1041 | /// is used to bind some item of ItemsControl-derived type. This annotation will 1042 | /// enable the DataContext type resolve for XAML bindings for such properties. 1043 | /// 1044 | /// 1045 | /// Property should have the tree ancestor of the ItemsControl type or 1046 | /// marked with the attribute. 1047 | /// 1048 | [AttributeUsage(AttributeTargets.Property)] 1049 | public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { } 1050 | 1051 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 1052 | public sealed class AspChildControlTypeAttribute : Attribute 1053 | { 1054 | public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) 1055 | { 1056 | TagName = tagName; 1057 | ControlType = controlType; 1058 | } 1059 | 1060 | [NotNull] public string TagName { get; } 1061 | 1062 | [NotNull] public Type ControlType { get; } 1063 | } 1064 | 1065 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 1066 | public sealed class AspDataFieldAttribute : Attribute { } 1067 | 1068 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 1069 | public sealed class AspDataFieldsAttribute : Attribute { } 1070 | 1071 | [AttributeUsage(AttributeTargets.Property)] 1072 | public sealed class AspMethodPropertyAttribute : Attribute { } 1073 | 1074 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 1075 | public sealed class AspRequiredAttributeAttribute : Attribute 1076 | { 1077 | public AspRequiredAttributeAttribute([NotNull] string attribute) 1078 | { 1079 | Attribute = attribute; 1080 | } 1081 | 1082 | [NotNull] public string Attribute { get; } 1083 | } 1084 | 1085 | [AttributeUsage(AttributeTargets.Property)] 1086 | public sealed class AspTypePropertyAttribute : Attribute 1087 | { 1088 | public bool CreateConstructorReferences { get; } 1089 | 1090 | public AspTypePropertyAttribute(bool createConstructorReferences) 1091 | { 1092 | CreateConstructorReferences = createConstructorReferences; 1093 | } 1094 | } 1095 | 1096 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1097 | public sealed class RazorImportNamespaceAttribute : Attribute 1098 | { 1099 | public RazorImportNamespaceAttribute([NotNull] string name) 1100 | { 1101 | Name = name; 1102 | } 1103 | 1104 | [NotNull] public string Name { get; } 1105 | } 1106 | 1107 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1108 | public sealed class RazorInjectionAttribute : Attribute 1109 | { 1110 | public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) 1111 | { 1112 | Type = type; 1113 | FieldName = fieldName; 1114 | } 1115 | 1116 | [NotNull] public string Type { get; } 1117 | 1118 | [NotNull] public string FieldName { get; } 1119 | } 1120 | 1121 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1122 | public sealed class RazorDirectiveAttribute : Attribute 1123 | { 1124 | public RazorDirectiveAttribute([NotNull] string directive) 1125 | { 1126 | Directive = directive; 1127 | } 1128 | 1129 | [NotNull] public string Directive { get; } 1130 | } 1131 | 1132 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1133 | public sealed class RazorPageBaseTypeAttribute : Attribute 1134 | { 1135 | public RazorPageBaseTypeAttribute([NotNull] string baseType) 1136 | { 1137 | BaseType = baseType; 1138 | } 1139 | public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) 1140 | { 1141 | BaseType = baseType; 1142 | PageName = pageName; 1143 | } 1144 | 1145 | [NotNull] public string BaseType { get; } 1146 | [CanBeNull] public string PageName { get; } 1147 | } 1148 | 1149 | [AttributeUsage(AttributeTargets.Method)] 1150 | public sealed class RazorHelperCommonAttribute : Attribute { } 1151 | 1152 | [AttributeUsage(AttributeTargets.Property)] 1153 | public sealed class RazorLayoutAttribute : Attribute { } 1154 | 1155 | [AttributeUsage(AttributeTargets.Method)] 1156 | public sealed class RazorWriteLiteralMethodAttribute : Attribute { } 1157 | 1158 | [AttributeUsage(AttributeTargets.Method)] 1159 | public sealed class RazorWriteMethodAttribute : Attribute { } 1160 | 1161 | [AttributeUsage(AttributeTargets.Parameter)] 1162 | public sealed class RazorWriteMethodParameterAttribute : Attribute { } 1163 | } -------------------------------------------------------------------------------- /Sample/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | FileSystem 10 | Release 11 | Any CPU 12 | 13 | True 14 | False 15 | 8f5ea6b9-a262-4536-af82-6ffc9048ee98 16 | bin\Release\netcoreapp3.1\publish\ 17 | False 18 | 19 | -------------------------------------------------------------------------------- /Sample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:60357", 7 | "sslPort": 44341 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "Sample": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sample/Sample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sample/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @inherits LayoutComponentBase 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
16 | -------------------------------------------------------------------------------- /Sample/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 26 |
27 | 28 | @code { 29 | private bool collapseNavMenu = true; 30 | 31 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; 32 | 33 | private void ToggleNavMenu() 34 | { 35 | collapseNavMenu = !collapseNavMenu; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sample/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using BlazorAnimation; 6 | using Microsoft.AspNetCore.Builder; 7 | using Microsoft.AspNetCore.Components; 8 | using Microsoft.AspNetCore.Hosting; 9 | using Microsoft.AspNetCore.HttpsPolicy; 10 | using Microsoft.Extensions.Configuration; 11 | using Microsoft.Extensions.DependencyInjection; 12 | using Microsoft.Extensions.Hosting; 13 | using Sample.Data; 14 | 15 | namespace Sample { 16 | public class Startup { 17 | public Startup(IConfiguration configuration) { 18 | Configuration = configuration; 19 | } 20 | 21 | public IConfiguration Configuration { get; } 22 | 23 | // This method gets called by the runtime. Use this method to add services to the container. 24 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 25 | public void ConfigureServices(IServiceCollection services) { 26 | services.AddRazorPages(); 27 | services.AddServerSideBlazor(); 28 | services.AddSingleton(); 29 | services.Configure("fast", o => { 30 | o.Speed = Speed.Faster; 31 | o.Delay = Delay.None; 32 | }); 33 | } 34 | 35 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 36 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { 37 | if (env.IsDevelopment()) { 38 | app.UseDeveloperExceptionPage(); 39 | } 40 | else { 41 | app.UseExceptionHandler("/Error"); 42 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 43 | app.UseHsts(); 44 | } 45 | 46 | app.UseHttpsRedirection(); 47 | app.UseStaticFiles(); 48 | 49 | app.UseRouting(); 50 | 51 | app.UseEndpoints(endpoints => { 52 | endpoints.MapBlazorHub(); 53 | endpoints.MapFallbackToPage("/_Host"); 54 | }); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Sample/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.JSInterop 8 | @using Sample 9 | @using Sample.Shared 10 | @using BlazorAnimation; 11 | -------------------------------------------------------------------------------- /Sample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | icon name 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 9 | By P.J. Onori 10 | Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) 11 | 12 | 13 | 14 | 27 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 71 | 74 | 76 | 79 | 81 | 84 | 86 | 88 | 91 | 93 | 95 | 98 | 100 | 102 | 104 | 106 | 109 | 112 | 115 | 117 | 121 | 123 | 125 | 127 | 130 | 132 | 134 | 136 | 138 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 155 | 157 | 159 | 162 | 165 | 167 | 169 | 172 | 174 | 177 | 179 | 181 | 183 | 185 | 189 | 191 | 194 | 196 | 198 | 200 | 202 | 205 | 207 | 209 | 211 | 213 | 215 | 218 | 220 | 222 | 224 | 226 | 228 | 230 | 232 | 234 | 236 | 238 | 241 | 243 | 245 | 247 | 249 | 251 | 253 | 256 | 259 | 261 | 263 | 265 | 267 | 269 | 272 | 274 | 276 | 280 | 282 | 285 | 287 | 289 | 292 | 295 | 298 | 300 | 302 | 304 | 306 | 309 | 312 | 314 | 316 | 318 | 320 | 322 | 324 | 326 | 330 | 334 | 338 | 340 | 343 | 345 | 347 | 349 | 351 | 353 | 355 | 358 | 360 | 363 | 365 | 367 | 369 | 371 | 373 | 375 | 377 | 379 | 381 | 383 | 386 | 388 | 390 | 392 | 394 | 396 | 399 | 401 | 404 | 406 | 408 | 410 | 412 | 414 | 416 | 419 | 421 | 423 | 425 | 428 | 431 | 435 | 438 | 440 | 442 | 444 | 446 | 448 | 451 | 453 | 455 | 457 | 460 | 462 | 464 | 466 | 468 | 471 | 473 | 477 | 479 | 481 | 483 | 486 | 488 | 490 | 492 | 494 | 496 | 499 | 501 | 504 | 506 | 509 | 512 | 515 | 517 | 520 | 522 | 524 | 526 | 529 | 532 | 534 | 536 | 539 | 542 | 543 | 544 | -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/Sample/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /Sample/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | a, .btn-link { 8 | color: #0366d6; 9 | } 10 | 11 | .btn-primary { 12 | color: #fff; 13 | background-color: #1b6ec2; 14 | border-color: #1861ac; 15 | } 16 | 17 | app { 18 | position: relative; 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | 23 | .top-row { 24 | height: 3.5rem; 25 | display: flex; 26 | align-items: center; 27 | } 28 | 29 | .main { 30 | flex: 1; 31 | } 32 | 33 | .main .top-row { 34 | background-color: #f7f7f7; 35 | border-bottom: 1px solid #d6d5d5; 36 | justify-content: flex-end; 37 | } 38 | 39 | .main .top-row > a, .main .top-row .btn-link { 40 | white-space: nowrap; 41 | margin-left: 1.5rem; 42 | } 43 | 44 | .main .top-row a:first-child { 45 | overflow: hidden; 46 | text-overflow: ellipsis; 47 | } 48 | 49 | .sidebar { 50 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 51 | } 52 | 53 | .sidebar .top-row { 54 | background-color: rgba(0,0,0,0.4); 55 | } 56 | 57 | .sidebar .navbar-brand { 58 | font-size: 1.1rem; 59 | } 60 | 61 | .sidebar .oi { 62 | width: 2rem; 63 | font-size: 1.1rem; 64 | vertical-align: text-top; 65 | top: -2px; 66 | } 67 | 68 | .sidebar .nav-item { 69 | font-size: 0.9rem; 70 | padding-bottom: 0.5rem; 71 | } 72 | 73 | .sidebar .nav-item:first-of-type { 74 | padding-top: 1rem; 75 | } 76 | 77 | .sidebar .nav-item:last-of-type { 78 | padding-bottom: 1rem; 79 | } 80 | 81 | .sidebar .nav-item a { 82 | color: #d7d7d7; 83 | border-radius: 4px; 84 | height: 3rem; 85 | display: flex; 86 | align-items: center; 87 | line-height: 3rem; 88 | } 89 | 90 | .sidebar .nav-item a.active { 91 | background-color: rgba(255,255,255,0.25); 92 | color: white; 93 | } 94 | 95 | .sidebar .nav-item a:hover { 96 | background-color: rgba(255,255,255,0.1); 97 | color: white; 98 | } 99 | 100 | .content { 101 | padding-top: 1.1rem; 102 | } 103 | 104 | .navbar-toggler { 105 | background-color: rgba(255, 255, 255, 0.1); 106 | } 107 | 108 | .valid.modified:not([type=checkbox]) { 109 | outline: 1px solid #26b050; 110 | } 111 | 112 | .invalid { 113 | outline: 1px solid red; 114 | } 115 | 116 | .validation-message { 117 | color: red; 118 | } 119 | 120 | #blazor-error-ui { 121 | background: lightyellow; 122 | bottom: 0; 123 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 124 | display: none; 125 | left: 0; 126 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 127 | position: fixed; 128 | width: 100%; 129 | z-index: 1000; 130 | } 131 | 132 | #blazor-error-ui .dismiss { 133 | cursor: pointer; 134 | position: absolute; 135 | right: 0.75rem; 136 | top: 0.5rem; 137 | } 138 | 139 | @media (max-width: 767.98px) { 140 | .main .top-row:not(.auth) { 141 | display: none; 142 | } 143 | 144 | .main .top-row.auth { 145 | justify-content: space-between; 146 | } 147 | 148 | .main .top-row a, .main .top-row .btn-link { 149 | margin-left: 0; 150 | } 151 | } 152 | 153 | @media (min-width: 768px) { 154 | app { 155 | flex-direction: row; 156 | } 157 | 158 | .sidebar { 159 | width: 250px; 160 | height: 100vh; 161 | position: sticky; 162 | top: 0; 163 | } 164 | 165 | .main .top-row { 166 | position: sticky; 167 | top: 0; 168 | } 169 | 170 | .main > div { 171 | padding-left: 2rem !important; 172 | padding-right: 1.5rem !important; 173 | } 174 | 175 | .navbar-toggler { 176 | display: none; 177 | } 178 | 179 | .sidebar .collapse { 180 | /* Never collapse the sidebar for wide screens */ 181 | display: block; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /Sample/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/Sample/wwwroot/favicon.ico -------------------------------------------------------------------------------- /inputpassword1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/inputpassword1.gif -------------------------------------------------------------------------------- /inputpassword2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboudoux/BlazorAnimation/52db90c43b9db70bb0844ef289bf063943658ae3/inputpassword2.gif --------------------------------------------------------------------------------