From d7af53291b5eb49177a72513f176724306ec8b53 Mon Sep 17 00:00:00 2001 From: Adam Davis Date: Sun, 10 Mar 2019 21:47:39 -0400 Subject: [PATCH] Improved and added to docs --- src/main/groovy/org/groocss/Color.groovy | 13 +++++++++++ src/main/groovy/org/groocss/Config.groovy | 10 ++++++++- .../groovy/org/groocss/Measurement.groovy | 6 ++--- .../groovy/org/groocss/PseudoClass.groovy | 7 ++++++ src/main/groovy/org/groocss/Raw.groovy | 2 +- .../groocss/valid/AbstractValidator.groovy | 2 -- .../org/groocss/valid/DefaultValidator.groovy | 5 +++++ .../groovy/org/groocss/valid/Processor.groovy | 22 ++++++++++++++----- .../groocss/valid/RequireMeasurements.groovy | 9 +++++++- 9 files changed, 63 insertions(+), 13 deletions(-) diff --git a/src/main/groovy/org/groocss/Color.groovy b/src/main/groovy/org/groocss/Color.groovy index 2ec037e..c403b18 100644 --- a/src/main/groovy/org/groocss/Color.groovy +++ b/src/main/groovy/org/groocss/Color.groovy @@ -21,6 +21,19 @@ import java.math.MathContext /** * Controls Color for CSS styles and has methods for brighter, darker, etc. + * + *

Colors can be created using many different methods: + *

  • {@link ColorMethods#rgb}, + *
  • {@link ColorMethods#rgba},
  • {@link ColorMethods#clr}, + *
  • {@link ColorMethods#hsl},
  • {@link ColorMethods#hsla}, + *
  • or using {@link org.groocss.ext.StringExtension#getColor(java.lang.String)} or 'hex'.toColor(), among others. + * + *

    The final CSS result from a Color depends on how it was created and what methods were called on it. + * For example, if {@link Color#alpha(double)} is used, the output color uses rgba. + * + *

    Methods from {@link ColorMethods} are available to modify Colors. + * + * @see ColorMethods */ @EqualsAndHashCode class Color { diff --git a/src/main/groovy/org/groocss/Config.groovy b/src/main/groovy/org/groocss/Config.groovy index 2a043c2..3ed7b24 100644 --- a/src/main/groovy/org/groocss/Config.groovy +++ b/src/main/groovy/org/groocss/Config.groovy @@ -22,7 +22,15 @@ import groovy.transform.builder.Builder import org.groocss.valid.Processor /** - * Configuration for GrooCSS conversions. + * Configuration for GrooCSS conversions. There are at least four different ways to configure GrooCSS: + * + *

  • Using the groovy constructor: new Config(compress: true) + *
  • Using the builder syntax: Config.builder().compress(true).build() + *
  • Using the DSL: GrooCSS.withConfig { noExts().compress().utf8() }... + *
  • Using StringExtension with config use: 'main.css'.groocss(new Config()) { ... }. + * + * @see GrooCSS + * @see org.groocss.ext.StringExtension */ @MapConstructor @Canonical diff --git a/src/main/groovy/org/groocss/Measurement.groovy b/src/main/groovy/org/groocss/Measurement.groovy index e66048f..8bb561d 100644 --- a/src/main/groovy/org/groocss/Measurement.groovy +++ b/src/main/groovy/org/groocss/Measurement.groovy @@ -20,11 +20,11 @@ import org.codehaus.groovy.util.HashCodeHelper /** * Represents some type of number value with a unit, such as 2 seconds or 20 pixels. - * + *

    * Measurements are created using the DSL syntax such as: - * 2.s //== two seconds + *

    2.s //== two seconds
      * 20.px //== 20 pixels
    - * 20.deg //== 20 degrees
    + * 20.deg //== 20 degrees
    * * @see org.groocss.ext.NumberExtension * @see org.groocss.valid.DefaultValidator diff --git a/src/main/groovy/org/groocss/PseudoClass.groovy b/src/main/groovy/org/groocss/PseudoClass.groovy index e794f26..295a421 100644 --- a/src/main/groovy/org/groocss/PseudoClass.groovy +++ b/src/main/groovy/org/groocss/PseudoClass.groovy @@ -19,6 +19,13 @@ import groovy.transform.* /** * Represents a CSS pseudo-class such as :active, :focus, or :nthChild(odd). + *

    + * Pseudo classes are appended to selectors using the % operator. They are chainable as well meaning + * the following is possible: a %active %hover becomes a:active:hover. + *

    + * Special abbreviations exist such as "odd" for ":nthChild(odd)" and "even" for :nthChild(even). + * + * @see GrooCSS */ @TypeChecked @TupleConstructor diff --git a/src/main/groovy/org/groocss/Raw.groovy b/src/main/groovy/org/groocss/Raw.groovy index dd0127d..e6bcbc7 100644 --- a/src/main/groovy/org/groocss/Raw.groovy +++ b/src/main/groovy/org/groocss/Raw.groovy @@ -20,7 +20,7 @@ import groovy.transform.EqualsAndHashCode import groovy.transform.TupleConstructor /** - * Created by adavis on 8/9/17. + * Raw contains unescaped CSS that will be output in final CSS. Created by adavis on 8/9/17. */ @TupleConstructor @EqualsAndHashCode diff --git a/src/main/groovy/org/groocss/valid/AbstractValidator.groovy b/src/main/groovy/org/groocss/valid/AbstractValidator.groovy index e08c371..c8378b0 100644 --- a/src/main/groovy/org/groocss/valid/AbstractValidator.groovy +++ b/src/main/groovy/org/groocss/valid/AbstractValidator.groovy @@ -1,6 +1,5 @@ package org.groocss.valid -import groovy.transform.AutoImplement import groovy.transform.CompileStatic import org.groocss.CSSPart @@ -10,7 +9,6 @@ import org.groocss.CSSPart * @see Processor * @see DefaultValidator */ -@AutoImplement(exception = Processor.NotImplementedException) @CompileStatic abstract class AbstractValidator implements Processor { diff --git a/src/main/groovy/org/groocss/valid/DefaultValidator.groovy b/src/main/groovy/org/groocss/valid/DefaultValidator.groovy index e11e47d..00e089e 100644 --- a/src/main/groovy/org/groocss/valid/DefaultValidator.groovy +++ b/src/main/groovy/org/groocss/valid/DefaultValidator.groovy @@ -21,6 +21,11 @@ import org.groocss.Style /** * Does default GrooCSS validation of Measurements. + *

    Makes sure that time values are time Measurements and size values (such as top, left, width, and fontSize) + * are size values such as 1.px or 1.em or 10%. + * + * @see org.groocss.Config + * @see RequireMeasurements */ @CompileStatic class DefaultValidator extends AbstractValidator