Skip to content

Commit

Permalink
feats: add style components (#8)
Browse files Browse the repository at this point in the history
### Feats
1. add styleoutlet component
2. add stylecontent component
3. style support cache with hash token

### Fix
1. fix number value to px error
  • Loading branch information
yoli799480165 authored Dec 2, 2023
1 parent aac4127 commit 752dd84
Show file tree
Hide file tree
Showing 60 changed files with 2,575 additions and 2,385 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,11 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Package Nightly Nuget 📦
run: |
npm i
SUFFIX=`date "+%y%m%d%H%M%S"`
dotnet build src/CssInCs.csproj
dotnet pack src/CssInCs.csproj /p:PackageVersion=$Version-nightly-${SUFFIX} -c Release -o publish
dotnet build src/CssInCSharp.csproj
dotnet pack src/CssInCSharp.csproj /p:PackageVersion=$Version-nightly-${SUFFIX} -c Release -o publish
- name: Publish to Nuget ✔
run: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Check Building ⚙
run: |
npm i
dotnet build
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,10 @@ jobs:
with:
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Package and publish to Nuget📦
run: |
VERSION=`git describe --tags`
echo "Publishing Version: ${VERSION}"
npm install
dotnet build src/CssInCs.csproj
rm -rf ./node_modules
dotnet pack src/CssInCs.csproj /p:PackageVersion=$VERSION -c Release -o publish
dotnet build src/CssInCSharp.csproj
dotnet pack src/CssInCSharp.csproj /p:PackageVersion=$VERSION -c Release -o publish
dotnet nuget push publish/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY --skip-duplicate
35 changes: 14 additions & 21 deletions cssincs.sln → CssInCSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.Basic", "examples\Examples.Basic\Examples.Basic.csproj", "{65C2053A-EAC7-4254-AE1A-88C1317993EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCs", "src\CssInCs.csproj", "{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCSharp", "src\CssInCSharp.csproj", "{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCs.Tests", "test\CssInCs.Tests\CssInCs.Tests.csproj", "{38A62961-5BA8-4519-A7E0-380793415492}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCs.Benchmarks", "benchmark\CssInCs.Benchmarks\CssInCs.Benchmarks.csproj", "{5CCEF00A-9CBD-41FD-A026-F008CA6899AF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.Component", "examples\Examples.Component\Examples.Component.csproj", "{25DAE86F-F572-49C7-B989-834489F4B018}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCsLab", "examples\CssInCsLab\CssInCsLab.csproj", "{7833C610-C469-4E12-9D81-E510515D3281}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCSharp.Tests", "test\CssInCSharp.Tests\CssInCSharp.Tests.csproj", "{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.Component", "examples\Examples.Component\Examples.Component.csproj", "{25DAE86F-F572-49C7-B989-834489F4B018}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CssInCSharp.Benchmarks", "benchmark\CssInCSharp.Benchmarks\CssInCSharp.Benchmarks.csproj", "{D962B903-9225-4A8A-BA59-6E5B4AEC3F08}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -37,33 +35,28 @@ Global
{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83}.Release|Any CPU.Build.0 = Release|Any CPU
{38A62961-5BA8-4519-A7E0-380793415492}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38A62961-5BA8-4519-A7E0-380793415492}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38A62961-5BA8-4519-A7E0-380793415492}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38A62961-5BA8-4519-A7E0-380793415492}.Release|Any CPU.Build.0 = Release|Any CPU
{5CCEF00A-9CBD-41FD-A026-F008CA6899AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CCEF00A-9CBD-41FD-A026-F008CA6899AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CCEF00A-9CBD-41FD-A026-F008CA6899AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CCEF00A-9CBD-41FD-A026-F008CA6899AF}.Release|Any CPU.Build.0 = Release|Any CPU
{7833C610-C469-4E12-9D81-E510515D3281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7833C610-C469-4E12-9D81-E510515D3281}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7833C610-C469-4E12-9D81-E510515D3281}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7833C610-C469-4E12-9D81-E510515D3281}.Release|Any CPU.Build.0 = Release|Any CPU
{25DAE86F-F572-49C7-B989-834489F4B018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25DAE86F-F572-49C7-B989-834489F4B018}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25DAE86F-F572-49C7-B989-834489F4B018}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25DAE86F-F572-49C7-B989-834489F4B018}.Release|Any CPU.Build.0 = Release|Any CPU
{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13}.Release|Any CPU.Build.0 = Release|Any CPU
{D962B903-9225-4A8A-BA59-6E5B4AEC3F08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D962B903-9225-4A8A-BA59-6E5B4AEC3F08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D962B903-9225-4A8A-BA59-6E5B4AEC3F08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D962B903-9225-4A8A-BA59-6E5B4AEC3F08}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{65C2053A-EAC7-4254-AE1A-88C1317993EC} = {88F10CF7-CAB8-4BCC-9989-4FF19AEDF449}
{451A68DF-7C2C-455E-B4D7-F2AA41C2FB83} = {36562B76-DD8A-44AB-8929-E1952999FF22}
{38A62961-5BA8-4519-A7E0-380793415492} = {285BBCAE-8461-4150-A830-F7F06388A0B9}
{5CCEF00A-9CBD-41FD-A026-F008CA6899AF} = {98DC1D7D-187D-4CC2-88E0-386E4E3C69BF}
{7833C610-C469-4E12-9D81-E510515D3281} = {88F10CF7-CAB8-4BCC-9989-4FF19AEDF449}
{25DAE86F-F572-49C7-B989-834489F4B018} = {88F10CF7-CAB8-4BCC-9989-4FF19AEDF449}
{3A5C3FD4-3D1D-4CC7-B01E-AABB60B2FF13} = {285BBCAE-8461-4150-A830-F7F06388A0B9}
{D962B903-9225-4A8A-BA59-6E5B4AEC3F08} = {98DC1D7D-187D-4CC2-88E0-386E4E3C69BF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {03E4F30D-3A2E-4026-A665-8631C0C1188A}
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CssInCs
# CssInCSharp

A lib for generating Style Sheets with C#.

Expand All @@ -16,9 +16,9 @@ dotnet add package CssInCSharp
<button class="button">Click</button>
</div>

<Style Id="basic-css">
<style>
@_css
</Style>
</style>

@code
{
Expand All @@ -28,22 +28,22 @@ dotnet add package CssInCSharp
{
_css = new CSSObject
{
[".basic"] = new()
[".basic"] = new CSSObject
{
Width = "300px",
Height = "300px",
Border = "1px solid #DDD",
["& .title"] = new()
["& .title"] = new CSSObject
{
LineHeight = "20px",
Color = "red"
},
["& .button"] = new()
["& .button"] = new CSSObject
{
Width = "100%",
Height = "20px",
TextAlign = "center",
["&:hover"] = new()
["&:hover"] = new CSSObject
{
Color = "blue"
}
Expand All @@ -57,7 +57,7 @@ dotnet add package CssInCSharp
For other examples, you can check out the example code.

## Css Compiler
The cssincs is similar to less or sass. You can simply convert you style file into C# class, so that you can make full use of the C# language features to generate style content.
The CssInCSharp is similar to less or sass. You can simply convert you style file into C# class, so that you can make full use of the C# language features to generate style content.

## Benchmark
``` ini
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using static CssInCs.Styles;
using static CssInCSharp.Styles;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\CssInCs.csproj" />
<ProjectReference Include="..\..\src\CssInCSharp.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
Loading

0 comments on commit 752dd84

Please sign in to comment.