<Project Sdk="Microsoft.NET.Sdk.Razor">
  <PropertyGroup>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
    <NoWarn>BL9993;BL0007;BL0005</NoWarn>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <IsTrimmable>true</IsTrimmable>
    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
    <TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
    <RazorLangVersion>7.0</RazorLangVersion>
    <LangVersion>latest</LangVersion>
    <OutputType>Library</OutputType>
    <IsPackable>true</IsPackable>
    <PackageId>Radzen.Blazor</PackageId>
    <Product>Radzen.Blazor</Product>
    <Version>11.0.4</Version>
    <Copyright>Radzen Ltd.</Copyright>
    <Authors>Radzen Ltd.</Authors>
    <Description>Radzen Blazor is the most sophisticated free UI component library for Blazor, featuring 110+ native components including DataGrid, Scheduler, Charts, and advanced theming with full support for Material Design and Fluent UI.</Description>
    <PackageTags>blazor material design fluent fluentui components datagrid scheduler charts</PackageTags>
    <PackageReadmeFile>README.md</PackageReadmeFile>
    <PackageProjectUrl>https://www.radzen.com</PackageProjectUrl>
    <PackageIcon>icon.png</PackageIcon>
    <PackageLicenseExpression>MIT</PackageLicenseExpression>
    <Title>Radzen Components for Blazor</Title>
    <RepositoryUrl>https://github.com/radzenhq/radzen-blazor</RepositoryUrl>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
  </PropertyGroup>

  <!--
    NuGet symbol packages (.snupkg) require portable PDB files.
    Directory.Build.props in this repo uses DebugType=embedded by default, which produces no .pdb files and results
    in an effectively empty .snupkg. Force portable PDBs for Release/packing.
  -->
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <DebugType>portable</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components" Condition="'$(TargetFramework)' == 'net8.0'" Version="8.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Condition="'$(TargetFramework)' == 'net8.0'" Version="8.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components" Condition="'$(TargetFramework)' == 'net9.0'" Version="9.*-*" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Condition="'$(TargetFramework)' == 'net9.0'" Version="9.*-*" />
    <PackageReference Include="Microsoft.AspNetCore.Components" Condition="'$(TargetFramework)' == 'net10.0'" Version="10.*-*" />
    <PackageReference Include="Microsoft.AspNetCore.Components.Web" Condition="'$(TargetFramework)' == 'net10.0'" Version="10.*-*" />
  </ItemGroup>

  <ItemGroup>
    <None Include="LICENSE.txt" Pack="true" PackagePath="" />
    <None Include="icon.png" Pack="true" PackagePath="" />
    <None Include="..\README.md" Pack="true" PackagePath="\" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="LinkerConfig.xml">
      <LogicalName>$(MSBuildProjectName).xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Documents/Spreadsheet/theme1.xml" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Radzen.MSBuild" Version="0.0.6" PrivateAssets="All" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
    <SassFile Include="$(MSBuildProjectDirectory)/themes/**/*.scss" />
    <Content Remove="wwwroot/Radzen.Blazor.min.js" />
    <Content Remove="wwwroot/css/**/*.css" />
  </ItemGroup>

  <Target Name="CompileSass" BeforeTargets="MoveCss" Condition="'$(TargetFramework)' == 'net10.0'"
          Inputs="@(SassFile)" Outputs="$(IntermediateOutputPath)sass.stamp">
    <!-- The target runs before the compiler creates the intermediate dir, so the Touch below fails on a clean build. -->
    <MakeDir Directories="$(IntermediateOutputPath)" />
    <SassCompile InputFiles="@(SassFile)" OutputStyle="compressed" />
    <Touch Files="$(IntermediateOutputPath)sass.stamp" AlwaysCreate="true" />
  </Target>

  <Target Name="MoveCss" BeforeTargets="BeforeBuild" Condition="'$(TargetFramework)' == 'net10.0'">
    <ItemGroup>
        <CssFile Include="$(MSBuildProjectDirectory)/themes/*.css" />
    </ItemGroup>
    <Move SourceFiles="@(CssFile)" DestinationFolder="$(MSBuildProjectDirectory)/wwwroot/css/" />
    <ItemGroup>
        <Content Include="wwwroot/css/**/*.css" />
    </ItemGroup>
  </Target>

  <Target Name="MinifyJs" AfterTargets="BeforeBuild" Condition="'$(TargetFramework)' == 'net10.0'">
    <TerserMinify InputFile="wwwroot\Radzen.Blazor.js" OutputFile="wwwroot\Radzen.Blazor.min.js" />
    <ItemGroup>
        <Content Include="wwwroot/Radzen.Blazor.min.js" />
    </ItemGroup>
  </Target>

  <ItemGroup>
    <EmbeddedResource Update="RadzenStrings.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>RadzenStrings.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <Compile Update="RadzenStrings.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>RadzenStrings.resx</DependentUpon>
    </Compile>
  </ItemGroup>

  <ItemGroup Label="Allow internal method to be visible to the unit tests">
    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
      <_Parameter1>Radzen.Blazor.Tests</_Parameter1>
    </AssemblyAttribute>
    <AssemblyAttribute Include="System.Resources.NeutralResourcesLanguageAttribute">
      <_Parameter1>en</_Parameter1>
    </AssemblyAttribute>
  </ItemGroup>

</Project>
