├── .gitattributes ├── .github ├── actions │ └── dotnet │ │ ├── build │ │ └── action.yml │ │ ├── nuget │ │ └── action.yml │ │ ├── pack │ │ └── action.yml │ │ ├── test │ │ └── action.yml │ │ └── version │ │ └── action.yml └── workflows │ ├── build.yml │ ├── cd.yml │ ├── ci.yml │ └── publish.yml ├── .gitignore ├── ExCSS.sln ├── GitVersion.yml ├── license.txt ├── readme.md └── src ├── ExCSS.Tests ├── AttrSelectorTests.cs ├── Cases.cs ├── ClassSelectorTests.cs ├── Color.cs ├── ConstructionFunctions.cs ├── Container.cs ├── Debug.cs ├── DocumentFunction.cs ├── ExCSS.Tests.csproj ├── ExCSS.Tests.snk ├── Flexbox.cs ├── FontFace.cs ├── FontProperty.cs ├── Gradient.cs ├── ImportRule.cs ├── KeyframeRule.cs ├── ListProperty.cs ├── MediaFeatures.cs ├── MediaList.cs ├── ObjectArrayComparer.cs ├── ObjectSizing.cs ├── Properties │ └── AssemblyInfo.cs ├── Property.cs ├── PropertyTests │ ├── AnimationPropertyTests.cs │ ├── BackgroundProperty.cs │ ├── BorderImageProperty.cs │ ├── BorderProperty.cs │ ├── BorderRadiusProperty.cs │ ├── BoxSizingPropertyTests.cs │ ├── ColumnsProperty.cs │ ├── ContentProperty.cs │ ├── CoordinateProperty.cs │ ├── FillProperty.cs │ ├── FlexPropertyTests.cs │ ├── GapProperty.cs │ ├── MarginProperty.cs │ ├── OpacityPropertyTests.cs │ ├── OutlineProperty.cs │ ├── PaddingProperty.cs │ ├── RowGapProperty.cs │ ├── StrokeProperty.cs │ ├── TextProperty.cs │ ├── TransformProperty.cs │ └── TransitionProperty.cs ├── RealWorld.cs ├── SelectorsTests.cs ├── Sheet.cs ├── Supports.cs ├── TestExtensions.cs ├── Tokenization.cs └── bootstrap.css └── ExCSS ├── Conditions ├── AndCondition.cs ├── DeclarationCondition.cs ├── EmptyCondition.cs ├── GroupCondition.cs ├── NotCondition.cs └── OrCondition.cs ├── Directory.Build.targets ├── Enumerations ├── AlignContent.cs ├── AlignItem.cs ├── AnimationDirection.cs ├── AnimationFillStyle.cs ├── BackgroundAttachment.cs ├── BackgroundRepeat.cs ├── BlendMode.cs ├── BorderRepeat.cs ├── BoxModel.cs ├── BreakMode.cs ├── ClearMode.cs ├── Colors.cs ├── Combinators.cs ├── ContainerType.cs ├── DirectionMode.cs ├── DisplayMode.cs ├── FeatureNames.cs ├── FillRule.cs ├── FlexDirection.cs ├── FlexWrap.cs ├── Floating.cs ├── FontSize.cs ├── FontStretch.cs ├── FontStyle.cs ├── FontVariant.cs ├── FontWeight.cs ├── FunctionNames.cs ├── HorizontalAlignment.cs ├── HoverAbility.cs ├── IntrinsicSizing.cs ├── JustifyContent.cs ├── Keywords.cs ├── LineStyle.cs ├── ListPosition.cs ├── ListStyle.cs ├── ObjectFitting.cs ├── Overflow.cs ├── OverflowWrap.cs ├── ParseError.cs ├── PlayState.cs ├── PointerAccuracy.cs ├── PositionMode.cs ├── PropertyFlags.cs ├── PropertyNames.cs ├── PseudoClassNames.cs ├── PseudoElementNames.cs ├── QuirksMode.cs ├── RuleNames.cs ├── RuleType.cs ├── ScriptingState.cs ├── StrokeLinecap.cs ├── StrokeLinejoin.cs ├── SystemCursor.cs ├── SystemFont.cs ├── TextAlignLast.cs ├── TextAnchor.cs ├── TextDecorationLine.cs ├── TextDecorationStyle.cs ├── TextJustify.cs ├── TextTransform.cs ├── TokenType.cs ├── UnicodeMode.cs ├── UnitNames.cs ├── UpdateFrequency.cs ├── VerticalAlignment.cs ├── Visibility.cs ├── Whitespace.cs └── WordBreak.cs ├── ExCSS.csproj ├── ExCSS.snk ├── Extensions ├── CharExtensions.cs ├── CollectionExtensions.cs ├── FormatExtensions.cs ├── PortableExtensions.cs ├── StringExtensions.cs ├── ValueConverterExtensions.cs └── ValueExtensions.cs ├── Factories ├── AttributeSelectorFactory.cs ├── MediaFeatureFactory.cs ├── PropertyFactory.cs ├── PseudoClassSelectorFactory.cs └── PseudoElementSelectorFactory.cs ├── Formatting └── CompressedStyleFormatter.cs ├── Functions ├── DocumentFunction.cs ├── DomainFunction.cs ├── IConditionFunction.cs ├── IDocumentFunction.cs ├── RegexpFunction.cs ├── UrlFunction.cs └── UrlPrefixFunction.cs ├── MediaFeatures ├── AspectRatioMediaFeature.cs ├── ColorIndexMediaFeature.cs ├── ColorMediaFeature.cs ├── DeviceAspectRatioMediaFeature.cs ├── DeviceHeightMediaFeature.cs ├── DevicePixelRatioFeature.cs ├── DeviceWidthMediaFeature.cs ├── GridMediaFeature.cs ├── HeightMediaFeature.cs ├── HoverMediaFeature.cs ├── MediaFeature.cs ├── MonochromeMediaFeature.cs ├── OrientationMediaFeature.cs ├── PointerMediaFeature.cs ├── ResolutionMediaFeature.cs ├── ScanMediaFeature.cs ├── ScriptingMediaFeature.cs ├── SizeMediaFeature.cs ├── UnknownMediaFeature.cs ├── UpdateFrequencyMediaFeature.cs └── WidthMediaFeature.cs ├── Model ├── Combinator.cs ├── Comment.cs ├── Converters.cs ├── IMediaFeature.cs ├── ISelector.cs ├── IStyleFormattable.cs ├── IStyleFormatter.cs ├── IStylesheetNode.cs ├── IValueConverter.cs ├── Map.cs ├── MediaList.cs ├── Medium.cs ├── ParseException.cs ├── ParserExtensions.cs ├── ParserOptions.cs ├── Pool.cs ├── Priority.cs ├── StyleDeclaration.cs ├── Stylesheet.cs ├── StylesheetNode.cs ├── StylesheetText.cs ├── Symbols.cs ├── TaskEx.cs ├── TextPosition.cs ├── TextRange.cs ├── TextSource.cs ├── TokenValue.cs ├── TransformMatrix.cs ├── Url.cs └── ValueBuilder.cs ├── Parser ├── Lexer.cs ├── LexerBase.cs ├── SelectorConstructor.cs ├── StylesheetComposer.cs ├── StylesheetParser.cs └── TokenizerError.cs ├── Properties └── AssemblyInfo.cs ├── Rules ├── CharsetRule.cs ├── ConditionRule.cs ├── ContainerRule.cs ├── DeclarationRule.cs ├── DocumentRule.cs ├── FontFaceRule.cs ├── GroupingRule.cs ├── ICharsetRule.cs ├── IConditionRule.cs ├── IContainer.cs ├── IFontFaceRule.cs ├── IGroupingRule.cs ├── IImportRule.cs ├── IKeyframeRule.cs ├── IKeyframesRule.cs ├── IMarginRule.cs ├── IMediaRule.cs ├── INamespaceRule.cs ├── IPageRule.cs ├── IRule.cs ├── IRuleCreator.cs ├── IRuleList.cs ├── IStyleRule.cs ├── ISupportsRule.cs ├── ImportRule.cs ├── KeyframeRule.cs ├── KeyframesRule.cs ├── MarginStyleRule.cs ├── MediaRule.cs ├── NamespaceRule.cs ├── PageRule.cs ├── Rule.cs ├── RuleList.cs ├── StyleRule.cs ├── SupportsRule.cs ├── UnknownRule.cs └── ViewportRule.cs ├── Selectors ├── AllSelector.cs ├── AttrAvailableSelector.cs ├── AttrBeginsSelector.cs ├── AttrContainsSelector.cs ├── AttrEndsSelector.cs ├── AttrHyphenSelector.cs ├── AttrListSelector.cs ├── AttrMatchSelector.cs ├── AttrNotMatchSelector.cs ├── AttrSelectorBase.cs ├── ChildSelector.cs ├── ClassSelector.cs ├── CombinatorSelector.cs ├── ComplexSelector.cs ├── CompoundSelector.cs ├── FirstChildSelector.cs ├── FirstColumnSelector.cs ├── FirstTypeSelector.cs ├── IAttrSelector.cs ├── IdSelector.cs ├── KeyframeSelector.cs ├── LastChildSelector.cs ├── LastColumnSelector.cs ├── LastTypeSelector.cs ├── ListSelector.cs ├── NamespaceSelector.cs ├── PseudoClassSelector.cs ├── PseudoElementSelector.cs ├── SelectorBase.cs ├── Selectors.cs ├── TypeSelector.cs └── UnknownSelector.cs ├── StyleProperties ├── Animation │ ├── AnimationDelayProperty.cs │ ├── AnimationDirectionProperty.cs │ ├── AnimationDurationProperty.cs │ ├── AnimationFillModeProperty.cs │ ├── AnimationIterationCountProperty.cs │ ├── AnimationNameProperty.cs │ ├── AnimationPlayStateProperty.cs │ ├── AnimationProperty.cs │ └── AnimationTimingFunctionProperty.cs ├── Background │ ├── BackgroundAttachmentProperty.cs │ ├── BackgroundClipProperty.cs │ ├── BackgroundColorProperty.cs │ ├── BackgroundImageProperty.cs │ ├── BackgroundOriginProperty.cs │ ├── BackgroundPositionProperty.cs │ ├── BackgroundProperty.cs │ ├── BackgroundRepeatProperty.cs │ └── BackgroundSizeProperty.cs ├── Border │ ├── BorderBottomColorProperty.cs │ ├── BorderBottomProperty.cs │ ├── BorderBottomStyleProperty.cs │ ├── BorderBottomWidthProperty.cs │ ├── BorderCollapseProperty.cs │ ├── BorderColorProperty.cs │ ├── BorderLeftColorProperty.cs │ ├── BorderLeftProperty.cs │ ├── BorderLeftStyleProperty.cs │ ├── BorderLeftWidthProperty.cs │ ├── BorderProperty.cs │ ├── BorderRightColorProperty.cs │ ├── BorderRightProperty.cs │ ├── BorderRightStyleProperty.cs │ ├── BorderRightWidthProperty.cs │ ├── BorderSpacingProperty.cs │ ├── BorderStyleProperty.cs │ ├── BorderTopColorProperty.cs │ ├── BorderTopProperty.cs │ ├── BorderTopStyleProperty.cs │ ├── BorderTopWidthProperty.cs │ └── BorderWidthProperty.cs ├── BorderImage │ ├── BorderImageOutsetProperty.cs │ ├── BorderImageProperty.cs │ ├── BorderImageRepeatProperty.cs │ ├── BorderImageSliceProperty.cs │ ├── BorderImageSourceProperty.cs │ └── BorderImageWidthProperty.cs ├── BorderRadius │ ├── BorderBottomLeftRadiusProperty.cs │ ├── BorderBottomRightRadiusProperty.cs │ ├── BorderRadiusProperty.cs │ ├── BorderTopLeftRadiusProperty.cs │ └── BorderTopRightRadiusProperty.cs ├── Box │ ├── BoxDecorationBreak.cs │ ├── BoxShadowProperty.cs │ ├── BoxSizingProperty.cs │ ├── MarginBottomProperty.cs │ ├── MarginLeftProperty.cs │ ├── MarginProperty.cs │ ├── MarginRightProperty.cs │ ├── MarginTopProperty.cs │ ├── PaddingBottomProperty.cs │ ├── PaddingLeftProperty.cs │ ├── PaddingProperty.cs │ ├── PaddingRightProperty .cs │ └── PaddingTopProperty.cs ├── Break │ ├── BreakAfterProperty.cs │ ├── BreakBeforeProperty.cs │ ├── BreakInsideProperty.cs │ ├── PageBreakAfterProperty.cs │ ├── PageBreakBeforeProperty.cs │ └── PageBreakInsideProperty.cs ├── CaptionSideProperty.cs ├── Columns │ ├── ColumnCountProperty.cs │ ├── ColumnFillProperty.cs │ ├── ColumnGapProperty.cs │ ├── ColumnRuleColorProperty.cs │ ├── ColumnRuleProperty.cs │ ├── ColumnRuleStyleProperty.cs │ ├── ColumnRuleWidthProperty.cs │ ├── ColumnSpanProperty.cs │ ├── ColumnWidthProperty.cs │ └── ColumnsProperty.cs ├── Container │ ├── ContainerNameProperty.cs │ └── ContainerTypeProperty.cs ├── ContentProperty.cs ├── Coordinate │ ├── BottomProperty.cs │ ├── HeightProperty.cs │ ├── LeftProperty.cs │ ├── MaxHeightProperty.cs │ ├── MaxWidthProperty.cs │ ├── MinHeightProperty.cs │ ├── MinWidthProperty.cs │ ├── RightProperty .cs │ ├── TopProperty.cs │ └── WidthProperty.cs ├── CursorProperty.cs ├── EmptyCellsProperty.cs ├── FeatureProperty.cs ├── Fill │ ├── FillOpacityProperty.cs │ ├── FillProperty.cs │ └── FillRuleProperty.cs ├── Flexbox │ ├── AlignContentProperty.cs │ ├── AlignItemsProperty.cs │ ├── AlignSelfProperty.cs │ ├── FlexBasisProperty.cs │ ├── FlexDirectionProperty.cs │ ├── FlexFlowProperty.cs │ ├── FlexGrowProperty.cs │ ├── FlexProperty.cs │ ├── FlexShrinkProperty.cs │ ├── FlexWrapProperty.cs │ ├── JustifyContentProperty.cs │ └── OrderProperty.cs ├── Flow │ ├── ClearProperty.cs │ ├── DisplayProperty.cs │ ├── FloatProperty.cs │ ├── OverflowProperty.cs │ ├── PositionProperty.cs │ └── ZIndexProperty.cs ├── Font │ ├── ColorProperty.cs │ ├── FontFamilyProperty.cs │ ├── FontProperty.cs │ ├── FontSizeAdjustProperty.cs │ ├── FontSizeProperty.cs │ ├── FontStretchProperty.cs │ ├── FontStyleProperty.cs │ ├── FontVariantProperty.cs │ ├── FontWeightProperty.cs │ ├── LetterSpacingProperty.cs │ ├── LineHeightProperty.cs │ ├── SrcProperty.cs │ ├── UnicodeRangeProperty.cs │ └── WordSpacingProperty.cs ├── GapProperty.cs ├── IProperties .cs ├── IProperty.cs ├── IPropertyValue.cs ├── List │ ├── CounterIncrementProperty.cs │ ├── CounterResetProperty.cs │ ├── ListStyleImageProperty.cs │ ├── ListStylePositionProperty.cs │ ├── ListStyleProperty.cs │ └── ListStyleTypeProperty.cs ├── OrphansProperty.cs ├── Outline │ ├── OutlineColorProperty.cs │ ├── OutlineProperty.cs │ ├── OutlineStyleProperty.cs │ └── OutlineWidthProperty.cs ├── Property.cs ├── QuotesProperty.cs ├── RowGapProperty.cs ├── ShorthandProperty.cs ├── Sizing │ ├── ObjectFitProperty.cs │ └── ObjectPositionProperty.cs ├── Stroke │ ├── StrokeDasharrayProperty.cs │ ├── StrokeDashoffsetProperty.cs │ ├── StrokeLinecapProperty.cs │ ├── StrokeLinejoinProperty.cs │ ├── StrokeMiterlimitProperty.cs │ ├── StrokeOpacityProperty.cs │ ├── StrokeProperty.cs │ └── StrokeWidthProperty.cs ├── TableLayoutProperty.cs ├── Text │ ├── DirectionProperty.cs │ ├── OverflowWrapProperty.cs │ ├── TextAlignLastProperty.cs │ ├── TextAlignProperty.cs │ ├── TextAnchorProperty.cs │ ├── TextDecorationColorProperty.cs │ ├── TextDecorationLineProperty.cs │ ├── TextDecorationProperty.cs │ ├── TextDecorationStyleProperty.cs │ ├── TextIndentProperty.cs │ ├── TextJustifyProperty.cs │ ├── TextShadowProperty.cs │ ├── TextTransformProperty.cs │ ├── VerticalAlignProperty.cs │ ├── WhiteSpaceProperty.cs │ └── WordBreakProperty.cs ├── Transform │ ├── PerspectiveOriginProperty.cs │ ├── PerspectiveProperty.cs │ ├── TransformOriginProperty.cs │ ├── TransformProperty.cs │ └── TransformStyleProperty.cs ├── Transition │ ├── TransitionDelayProperty.cs │ ├── TransitionDurationProperty.cs │ ├── TransitionProperty.cs │ ├── TransitionPropertyProperty.cs │ └── TransitionTimingFunctionProperty.cs ├── UnicodeBidirectionalProperty.cs ├── UnknownProperty.cs ├── Visibility │ ├── BackfaceVisibilityProperty.cs │ ├── ClipProperty.cs │ ├── OpacityProperty.cs │ └── VisibilityProperty.cs └── WidowsProperty.cs ├── TextEncoding.cs ├── Tokens ├── ColorToken.cs ├── CommentToken.cs ├── FunctionToken.cs ├── KeywordToken.cs ├── NumberToken.cs ├── RangeToken.cs ├── StringToken.cs ├── Token.cs ├── UnitToken.cs └── UrlToken.cs ├── ValueConverters ├── AnyValueConverter.cs ├── ArgumentsValueConverter.cs ├── BorderRadiusConverter.cs ├── ConditionalStartsWithValueConverter.cs ├── ConstraintValueConverter.cs ├── ContinuousValueConverter.cs ├── DictionaryValueConverter.cs ├── EndListValueConverter.cs ├── FallbackValueConverter.cs ├── FunctionValueConverter.cs ├── GradientConverter.cs ├── IdentifierValueConverter.cs ├── ListValueConverter.cs ├── OneOrMoreValueConverter.cs ├── OptionValueConverter.cs ├── OrValueConverter.cs ├── OrderedOptionsConverter.cs ├── PeriodicValueConverter.cs ├── RequiredValueConverter.cs ├── StartsWithValueConverter.cs ├── StringValueConverter.cs ├── StringsValueConverter.cs ├── StructValueConverter.cs ├── UnorderedOptionsConverter.cs └── UrlValueConverter.cs └── Values ├── Angle.cs ├── Color.cs ├── Counter.cs ├── CubicBezierTimingFunction.cs ├── Frequency.cs ├── GradientStop.cs ├── IGradient.cs ├── IImageSource.cs ├── ITimingFunction.cs ├── ITransform.cs ├── Length.cs ├── LinearGradient.cs ├── MatrixTransform.cs ├── Number.cs ├── Percent.cs ├── PerspectiveTransform.cs ├── Point.cs ├── PortNumbers.cs ├── ProtocolNames.cs ├── RadialGradient.cs ├── Resolution.cs ├── RotateTransform.cs ├── ScaleTransform.cs ├── Shadow.cs ├── Shape.cs ├── SkewTransform.cs ├── StepsTimingFunction.cs ├── Time.cs └── TranslateTransform.cs /.github/actions/dotnet/build/action.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | description: 'Restore and build the dotnet solution' 3 | 4 | inputs: 5 | dotnet-build-configuration: 6 | default: Release 7 | description: 'Defines the build configuration. The default for most projects is Release.' 8 | required: true 9 | 10 | runs: 11 | using: "composite" 12 | steps: 13 | - name: Restore dependencies 14 | shell: bash 15 | run: dotnet restore 16 | 17 | - name: Build solutions 18 | shell: bash 19 | run: dotnet build --no-restore --configuration ${{ inputs.dotnet-build-configuration }} -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: continuous-integration 2 | run-name: Build pipeline after ${{github.event_name}} by @${{ github.actor }} 3 | 4 | on: 5 | workflow_dispatch: 6 | 7 | push: 8 | branches: 9 | - master 10 | - feature/** 11 | - bugfix/** 12 | 13 | pull_request: 14 | branches: 15 | - feature/** 16 | - bugfix/** 17 | 18 | jobs: 19 | continuous-integration: 20 | uses: ./.github/workflows/build.yml 21 | with: 22 | pack: false 23 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | on: 3 | workflow_call: 4 | inputs: 5 | environment: 6 | type: string 7 | required: true 8 | 9 | jobs: 10 | publish: 11 | environment: ${{ inputs.environment }} 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | 17 | - name: Download artifacts 18 | uses: actions/download-artifact@v4.1.7 19 | id: download 20 | with: 21 | name: 'packages' 22 | path: './packages' 23 | 24 | - name: Publish packages 25 | uses: './.github/actions/dotnet/nuget' 26 | with: 27 | nuget-api-key: ${{ secrets.NUGET_API_KEY }} 28 | packages-directory: '${{steps.download.outputs.download-path}}' -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDeployment 2 | branches: 3 | master: 4 | prevent-increment-of-merged-branch-version: false 5 | source-branches: ['feature'] 6 | tag: master 7 | feature: 8 | tag: 'feature.{BranchName}' 9 | source-branches: ['master'] 10 | release: 11 | tag: 'release' -------------------------------------------------------------------------------- /src/ExCSS.Tests/ClassSelectorTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | 5 | namespace ExCSS.Tests; 6 | 7 | public class ClassSelectorTests 8 | { 9 | [Fact] 10 | public async Task FindAllClassSelectorsThatMatchClassName() 11 | { 12 | // Arrange 13 | var css = 14 | @".sample-class { background-color: #101010 } .sample-class[type='input'] { background-color: #121212 }"; 15 | var sheet = await new StylesheetParser().ParseAsync(css); 16 | 17 | // Act 18 | var list = sheet.StyleRules 19 | .Where(x => 20 | (x.Selector is CompoundSelector selector && 21 | selector.Any(y => y is ClassSelector { Class: "sample-class" })) 22 | || x.Selector is ClassSelector { Class: "sample-class" } 23 | ); 24 | 25 | // Assert 26 | Assert.Equal(2, list.Count()); 27 | } 28 | } -------------------------------------------------------------------------------- /src/ExCSS.Tests/Debug.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Xunit; 4 | 5 | namespace ExCSS.Tests 6 | { 7 | using ExCSS; 8 | 9 | public class DebugTests 10 | { 11 | [Fact] 12 | public void Debug_stuff_here() 13 | { 14 | var sheet = new StylesheetParser().Parse("foo > bar {color: red; }"); 15 | var _ = sheet.ToCss(); 16 | Console.WriteLine(sheet.StyleRules.First().SelectorText); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS.Tests/ExCSS.Tests.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBrinks/ExCSS/b0e2f461ccb9ee459b91559dc666cc53b430e987/src/ExCSS.Tests/ExCSS.Tests.snk -------------------------------------------------------------------------------- /src/ExCSS.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("ExCSS.Tests")] 11 | [assembly: AssemblyTrademark("")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("2f5163cb-b410-402a-85d8-448f8125c5fa")] 20 | -------------------------------------------------------------------------------- /src/ExCSS.Tests/PropertyTests/RowGapProperty.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace ExCSS.Tests.PropertyTests 4 | { 5 | public class RowGapPropertyTests : CssConstructionFunctions 6 | { 7 | [Theory] 8 | [MemberData(nameof(LengthOrPercentOrGlobalTestValues))] 9 | public void RowGapLegalValues(string value) 10 | => TestForLegalValue(PropertyNames.RowGap, value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ExCSS/Conditions/EmptyCondition.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class EmptyCondition : StylesheetNode, IConditionFunction 6 | { 7 | public bool Check() 8 | { 9 | return true; 10 | } 11 | 12 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Conditions/NotCondition.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class NotCondition : StylesheetNode, IConditionFunction 6 | { 7 | private IConditionFunction _content; 8 | 9 | public IConditionFunction Content 10 | { 11 | get => _content ?? new EmptyCondition(); 12 | set 13 | { 14 | if (_content != null) RemoveChild(_content); 15 | 16 | _content = value; 17 | 18 | if (value != null) AppendChild(_content); 19 | } 20 | } 21 | 22 | public bool Check() 23 | { 24 | return !Content.Check(); 25 | } 26 | 27 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 28 | { 29 | writer.Write("not "); 30 | Content.ToCss(writer, formatter); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/ExCSS/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/AlignContent.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace ExCSS 3 | { 4 | public enum AlignContent : byte 5 | { 6 | Center, 7 | Start, 8 | End, 9 | FlexStart, 10 | FlexEnd, 11 | Normal, 12 | Baseline, 13 | SpaceBetween, 14 | SpaceAround, 15 | SpaceEvenly, 16 | Stretch 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/AlignItem.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace ExCSS 3 | { 4 | public enum AlignItem : byte 5 | { 6 | Normal, 7 | Stretch, 8 | Center, 9 | Start, 10 | End, 11 | FlexStart, 12 | FlexEnd, 13 | SelfStart, 14 | SelfEnd, 15 | Baseline 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/AnimationDirection.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum AnimationDirection : byte 4 | { 5 | Normal, 6 | Alternate, 7 | Reverse, 8 | AlternateReverse 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/AnimationFillStyle.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum AnimationFillStyle : byte 4 | { 5 | None, 6 | Forwards, 7 | Backwards, 8 | Both 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BackgroundAttachment.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BackgroundAttachment : byte 4 | { 5 | Fixed, 6 | Local, 7 | Scroll 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BackgroundRepeat.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BackgroundRepeat : byte 4 | { 5 | Repeat, 6 | Space, 7 | Round, 8 | NoRepeat 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BlendMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BlendMode : byte 4 | { 5 | Normal, 6 | Multiply, 7 | Screen, 8 | Overlay, 9 | Darken, 10 | Lighten, 11 | ColorDodge, 12 | ColorBurn, 13 | HardLight, 14 | SoftLight, 15 | Difference, 16 | Exclusion, 17 | Hue, 18 | Saturation, 19 | Color, 20 | Luminosity 21 | } 22 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BorderRepeat.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BorderRepeat : byte 4 | { 5 | Stretch, 6 | Repeat, 7 | Round 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BoxModel.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BoxModel : byte 4 | { 5 | BorderBox, 6 | PaddingBox, 7 | ContentBox 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/BreakMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum BreakMode : byte 4 | { 5 | Auto, 6 | Always, 7 | Avoid, 8 | Left, 9 | Right, 10 | Page, 11 | Column, 12 | AvoidPage, 13 | AvoidColumn, 14 | AvoidRegion 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ClearMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ClearMode : byte 4 | { 5 | None, 6 | Left, 7 | Right, 8 | Both 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/Combinators.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public static class Combinators 4 | { 5 | public static readonly string Exactly = "="; 6 | public static readonly string Unlike = "!="; 7 | public static readonly string InList = "~="; 8 | public static readonly string InToken = "|="; 9 | public static readonly string Begins = "^="; 10 | public static readonly string Ends = "$="; 11 | public static readonly string InText = "*="; 12 | public static readonly string Column = "||"; 13 | public static readonly string Pipe = "|"; 14 | public static readonly string Adjacent = "+"; 15 | public static readonly string Descendent = " "; 16 | public static readonly string Deep = ">>>"; 17 | public static readonly string Child = ">"; 18 | public static readonly string Sibling = "~"; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ContainerType.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ContainerType : byte 4 | { 5 | Normal, 6 | Size, 7 | InlineSize 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/DirectionMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum DirectionMode : byte 4 | { 5 | Ltr, 6 | Rtl 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/DisplayMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum DisplayMode : byte 4 | { 5 | None, 6 | Inline, 7 | Block, 8 | ListItem, 9 | InlineBlock, 10 | InlineTable, 11 | Table, 12 | TableCaption, 13 | TableCell, 14 | TableColumn, 15 | TableColumnGroup, 16 | TableFooterGroup, 17 | TableHeaderGroup, 18 | TableRow, 19 | TableRowGroup, 20 | Flex, 21 | InlineFlex, 22 | Grid, 23 | InlineGrid 24 | } 25 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FillRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FillRule : byte 4 | { 5 | Nonzero, 6 | Evenodd 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FlexDirection.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FlexDirection : byte 4 | { 5 | Row, 6 | RowReverse, 7 | Column, 8 | ColumnReverse 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FlexWrap.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FlexWrap : byte 4 | { 5 | NoWrap, 6 | Wrap, 7 | WrapReverse 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/Floating.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum Floating : byte 4 | { 5 | None, 6 | Left, 7 | Right 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FontSize.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FontSize : byte 4 | { 5 | Custom, 6 | Tiny, 7 | Little, 8 | Smaller, 9 | Small, 10 | Medium, 11 | Large, 12 | Larger, 13 | Big, 14 | Huge 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FontStretch.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FontStretch : byte 4 | { 5 | Normal, 6 | UltraCondensed, 7 | ExtraCondensed, 8 | Condensed, 9 | SemiCondensed, 10 | SemiExpanded, 11 | Expanded, 12 | ExtraExpanded, 13 | UltraExpanded 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FontStyle.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FontStyle : byte 4 | { 5 | Normal, 6 | Italic, 7 | Oblique 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FontVariant.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FontVariant : byte 4 | { 5 | Normal, 6 | SmallCaps 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/FontWeight.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum FontWeight : byte 4 | { 5 | Normal, 6 | Bold, 7 | Bolder, 8 | Lighter 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/HorizontalAlignment.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum HorizontalAlignment : byte 4 | { 5 | Left, 6 | Center, 7 | Right, 8 | Justify 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/HoverAbility.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum HoverAbility : byte 4 | { 5 | None, 6 | OnDemand, 7 | Hover 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/IntrinsicSizing.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum IntrinsicSizing : byte 4 | { 5 | MaxContent, 6 | MinContent, 7 | FitContent, 8 | Content 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/JustifyContent.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum JustifyContent : byte 4 | { 5 | Start, 6 | Center, 7 | SpaceBetween, 8 | SpaceAround, 9 | SpaceEvenly, 10 | End, 11 | FlexStart, 12 | FlexEnd, 13 | Left, 14 | Right, 15 | Normal, 16 | Stretch 17 | } 18 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/LineStyle.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum LineStyle : byte 4 | { 5 | None, 6 | Hidden, 7 | Dotted, 8 | Dashed, 9 | Solid, 10 | Double, 11 | Groove, 12 | Ridge, 13 | Inset, 14 | Outset 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ListPosition.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ListPosition : byte 4 | { 5 | Inside, 6 | Outside 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ListStyle.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ListStyle : byte 4 | { 5 | None, 6 | Disc, 7 | Circle, 8 | Square, 9 | Decimal, 10 | DecimalLeadingZero, 11 | LowerRoman, 12 | UpperRoman, 13 | LowerGreek, 14 | LowerLatin, 15 | UpperLatin, 16 | Armenian, 17 | Georgian 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ObjectFitting.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ObjectFitting : byte 4 | { 5 | None, 6 | Fill, 7 | Contain, 8 | Cover, 9 | ScaleDown 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/Overflow.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum Overflow : byte 4 | { 5 | Auto, 6 | Visible, 7 | Hidden, 8 | Scroll 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/OverflowWrap.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum OverflowWrap : byte 4 | { 5 | Normal, 6 | BreakWord 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ParseError.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ParseError : byte 4 | { 5 | EOF = 0, 6 | InvalidCharacter = 16, // 0x10, 7 | InvalidBlockStart = 17, // 0x11, 8 | InvalidToken = 18, // 0x12, 9 | ColonMissing = 19, // 0x13, 10 | IdentExpected = 20, // 0x14, 11 | InputUnexpected = 21, // 0x15, 12 | LineBreakUnexpected = 22, // 0x16, 13 | UnknownAtRule = 32, // 0x20, 14 | InvalidSelector = 48, // 0x30, 15 | InvalidKeyframe = 49, // 0x31, 16 | ValueMissing = 64, // 0x40, 17 | InvalidValue = 65, // 0x41, 18 | UnknownDeclarationName = 80 // 0x50 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/PlayState.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum PlayState : byte 4 | { 5 | Running, 6 | Paused 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/PointerAccuracy.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum PointerAccuracy : byte 4 | { 5 | None, 6 | Coarse, 7 | Fine 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/PositionMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum PositionMode : byte 4 | { 5 | Static, 6 | Relative, 7 | Absolute, 8 | Fixed, 9 | Sticky 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/PropertyFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | [Flags] 6 | internal enum PropertyFlags : byte 7 | { 8 | None = 0, 9 | Inherited = 1, 10 | Hashless = 2, 11 | Unitless = 4, 12 | Animatable = 8, 13 | Shorthand = 16 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/PseudoElementNames.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public static class PseudoElementNames 4 | { 5 | public static readonly string Before = "before"; 6 | public static readonly string After = "after"; 7 | public static readonly string Selection = "selection"; 8 | public static readonly string FirstLine = "first-line"; 9 | public static readonly string FirstLetter = "first-letter"; 10 | public static readonly string Content = "content"; 11 | public static readonly string Separator = "::"; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/QuirksMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal enum QuirksMode : byte 4 | { 5 | Off, 6 | Limited, 7 | On 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/RuleNames.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public static class RuleNames 4 | { 5 | public static readonly string Supports = "supports"; 6 | public static readonly string Charset = "charset"; 7 | public static readonly string Document = "document"; 8 | public static readonly string FontFace = "font-face"; 9 | public static readonly string ViewPort = "viewport"; 10 | public static readonly string Import = "import"; 11 | public static readonly string Keyframes = "keyframes"; 12 | public static readonly string Media = "media"; 13 | public static readonly string Namespace = "namespace"; 14 | public static readonly string Page = "page"; 15 | public static readonly string Container = "container"; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/RuleType.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum RuleType : byte 4 | { 5 | Unknown, 6 | Style, 7 | Charset, 8 | Import, 9 | Media, 10 | FontFace, 11 | Page, 12 | Keyframes, 13 | Keyframe, 14 | MarginBox, 15 | Namespace, 16 | CounterStyle, 17 | Supports, 18 | Document, 19 | FontFeatureValues, 20 | Viewport, 21 | RegionStyle, 22 | Container 23 | } 24 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/ScriptingState.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum ScriptingState : byte 4 | { 5 | None, 6 | InitialOnly, 7 | Enabled 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/StrokeLinecap.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum StrokeLinecap : byte 4 | { 5 | Butt, 6 | Round, 7 | Square 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/StrokeLinejoin.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum StrokeLinejoin : byte 4 | { 5 | Miter, 6 | Round, 7 | Bevel 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/SystemCursor.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum SystemCursor : byte 4 | { 5 | Auto, 6 | Default, 7 | None, 8 | ContextMenu, 9 | Help, 10 | Pointer, 11 | Progress, 12 | Wait, 13 | Cell, 14 | Crosshair, 15 | Text, 16 | VerticalText, 17 | Alias, 18 | Copy, 19 | Move, 20 | NoDrop, 21 | NotAllowed, 22 | EResize, 23 | NResize, 24 | NeResize, 25 | NwResize, 26 | SResize, 27 | SeResize, 28 | SwResize, 29 | WResize, 30 | EwResize, 31 | NsResize, 32 | NeswResize, 33 | NwseResize, 34 | ColResize, 35 | RowResize, 36 | AllScroll, 37 | ZoomIn, 38 | ZoomOut, 39 | Grab, 40 | Grabbing 41 | } 42 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/SystemFont.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum SystemFont : byte 4 | { 5 | Caption, 6 | Icon, 7 | Menu, 8 | MessageBox, 9 | SmallCaption, 10 | StatusBar 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextAlignLast.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextAlignLast : byte 4 | { 5 | Auto, 6 | Start, 7 | End, 8 | Left, 9 | Right, 10 | Center, 11 | Justify 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextAnchor.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextAnchor : byte 4 | { 5 | Start, 6 | Middle, 7 | End 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextDecorationLine.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextDecorationLine : byte 4 | { 5 | Underline, 6 | Overline, 7 | LineThrough, 8 | Blink 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextDecorationStyle.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextDecorationStyle : byte 4 | { 5 | Solid, 6 | Double, 7 | Dotted, 8 | Dashed, 9 | Wavy 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextJustify.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextJustify : byte 4 | { 5 | Auto, 6 | InterWord, 7 | InterIdeograph, 8 | InterCluster, 9 | Distribute, 10 | DistributeAllLines, 11 | DistributeCenterLast, 12 | Kashida, 13 | Newspaper 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TextTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum TextTransform : byte 4 | { 5 | None, 6 | Capitalize, 7 | Uppercase, 8 | Lowercase, 9 | FullWidth 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/TokenType.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal enum TokenType : byte 4 | { 5 | String, 6 | Url, 7 | Color, 8 | Hash, 9 | Comment, 10 | AtKeyword, 11 | Ident, 12 | Function, 13 | Number, 14 | Percentage, 15 | Dimension, 16 | Range, 17 | Cdo, 18 | Cdc, 19 | Column, 20 | Delim, 21 | Match, 22 | RoundBracketOpen, 23 | RoundBracketClose, 24 | CurlyBracketOpen, 25 | CurlyBracketClose, 26 | SquareBracketOpen, 27 | SquareBracketClose, 28 | Colon, 29 | Comma, 30 | Semicolon, 31 | Whitespace, 32 | EndOfFile, 33 | GreaterThan, 34 | GreaterThanOrEqual, 35 | LessThan, 36 | LessThanOrEqual, 37 | Equal 38 | } 39 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/UnicodeMode.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum UnicodeMode : byte 4 | { 5 | Normal, 6 | Embed, 7 | Isolate, 8 | BidirectionalOverride, 9 | IsolateOverride, 10 | Plaintext 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/UpdateFrequency.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum UpdateFrequency : byte 4 | { 5 | None, 6 | Slow, 7 | Normal 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/VerticalAlignment.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum VerticalAlignment : byte 4 | { 5 | Baseline, 6 | Sub, 7 | Super, 8 | TextTop, 9 | TextBottom, 10 | Middle, 11 | Top, 12 | Bottom 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/Visibility.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum Visibility : byte 4 | { 5 | Visible, 6 | Hidden, 7 | Collapse 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/Whitespace.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum Whitespace : byte 4 | { 5 | Normal, 6 | Pre, 7 | NoWrap, 8 | PreWrap, 9 | PreLine 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Enumerations/WordBreak.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public enum WordBreak : byte 4 | { 5 | Normal, 6 | BreakAll, 7 | KeepAll 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/ExCSS.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBrinks/ExCSS/b0e2f461ccb9ee459b91559dc666cc53b430e987/src/ExCSS/ExCSS.snk -------------------------------------------------------------------------------- /src/ExCSS/Extensions/FormatExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public static class FormatExtensions 6 | { 7 | public static string ToCss(this IStyleFormattable style) 8 | { 9 | return style.ToCss(CompressedStyleFormatter.Instance); 10 | } 11 | 12 | public static string ToCss(this IStyleFormattable style, IStyleFormatter formatter) 13 | { 14 | var sb = Pool.NewStringBuilder(); 15 | using (var writer = new StringWriter(sb)) 16 | { 17 | style.ToCss(writer, formatter); 18 | } 19 | 20 | return sb.ToPool(); 21 | } 22 | 23 | public static void ToCss(this IStyleFormattable style, TextWriter writer) 24 | { 25 | style.ToCss(writer, CompressedStyleFormatter.Instance); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/ExCSS/Extensions/PortableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | #if !NET40 && !SL50 6 | 7 | namespace ExCSS 8 | { 9 | internal static class PortableExtensions 10 | { 11 | public static string ConvertFromUtf32(this int utf32) 12 | { 13 | return char.ConvertFromUtf32(utf32); 14 | } 15 | 16 | public static PropertyInfo[] GetProperties(this Type type) 17 | { 18 | return type.GetRuntimeProperties().ToArray(); 19 | } 20 | } 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /src/ExCSS/Functions/DocumentFunction.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | internal abstract class DocumentFunction : StylesheetNode, IDocumentFunction 6 | { 7 | internal DocumentFunction(string name, string data) 8 | { 9 | Name = name; 10 | Data = data; 11 | } 12 | 13 | public string Name { get; } 14 | public string Data { get; } 15 | 16 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 17 | { 18 | writer.Write(Name.StylesheetFunction(Data.StylesheetString())); 19 | } 20 | 21 | public abstract bool Matches(Url url); 22 | } 23 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/DomainFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class DomainFunction : DocumentFunction 6 | { 7 | private readonly string _subdomain; 8 | 9 | public DomainFunction(string url) : base(FunctionNames.Domain, url) 10 | { 11 | _subdomain = "." + url; 12 | } 13 | 14 | public override bool Matches(Url url) 15 | { 16 | var domain = url.HostName; 17 | return domain.Isi(Data) || domain.EndsWith(_subdomain, StringComparison.OrdinalIgnoreCase); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/IConditionFunction.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IConditionFunction : IStylesheetNode 4 | { 5 | bool Check(); 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/IDocumentFunction.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IDocumentFunction : IStylesheetNode 4 | { 5 | string Name { get; } 6 | string Data { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/RegexpFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class RegexpFunction : DocumentFunction 6 | { 7 | private readonly Regex _regex; 8 | 9 | public RegexpFunction(string url) : base(FunctionNames.Regexp, url) 10 | { 11 | _regex = new Regex(url, RegexOptions.ECMAScript | RegexOptions.CultureInvariant); 12 | } 13 | 14 | public override bool Matches(Url url) 15 | { 16 | return _regex.IsMatch(url.Href); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/UrlFunction.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UrlFunction : DocumentFunction 4 | { 5 | private readonly Url _expected; 6 | 7 | public UrlFunction(string url) : base(FunctionNames.Url, url) 8 | { 9 | _expected = Url.Create(Data); 10 | } 11 | 12 | public override bool Matches(Url actual) 13 | { 14 | return !_expected.IsInvalid && _expected.Equals(actual); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Functions/UrlPrefixFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class UrlPrefixFunction : DocumentFunction 6 | { 7 | public UrlPrefixFunction(string url) : base(FunctionNames.UrlPrefix, url) 8 | { 9 | } 10 | 11 | public override bool Matches(Url url) 12 | { 13 | return url.Href.StartsWith(Data, StringComparison.OrdinalIgnoreCase); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/AspectRatioMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AspectRatioMediaFeature : MediaFeature 4 | { 5 | public AspectRatioMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.RatioConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/ColorIndexMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class ColorIndexMediaFeature : MediaFeature 6 | { 7 | public ColorIndexMediaFeature(string name) : base(name) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => 12 | IsMinimum || IsMaximum 13 | ? NaturalIntegerConverter 14 | : NaturalIntegerConverter.Option(1); 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/ColorMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class ColorMediaFeature : MediaFeature 6 | { 7 | public ColorMediaFeature(string name) : base(name) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => 12 | IsMinimum || IsMaximum 13 | ? PositiveIntegerConverter 14 | : PositiveIntegerConverter.Option(1); 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/DeviceAspectRatioMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DeviceAspectRatioMediaFeature : MediaFeature 4 | { 5 | public DeviceAspectRatioMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.RatioConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/DeviceHeightMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DeviceHeightMediaFeature : MediaFeature 4 | { 5 | public DeviceHeightMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.LengthConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/DevicePixelRatioFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DevicePixelRatioFeature : MediaFeature 4 | { 5 | public DevicePixelRatioFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.NaturalNumberConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/DeviceWidthMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DeviceWidthMediaFeature : MediaFeature 4 | { 5 | public DeviceWidthMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.LengthConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/GridMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class GridMediaFeature : MediaFeature 4 | { 5 | public GridMediaFeature() : base(FeatureNames.Grid) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.BinaryConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/HeightMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class HeightMediaFeature : MediaFeature 4 | { 5 | public HeightMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.LengthConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/HoverMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class HoverMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = Map.HoverAbilities.ToConverter(); 6 | 7 | public HoverMediaFeature() : base(FeatureNames.Hover) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => TheConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/MonochromeMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class MonochromeMediaFeature : MediaFeature 6 | { 7 | public MonochromeMediaFeature(string name) : base(name) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => 12 | IsMinimum || IsMaximum ? NaturalIntegerConverter : NaturalIntegerConverter.Option(1); 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/OrientationMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OrientationMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = Converters.Toggle(Keywords.Portrait, Keywords.Landscape); 6 | 7 | public OrientationMediaFeature() : base(FeatureNames.Orientation) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => TheConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/PointerMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PointerMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = Map.PointerAccuracies.ToConverter(); 6 | 7 | public PointerMediaFeature() : base(FeatureNames.Pointer) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => TheConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/ResolutionMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ResolutionMediaFeature : MediaFeature 4 | { 5 | public ResolutionMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.ResolutionConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/ScanMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ScanMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = 6 | Converters.Toggle(Keywords.Interlace, Keywords.Progressive); 7 | 8 | public ScanMediaFeature() : base(FeatureNames.Scan) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => TheConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/ScriptingMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ScriptingMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = Map.ScriptingStates.ToConverter(); 6 | 7 | public ScriptingMediaFeature() : base(FeatureNames.Scripting) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => TheConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/SizeMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class SizeMediaFeature : MediaFeature 4 | { 5 | public SizeMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.LengthConverter; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/UnknownMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UnknownMediaFeature : MediaFeature 4 | { 5 | public UnknownMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.Any; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/UpdateFrequencyMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UpdateFrequencyMediaFeature : MediaFeature 4 | { 5 | private static readonly IValueConverter TheConverter = Map.UpdateFrequencies.ToConverter(); 6 | 7 | public UpdateFrequencyMediaFeature() : base(FeatureNames.UpdateFrequency) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => TheConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/MediaFeatures/WidthMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WidthMediaFeature : MediaFeature 4 | { 5 | public WidthMediaFeature(string name) : base(name) 6 | { 7 | } 8 | 9 | internal override IValueConverter Converter => Converters.LengthConverter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/Comment.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class Comment : StylesheetNode 6 | { 7 | public Comment(string data) 8 | { 9 | Data = data; 10 | } 11 | 12 | public string Data { get; } 13 | 14 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 15 | { 16 | writer.Write(formatter.Comment(Data)); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/IMediaFeature.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IMediaFeature : IStylesheetNode 4 | { 5 | string Name { get; } 6 | string Value { get; } 7 | bool HasValue { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/ISelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface ISelector : IStylesheetNode 4 | { 5 | Priority Specificity { get; } 6 | string Text { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/IStyleFormattable.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IStyleFormattable 6 | { 7 | void ToCss(TextWriter writer, IStyleFormatter formatter); 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/IStyleFormatter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IStyleFormatter 6 | { 7 | string Sheet(IEnumerable rules); 8 | string Block(IEnumerable rules); 9 | string Declaration(string name, string value, bool important); 10 | string Declarations(IEnumerable declarations); 11 | string Medium(bool exclusive, bool inverse, string type, IEnumerable constraints); 12 | string Constraint(string name, string value, string constraintDelimiter); 13 | string Rule(string name, string value); 14 | string Rule(string name, string prelude, string rules); 15 | string Style(string selector, IStyleFormattable rules); 16 | string Comment(string data); 17 | } 18 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/IStylesheetNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IStylesheetNode : IStyleFormattable 6 | { 7 | IEnumerable Children { get; } 8 | StylesheetText StylesheetText { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/IValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | internal interface IValueConverter 6 | { 7 | IPropertyValue Convert(IEnumerable value); 8 | IPropertyValue Construct(Property[] properties); 9 | } 10 | 11 | internal static class PropertyExtensions 12 | { 13 | public static IPropertyValue Guard(this Property[] properties) 14 | { 15 | if (properties.Length != 1) return null; 16 | 17 | var value = properties[0].DeclaredValue; 18 | return value is T ? properties[0].DeclaredValue : null; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/ParseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | public class ParseException : Exception 6 | { 7 | public ParseException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/ParserOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal struct ParserOptions 4 | { 5 | public bool IncludeUnknownRules { get; set; } 6 | public bool IncludeUnknownDeclarations { get; set; } 7 | public bool AllowInvalidSelectors { get; set; } 8 | public bool AllowInvalidValues { get; set; } 9 | public bool AllowInvalidConstraints { get; set; } 10 | public bool PreserveComments { get; set; } 11 | public bool PreserveDuplicateProperties { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/StylesheetText.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | public class StylesheetText 6 | { 7 | private readonly TextSource _source; 8 | 9 | internal StylesheetText(TextRange range, TextSource source) 10 | { 11 | Range = range; 12 | _source = source; 13 | } 14 | 15 | public TextRange Range { get; } 16 | 17 | public string Text 18 | { 19 | get 20 | { 21 | var start = Math.Max(Range.Start.Position - 1, 0); 22 | var length = Range.End.Position + 1 - Range.Start.Position; 23 | var text = _source.Text; 24 | 25 | if (start + length > text.Length) length = text.Length - start; 26 | 27 | return text.Substring(start, length); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/ExCSS/Model/TaskEx.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | #if !NET40 && !SL50 4 | 5 | namespace System.Threading.Tasks 6 | { 7 | internal static class TaskEx 8 | { 9 | public static Task Run(Action action, CancellationToken cancel) 10 | { 11 | return Task.Run(action, cancel); 12 | } 13 | 14 | public static Task Delay(int millisecondsDelay, CancellationToken cancel) 15 | { 16 | return Task.Delay(millisecondsDelay, cancel); 17 | } 18 | 19 | public static Task WhenAll(IEnumerable tasks) 20 | { 21 | return Task.WhenAll(tasks); 22 | } 23 | } 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /src/ExCSS/Parser/TokenizerError.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public class TokenizerError 4 | { 5 | private readonly ParseError _code; 6 | 7 | public TokenizerError(ParseError code, TextPosition position) 8 | { 9 | _code = code; 10 | Position = position; 11 | } 12 | 13 | public TextPosition Position { get; } 14 | public int Code => _code.GetCode(); 15 | public string Message => "An unknown error occurred."; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/CharsetRule.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public sealed class CharsetRule : Rule, ICharsetRule 6 | { 7 | internal CharsetRule(StylesheetParser parser) 8 | : base(RuleType.Charset, parser) 9 | { 10 | } 11 | 12 | public string CharacterSet { get; set; } 13 | 14 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 15 | { 16 | writer.Write(formatter.Rule("@charset", CharacterSet.StylesheetString())); 17 | } 18 | 19 | protected override void ReplaceWith(IRule rule) 20 | { 21 | var newRule = rule as CharsetRule; 22 | CharacterSet = newRule?.CharacterSet; 23 | base.ReplaceWith(rule); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/ConditionRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal abstract class ConditionRule : GroupingRule 4 | { 5 | internal ConditionRule(RuleType type, StylesheetParser parser) 6 | : base(type, parser) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/ICharsetRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface ICharsetRule : IRule 4 | { 5 | string CharacterSet { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IConditionRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IConditionRule : IGroupingRule 4 | { 5 | string ConditionText { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IContainer.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IContainerRule : IConditionRule 4 | { 5 | string Name { get; set; } 6 | MediaList Media { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IFontFaceRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IFontFaceRule : IRule, IProperties 4 | { 5 | string Family { get; set; } 6 | string Source { get; set; } 7 | string Style { get; set; } 8 | string Weight { get; set; } 9 | string Stretch { get; set; } 10 | string Range { get; set; } 11 | string Variant { get; set; } 12 | string Features { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IGroupingRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IGroupingRule : IRule, IRuleCreator 4 | { 5 | IRuleList Rules { get; } 6 | int Insert(string rule, int index); 7 | void RemoveAt(int index); 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IImportRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IImportRule : IRule 4 | { 5 | string Href { get; set; } 6 | MediaList Media { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IKeyframeRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IKeyframeRule : IRule 4 | { 5 | string KeyText { get; set; } 6 | StyleDeclaration Style { get; } 7 | KeyframeSelector Key { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IKeyframesRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IKeyframesRule : IRule 4 | { 5 | string Name { get; set; } 6 | IRuleList Rules { get; } 7 | void Add(string rule); 8 | void Remove(string key); 9 | IKeyframeRule Find(string key); 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IMarginRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IMarginRule : IRule 4 | { 5 | string Name { get; } 6 | StyleDeclaration Style { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IMediaRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IMediaRule : IConditionRule 4 | { 5 | MediaList Media { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/INamespaceRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface INamespaceRule : IRule 4 | { 5 | string NamespaceUri { get; set; } 6 | string Prefix { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IPageRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IPageRule : IRule 4 | { 5 | string SelectorText { get; set; } 6 | StyleDeclaration Style { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IRule : IStylesheetNode 4 | { 5 | RuleType Type { get; } 6 | string Text { get; set; } 7 | IRule Parent { get; } 8 | Stylesheet Owner { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IRuleCreator.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IRuleCreator 4 | { 5 | IRule AddNewRule(RuleType ruleType); 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IRuleList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IRuleList : IEnumerable 6 | { 7 | IRule this[int index] { get; } 8 | int Length { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/IStyleRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IStyleRule : IRule 4 | { 5 | string SelectorText { get; set; } 6 | StyleDeclaration Style { get; } 7 | ISelector Selector { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/ISupportsRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface ISupportsRule : IConditionRule 4 | { 5 | IConditionFunction Condition { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/MediaRule.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | 4 | namespace ExCSS 5 | { 6 | internal sealed class MediaRule : ConditionRule, IMediaRule 7 | { 8 | internal MediaRule(StylesheetParser parser) : base(RuleType.Media, parser) 9 | { 10 | AppendChild(new MediaList(parser)); 11 | } 12 | 13 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 14 | { 15 | var rules = formatter.Block(Rules); 16 | writer.Write(formatter.Rule("@media", Media.MediaText, rules)); 17 | } 18 | 19 | public string ConditionText 20 | { 21 | get => Media.MediaText; 22 | set => Media.MediaText = value; 23 | } 24 | 25 | public MediaList Media => Children.OfType().FirstOrDefault(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/UnknownRule.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class UnknownRule : Rule 6 | { 7 | public UnknownRule(string name, StylesheetParser parser) 8 | : base(RuleType.Unknown, parser) 9 | { 10 | Name = name; 11 | } 12 | 13 | public string Name { get; } 14 | 15 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 16 | { 17 | writer.Write(StylesheetText?.Text); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/Rules/ViewportRule.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ViewportRule : DeclarationRule 4 | { 5 | internal ViewportRule(StylesheetParser parser) 6 | : base(RuleType.Viewport, RuleNames.ViewPort, parser) 7 | { 8 | } 9 | 10 | protected override Property CreateNewProperty(string name) 11 | { 12 | return PropertyFactory.Instance.CreateViewport(name); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AllSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AllSelector : SelectorBase 4 | { 5 | public static AllSelector Create() 6 | { 7 | return new AllSelector(); 8 | } 9 | 10 | private AllSelector() : base(Priority.Zero, "*") 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrAvailableSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrAvailableSelector : AttrSelectorBase 4 | { 5 | public AttrAvailableSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrBeginsSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrBeginsSelector : AttrSelectorBase 4 | { 5 | public AttrBeginsSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}^={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrContainsSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrContainsSelector : AttrSelectorBase 4 | { 5 | public AttrContainsSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}*={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrEndsSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrEndsSelector : AttrSelectorBase 4 | { 5 | public AttrEndsSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}$={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrHyphenSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrHyphenSelector : AttrSelectorBase 4 | { 5 | public AttrHyphenSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}|={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrListSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrListSelector : AttrSelectorBase 4 | { 5 | public AttrListSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}~={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrMatchSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrMatchSelector : AttrSelectorBase 4 | { 5 | public AttrMatchSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrNotMatchSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class AttrNotMatchSelector : AttrSelectorBase 4 | { 5 | public AttrNotMatchSelector(string attribute, string value) 6 | : base(attribute, value, $"[{attribute}!={value.StylesheetString()}]") 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/AttrSelectorBase.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public abstract class AttrSelectorBase : SelectorBase, IAttrSelector 4 | { 5 | protected AttrSelectorBase(string attribute, string value, string text) : base(Priority.OneClass, text) 6 | { 7 | Attribute = attribute; 8 | Value = value; 9 | } 10 | public string Attribute { get; } 11 | public string Value { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/ClassSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class ClassSelector : SelectorBase 4 | { 5 | private ClassSelector(string name) : base(Priority.OneClass, $".{name}") 6 | { 7 | Class = name; 8 | } 9 | 10 | public string Class { get; } 11 | 12 | public static ClassSelector Create(string name) 13 | { 14 | return new ClassSelector(name); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/CombinatorSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public struct CombinatorSelector 4 | { 5 | public string Delimiter { get; internal set; } 6 | public ISelector Selector { get; internal set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/CompoundSelector.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public sealed class CompoundSelector : Selectors, ISelector 6 | { 7 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 8 | { 9 | foreach (var selector in _selectors) writer.Write(selector.Text); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/FirstChildSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | 3 | { 4 | public sealed class FirstChildSelector : ChildSelector 5 | { 6 | public FirstChildSelector() 7 | : base(PseudoClassNames.NthChild) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/FirstColumnSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class FirstColumnSelector : ChildSelector 4 | { 5 | public FirstColumnSelector() 6 | : base(PseudoClassNames.NthColumn) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/FirstTypeSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class FirstTypeSelector : ChildSelector 4 | { 5 | public FirstTypeSelector() 6 | : base(PseudoClassNames.NthOfType) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/IAttrSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IAttrSelector : ISelector 4 | { 5 | string Attribute { get; } 6 | string Value { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/IdSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class IdSelector : SelectorBase 4 | { 5 | private IdSelector(string name) : base(Priority.OneId, $"#{name}") 6 | { 7 | Id = name; 8 | } 9 | 10 | public string Id { get; } 11 | 12 | public static IdSelector Create(string name) 13 | { 14 | return new IdSelector(name); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/LastChildSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class LastChildSelector : ChildSelector 4 | { 5 | public LastChildSelector() 6 | : base(PseudoClassNames.NthLastChild) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/LastColumnSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class LastColumnSelector : ChildSelector 4 | { 5 | public LastColumnSelector() 6 | : base(PseudoClassNames.NthLastColumn) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/LastTypeSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class LastTypeSelector : ChildSelector 4 | { 5 | public LastTypeSelector() 6 | : base(PseudoClassNames.NthLastOfType) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/ListSelector.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public sealed class ListSelector : Selectors, ISelector 6 | { 7 | public bool IsInvalid { get; internal set; } 8 | 9 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 10 | { 11 | if (_selectors.Count <= 0) return; 12 | writer.Write(_selectors[0].Text); 13 | 14 | for (var i = 1; i < _selectors.Count; i++) 15 | { 16 | writer.Write(Symbols.Comma); 17 | writer.Write(_selectors[i].Text); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/NamespaceSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class NamespaceSelector : SelectorBase 4 | { 5 | private NamespaceSelector(string prefix) : base(Priority.Zero, prefix) 6 | { 7 | } 8 | 9 | public static NamespaceSelector Create(string prefix) 10 | { 11 | return new NamespaceSelector(prefix); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/PseudoClassSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class PseudoClassSelector : SelectorBase 4 | { 5 | private PseudoClassSelector(string name) : base(Priority.OneClass, $"{PseudoClassNames.Separator}{name}") 6 | { 7 | Class = name; 8 | } 9 | 10 | public string Class { get; } 11 | 12 | public static ISelector Create(string name) 13 | { 14 | return new PseudoClassSelector(name); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/PseudoElementSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class PseudoElementSelector : SelectorBase 4 | { 5 | private PseudoElementSelector(string name) : base(Priority.OneTag, $"{PseudoElementNames.Separator}{name}") 6 | { 7 | Name = name; 8 | } 9 | 10 | public string Name { get; } 11 | 12 | public static ISelector Create(string name) 13 | { 14 | return new PseudoElementSelector(name); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/SelectorBase.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public abstract class SelectorBase : StylesheetNode, ISelector 6 | { 7 | protected SelectorBase(Priority specificity, string text) 8 | { 9 | Specificity = specificity; 10 | Text = text; 11 | } 12 | 13 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 14 | { 15 | writer.Write(Text); 16 | } 17 | 18 | public Priority Specificity { get; } 19 | public string Text { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/TypeSelector.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class TypeSelector : SelectorBase 4 | { 5 | private TypeSelector(string name) : base(Priority.OneTag, name) 6 | { 7 | Name = name; 8 | } 9 | 10 | public string Name { get; } 11 | 12 | public static TypeSelector Create(string name) 13 | { 14 | return new TypeSelector(name); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Selectors/UnknownSelector.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ExCSS 4 | { 5 | public sealed class UnknownSelector : StylesheetNode, ISelector 6 | { 7 | public Priority Specificity => Priority.Zero; 8 | 9 | public string Text => this.ToCss(); 10 | 11 | public override void ToCss(TextWriter writer, IStyleFormatter formatter) 12 | { 13 | writer.Write(StylesheetText?.Text); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationDelayProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationDelayProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | ListConverter = Converters.TimeConverter.FromList().OrDefault(Time.Zero); 7 | 8 | internal AnimationDelayProperty() 9 | : base(PropertyNames.AnimationDelay) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationDirectionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationDirectionProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.AnimationDirectionConverter.FromList().OrDefault(AnimationDirection.Normal); 7 | 8 | internal AnimationDirectionProperty() 9 | : base(PropertyNames.AnimationDirection) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationDurationProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationDurationProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | ListConverter = Converters.TimeConverter.FromList().OrDefault(Time.Zero); 7 | 8 | internal AnimationDurationProperty() : base(PropertyNames.AnimationDuration) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => ListConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationFillModeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationFillModeProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.AnimationFillStyleConverter.FromList().OrDefault(AnimationFillStyle.None); 7 | 8 | internal AnimationFillModeProperty() 9 | : base(PropertyNames.AnimationFillMode) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationIterationCountProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationIterationCountProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.PositiveOrInfiniteNumberConverter.FromList().OrDefault(1f); 7 | 8 | internal AnimationIterationCountProperty() 9 | : base(PropertyNames.AnimationIterationCount) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationNameProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationNameProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.IdentifierConverter.FromList().OrNone().OrDefault(); 7 | 8 | internal AnimationNameProperty() 9 | : base(PropertyNames.AnimationName) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationPlayStateProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationPlayStateProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.PlayStateConverter.FromList().OrDefault(PlayState.Running); 7 | 8 | internal AnimationPlayStateProperty() 9 | : base(PropertyNames.AnimationPlayState) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Animation/AnimationTimingFunctionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AnimationTimingFunctionProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.TransitionConverter.FromList().OrDefault(Map.TimingFunctions[Keywords.Ease]); 7 | 8 | internal AnimationTimingFunctionProperty() 9 | : base(PropertyNames.AnimationTimingFunction) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundAttachmentProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundAttachmentProperty : Property 4 | { 5 | private static readonly IValueConverter AttachmentConverter = 6 | Converters.BackgroundAttachmentConverter.FromList().OrDefault(BackgroundAttachment.Scroll); 7 | 8 | internal BackgroundAttachmentProperty() 9 | : base(PropertyNames.BackgroundAttachment) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => AttachmentConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundClipProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundClipProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.BoxModelConverter.FromList().OrDefault(BoxModel.BorderBox); 7 | 8 | internal BackgroundClipProperty() 9 | : base(PropertyNames.BackgroundClip) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.CurrentColorConverter.OrDefault(); 6 | 7 | internal BackgroundColorProperty() 8 | : base(PropertyNames.BackgroundColor, PropertyFlags.Hashless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundImageProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundImageProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.MultipleImageSourceConverter.OrDefault(); 6 | 7 | internal BackgroundImageProperty() 8 | : base(PropertyNames.BackgroundImage) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundOriginProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundOriginProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.BoxModelConverter.FromList().OrDefault(BoxModel.PaddingBox); 7 | 8 | internal BackgroundOriginProperty() 9 | : base(PropertyNames.BackgroundOrigin) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundPositionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundPositionProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.PointConverter.FromList().OrDefault(Point.Center); 7 | 8 | internal BackgroundPositionProperty() 9 | : base(PropertyNames.BackgroundPosition, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundRepeatProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundRepeatProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.BackgroundRepeatsConverter.FromList().OrDefault(BackgroundRepeat.Repeat); 7 | 8 | internal BackgroundRepeatProperty() 9 | : base(PropertyNames.BackgroundRepeat) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Background/BackgroundSizeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackgroundSizeProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.BackgroundSizeConverter.FromList().OrDefault(); 7 | 8 | internal BackgroundSizeProperty() 9 | : base(PropertyNames.BackgroundSize, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderBottomColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderBottomColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.CurrentColorConverter.OrDefault(Color.Transparent); 7 | 8 | internal BorderBottomColorProperty() 9 | : base(PropertyNames.BorderBottomColor) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderBottomProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class BorderBottomProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | LineWidthConverter.Option().For(PropertyNames.BorderBottomWidth), 9 | LineStyleConverter.Option().For(PropertyNames.BorderBottomStyle), 10 | CurrentColorConverter.Option().For(PropertyNames.BorderBottomColor) 11 | ).OrDefault(); 12 | 13 | internal BorderBottomProperty() 14 | : base(PropertyNames.BorderBottom, PropertyFlags.Animatable) 15 | { 16 | } 17 | 18 | internal override IValueConverter Converter => StyleConverter; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderBottomStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderBottomStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal BorderBottomStyleProperty() 9 | : base(PropertyNames.BorderBottomStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderBottomWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderBottomWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal BorderBottomWidthProperty() 8 | : base(PropertyNames.BorderBottomWidth, PropertyFlags.Unitless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderCollapseProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderCollapseProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.BorderCollapseConverter.OrDefault(true); 6 | 7 | internal BorderCollapseProperty() 8 | : base(PropertyNames.BorderCollapse, PropertyFlags.Inherited) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderColorProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.CurrentColorConverter.Periodic( 6 | PropertyNames.BorderTopColor, PropertyNames.BorderRightColor, PropertyNames.BorderBottomColor, 7 | PropertyNames.BorderLeftColor).OrDefault(); 8 | 9 | internal BorderColorProperty() 10 | : base(PropertyNames.BorderColor, PropertyFlags.Hashless | PropertyFlags.Animatable) 11 | { 12 | } 13 | 14 | internal override IValueConverter Converter => StyleConverter; 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderLeftColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderLeftColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.CurrentColorConverter.OrDefault(Color.Transparent); 7 | 8 | internal BorderLeftColorProperty() 9 | : base(PropertyNames.BorderLeftColor) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderLeftProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class BorderLeftProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | LineWidthConverter.Option().For(PropertyNames.BorderLeftWidth), 9 | LineStyleConverter.Option().For(PropertyNames.BorderLeftStyle), 10 | CurrentColorConverter.Option().For(PropertyNames.BorderLeftColor) 11 | ).OrDefault(); 12 | 13 | internal BorderLeftProperty() 14 | : base(PropertyNames.BorderLeft, PropertyFlags.Animatable) 15 | { 16 | } 17 | 18 | internal override IValueConverter Converter => StyleConverter; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderLeftStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderLeftStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal BorderLeftStyleProperty() 9 | : base(PropertyNames.BorderLeftStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderLeftWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderLeftWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal BorderLeftWidthProperty() 8 | : base(PropertyNames.BorderLeftWidth, PropertyFlags.Unitless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderRightColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderRightColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.CurrentColorConverter.OrDefault(Color.Transparent); 7 | 8 | internal BorderRightColorProperty() 9 | : base(PropertyNames.BorderRightColor) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderRightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class BorderRightProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | LineWidthConverter.Option().For(PropertyNames.BorderRightWidth), 9 | LineStyleConverter.Option().For(PropertyNames.BorderRightStyle), 10 | CurrentColorConverter.Option().For(PropertyNames.BorderRightColor) 11 | ).OrDefault(); 12 | 13 | internal BorderRightProperty() 14 | : base(PropertyNames.BorderRight, PropertyFlags.Animatable) 15 | { 16 | } 17 | 18 | internal override IValueConverter Converter => StyleConverter; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderRightStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderRightStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal BorderRightStyleProperty() 9 | : base(PropertyNames.BorderRightStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderRightWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderRightWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal BorderRightWidthProperty() 8 | : base(PropertyNames.BorderRightWidth, PropertyFlags.Unitless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderSpacingProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderSpacingProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthConverter.Many(1, 2).OrDefault(Length.Zero); 7 | 8 | internal BorderSpacingProperty() 9 | : base(PropertyNames.BorderSpacing, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderStyleProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineStyleConverter.Periodic( 6 | PropertyNames.BorderTopStyle, PropertyNames.BorderRightStyle, PropertyNames.BorderBottomStyle, 7 | PropertyNames.BorderLeftStyle).OrDefault(); 8 | 9 | internal BorderStyleProperty() 10 | : base(PropertyNames.BorderStyle) 11 | { 12 | } 13 | 14 | internal override IValueConverter Converter => StyleConverter; 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderTopColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderTopColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.CurrentColorConverter.OrDefault(Color.Transparent); 7 | 8 | internal BorderTopColorProperty() 9 | : base(PropertyNames.BorderTopColor) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderTopProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class BorderTopProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | LineWidthConverter.Option().For(PropertyNames.BorderTopWidth), 9 | LineStyleConverter.Option().For(PropertyNames.BorderTopStyle), 10 | CurrentColorConverter.Option().For(PropertyNames.BorderTopColor) 11 | ).OrDefault(); 12 | 13 | internal BorderTopProperty() 14 | : base(PropertyNames.BorderTop, PropertyFlags.Animatable) 15 | { 16 | } 17 | 18 | internal override IValueConverter Converter => StyleConverter; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderTopStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderTopStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal BorderTopStyleProperty() 9 | : base(PropertyNames.BorderTopStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderTopWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderTopWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal BorderTopWidthProperty() 8 | : base(PropertyNames.BorderTopWidth, PropertyFlags.Unitless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Border/BorderWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderWidthProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.Periodic( 6 | PropertyNames.BorderTopWidth, PropertyNames.BorderRightWidth, PropertyNames.BorderBottomWidth, 7 | PropertyNames.BorderLeftWidth).OrDefault(); 8 | 9 | internal BorderWidthProperty() 10 | : base(PropertyNames.BorderWidth, PropertyFlags.Animatable) 11 | { 12 | } 13 | 14 | internal override IValueConverter Converter => StyleConverter; 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderImage/BorderImageOutsetProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderImageOutsetProperty : Property 4 | { 5 | internal static readonly IValueConverter TheConverter = Converters.LengthOrPercentConverter.Periodic(); 6 | private static readonly IValueConverter StyleConverter = TheConverter.OrDefault(Length.Zero); 7 | 8 | internal BorderImageOutsetProperty() 9 | : base(PropertyNames.BorderImageOutset) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderImage/BorderImageRepeatProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderImageRepeatProperty : Property 4 | { 5 | internal static readonly IValueConverter TheConverter = Map.BorderRepeatModes.ToConverter().Many(1, 2); 6 | private static readonly IValueConverter StyleConverter = TheConverter.OrDefault(BorderRepeat.Stretch); 7 | 8 | internal BorderImageRepeatProperty() 9 | : base(PropertyNames.BorderImageRepeat) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderImage/BorderImageSliceProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class BorderImageSliceProperty : Property 6 | { 7 | internal static readonly IValueConverter TheConverter = WithAny( 8 | BorderSliceConverter.Option(new Length(100f, Length.Unit.Percent)), 9 | BorderSliceConverter.Option(), 10 | BorderSliceConverter.Option(), 11 | BorderSliceConverter.Option(), 12 | Assign(Keywords.Fill, true).Option(false)); 13 | 14 | private static readonly IValueConverter StyleConverter = TheConverter.OrDefault(Length.Full); 15 | 16 | internal BorderImageSliceProperty() 17 | : base(PropertyNames.BorderImageSlice) 18 | { 19 | } 20 | 21 | internal override IValueConverter Converter => StyleConverter; 22 | } 23 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderImage/BorderImageSourceProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderImageSourceProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalImageSourceConverter.OrDefault(); 6 | 7 | internal BorderImageSourceProperty() 8 | : base(PropertyNames.BorderImageSource) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderImage/BorderImageWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderImageWidthProperty : Property 4 | { 5 | internal static readonly IValueConverter TheConverter = Converters.ImageBorderWidthConverter.Periodic(); 6 | private static readonly IValueConverter StyleConverter = TheConverter.OrDefault(Length.Full); 7 | 8 | internal BorderImageWidthProperty() 9 | : base(PropertyNames.BorderImageWidth) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderRadius/BorderBottomLeftRadiusProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderBottomLeftRadiusProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BorderRadiusConverter.OrDefault(Length.Zero); 7 | 8 | internal BorderBottomLeftRadiusProperty() 9 | : base(PropertyNames.BorderBottomLeftRadius, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderRadius/BorderBottomRightRadiusProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderBottomRightRadiusProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BorderRadiusConverter.OrDefault(Length.Zero); 7 | 8 | internal BorderBottomRightRadiusProperty() 9 | : base(PropertyNames.BorderBottomRightRadius, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderRadius/BorderRadiusProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderRadiusProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.BorderRadiusShorthandConverter.OrDefault(); 6 | 7 | internal BorderRadiusProperty() 8 | : base(PropertyNames.BorderRadius, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderRadius/BorderTopLeftRadiusProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderTopLeftRadiusProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BorderRadiusConverter.OrDefault(Length.Zero); 7 | 8 | internal BorderTopLeftRadiusProperty() 9 | : base(PropertyNames.BorderTopLeftRadius, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/BorderRadius/BorderTopRightRadiusProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BorderTopRightRadiusProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BorderRadiusConverter.OrDefault(Length.Zero); 7 | 8 | internal BorderTopRightRadiusProperty() 9 | : base(PropertyNames.BorderTopRightRadius, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/BoxDecorationBreak.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BoxDecorationBreak : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.BoxDecorationConverter.OrDefault(false); 6 | 7 | internal BoxDecorationBreak() 8 | : base(PropertyNames.BoxDecorationBreak) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/BoxShadowProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BoxShadowProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.MultipleShadowConverter.OrDefault(); 6 | 7 | internal BoxShadowProperty() 8 | : base(PropertyNames.BoxShadow, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/BoxSizingProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal class BoxSizingProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.BoxSizingConverter.OrDefault(Keywords.ContentBox); 6 | 7 | public BoxSizingProperty() 8 | : base(PropertyNames.BoxSizing, PropertyFlags.None) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/MarginBottomProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MarginBottomProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MarginBottomProperty() 9 | : base(PropertyNames.MarginBottom, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/MarginLeftProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MarginLeftProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MarginLeftProperty() 9 | : base(PropertyNames.MarginLeft, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/MarginProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MarginProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.AutoLengthOrPercentConverter.Periodic( 6 | PropertyNames.MarginTop, PropertyNames.MarginRight, PropertyNames.MarginBottom, 7 | PropertyNames.MarginLeft) 8 | .OrDefault(Length.Zero); 9 | 10 | internal MarginProperty() 11 | : base(PropertyNames.Margin) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/MarginRightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MarginRightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MarginRightProperty() 9 | : base(PropertyNames.MarginRight, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/MarginTopProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MarginTopProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MarginTopProperty() 9 | : base(PropertyNames.MarginTop, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/PaddingBottomProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PaddingBottomProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal PaddingBottomProperty() 9 | : base(PropertyNames.PaddingBottom, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/PaddingLeftProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PaddingLeftProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal PaddingLeftProperty() 9 | : base(PropertyNames.PaddingLeft, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/PaddingProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PaddingProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LengthOrPercentConverter.Periodic( 6 | PropertyNames.PaddingTop, PropertyNames.PaddingRight, PropertyNames.PaddingBottom, 7 | PropertyNames.PaddingLeft) 8 | .OrDefault(Length.Zero); 9 | 10 | internal PaddingProperty() 11 | : base(PropertyNames.Padding) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/PaddingRightProperty .cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PaddingRightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal PaddingRightProperty() 9 | : base(PropertyNames.PaddingRight, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Box/PaddingTopProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PaddingTopProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal PaddingTopProperty() 9 | : base(PropertyNames.PaddingTop, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/BreakAfterProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BreakAfterProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BreakModeConverter.OrDefault(BreakMode.Auto); 7 | 8 | internal BreakAfterProperty() 9 | : base(PropertyNames.BreakAfter) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/BreakBeforeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BreakBeforeProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.BreakModeConverter.OrDefault(BreakMode.Auto); 7 | 8 | internal BreakBeforeProperty() 9 | : base(PropertyNames.BreakBefore) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/BreakInsideProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BreakInsideProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.BreakInsideModeConverter.OrDefault(BreakMode.Auto); 7 | 8 | internal BreakInsideProperty() 9 | : base(PropertyNames.BreakInside) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/PageBreakAfterProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PageBreakAfterProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.PageBreakModeConverter.OrDefault(BreakMode.Auto); 7 | 8 | internal PageBreakAfterProperty() 9 | : base(PropertyNames.PageBreakAfter) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/PageBreakBeforeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PageBreakBeforeProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.PageBreakModeConverter.OrDefault(BreakMode.Auto); 7 | 8 | internal PageBreakBeforeProperty() 9 | : base(PropertyNames.PageBreakBefore) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Break/PageBreakInsideProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PageBreakInsideProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.Assign(Keywords.Auto, BreakMode.Auto) 7 | .Or(Keywords.Avoid, BreakMode.Avoid) 8 | .OrDefault(BreakMode.Auto); 9 | 10 | internal PageBreakInsideProperty() 11 | : base(PropertyNames.PageBreakInside) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/CaptionSideProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class CaptionSideProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.CaptionSideConverter.OrDefault(true); 6 | 7 | internal CaptionSideProperty() : base(PropertyNames.CaptionSide) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnCountProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnCountProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalIntegerConverter.OrDefault(); 6 | 7 | internal ColumnCountProperty() 8 | : base(PropertyNames.ColumnCount, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnFillProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnFillProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ColumnFillConverter.OrDefault(true); 6 | 7 | internal ColumnFillProperty() 8 | : base(PropertyNames.ColumnFill) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnGapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnGapProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter 7 | .OrGlobalValue() 8 | .OrDefault(new Length(1f, Length.Unit.Em)); 9 | 10 | internal ColumnGapProperty() 11 | : base(PropertyNames.ColumnGap, PropertyFlags.Animatable) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnRuleColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnRuleColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ColorConverter.OrDefault(Color.Transparent); 6 | 7 | internal ColumnRuleColorProperty() 8 | : base(PropertyNames.ColumnRuleColor, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnRuleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class ColumnRuleProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | ColorConverter.Option().For(PropertyNames.ColumnRuleColor), 9 | LineWidthConverter.Option().For(PropertyNames.ColumnRuleWidth), 10 | LineStyleConverter.Option().For(PropertyNames.ColumnRuleStyle)).OrDefault(); 11 | 12 | internal ColumnRuleProperty() 13 | : base(PropertyNames.ColumnRule, PropertyFlags.Animatable) 14 | { 15 | } 16 | 17 | internal override IValueConverter Converter => StyleConverter; 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnRuleStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnRuleStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal ColumnRuleStyleProperty() 9 | : base(PropertyNames.ColumnRuleStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnRuleWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnRuleWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal ColumnRuleWidthProperty() 8 | : base(PropertyNames.ColumnRuleWidth, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnSpanProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnSpanProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ColumnSpanConverter.OrDefault(false); 6 | 7 | internal ColumnSpanProperty() 8 | : base(PropertyNames.ColumnSpan) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColumnWidthProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.AutoLengthConverter.OrDefault(Keywords.Auto); 7 | 8 | internal ColumnWidthProperty() 9 | : base(PropertyNames.ColumnWidth, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Columns/ColumnsProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class ColumnsProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | AutoLengthConverter.Option().For(PropertyNames.ColumnWidth), 9 | OptionalIntegerConverter.Option().For(PropertyNames.ColumnCount)).OrDefault(); 10 | 11 | internal ColumnsProperty() 12 | : base(PropertyNames.Columns, PropertyFlags.Animatable) 13 | { 14 | } 15 | 16 | internal override IValueConverter Converter => StyleConverter; 17 | } 18 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Container/ContainerNameProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ContainerNameProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.StringConverter.OrDefault(); 7 | 8 | internal ContainerNameProperty() 9 | : base(PropertyNames.ContainerName) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Container/ContainerTypeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ContainerTypeProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.ContainerTypeConverter.OrDefault(Keywords.Normal); 7 | 8 | internal ContainerTypeProperty() 9 | : base(PropertyNames.ContainerType) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/BottomProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BottomProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal BottomProperty() 9 | : base(PropertyNames.Bottom, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/HeightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class HeightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal HeightProperty() 9 | : base(PropertyNames.Height, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/LeftProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class LeftProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal LeftProperty() 9 | : base(PropertyNames.Left, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/MaxHeightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MaxHeightProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.OptionalLengthOrPercentConverter.OrDefault(); 7 | 8 | internal MaxHeightProperty() 9 | : base(PropertyNames.MaxHeight, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/MaxWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MaxWidthProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.OptionalLengthOrPercentConverter.OrDefault(); 7 | 8 | internal MaxWidthProperty() 9 | : base(PropertyNames.MaxWidth, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/MinHeightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MinHeightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MinHeightProperty() 9 | : base(PropertyNames.MinHeight, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/MinWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MinWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal MinWidthProperty() 9 | : base(PropertyNames.MinWidth, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/RightProperty .cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class RightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal RightProperty() 9 | : base(PropertyNames.Right, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/TopProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TopProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal TopProperty() 9 | : base(PropertyNames.Top, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Coordinate/WidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.AutoLengthOrPercentConverter.OrDefault(Keywords.Auto); 7 | 8 | internal WidthProperty() 9 | : base(PropertyNames.Width, PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/CursorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class CursorProperty : Property 6 | { 7 | private static readonly IValueConverter StyleConverter = ImageSourceConverter.Or( 8 | WithOrder( 9 | ImageSourceConverter.Required(), 10 | NumberConverter.Required(), 11 | NumberConverter.Required())).RequiresEnd( 12 | Map.Cursors.ToConverter()).OrDefault(SystemCursor.Auto); 13 | 14 | internal CursorProperty() 15 | : base(PropertyNames.Cursor, PropertyFlags.Inherited) 16 | { 17 | } 18 | 19 | internal override IValueConverter Converter => StyleConverter; 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/EmptyCellsProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class EmptyCellsProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.EmptyCellsConverter.OrDefault(true); 6 | 7 | internal EmptyCellsProperty() 8 | : base(PropertyNames.EmptyCells, PropertyFlags.Inherited) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/FeatureProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FeatureProperty : Property 4 | { 5 | internal FeatureProperty(MediaFeature feature) 6 | : base(feature.Name) 7 | { 8 | Feature = feature; 9 | } 10 | 11 | 12 | internal override IValueConverter Converter => Feature.Converter; 13 | 14 | internal MediaFeature Feature { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Fill/FillOpacityProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FillOpacityProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.NumberConverter.OrDefault(1f); 6 | 7 | internal FillOpacityProperty() 8 | : base(PropertyNames.FillOpacity, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Fill/FillProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FillProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.PaintConverter; 6 | 7 | internal FillProperty() 8 | : base(PropertyNames.Fill, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Fill/FillRuleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FillRuleProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.FillRuleConverter.OrDefault(FillRule.Nonzero); 7 | 8 | public FillRuleProperty() 9 | : base(PropertyNames.FillRule, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/AlignContentProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AlignContentProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.AlignContentConverter; 6 | 7 | internal AlignContentProperty() 8 | : base(PropertyNames.AlignContent) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/AlignItemsProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AlignItemsProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.AlignItemsConverter 6 | .OrDefault(Keywords.Normal); 7 | 8 | internal AlignItemsProperty() 9 | : base(PropertyNames.AlignItems) 10 | { } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/AlignSelfProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class AlignSelfProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.AlignSelfConverter; 6 | 7 | internal AlignSelfProperty() 8 | : base(PropertyNames.AlignSelf) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexBasisProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexBasisProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexBasisConverter; 6 | 7 | internal FlexBasisProperty() 8 | : base(PropertyNames.FlexBasis) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexDirectionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexDirectionProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexDirectionConverter; 6 | 7 | internal FlexDirectionProperty() 8 | : base(PropertyNames.FlexDirection) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexFlowProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexFlowProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexFlowConverter; 6 | 7 | internal FlexFlowProperty() 8 | : base(PropertyNames.FlexFlow) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexGrowProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexGrowProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexGrowShrinkConverter; 6 | 7 | internal FlexGrowProperty() 8 | : base(PropertyNames.FlexGrow) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexConverter; 6 | 7 | internal FlexProperty() 8 | : base(PropertyNames.Flex) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexShrinkProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexShrinkProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexGrowShrinkConverter; 6 | 7 | internal FlexShrinkProperty() 8 | : base(PropertyNames.FlexShrink) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/FlexWrapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FlexWrapProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FlexWrapConverter; 6 | 7 | internal FlexWrapProperty() 8 | : base(PropertyNames.FlexWrap) 9 | { } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/JustifyContentProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class JustifyContentProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.JustifyContentConverter 6 | .OrDefault(Keywords.Normal); 7 | 8 | internal JustifyContentProperty() 9 | : base(PropertyNames.JustifyContent) 10 | { } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flexbox/OrderProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OrderProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.IntegerConverter 6 | .OrGlobalValue() 7 | .OrDefault(0); 8 | 9 | internal OrderProperty() 10 | : base(PropertyNames.Order) 11 | { } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/ClearProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ClearProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.ClearModeConverter.OrDefault(ClearMode.None); 7 | 8 | internal ClearProperty() 9 | : base(PropertyNames.Clear) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/DisplayProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DisplayProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.DisplayModeConverter.OrDefault(DisplayMode.Inline); 7 | 8 | internal DisplayProperty() 9 | : base(PropertyNames.Display) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/FloatProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FloatProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.FloatingConverter.OrDefault(Floating.None); 6 | 7 | internal FloatProperty() 8 | : base(PropertyNames.Float) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/OverflowProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OverflowProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.OverflowModeConverter.OrDefault(Overflow.Visible); 7 | 8 | internal OverflowProperty() 9 | : base(PropertyNames.Overflow) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/PositionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PositionProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.PositionModeConverter.OrDefault(PositionMode.Static); 7 | 8 | internal PositionProperty() 9 | : base(PropertyNames.Position) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Flow/ZIndexProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ZIndexProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalIntegerConverter.OrDefault(); 6 | 7 | internal ZIndexProperty() 8 | : base(PropertyNames.ZIndex, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/ColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ColorConverter.OrDefault(Color.Black); 6 | 7 | internal ColorProperty() 8 | : base(PropertyNames.Color, PropertyFlags.Inherited | PropertyFlags.Hashless | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontSizeAdjustProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FontSizeAdjustProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalNumberConverter.OrDefault(); 6 | 7 | internal FontSizeAdjustProperty() 8 | : base(PropertyNames.FontSizeAdjust, PropertyFlags.Inherited | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontSizeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FontSizeProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.FontSizeConverter.OrDefault(FontSize.Medium.ToLength()); 7 | 8 | internal FontSizeProperty() 9 | : base(PropertyNames.FontSize, PropertyFlags.Inherited | PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontStretchProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FontStretchProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.FontStretchConverter.OrDefault(FontStretch.Normal); 7 | 8 | internal FontStretchProperty() 9 | : base(PropertyNames.FontStretch, PropertyFlags.Inherited | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FontStyleProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.FontStyleConverter.OrDefault(FontStyle.Normal); 7 | 8 | internal FontStyleProperty() 9 | : base(PropertyNames.FontStyle, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontVariantProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class FontVariantProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.FontVariantConverter.OrDefault(FontVariant.Normal); 7 | 8 | internal FontVariantProperty() 9 | : base(PropertyNames.FontVariant, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/FontWeightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class FontWeightProperty : Property 6 | { 7 | private static readonly IValueConverter StyleConverter = FontWeightConverter.Or( 8 | WeightIntegerConverter).OrDefault(FontWeight.Normal); 9 | 10 | internal FontWeightProperty() 11 | : base(PropertyNames.FontWeight, PropertyFlags.Inherited | PropertyFlags.Animatable) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/LetterSpacingProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class LetterSpacingProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalLengthConverter.OrDefault(); 6 | 7 | internal LetterSpacingProperty() 8 | : base(PropertyNames.LetterSpacing, PropertyFlags.Inherited | PropertyFlags.Unitless) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/LineHeightProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class LineHeightProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LineHeightConverter.OrDefault(new Length(120f, Length.Unit.Percent)); 7 | 8 | internal LineHeightProperty() 9 | : base(PropertyNames.LineHeight, PropertyFlags.Inherited | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/SrcProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class SrcProperty : Property 4 | { 5 | public SrcProperty() 6 | : base(PropertyNames.Src) 7 | { 8 | } 9 | 10 | internal override IValueConverter Converter => Converters.Any; 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/UnicodeRangeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UnicodeRangeProperty : Property 4 | { 5 | public UnicodeRangeProperty() 6 | : base(PropertyNames.UnicodeRange) 7 | { 8 | } 9 | 10 | internal override IValueConverter Converter => Converters.Any; 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Font/WordSpacingProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WordSpacingProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalLengthConverter.OrDefault(); 6 | 7 | internal WordSpacingProperty() 8 | : base( 9 | PropertyNames.WordSpacing, PropertyFlags.Inherited | PropertyFlags.Unitless | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/GapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal class GapProperty : ShorthandProperty 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LengthOrPercentConverter 6 | .OrGlobalValue() 7 | .Periodic(PropertyNames.RowGap, PropertyNames.ColumnGap); 8 | 9 | internal GapProperty() 10 | : base(PropertyNames.Gap, PropertyFlags.Animatable) 11 | { } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/IProperties .cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IProperties : IEnumerable 6 | { 7 | string this[string propertyName] { get; } 8 | int Length { get; } 9 | string GetPropertyValue(string propertyName); 10 | string GetPropertyPriority(string propertyName); 11 | void SetProperty(string propertyName, string propertyValue, string priority = null); 12 | string RemoveProperty(string propertyName); 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/IProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IProperty : IStylesheetNode 4 | { 5 | string Name { get; } 6 | string Value { get; } 7 | string Original { get; } 8 | bool IsImportant { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/IPropertyValue.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal interface IPropertyValue 4 | { 5 | string CssText { get; } 6 | TokenValue Original { get; } 7 | TokenValue ExtractFor(string name); 8 | } 9 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/CounterIncrementProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class CounterIncrementProperty : Property 6 | { 7 | private static readonly IValueConverter StyleConverter = Continuous( 8 | WithOrder(IdentifierConverter.Required(), IntegerConverter.Option(1))).OrDefault(); 9 | 10 | internal CounterIncrementProperty() 11 | : base(PropertyNames.CounterIncrement) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/CounterResetProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class CounterResetProperty : Property 6 | { 7 | private static readonly IValueConverter StyleConverter = Continuous( 8 | WithOrder(IdentifierConverter.Required(), IntegerConverter.Option(0))).OrDefault(); 9 | 10 | internal CounterResetProperty() 11 | : base(PropertyNames.CounterReset) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/ListStyleImageProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ListStyleImageProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalImageSourceConverter.OrDefault(); 6 | 7 | internal ListStyleImageProperty() 8 | : base(PropertyNames.ListStyleImage, PropertyFlags.Inherited) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/ListStylePositionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ListStylePositionProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.ListPositionConverter.OrDefault(ListPosition.Outside); 7 | 8 | internal ListStylePositionProperty() 9 | : base(PropertyNames.ListStylePosition, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/ListStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class ListStyleProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | ListStyleConverter.Option().For(PropertyNames.ListStyleType), 9 | ListPositionConverter.Option().For(PropertyNames.ListStylePosition), 10 | OptionalImageSourceConverter.Option().For(PropertyNames.ListStyleImage)).OrDefault(); 11 | 12 | internal ListStyleProperty() 13 | : base(PropertyNames.ListStyle, PropertyFlags.Inherited) 14 | { 15 | } 16 | 17 | internal override IValueConverter Converter => StyleConverter; 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/List/ListStyleTypeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ListStyleTypeProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.ListStyleConverter.OrDefault(ListStyle.Disc); 7 | 8 | internal ListStyleTypeProperty() 9 | : base(PropertyNames.ListStyleType, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/OrphansProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OrphansProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.NaturalIntegerConverter.OrDefault(2); 6 | 7 | internal OrphansProperty() 8 | : base(PropertyNames.Orphans, PropertyFlags.Inherited) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Outline/OutlineColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OutlineColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.InvertedColorConverter.OrDefault(Color.Transparent); 7 | 8 | internal OutlineColorProperty() 9 | : base(PropertyNames.OutlineColor, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Outline/OutlineProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class OutlineProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | LineWidthConverter.Option().For(PropertyNames.OutlineWidth), 9 | LineStyleConverter.Option().For(PropertyNames.OutlineStyle), 10 | InvertedColorConverter.Option().For(PropertyNames.OutlineColor)).OrDefault(); 11 | 12 | internal OutlineProperty() 13 | : base(PropertyNames.Outline, PropertyFlags.Animatable) 14 | { 15 | } 16 | 17 | internal override IValueConverter Converter => StyleConverter; 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Outline/OutlineStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OutlineStyleProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | StyleConverter = Converters.LineStyleConverter.OrDefault(LineStyle.None); 7 | 8 | internal OutlineStyleProperty() 9 | : base(PropertyNames.OutlineStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Outline/OutlineWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OutlineWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LineWidthConverter.OrDefault(Length.Medium); 6 | 7 | internal OutlineWidthProperty() 8 | : base(PropertyNames.OutlineWidth, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/QuotesProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class QuotesProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.EvenStringsConverter.OrNone().OrDefault(new[] {"«", "»"}); 7 | 8 | internal QuotesProperty() 9 | : base(PropertyNames.Quotes, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/RowGapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class RowGapProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LengthOrPercentConverter 6 | .OrGlobalValue() 7 | .OrDefault(0); 8 | 9 | internal RowGapProperty() 10 | : base(PropertyNames.RowGap, PropertyFlags.Animatable) 11 | { } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/ShorthandProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal abstract class ShorthandProperty : Property 4 | { 5 | protected ShorthandProperty(string name, PropertyFlags flags = PropertyFlags.None) 6 | : base(name, flags | PropertyFlags.Shorthand) 7 | { 8 | } 9 | 10 | public string Stringify(Property[] properties) 11 | { 12 | return Converter.Construct(properties)?.CssText; 13 | } 14 | 15 | public void Export(Property[] properties) 16 | { 17 | foreach (var property in properties) 18 | { 19 | var value = DeclaredValue.ExtractFor(property.Name); 20 | 21 | if (property.TrySetValue(value)) property.IsImportant = IsImportant; 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Sizing/ObjectFitProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ObjectFitProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.ObjectFittingConverter.OrDefault(ObjectFitting.Fill); 7 | 8 | internal ObjectFitProperty() 9 | : base(PropertyNames.ObjectFit) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Sizing/ObjectPositionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ObjectPositionProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.PointConverter.OrDefault(Point.Center); 6 | 7 | internal ObjectPositionProperty() 8 | : base(PropertyNames.ObjectPosition, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeDasharrayProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeDasharrayProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.StrokeDasharrayConverter; 6 | 7 | public StrokeDasharrayProperty() 8 | : base(PropertyNames.StrokeDasharray, PropertyFlags.Animatable | PropertyFlags.Unitless) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeDashoffsetProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeDashoffsetProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LengthOrPercentConverter; 6 | 7 | public StrokeDashoffsetProperty() 8 | : base(PropertyNames.StrokeDashoffset, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeLinecapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeLinecapProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.StrokeLinecapConverter.OrDefault(StrokeLinecap.Butt); 7 | 8 | public StrokeLinecapProperty() 9 | : base(PropertyNames.StrokeLinecap, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeLinejoinProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeLinejoinProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.StrokeLinejoinConverter; 6 | 7 | public StrokeLinejoinProperty() 8 | : base(PropertyNames.StrokeLinejoin, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeMiterlimitProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeMiterlimitProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.StrokeMiterlimitConverter; 6 | 7 | public StrokeMiterlimitProperty() 8 | : base(PropertyNames.StrokeMiterlimit, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeOpacityProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeOpacityProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.NumberConverter.OrDefault(1f); 6 | 7 | internal StrokeOpacityProperty() 8 | : base(PropertyNames.StrokeOpacity, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.PaintConverter; 6 | 7 | internal StrokeProperty() 8 | : base(PropertyNames.Stroke, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Stroke/StrokeWidthProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StrokeWidthProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.LengthOrPercentConverter; 6 | 7 | internal StrokeWidthProperty() 8 | : base(PropertyNames.StrokeWidth, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/TableLayoutProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TableLayoutProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.TableLayoutConverter.OrDefault(false); 6 | 7 | internal TableLayoutProperty() 8 | : base(PropertyNames.TableLayout) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/DirectionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class DirectionProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.DirectionModeConverter.OrDefault(DirectionMode.Ltr); 7 | 8 | internal DirectionProperty() 9 | : base(PropertyNames.Direction, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/OverflowWrapProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OverflowWrapProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OverflowWrapConverter; 6 | 7 | public OverflowWrapProperty() 8 | : base(PropertyNames.OverflowWrap) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextAlignLastProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextAlignLastProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.TextAlignLastConverter; 6 | 7 | public TextAlignLastProperty() 8 | : base(PropertyNames.TextAlignLast) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextAlignProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextAlignProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.HorizontalAlignmentConverter.OrDefault(HorizontalAlignment.Left); 7 | 8 | internal TextAlignProperty() 9 | : base(PropertyNames.TextAlign, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextAnchorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextAnchorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.TextAnchorConverter; 6 | 7 | public TextAnchorProperty() 8 | : base(PropertyNames.TextAnchor) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextDecorationColorProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextDecorationColorProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ColorConverter.OrDefault(Color.Black); 6 | 7 | internal TextDecorationColorProperty() 8 | : base(PropertyNames.TextDecorationColor, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextDecorationLineProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextDecorationLineProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = Converters.TextDecorationLinesConverter.OrDefault(); 6 | 7 | internal TextDecorationLineProperty() 8 | : base(PropertyNames.TextDecorationLine) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => ListConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextDecorationProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class TextDecorationProperty : ShorthandProperty 6 | { 7 | private static readonly IValueConverter StyleConverter = WithAny( 8 | ColorConverter.Option().For(PropertyNames.TextDecorationColor), 9 | TextDecorationStyleConverter.Option().For(PropertyNames.TextDecorationStyle), 10 | TextDecorationLinesConverter.Option().For(PropertyNames.TextDecorationLine)).OrDefault(); 11 | 12 | internal TextDecorationProperty() 13 | : base(PropertyNames.TextDecoration, PropertyFlags.Animatable) 14 | { 15 | } 16 | 17 | internal override IValueConverter Converter => StyleConverter; 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextDecorationStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextDecorationStyleProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.TextDecorationStyleConverter.OrDefault(TextDecorationStyle.Solid); 7 | 8 | internal TextDecorationStyleProperty() 9 | : base(PropertyNames.TextDecorationStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextIndentProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextIndentProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthOrPercentConverter.OrDefault(Length.Zero); 7 | 8 | internal TextIndentProperty() 9 | : base(PropertyNames.TextIndent, PropertyFlags.Inherited | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextJustifyProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextJustifyProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.TextJustifyConverter; 6 | 7 | public TextJustifyProperty() 8 | : base(PropertyNames.TextJustify) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextShadowProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextShadowProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.MultipleShadowConverter.OrDefault(); 6 | 7 | internal TextShadowProperty() 8 | : base(PropertyNames.TextShadow, PropertyFlags.Inherited | PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/TextTransformProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TextTransformProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.TextTransformConverter.OrDefault(TextTransform.None); 7 | 8 | internal TextTransformProperty() 9 | : base(PropertyNames.TextTransform, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/VerticalAlignProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class VerticalAlignProperty : Property 6 | { 7 | private static readonly IValueConverter StyleConverter = LengthOrPercentConverter.Or( 8 | VerticalAlignmentConverter).OrDefault(VerticalAlignment.Baseline); 9 | 10 | internal VerticalAlignProperty() 11 | : base(PropertyNames.VerticalAlign, PropertyFlags.Animatable) 12 | { 13 | } 14 | 15 | internal override IValueConverter Converter => StyleConverter; 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/WhiteSpaceProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WhiteSpaceProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.WhitespaceConverter.OrDefault(Whitespace.Normal); 7 | 8 | internal WhiteSpaceProperty() 9 | : base(PropertyNames.WhiteSpace, PropertyFlags.Inherited) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Text/WordBreakProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WordBreakProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.WordBreakConverter; 6 | 7 | public WordBreakProperty() 8 | : base(PropertyNames.WordBreak) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transform/PerspectiveProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PerspectiveProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.LengthConverter.OrNone().OrDefault(Length.Zero); 7 | 8 | internal PerspectiveProperty() 9 | : base(PropertyNames.Perspective, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transform/TransformProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransformProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.TransformConverter.Many().OrNone().OrDefault(); 7 | 8 | internal TransformProperty() 9 | : base(PropertyNames.Transform, PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transform/TransformStyleProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransformStyleProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.Toggle(Keywords.Flat, Keywords.Preserve3d).OrDefault(true); 7 | 8 | internal TransformStyleProperty() 9 | : base(PropertyNames.TransformStyle) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transition/TransitionDelayProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransitionDelayProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | ListConverter = Converters.TimeConverter.FromList().OrDefault(Time.Zero); 7 | 8 | internal TransitionDelayProperty() 9 | : base(PropertyNames.TransitionDelay) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transition/TransitionDurationProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransitionDurationProperty : Property 4 | { 5 | private static readonly IValueConverter 6 | ListConverter = Converters.TimeConverter.FromList().OrDefault(Time.Zero); 7 | 8 | internal TransitionDurationProperty() 9 | : base(PropertyNames.TransitionDuration) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transition/TransitionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | using static Converters; 4 | 5 | internal sealed class TransitionProperty : ShorthandProperty 6 | { 7 | internal static readonly IValueConverter ListConverter = WithAny( 8 | AnimatableConverter.Option().For(PropertyNames.TransitionProperty), 9 | TimeConverter.Option().For(PropertyNames.TransitionDuration), 10 | TransitionConverter.Option().For(PropertyNames.TransitionTimingFunction), 11 | TimeConverter.Option().For(PropertyNames.TransitionDelay)).FromList().OrDefault(); 12 | 13 | internal TransitionProperty() 14 | : base(PropertyNames.Transition) 15 | { 16 | } 17 | 18 | internal override IValueConverter Converter => ListConverter; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transition/TransitionPropertyProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransitionPropertyProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.AnimatableConverter.FromList().OrNone().OrDefault(Keywords.All); 7 | 8 | internal TransitionPropertyProperty() 9 | : base(PropertyNames.TransitionProperty) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Transition/TransitionTimingFunctionProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TransitionTimingFunctionProperty : Property 4 | { 5 | private static readonly IValueConverter ListConverter = 6 | Converters.TransitionConverter.FromList().OrDefault(Map.TimingFunctions[Keywords.Ease]); 7 | 8 | internal TransitionTimingFunctionProperty() 9 | : base(PropertyNames.TransitionTimingFunction) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => ListConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/UnicodeBidirectionalProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UnicodeBidirectionalProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.UnicodeModeConverter.OrDefault(UnicodeMode.Normal); 7 | 8 | internal UnicodeBidirectionalProperty() 9 | : base(PropertyNames.UnicodeBidirectional) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/UnknownProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UnknownProperty : Property 4 | { 5 | internal UnknownProperty(string name) 6 | : base(name) 7 | { 8 | } 9 | 10 | internal override IValueConverter Converter => Converters.Any; 11 | } 12 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Visibility/BackfaceVisibilityProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class BackfaceVisibilityProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.BackfaceVisibilityConverter.OrDefault(true); 6 | 7 | internal BackfaceVisibilityProperty() 8 | : base(PropertyNames.BackfaceVisibility) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Visibility/ClipProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ClipProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.ShapeConverter.OrDefault(); 6 | 7 | internal ClipProperty() 8 | : base(PropertyNames.Clip, PropertyFlags.Animatable) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Visibility/OpacityProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class OpacityProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.OptionalPercentOrNumberConverter; 6 | 7 | internal OpacityProperty() : base(PropertyNames.Opacity, PropertyFlags.Animatable) 8 | { 9 | } 10 | 11 | internal override IValueConverter Converter => StyleConverter; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/Visibility/VisibilityProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class VisibilityProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = 6 | Converters.VisibilityConverter.OrDefault(Visibility.Visible); 7 | 8 | internal VisibilityProperty() 9 | : base(PropertyNames.Visibility, PropertyFlags.Inherited | PropertyFlags.Animatable) 10 | { 11 | } 12 | 13 | internal override IValueConverter Converter => StyleConverter; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ExCSS/StyleProperties/WidowsProperty.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class WidowsProperty : Property 4 | { 5 | private static readonly IValueConverter StyleConverter = Converters.IntegerConverter.OrDefault(2); 6 | 7 | internal WidowsProperty() 8 | : base(PropertyNames.Widows, PropertyFlags.Inherited) 9 | { 10 | } 11 | 12 | internal override IValueConverter Converter => StyleConverter; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/ColorToken.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ColorToken : Token 4 | { 5 | public ColorToken(string data, TextPosition position) 6 | : base(TokenType.Color, data, position) 7 | { 8 | } 9 | 10 | public bool IsValid => Data.Length != 3 && Data.Length != 4 && Data.Length != 6 && Data.Length != 8; 11 | 12 | public override string ToValue() 13 | { 14 | return "#" + Data; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/CommentToken.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class CommentToken : Token 4 | { 5 | public CommentToken(string data, bool valid, TextPosition position) 6 | : base(TokenType.Comment, data, position) 7 | { 8 | IsValid = valid; 9 | } 10 | 11 | public bool IsValid { get; } 12 | 13 | public override string ToValue() 14 | { 15 | var trailing = IsValid ? string.Empty : "*/"; 16 | return string.Concat("/*", Data, trailing); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/KeywordToken.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class KeywordToken : Token 4 | { 5 | public KeywordToken(TokenType type, string data, TextPosition position) 6 | : base(type, data, position) 7 | { 8 | } 9 | 10 | public override string ToValue() 11 | { 12 | switch (Type) 13 | { 14 | case TokenType.Hash: 15 | return "#" + Data; 16 | case TokenType.AtKeyword: 17 | return "@" + Data; 18 | case TokenType.Function: 19 | return Data + "("; 20 | default: 21 | return Data; 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/StringToken.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class StringToken : Token 4 | { 5 | public StringToken(string data, bool valid, char quote, TextPosition position) 6 | : base(TokenType.String, data, position) 7 | { 8 | IsValid = valid; 9 | Quote = quote; 10 | } 11 | 12 | public override string ToValue() 13 | { 14 | return Data.StylesheetString(); 15 | } 16 | 17 | public bool IsValid { get; } 18 | public char Quote { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/Token.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal class Token 4 | { 5 | public static readonly Token Whitespace = new(TokenType.Whitespace, " ", TextPosition.Empty); 6 | public static readonly Token Comma = new(TokenType.Comma, ",", TextPosition.Empty); 7 | 8 | public Token(TokenType type, string data, TextPosition position) 9 | { 10 | Type = type; 11 | Data = data; 12 | Position = position; 13 | } 14 | 15 | public virtual string ToValue() 16 | { 17 | return Data; 18 | } 19 | 20 | public TextPosition Position { get; } 21 | public TokenType Type { get; } 22 | public string Data { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/UnitToken.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class UnitToken : Token 6 | { 7 | public UnitToken(TokenType type, string value, string dimension, TextPosition position) 8 | : base(type, value, position) 9 | { 10 | Unit = dimension; 11 | } 12 | 13 | public override string ToValue() 14 | { 15 | return Data + Unit; 16 | } 17 | 18 | public float Value => float.Parse(Data, CultureInfo.InvariantCulture); 19 | 20 | public string Unit { get; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/ExCSS/Tokens/UrlToken.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class UrlToken : Token 4 | { 5 | public UrlToken(string functionName, string data, bool valid, TextPosition position) 6 | : base(TokenType.Url, data, position) 7 | { 8 | IsValid = valid; 9 | FunctionName = functionName; 10 | } 11 | 12 | public override string ToValue() 13 | { 14 | var url = Data.StylesheetString(); 15 | return FunctionName.StylesheetFunction(url); 16 | } 17 | 18 | public bool IsValid { get; } 19 | public string FunctionName { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/ValueConverters/OrValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class OrValueConverter : IValueConverter 6 | { 7 | private readonly IValueConverter _next; 8 | private readonly IValueConverter _previous; 9 | 10 | public OrValueConverter(IValueConverter previous, IValueConverter next) 11 | { 12 | _previous = previous; 13 | _next = next; 14 | } 15 | 16 | public IPropertyValue Convert(IEnumerable value) 17 | { 18 | return _previous.Convert(value) ?? _next.Convert(value); 19 | } 20 | 21 | public IPropertyValue Construct(Property[] properties) 22 | { 23 | return _previous.Construct(properties) ?? _next.Construct(properties); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/ExCSS/ValueConverters/RequiredValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace ExCSS 5 | { 6 | internal sealed class RequiredValueConverter : IValueConverter 7 | { 8 | private readonly IValueConverter _converter; 9 | 10 | public RequiredValueConverter(IValueConverter converter) 11 | { 12 | _converter = converter; 13 | } 14 | 15 | public IPropertyValue Convert(IEnumerable value) 16 | { 17 | return value.Any() ? _converter.Convert(value) : null; 18 | } 19 | 20 | public IPropertyValue Construct(Property[] properties) 21 | { 22 | return _converter.Construct(properties); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/Counter.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class Counter 4 | { 5 | public Counter(string identifier, string listStyle, string separator) 6 | { 7 | CounterIdentifier = identifier; 8 | ListStyle = listStyle; 9 | DefinedSeparator = separator; 10 | } 11 | 12 | public string CounterIdentifier { get; } 13 | public string ListStyle { get; } 14 | public string DefinedSeparator { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/CubicBezierTimingFunction.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class CubicBezierTimingFunction : ITimingFunction 4 | { 5 | public CubicBezierTimingFunction(float x1, float y1, float x2, float y2) 6 | { 7 | X1 = x1; 8 | Y1 = y1; 9 | X2 = x2; 10 | Y2 = y2; 11 | } 12 | 13 | public float X1 { get; } 14 | public float Y1 { get; } 15 | public float X2 { get; } 16 | public float Y2 { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/GradientStop.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public struct GradientStop 4 | { 5 | public GradientStop(Color color, Length location) 6 | { 7 | Color = color; 8 | Location = location; 9 | } 10 | 11 | public Color Color { get; } 12 | public Length Location { get; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/IGradient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | public interface IGradient : IImageSource 6 | { 7 | IEnumerable Stops { get; } 8 | bool IsRepeating { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/IImageSource.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface IImageSource 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/ITimingFunction.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface ITimingFunction 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/ITransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public interface ITransform 4 | { 5 | TransformMatrix ComputeMatrix(); 6 | } 7 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/LinearGradient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace ExCSS 5 | { 6 | public sealed class LinearGradient : IGradient 7 | { 8 | public LinearGradient(Angle angle, GradientStop[] stops, bool repeating = false) 9 | { 10 | _stops = stops; 11 | Angle = angle; 12 | IsRepeating = repeating; 13 | } 14 | 15 | private readonly GradientStop[] _stops; 16 | 17 | public Angle Angle { get; } 18 | public IEnumerable Stops => _stops.AsEnumerable(); 19 | public bool IsRepeating { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/MatrixTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class MatrixTransform : ITransform 4 | { 5 | private readonly float[] _values; 6 | 7 | internal MatrixTransform(float[] values) 8 | { 9 | _values = values; 10 | } 11 | 12 | public TransformMatrix ComputeMatrix() 13 | { 14 | return new (_values); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/PerspectiveTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class PerspectiveTransform : ITransform 4 | { 5 | private readonly Length _distance; 6 | 7 | internal PerspectiveTransform(Length distance) 8 | { 9 | _distance = distance; 10 | } 11 | 12 | public TransformMatrix ComputeMatrix() 13 | { 14 | return new ( 15 | 1f, 16 | 0f, 17 | 0f, 18 | 0f, 19 | 1f, 20 | 0f, 21 | 0f, 22 | 0f, 23 | 1f, 24 | 0f, 25 | 0f, 26 | 0f, 27 | 0f, 28 | 0f, 29 | -1f/_distance.ToPixel()); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/PortNumbers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ExCSS 4 | { 5 | internal static class PortNumbers 6 | { 7 | private static readonly Dictionary Ports = new() 8 | { 9 | {ProtocolNames.Http, "80"}, 10 | {ProtocolNames.Https, "443"}, 11 | {ProtocolNames.Ftp, "21"}, 12 | {ProtocolNames.File, ""}, 13 | {ProtocolNames.Ws, "80"}, 14 | {ProtocolNames.Wss, "443"}, 15 | {ProtocolNames.Gopher, "70"}, 16 | {ProtocolNames.Telnet, "23"}, 17 | {ProtocolNames.Ssh, "22"} 18 | }; 19 | 20 | public static string GetDefaultPort(string protocol) 21 | { 22 | Ports.TryGetValue(protocol, out var value); 23 | return value; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/ScaleTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class ScaleTransform : ITransform 4 | { 5 | private readonly float _sx; 6 | private readonly float _sy; 7 | private readonly float _sz; 8 | 9 | internal ScaleTransform(float sx, float sy, float sz) 10 | { 11 | _sx = sx; 12 | _sy = sy; 13 | _sz = sz; 14 | } 15 | 16 | public TransformMatrix ComputeMatrix() 17 | { 18 | return new(_sx, 0f, 0f, 0f, _sy, 0f, 0f, 0f, _sz, 0f, 0f, 0f, 0f, 0f, 0f); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/Shadow.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class Shadow 4 | { 5 | public Shadow(bool inset, Length offsetX, Length offsetY, Length blurRadius, Length spreadRadius, Color color) 6 | { 7 | IsInset = inset; 8 | OffsetX = offsetX; 9 | OffsetY = offsetY; 10 | BlurRadius = blurRadius; 11 | SpreadRadius = spreadRadius; 12 | Color = color; 13 | } 14 | 15 | public Color Color { get; } 16 | public Length OffsetX { get; } 17 | public Length OffsetY { get; } 18 | public Length BlurRadius { get; } 19 | public Length SpreadRadius { get; } 20 | public bool IsInset { get; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/Shape.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | public sealed class Shape 4 | { 5 | public Shape(Length top, Length right, Length bottom, Length left) 6 | { 7 | Top = top; 8 | Right = right; 9 | Bottom = bottom; 10 | Left = left; 11 | } 12 | 13 | public Length Top { get; } 14 | public Length Right { get; } 15 | public Length Bottom { get; } 16 | public Length Left { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/SkewTransform.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | internal sealed class SkewTransform : ITransform 6 | { 7 | internal SkewTransform(float alpha, float beta) 8 | { 9 | Alpha = alpha; 10 | Beta = beta; 11 | } 12 | 13 | public TransformMatrix ComputeMatrix() 14 | { 15 | var a = (float) Math.Tan(Alpha); 16 | var b = (float) Math.Tan(Beta); 17 | return new TransformMatrix(1f, a, 0f, b, 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 0f); 18 | } 19 | 20 | public float Alpha { get; } 21 | public float Beta { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/StepsTimingFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ExCSS 4 | { 5 | public sealed class StepsTimingFunction : ITimingFunction 6 | { 7 | public StepsTimingFunction(int intervals, bool start = false) 8 | { 9 | Intervals = Math.Max(1, intervals); 10 | IsStart = start; 11 | } 12 | 13 | public int Intervals { get; } 14 | public bool IsStart { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ExCSS/Values/TranslateTransform.cs: -------------------------------------------------------------------------------- 1 | namespace ExCSS 2 | { 3 | internal sealed class TranslateTransform : ITransform 4 | { 5 | internal TranslateTransform(Length x, Length y, Length z) 6 | { 7 | Dx = x; 8 | Dy = y; 9 | Dz = z; 10 | } 11 | 12 | public TransformMatrix ComputeMatrix() 13 | { 14 | var dx = Dx.ToPixel(); 15 | var dy = Dy.ToPixel(); 16 | var dz = Dz.ToPixel(); 17 | return new TransformMatrix(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f, dx, dy, dz, 0f, 0f, 0f); 18 | } 19 | 20 | public Length Dx { get; } 21 | public Length Dy { get; } 22 | public Length Dz { get; } 23 | } 24 | } --------------------------------------------------------------------------------