Skip to content

Commit

Permalink
Adds loads of more utilities
Browse files Browse the repository at this point in the history
* AlignContent
* AlignItems
* AlignSelf
* FlexBasis
* JustifyContent
* JustifyItems
* JustifySelf
* PlaceContent
* PlaceItems
* PlaceSelf
* Overflow
* FontSmoothing
* LineHeight
* WordBreak
  • Loading branch information
phil-scott-78 committed Apr 10, 2022
1 parent 67292f5 commit 87d0220
Show file tree
Hide file tree
Showing 25 changed files with 614 additions and 152 deletions.
31 changes: 31 additions & 0 deletions src/MonorailCss/Plugins/Effects/Opacity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.Effects;

/// <summary>
/// The opacity plugin.
/// </summary>
public class Opacity : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "opacity";

protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>()
{
{ "opacity-0", "0" },
{ "opacity-5", "0.05" },
{ "opacity-10", "0.1" },
{ "opacity-20", "0.2" },
{ "opacity-25", "0.25" },
{ "opacity-30", "0.3" },
{ "opacity-40", "0.4" },
{ "opacity-50", "0.5" },
{ "opacity-60", "0.6" },
{ "opacity-70", "0.7" },
{ "opacity-75", "0.75" },
{ "opacity-80", "0.8" },
{ "opacity-90", "0.9" },
{ "opacity-95", "0.95" },
{ "opacity-100", "1" },
}.ToImmutableDictionary();
}
23 changes: 23 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/AlignContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The align-content plugin.
/// </summary>
public class AlignContent : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "align-content";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>
{
{ "content-center", "center" },
{ "content-start", "flex-start" },
{ "content-end", "flex-end" },
{ "content-between", "space-between" },
{ "content-around", "space-around" },
{ "content-evenly", "space-evenly" },
}.ToImmutableDictionary();
}
22 changes: 22 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/AlignItems.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The align-items plugin.
/// </summary>
public class AlignItems : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "align-items";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>
{
{ "items-start", "flex-start" },
{ "items-end", "flex-end" },
{ "items-center", "center" },
{ "items-baseline", "baseline" },
{ "items-stretch", "stretch" },
}.ToImmutableDictionary();
}
23 changes: 23 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/AlignSelf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The align-self plugin.
/// </summary>
public class AlignSelf : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "align-self";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>
{
{ "self-auto", "auto" },
{ "self-start", "flex-start" },
{ "self-end", "flex-end" },
{ "self-center", "center" },
{ "self-stretch", "stretch" },
{ "self-baseline", "baseline" },
}.ToImmutableDictionary();
}
65 changes: 1 addition & 64 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/Flex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,4 @@ public class Flex : BaseUtilityPlugin
{
{ "flex-1", "1 1 0;" }, { "flex-auto", "1 1 auto" }, { "flex-initial", "0 1 auto" }, { "flex-none", "none" },
}.ToImmutableDictionary();
}

/// <summary>
/// The flex-grow plugin.
/// </summary>
public class FlexGrow : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-grow";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>() { { "grow", "1" }, { "grow-0", "0" }, }.ToImmutableDictionary();
}

/// <summary>
/// The flex-shrink plugin.
/// </summary>
public class FlexShrink : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-shrink";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>() { { "shrink", "1" }, { "shrink-0", "0" }, }.ToImmutableDictionary();
}

/// <summary>
/// The flex-direction plugin.
/// </summary>
public class FlexDirection : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-direction";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>()
{
{ "flex-row", "row" },
{ "flex-row-reverse", "row-reverse" },
{ "flex-col", "column" },
{ "flex-col-reverse", "column-reverse" },
}.ToImmutableDictionary();
}

/// <summary>
/// The flex-shrink plugin.
/// </summary>
public class FlexWrap : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-wrap";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>()
{
{ "flex-wrap", "wrap" },
{ "flex-wrap-reverse", "wrap-reverse" },
{ "flex-nowrap", "nowrap" },
}.ToImmutableDictionary();
}
}
51 changes: 51 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/FlexBasis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The flex-basis plugin.
/// </summary>
public class FlexBasis : BaseUtilityNamespacePlugin
{
/// <summary>
/// Initializes a new instance of the <see cref="FlexBasis"/> class.
/// </summary>
/// <param name="designSystem">The design system</param>
public FlexBasis(DesignSystem designSystem)
{
Values = designSystem.Spacing.AddRange(SizeHelpers.Percentages).Add("auto", "auto");
}

/// <inheritdoc />
protected override CssNamespaceToPropertyMap NamespacePropertyMapList => new()
{
{ "basis", "flex-basis" },
};

/// <inheritdoc />
protected override CssSuffixToValueMap Values { get; }
}

/// <summary>
/// The gap plugin.
/// </summary>
public class Gap : BaseUtilityNamespacePlugin
{
/// <summary>
/// Initializes a new instance of the <see cref="Gap"/> class.
/// </summary>
/// <param name="designSystem">The design system.</param>
public Gap(DesignSystem designSystem)
{
Values = designSystem.Spacing;
}

/// <inheritdoc />
protected override CssNamespaceToPropertyMap NamespacePropertyMapList => new()
{
{ "gap", "gap" },
{ "gap-x", "column-gap" },
{ "gap-y", "row-gap" },
};

/// <inheritdoc />
protected override CssSuffixToValueMap Values { get; }
}
22 changes: 22 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/FlexDirection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The flex-direction plugin.
/// </summary>
public class FlexDirection : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-direction";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>()
{
{ "flex-row", "row" },
{ "flex-row-reverse", "row-reverse" },
{ "flex-col", "column" },
{ "flex-col-reverse", "column-reverse" },
}.ToImmutableDictionary();
}
16 changes: 16 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/FlexGrow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The flex-grow plugin.
/// </summary>
public class FlexGrow : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-grow";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>() { { "grow", "1" }, { "grow-0", "0" }, }.ToImmutableDictionary();
}
16 changes: 16 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/FlexShrink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The flex-shrink plugin.
/// </summary>
public class FlexShrink : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-shrink";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>() { { "shrink", "1" }, { "shrink-0", "0" }, }.ToImmutableDictionary();
}
21 changes: 21 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/FlexWrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The flex-shrink plugin.
/// </summary>
public class FlexWrap : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "flex-wrap";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities =>
new Dictionary<string, string>()
{
{ "flex-wrap", "wrap" },
{ "flex-wrap-reverse", "wrap-reverse" },
{ "flex-nowrap", "nowrap" },
}.ToImmutableDictionary();
}
23 changes: 23 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/JustifyContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The justify-content plugin.
/// </summary>
public class JustifyContent : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "justify-content";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>()
{
{ "justify-start", "flex-start" },
{ "justify-end", "flex-end" },
{ "justify-center", "center" },
{ "justify-between", "space-between" },
{ "justify-around", "space-around" },
{ "justify-evenly", "space-evenly" },
}.ToImmutableDictionary();
}
21 changes: 21 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/JustifyItems.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The justify-items plugin.
/// </summary>
public class JustifyItems : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "justify-items";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>()
{
{ "justify-items-start", "start" },
{ "justify-items-end", "end" },
{ "justify-items-center", "center" },
{ "justify-items-stretch", "stretch" },
}.ToImmutableDictionary();
}
22 changes: 22 additions & 0 deletions src/MonorailCss/Plugins/FlexBoxAndGrid/JustifySelf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Immutable;

namespace MonorailCss.Plugins.FlexBoxAndGrid;

/// <summary>
/// The justify-self plugin.
/// </summary>
public class JustifySelf : BaseUtilityPlugin
{
/// <inheritdoc />
protected override string Property => "justify-self";

/// <inheritdoc />
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>()
{
{ "justify-self-auto", "auto" },
{ "justify-self-start", "start" },
{ "justify-self-end", "end" },
{ "justify-self-center", "center" },
{ "justify-self-stretch", "stretch" },
}.ToImmutableDictionary();
}

0 comments on commit 87d0220

Please sign in to comment.