From 4329c3e94a32c59aafea33f9e1ed0076dbb9df2f Mon Sep 17 00:00:00 2001 From: Edmund Date: Fri, 4 Sep 2015 18:56:12 +0100 Subject: [PATCH 01/29] adding 'to-string' function --- stylesheets/encode/encode.scss | 1 + stylesheets/encode/helpers/_to-string.scss | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 stylesheets/encode/helpers/_to-string.scss diff --git a/stylesheets/encode/encode.scss b/stylesheets/encode/encode.scss index bb6c6af..6909e20 100644 --- a/stylesheets/encode/encode.scss +++ b/stylesheets/encode/encode.scss @@ -1,4 +1,5 @@ // Helpers +@import "helpers/to-string"; @import "helpers/quote"; // Type specific encoding functions diff --git a/stylesheets/encode/helpers/_to-string.scss b/stylesheets/encode/helpers/_to-string.scss new file mode 100644 index 0000000..7f3a81b --- /dev/null +++ b/stylesheets/encode/helpers/_to-string.scss @@ -0,0 +1,21 @@ +// Joins all elements of `$list` with `$glue` +// @access private +// param {List} $list - list to cast +// @param {String} $glue ('') - value to use as a join string + +@function to-string($list, $glue: '', $is-nested: false, $recursive: false) { + $result: null; + @for $i from 1 through length($list) { + $e: nth($list, $i); + @if type-of($e) == list and $recursive { + $result: $result#{to-string($e, $glue, true)}; + } + @else { + $result: if( + $i != length($list) or $is-nested, + $result#{$e}#{$glue}, $result#{$e} + ); + } + } + @return $result; +} \ No newline at end of file From d5ef5b5e94d6203e11ce52288856fa5ecbe4a88d Mon Sep 17 00:00:00 2001 From: Edmund Date: Fri, 4 Sep 2015 19:03:30 +0100 Subject: [PATCH 02/29] making comment consistent --- stylesheets/encode/helpers/_to-string.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylesheets/encode/helpers/_to-string.scss b/stylesheets/encode/helpers/_to-string.scss index 7f3a81b..40ddfdb 100644 --- a/stylesheets/encode/helpers/_to-string.scss +++ b/stylesheets/encode/helpers/_to-string.scss @@ -1,6 +1,6 @@ // Joins all elements of `$list` with `$glue` // @access private -// param {List} $list - list to cast +// @param {List} $list - list to cast // @param {String} $glue ('') - value to use as a join string @function to-string($list, $glue: '', $is-nested: false, $recursive: false) { From dd8c241b732addf882903ce46469b7c6a66b1417 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Thu, 10 Sep 2015 19:14:50 +0100 Subject: [PATCH 03/29] correcting formatting and best practices --- stylesheets/encode/helpers/_quote.scss | 4 +-- stylesheets/encode/helpers/_to-string.scss | 29 +++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/stylesheets/encode/helpers/_quote.scss b/stylesheets/encode/helpers/_quote.scss index 7282a53..a9ef72b 100755 --- a/stylesheets/encode/helpers/_quote.scss +++ b/stylesheets/encode/helpers/_quote.scss @@ -4,6 +4,6 @@ /// @return {String} - quoted value @function _proof-quote($value) { - $value: to-string($value); - @return '"' + $value + '"'; + $value: to-string($value); + @return '"' + $value + '"'; } diff --git a/stylesheets/encode/helpers/_to-string.scss b/stylesheets/encode/helpers/_to-string.scss index 40ddfdb..9b6e47c 100644 --- a/stylesheets/encode/helpers/_to-string.scss +++ b/stylesheets/encode/helpers/_to-string.scss @@ -4,18 +4,19 @@ // @param {String} $glue ('') - value to use as a join string @function to-string($list, $glue: '', $is-nested: false, $recursive: false) { - $result: null; - @for $i from 1 through length($list) { - $e: nth($list, $i); - @if type-of($e) == list and $recursive { - $result: $result#{to-string($e, $glue, true)}; - } - @else { - $result: if( - $i != length($list) or $is-nested, - $result#{$e}#{$glue}, $result#{$e} - ); - } - } - @return $result; + $result: null; + + @for $i from 1 through length($list) { + $e: nth($list, $i); + @if type-of($e) == 'list' and $recursive { + $result: $result + #{to-string($e, $glue, true, true)}; + } @else { + $result: if( + $i != length($list) or $is-nested, + $result + #{$e} + #{$glue}, $result#{$e} + ); + } + } + + @return $result; } \ No newline at end of file From 14562d0da6fa0300e55e1a33b2ab17598375f9f1 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Fri, 11 Sep 2015 12:16:05 +0100 Subject: [PATCH 04/29] changing null to '', concatenating instead of interpolating --- stylesheets/encode/helpers/_to-string.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stylesheets/encode/helpers/_to-string.scss b/stylesheets/encode/helpers/_to-string.scss index 9b6e47c..b4c6998 100644 --- a/stylesheets/encode/helpers/_to-string.scss +++ b/stylesheets/encode/helpers/_to-string.scss @@ -4,7 +4,7 @@ // @param {String} $glue ('') - value to use as a join string @function to-string($list, $glue: '', $is-nested: false, $recursive: false) { - $result: null; + $result: ''; @for $i from 1 through length($list) { $e: nth($list, $i); @@ -13,7 +13,7 @@ } @else { $result: if( $i != length($list) or $is-nested, - $result + #{$e} + #{$glue}, $result#{$e} + $result + $e + $glue, $result + $e ); } } From d42055887c42edd7039d8ea67dd50fae2db16c8c Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Fri, 11 Sep 2015 17:44:42 +0100 Subject: [PATCH 05/29] removing unnecessary interpolation & passing variable names to function --- stylesheets/encode/helpers/_to-string.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stylesheets/encode/helpers/_to-string.scss b/stylesheets/encode/helpers/_to-string.scss index b4c6998..0d6a495 100644 --- a/stylesheets/encode/helpers/_to-string.scss +++ b/stylesheets/encode/helpers/_to-string.scss @@ -9,7 +9,7 @@ @for $i from 1 through length($list) { $e: nth($list, $i); @if type-of($e) == 'list' and $recursive { - $result: $result + #{to-string($e, $glue, true, true)}; + $result: $result + to-string($e, $glue, $is-nested: true, $recursive: true); } @else { $result: if( $i != length($list) or $is-nested, From dfcf250ddf9510a8bc0fa4b1ac5049b2cc7b9e45 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Mon, 14 Sep 2015 14:55:25 +0100 Subject: [PATCH 06/29] removing "to-string()" function call --- stylesheets/encode/helpers/_quote.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/stylesheets/encode/helpers/_quote.scss b/stylesheets/encode/helpers/_quote.scss index a9ef72b..f39d864 100755 --- a/stylesheets/encode/helpers/_quote.scss +++ b/stylesheets/encode/helpers/_quote.scss @@ -4,6 +4,5 @@ /// @return {String} - quoted value @function _proof-quote($value) { - $value: to-string($value); @return '"' + $value + '"'; } From 0116f6d7c7af27b21e4c8da75a3249ae737dbc81 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Fri, 16 Oct 2015 20:21:18 +0100 Subject: [PATCH 07/29] synchronising with customizations --- stylesheets/{SassyJSON.scss => _SassyJSON.scss} | 2 +- stylesheets/decode/api/_json.scss | 0 stylesheets/decode/decode.scss | 2 +- stylesheets/decode/helpers/all/_throw.scss | 0 stylesheets/decode/helpers/all/_value.scss | 0 stylesheets/decode/helpers/color/_color.scss | 0 .../decode/helpers/color/_get-color-value.scss | 0 .../decode/helpers/color/_hex-to-dec.scss | 0 stylesheets/decode/helpers/color/_hex.scss | 0 stylesheets/decode/helpers/color/_hsl.scss | 0 stylesheets/decode/helpers/color/_rgb.scss | 0 stylesheets/decode/helpers/map/_consume.scss | 0 .../decode/helpers/number/_find-digits.scss | 0 .../decode/helpers/number/_find-exponent.scss | 0 .../decode/helpers/number/_find-integer.scss | 0 stylesheets/decode/helpers/number/_pow.scss | 0 .../helpers/string/_find-ending-quote.scss | 0 stylesheets/decode/helpers/string/_length.scss | 0 .../decode/helpers/string/_strip-token.scss | 0 stylesheets/decode/types/_bool.scss | 0 stylesheets/decode/types/_list.scss | 0 stylesheets/decode/types/_map.scss | 0 stylesheets/decode/types/_null.scss | 0 stylesheets/decode/types/_number.scss | 0 stylesheets/decode/types/_string.scss | 5 ++--- stylesheets/encode/api/_json.scss | 0 stylesheets/encode/encode.scss | 4 ++-- stylesheets/encode/helpers/_quote.scss | 5 +++-- stylesheets/encode/mixins/_json.scss | 17 +++++++++++------ stylesheets/encode/types/_bool.scss | 0 stylesheets/encode/types/_color.scss | 0 stylesheets/encode/types/_list.scss | 0 stylesheets/encode/types/_map.scss | 0 stylesheets/encode/types/_null.scss | 0 stylesheets/encode/types/_number.scss | 0 stylesheets/encode/types/_string.scss | 0 36 files changed, 20 insertions(+), 15 deletions(-) rename stylesheets/{SassyJSON.scss => _SassyJSON.scss} (65%) mode change 100644 => 100755 mode change 100644 => 100755 stylesheets/decode/api/_json.scss mode change 100644 => 100755 stylesheets/decode/decode.scss mode change 100644 => 100755 stylesheets/decode/helpers/all/_throw.scss mode change 100644 => 100755 stylesheets/decode/helpers/all/_value.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_color.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_get-color-value.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_hex-to-dec.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_hex.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_hsl.scss mode change 100644 => 100755 stylesheets/decode/helpers/color/_rgb.scss mode change 100644 => 100755 stylesheets/decode/helpers/map/_consume.scss mode change 100644 => 100755 stylesheets/decode/helpers/number/_find-digits.scss mode change 100644 => 100755 stylesheets/decode/helpers/number/_find-exponent.scss mode change 100644 => 100755 stylesheets/decode/helpers/number/_find-integer.scss mode change 100644 => 100755 stylesheets/decode/helpers/number/_pow.scss mode change 100644 => 100755 stylesheets/decode/helpers/string/_find-ending-quote.scss mode change 100644 => 100755 stylesheets/decode/helpers/string/_length.scss mode change 100644 => 100755 stylesheets/decode/helpers/string/_strip-token.scss mode change 100644 => 100755 stylesheets/decode/types/_bool.scss mode change 100644 => 100755 stylesheets/decode/types/_list.scss mode change 100644 => 100755 stylesheets/decode/types/_map.scss mode change 100644 => 100755 stylesheets/decode/types/_null.scss mode change 100644 => 100755 stylesheets/decode/types/_number.scss mode change 100644 => 100755 stylesheets/encode/api/_json.scss mode change 100644 => 100755 stylesheets/encode/encode.scss mode change 100644 => 100755 stylesheets/encode/mixins/_json.scss mode change 100644 => 100755 stylesheets/encode/types/_bool.scss mode change 100644 => 100755 stylesheets/encode/types/_color.scss mode change 100644 => 100755 stylesheets/encode/types/_list.scss mode change 100644 => 100755 stylesheets/encode/types/_map.scss mode change 100644 => 100755 stylesheets/encode/types/_null.scss mode change 100644 => 100755 stylesheets/encode/types/_number.scss mode change 100644 => 100755 stylesheets/encode/types/_string.scss diff --git a/stylesheets/SassyJSON.scss b/stylesheets/_SassyJSON.scss old mode 100644 new mode 100755 similarity index 65% rename from stylesheets/SassyJSON.scss rename to stylesheets/_SassyJSON.scss index e97edce..28dc5d2 --- a/stylesheets/SassyJSON.scss +++ b/stylesheets/_SassyJSON.scss @@ -2,4 +2,4 @@ @import "encode/encode"; // Decoder -@import "decode/decode"; +@import "decode/decode"; \ No newline at end of file diff --git a/stylesheets/decode/api/_json.scss b/stylesheets/decode/api/_json.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/decode.scss b/stylesheets/decode/decode.scss old mode 100644 new mode 100755 index 7aeaf2e..14dfe30 --- a/stylesheets/decode/decode.scss +++ b/stylesheets/decode/decode.scss @@ -25,4 +25,4 @@ @import "types/string"; // Public API -@import "api/json"; +@import "api/json"; \ No newline at end of file diff --git a/stylesheets/decode/helpers/all/_throw.scss b/stylesheets/decode/helpers/all/_throw.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/all/_value.scss b/stylesheets/decode/helpers/all/_value.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_color.scss b/stylesheets/decode/helpers/color/_color.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_get-color-value.scss b/stylesheets/decode/helpers/color/_get-color-value.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_hex-to-dec.scss b/stylesheets/decode/helpers/color/_hex-to-dec.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_hex.scss b/stylesheets/decode/helpers/color/_hex.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_hsl.scss b/stylesheets/decode/helpers/color/_hsl.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/color/_rgb.scss b/stylesheets/decode/helpers/color/_rgb.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/map/_consume.scss b/stylesheets/decode/helpers/map/_consume.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/number/_find-digits.scss b/stylesheets/decode/helpers/number/_find-digits.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/number/_find-exponent.scss b/stylesheets/decode/helpers/number/_find-exponent.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/number/_find-integer.scss b/stylesheets/decode/helpers/number/_find-integer.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/number/_pow.scss b/stylesheets/decode/helpers/number/_pow.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/string/_find-ending-quote.scss b/stylesheets/decode/helpers/string/_find-ending-quote.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/string/_length.scss b/stylesheets/decode/helpers/string/_length.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/helpers/string/_strip-token.scss b/stylesheets/decode/helpers/string/_strip-token.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_bool.scss b/stylesheets/decode/types/_bool.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_list.scss b/stylesheets/decode/types/_list.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_map.scss b/stylesheets/decode/types/_map.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_null.scss b/stylesheets/decode/types/_null.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_number.scss b/stylesheets/decode/types/_number.scss old mode 100644 new mode 100755 diff --git a/stylesheets/decode/types/_string.scss b/stylesheets/decode/types/_string.scss index be4d31f..0cb246e 100755 --- a/stylesheets/decode/types/_string.scss +++ b/stylesheets/decode/types/_string.scss @@ -21,8 +21,7 @@ // If string is not empty $string: str-slice($temp, 1, $end - 1); - $cr: " - "; + $cr: ""; $string: _strip-token($string, "\\\r", $cr); $string: _strip-token($string, "\\\n", $cr); $string: _strip-token($string, '\\\"', '"'); @@ -37,4 +36,4 @@ } @return ($pointer + $end, $string); -} \ No newline at end of file +} diff --git a/stylesheets/encode/api/_json.scss b/stylesheets/encode/api/_json.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/encode.scss b/stylesheets/encode/encode.scss old mode 100644 new mode 100755 index 6909e20..ca34fc2 --- a/stylesheets/encode/encode.scss +++ b/stylesheets/encode/encode.scss @@ -1,6 +1,6 @@ // Helpers -@import "helpers/to-string"; @import "helpers/quote"; +@import "helpers/to-string"; // Type specific encoding functions @import "types/bool"; @@ -15,4 +15,4 @@ @import "api/json"; // Mixin to pass the string to the DOM -@import "mixins/json"; +@import "mixins/json"; \ No newline at end of file diff --git a/stylesheets/encode/helpers/_quote.scss b/stylesheets/encode/helpers/_quote.scss index f39d864..73cd921 100755 --- a/stylesheets/encode/helpers/_quote.scss +++ b/stylesheets/encode/helpers/_quote.scss @@ -4,5 +4,6 @@ /// @return {String} - quoted value @function _proof-quote($value) { - @return '"' + $value + '"'; -} + $value: to-string($value); + @return '"' + $value + '"'; +} \ No newline at end of file diff --git a/stylesheets/encode/mixins/_json.scss b/stylesheets/encode/mixins/_json.scss old mode 100644 new mode 100755 index aee1e50..09525a9 --- a/stylesheets/encode/mixins/_json.scss +++ b/stylesheets/encode/mixins/_json.scss @@ -3,18 +3,19 @@ /// @param {*} $value - value to be stringified /// @param {String} $flag (all) - output driver /// @require {function} json-encode -@mixin json-encode($value, $flag: "all") { - $flag: if(index("all" "regular" "media" "comment", $flag), $flag, "all"); +@mixin json-encode($value, $flag: "pseudo", $selector: "#stylesConfigJSON") { + $json: json-encode($value); // Persistent comment - @if $flag == "comment" or $flag == "all" { + @if $flag == "comment" { /*! json-encode: #{$json} */ } + // Regular property value pair - @if $flag == "regular" or $flag == "all" { + @if $flag == "pseudo" { // All browsers except IE8- - body::before { + #{$selector}::before { // This element must be in the render tree to get it via getComputedStyle(document.body, ':before'); content: json-encode($value); display: block; @@ -22,7 +23,10 @@ overflow: hidden; width: 0; } + } + // Regular property value pair + @if $flag == "head" { // All browsers except Opera (Presto based) head { font-family: json-encode($value); @@ -30,11 +34,12 @@ } // Falsy media query - @if $flag == "media" or $flag == "all" { + @if $flag == "media" { @media -json-encode { json { json: $json; } } } + } diff --git a/stylesheets/encode/types/_bool.scss b/stylesheets/encode/types/_bool.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_color.scss b/stylesheets/encode/types/_color.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_list.scss b/stylesheets/encode/types/_list.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_map.scss b/stylesheets/encode/types/_map.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_null.scss b/stylesheets/encode/types/_null.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_number.scss b/stylesheets/encode/types/_number.scss old mode 100644 new mode 100755 diff --git a/stylesheets/encode/types/_string.scss b/stylesheets/encode/types/_string.scss old mode 100644 new mode 100755 From d6f6aefb01503746fda36a2036bba2213f550690 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Fri, 16 Oct 2015 20:47:07 +0100 Subject: [PATCH 08/29] adding a suitable readme --- README.md | 117 ++---------------------------------------------------- 1 file changed, 3 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index b9abfbd..8fc982c 100644 --- a/README.md +++ b/README.md @@ -1,116 +1,5 @@ -# SassyJSON [![NPM version](https://badge.fury.io/js/sassyjson.png)](http://badge.fury.io/js/sassyjson) [![Gem Version](https://badge.fury.io/rb/SassyJSON.png)](http://badge.fury.io/rb/SassyJSON) [![Build Status](https://travis-ci.org/HugoGiraudel/SassyJSON.png?branch=master)](https://travis-ci.org/HugoGiraudel/SassyJSON) +# SassyJSON -SassyJSON is a Sass-powered API for JSON. It provides you the classic `json-encode` and `json-decode` directly from your Sass files. We'll leave you the only judges of the point of this. Read [API documentation](http://hugogiraudel.com/SassyJSON). +This fork of SassyJSON has a few modifications from the original repo to make it compatible with [Modular](https://github.com/esr360/Modular). -## Install - -SassyJSON is available on [npm](https://npmjs.org/) or as a [Ruby Gem](http://rubygems.org/gems/SassyJSON). - -### Git - -``` git -git clone https://github.com/HugoGiraudel/SassyJSON.git && cd SassyJSON -``` - -### npm - -``` bash -npm install sassyjson --save-dev -``` - -### Compass extension - -1. `gem install SassyJSON` -2. Add `require 'SassyJSON'` to your `config.rb` -3. Import it in your stylesheets with `@import 'SassyJSON'` - -### Sass - -If you only want to play around the code without cloning the repo or using npm, you can find a [single file](https://github.com/HugoGiraudel/SassyJSON/blob/master/dist/_SassyJSON.scss) containing the whole API in the [dist](https://github.com/HugoGiraudel/SassyJSON/tree/master/dist) folder. - -Also, SassyJSON is available at [Sassmeister](http://sassmeister.com/). - -## Example - -### Encoding Sass to JSON - -#### Sass - -``` scss -$map: ((a: (1 2 ( b : 1 )), b: ( #444444, false, ( a: 1, b: test ) ), c: (2 3 4 string))); - -@include json-encode($map); -``` - -#### CSS - -``` css -/*! json-encode: '{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}' */ - -body::before { - display:block; - width:0;height:0; - overflow:hidden; - content: '{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'; -} - -head { - font-family: '{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'; -} - -@media -json-encode { - json { - json: '{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'; - } -} -``` - -If you want to restrict the output to only one of the three drivers (comment, media query or regular output) you can pass a flag as the second parameter with one of the four following keywords: `all`, `comment`, `media` or `regular`. Default is `all`. - -### Decoding JSON to Sass - -``` scss -$json-decode: json-decode('{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'); -// ("a": 1 2 ("b": 1), "b": #444444 false ("a": 1, "b": "test"), "c": 2 3 4 "string") -``` - -## Importing and decoding a JSON file - -To importe and decode an external `.json` file directly into a Sass variable: - -``` scss -@import 'SassyJSON'; // Import SassyJSON first! -@import 'relative/path/to/file.json?variable-name'; -// Do something with $variable-name -``` - -**Important:** - -* the path to the JSON file is relative to importing file -* the get parameter is the variable name to use it in Sass - -## Requirements - -All you need is a clean version of Sass 3.3. Otherwise it's just pure Sass madness. - -## Development - -### You need - - * [NodeJS](http://nodejs.org) - * [Ruby](https://www.ruby-lang.org/) - * Sass 3.3 via `gem install sass --pre` - * `grunt-cli` via `npm install -g grunt-cli` - -### How to - - 1. Fork this repository - 2. Run `npm install` - 3. `grunt dev` - 4. Make your changes + write tests - 5. Commit + Pull request - -## Credits - -* [Fabrice Weinberg](http://twitter.com/fweinb) -* [Hugo Giraudel](http://twitter.com/hugogiraudel) +If you are looking to use SassyJSON in your own project it is recommended to use [@HugoGiraudel](https://github.com/HugoGiraudel/SassyJSON)'s original repo. \ No newline at end of file From e26165c1a344eb110193f192c00e9fa65306181d Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Thu, 22 Oct 2015 00:39:20 +0100 Subject: [PATCH 09/29] adding bower.json --- bower.json | 24 + dist/_SassyJSON.scss | 1075 ------------------------------------------ 2 files changed, 24 insertions(+), 1075 deletions(-) create mode 100644 bower.json delete mode 100644 dist/_SassyJSON.scss diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..4d23ebf --- /dev/null +++ b/bower.json @@ -0,0 +1,24 @@ +{ + "name":"Modular-SassyJSON", + "description":"A fork of SassyJSON for Modular.", + "version":"1.0.0", + "main":[ + "stylesheets/_SassyJSON.scss" + ], + "keywords":[ + "css", + "sass", + "scss", + "module", + "modular", + "components", + "scalable" + ], + "homepage":"https://github.com/esr360/SassyJSON", + "ignore":[ + ".gitattributes", + ".gitignore", + "bower.json", + "prepros.cfg" + ] +} \ No newline at end of file diff --git a/dist/_SassyJSON.scss b/dist/_SassyJSON.scss deleted file mode 100644 index 63addbc..0000000 --- a/dist/_SassyJSON.scss +++ /dev/null @@ -1,1075 +0,0 @@ -/*! sassyjson - v1.1.8 - 2014-06-01 */ -// Logs an error at `$pointer` with `$string` message -// -------------------------------------------------------------------------------- -// @param [string] $string: error message -// @param [number] $pointer: pointer position -// -------------------------------------------------------------------------------- -// @return [list] (pointer, false) - -@function _throw($string, $pointer) { - @warn "ERROR::#{$pointer}::#{$string}"; - @return $pointer, false; -} - -// Delay parsing to type-specific function -// according to found character -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token $token." -// @throw "Empty JSON string." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed value) - -@function _json-decode--value($source, $pointer) { - $length: str-length($source); - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $token == '{' { - @return _json-decode--map($source, $pointer); - } - @else if $token == '[' { - @return _json-decode--list($source, $pointer); - } - @else if $token == 't' { - @return _json-decode--true($source, $pointer); - } - @else if $token == 'f' { - @return _json-decode--false($source, $pointer); - } - @else if $token == '"' { - @return _json-decode--string($source, $pointer); - } - @else if $token == 'n' { - @return _json-decode--null($source, $pointer); - } - @else if index('1' '2' '3' '4' '5' '6' '7' '8' '9' '0' '-' '.', $token) { - @return _json-decode--number($source, $pointer); - } - @else if $token == ' ' or $token == " " { - // @continue; - } - @else { - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - } - - @return _throw("Empty JSON string.", $pointer); -} - -// Move pointer to position of token -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// @param [string] $token: token to reach -// -------------------------------------------------------------------------------- -// @throw "Expected $token; found {x}." -// @throw "Expected $token but reached end of stream." -// -------------------------------------------------------------------------------- -// @return [number|false] new pointer - -@function _consume($source, $pointer, $token) { - $length: str-length($source); - - @while $pointer <= $length { - $char: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $char == $token { - @return $pointer; - } - - @else if $char == " " or $char == " " { - // @continue; - } - - @else { - @return _throw("Expected `" + $token + "; ` found `" + $char + "`.", $pointer); - } - } - - @return _throw("Expected `" + $token + "` but reached end of stream.", $pointer); -} - -// Will find the first non escaped quote in a JSON String -// -------------------------------------------------------------------------------- -// @param [string] $string: to search in -// -------------------------------------------------------------------------------- -// @return [number] position of the first non escaped quote - -@function _find-ending-quote($string) { - $backslash: str-slice('\\', 1, 1); // Dirty hack to have a single backslash - $escaped-chars: '"\/bfnrtu'; // Characters that can be escaped in JSON - $hexadecimal-chars: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' 'a' 'b' 'c' 'd' 'e' 'f'; - - $pos: 1; - $length: str-length($string); - $backslash-found: false; - - @while $pos <= $length { - $char: to-lower-case(str-slice($string, $pos, $pos)); - - // Previous char was a backslash - @if $backslash-found { - - // Special case, the 'u' character - @if $char == 'u' { - // Next 4 characters must be hexadecimal - @if not index($hexadecimal-chars, str-slice($string, $pos + 1, $pos + 1)) or - not index($hexadecimal-chars, str-slice($string, $pos + 2, $pos + 2)) or - not index($hexadecimal-chars, str-slice($string, $pos + 3, $pos + 3)) or - not index($hexadecimal-chars, str-slice($string, $pos + 4, $pos + 4)) { - @return 0; - } - - $pos: $pos + 4; - } - - // Invalid character escaped - @else if not str-index($escaped-chars, $char) { - @return 0; - } - - $backslash-found: false; - } - - @else if $char == $backslash { - $backslash-found: true; - } - - // Unescaped quote found - @else if $char == '"' { - @return $pos; - } - - $pos: $pos + 1; - } - - // No end of string found - @return 0; -} - -// Strip special carriage return characters -// -------------------------------------------------------------------------------- -// @param [string] $string: string to parse -// @param [string] $char: char to strip -// -------------------------------------------------------------------------------- -// @return [string] new string - -@function _strip-token($string, $token, $replace) { - - @while str-index($string, $token) and str-index($string, $token) > 0 { - $index: str-index($string, $token); - $string: str-slice($string, 1, $index - 1) + $replace + str-slice($string, $index + str-length($token)); - } - - @return $string; -} - -// Parses a JSON encoded string to see if it's a CSS length -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [number|string] string or number, depending on the match - -@function _length($string) { - @if type-of($string) == number { - @return $string; - } - - $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax'; - $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax; - $number: ""; - $unit: ""; - - @for $i from 1 through str-length($string) { - $c: str-slice($string, $i, $i); - @if $c == ' ' or $c == " " { - @if $number != "" { - @return $string; - } - } - @else if index('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '-' '.', $c) { - $number: $number + $c; - } - @else { - @if $number == "" { - @return $string; - } - $unit: $unit + $c; - } - } - - $number: nth(_json-decode--number($number, 2), 2); - $index: index($strings, to-lower-case($unit)); - - @if $index and $index > 0 { - @return $number * nth($units, $index); - } - - @return $string; -} - -// Parses a JSON encoded string to see if it's a CSS color -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [color|string] string or number, depending on the match - -@function _color($string) { - @if type-of($string) == color { - @return $string; - } - - $string-lower: to-lower-case($string); - $colors: transparent black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen; - $keywords: (); - - // Filling $keywords with stringified color keywords - @each $color in $colors { - $keywords: append($keywords, $color + ""); - } - - // Deal with inherit keyword - @if $string-lower == "inherit" { - @return unquote($string); - } - - // Deal with color keywords - @if index($keywords, $string-lower) { - @return nth($colors, index($keywords, $string-lower)); - } - - // Deal with hexadecimal triplets - @else if str-slice($string-lower, 1, 1) == '#' { - @return _from-hex($string); - } - - // Deal with rgb(a) colors - @else if str-slice($string-lower, 1, 3) == 'rgb' { - @return _from-rgb($string); - } - - // Deal with hsl(a) colors - @else if str-slice($string-lower, 1, 3) == 'hsl' { - @return _from-hsl($string); - } - - // Return string - @else { - @return $string; - } -} - -// Cast a stringified number / stringified percentage into number type -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [number] unitless number or percentage - -@function _get-color-value($string) { - $first: str-slice($string, 1, 1); - - // Pad <1 values with a leading 0 - @if $first == '.' { - $string: '0' + $string; - } - - $last: str-slice($string, -1, -1); - - @return if( - $last == '%', - nth(_json-decode--number(str-slice($string, 1, -2), 2), 2) * 1%, - nth(_json-decode--number($string, 2), 2) - ); -} - -// Cast a JSON encoded string into a hsl(a) color -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [color|string] string or hsl(a) color, depending on the match - -@function _from-hsl($string) { - $frags: (); - $string-lower: to-lower-case($string); - $is-alpha: str-slice($string-lower, 4, 4) == 'a'; - $length: str-length($string); - $start: str-index($string, "("); - - @for $i from $start through $length { - $token: str-slice($string-lower, $i, $i); - @if $token == ' ' or $token == " " { - // @continue; - } - @else if $token == '(' or $token == ',' { - $frags: append($frags, ""); - } - @else if $token == ')' { - @if length($frags) != if($is-alpha, 4, 3) { @return $string; } // Parsing error - $hue: _get-color-value(nth($frags, 1)); - $saturation: _get-color-value(nth($frags, 2)); - $lightness: _get-color-value(nth($frags, 3)); - - @if not $hue or not $saturation or not $lightness { - @return $string; - } - - @if $is-alpha { - @if length($frags) != 4 { @return $string; } // No alpha channel found - $alpha: _get-color-value(nth($frags, 4)); - @if not $alpha { @return $string; } // Error parsing alpha channel - @return hsla($hue, $saturation, $lightness, $alpha); - } - - @return hsl($hue, $saturation, $lightness); - } - @else { - $frags: set-nth($frags, length($frags), nth($frags, length($frags)) + $token); - } - } - - @return $string; -} - -// Cast a JSON encoded string into a rgb(a) color -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [color|string] string or rgb(a) color depending on the match - -@function _from-rgb($string) { - $string-lower: to-lower-case($string); - $frags: (); - $is-alpha: str-slice($string-lower, 4, 4) == 'a'; - $start: str-index($string, "("); - $length: str-length($string); - - @for $i from $start through $length { - $token: str-slice($string-lower, $i, $i); - @if $token == ' ' or $token == " " { - // @continue; - } - @else if $token == '(' or $token == ',' { - $frags: append($frags, ""); - } - @else if $token == ')' { - @if length($frags) != if($is-alpha, 4, 3) { @return $string; } // Parsing error - $red: _get-color-value(nth($frags, 1)); - $green: _get-color-value(nth($frags, 2)); - $blue: _get-color-value(nth($frags, 3)); - - @if not $red or not $green or not $blue { - @return $string; - } - - @if $is-alpha { - @if length($frags) != 4 { @return $string; } // No alpha channel found - $alpha: _get-color-value(nth($frags, 4)); - @if not $alpha { @return $string; } // Error parsing alpha channel - @return rgba($red, $green, $blue, $alpha); - } - - @return rgb($red, $green, $blue); - } - @else { - $frags: set-nth($frags, length($frags), nth($frags, length($frags)) + $token); - } - } - - @return $string; -} - -// Cast a JSON encoded string into a hexadecimal color -// -------------------------------------------------------------------------------- -// @param [string] $string: JSON string -// -------------------------------------------------------------------------------- -// @return [color|string] string or hex color depending on the match - -@function _from-hex($string) { - $string-lower: to-lower-case($string); - $r: ""; $g: ""; $b: ""; - $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; - $length: str-length($string); - $max: if($length == 4, 1, 2); - - // Check for length accuracy - @if $length != 4 and $length != 7 { - @return $string; - } - - // Loop from the second character (omitting #) - @for $i from 2 through $length { - $c: str-slice($string-lower, $i, $i); - - // If wrong character, return - @if not index($hex, $c) { - @return $string; - } - - @if str-length($r) < $max { $r: $r + $c } - @else if str-length($g) < $max { $g: $g + $c } - @else if str-length($b) < $max { $b: $b + $c } - } - - @if $length == 4 { - $r: $r + $r; - $g: $g + $g; - $b: $b + $b; - } - - @return rgb(_hex-to-dec($r), _hex-to-dec($g), _hex-to-dec($b)); -} - -// Convert an hexadecimal number to a decimal number -// -------------------------------------------------------------------------------- -// @param [string] $string: hexadecimal value -// -------------------------------------------------------------------------------- -// @return [number] decimal number - -@function _hex-to-dec($string) { - $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; - $string: to-lower-case($string); - $length: str-length($string); - - $dec: 0; - @for $i from 1 through $length { - $factor: 1 + (15 * ($length - $i)); - $index: index($hex, str-slice($string, $i, $i)); - $dec: $dec + $factor * ($index - 1); - } - - @return $dec; -} - -// Power function -// -------------------------------------------------------------------------------- -// @param [number] $x: number -// @param [number] $n: power -// -------------------------------------------------------------------------------- -// @return [number] $x ^ $n - -@function _pow($x, $n) { - @if $n == 0 { @return 1; } - $ret: 1; - @if $n >= 0 { - @for $i from 1 through $n { - $ret: $ret * $x; - } - } @else { - @for $i from $n to 0 { - $ret: $ret / $x; - } - } - - @return $ret; -} - -// Parses a JSON encoded number to find the integer part -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token $token." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed number) - -@function _find-integer($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: 0; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == '-' { - // do nothing - } - @else if $index { - $result: $result * 10 + ($index - 1); - } - @else { - @if index('e' '.' ' ' ',' ']' '}', $token) { - @return $pointer, $result; - } - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - - $pointer: $pointer + 1; - } - - @return $pointer, $result; -} - -// Parses a JSON encoded number to find the digits -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token $token." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed number) - -@function _find-digits($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: null; - $runs: 1; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == '.' { - // @continue; - } - @else if $index and $index > 0 { - $runs: $runs * 10; - $result: if($result == null, ($index - 1), $result * 10 + ($index - 1)); - } - @else { - @if index('e' '.' ' ' ',' ']' '}', $token) { - @return $pointer, if($result != null, $result / $runs, $result); - } - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - - $pointer: $pointer + 1; - } - - @return $pointer, if($result != null, $result / $runs, $result); -} - -// Parses a JSON encoded number to find the exponent part -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token $token." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed number) - -@function _find-exponent($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: null; - $minus: null; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == 'e' { - // @continue; - } - @else if $token == '-' { - @if $minus != null { - @return _throw("Unexpected token `-`.", $pointer); - } - $minus: true; - } - @else if $token == '+' { - @if $minus != null { - @return _throw("Unexpected token `+`.", $pointer); - } - $minus: false; - } - @else if $index and $index > 0 { - $result: if($result == null, ($index - 1), $result * 10 + ($index - 1)); - } - @else { - @if not index(' ' ',' ']' '}', $token) { - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - - @return $pointer, if($minus and $result != null, $result * -1, $result); - } - - $pointer: $pointer + 1; - } - - @return $pointer, if($minus and $result != null, $result * -1, $result); -} - -// Parses a JSON encoded string -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unterminated string." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed string / color / length) - -@function _json-decode--string($source, $pointer) { - // Check for the end of the string - $temp: str-slice($source, $pointer); - $end: _find-ending-quote($temp); - $string: ""; - - // If no end is found - @if not $end or $end == 0 { - @return _throw("Unterminated string.", $pointer); - } - - // If string is not empty - @else if $end > 1 { - $string: str-slice($temp, 1, $end - 1); - - $cr: " - "; - $string: _strip-token($string, "\r", $cr); - $string: _strip-token($string, "\n", $cr); - $string: _strip-token($string, '\\\"', '"'); - - // Test whether the string could be a CSS length - $string: _length($string); - - // Test whether the string could be a CSS color - @if type-of($string) == string { - $string: _color($string); - } - } - - @return ($pointer + $end, $string); -} - -// Parses a JSON encoded `true` -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token `t`." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, true) - -@function _json-decode--true($source, $pointer) { - $length: str-length($source); - @if $length - $pointer < 2 - or str-slice($source, $pointer, $pointer) != 'r' - or str-slice($source, $pointer + 1, $pointer + 1) != 'u' - or str-slice($source, $pointer + 2, $pointer + 2) != 'e' { - @return _throw("Unexpected token: `t`.", $pointer); - } - @return ($pointer + 3, true); -} - -// Parses a JSON encoded `false` -// -------------------------------------------------------------------------------- -// @param $source: JSON complete source -// @param $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token `f`." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, false) - -@function _json-decode--false($source, $pointer) { - $length: str-length($source); - @if $length - $pointer < 3 - or str-slice($source, $pointer, $pointer) != 'a' - or str-slice($source, $pointer + 1, $pointer + 1) != 'l' - or str-slice($source, $pointer + 2, $pointer + 2) != 's' - or str-slice($source, $pointer + 3, $pointer + 3) != 'e' { - @return _throw("Unexpected token: `f`.", $pointer); - } - @return ($pointer + 4, false); -} - -// Parses a JSON encoded `null` -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token `n`." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, null) - -@function _json-decode--null($source, $pointer) { - $length: str-length($source); - @if $length - $pointer < 2 - or str-slice($source, $pointer, $pointer) != 'u' - or str-slice($source, $pointer + 1, $pointer + 1) != 'l' - or str-slice($source, $pointer + 2, $pointer + 2) != 'l' { - @return _throw("Unexpected token: `n`.", $pointer); - } - @return ($pointer + 3, null); -} - -// Parses a JSON encoded number -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected token $token." -// @throw "Unexpected end of stream." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed number) - -@function _json-decode--number($source, $pointer) { - $pointer: $pointer - 1; // Move back pointer to begininng of number - $allowed: '-' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; // Allowed characted to start with - $first: str-slice($source, $pointer, $pointer); // First character of the number - $minus: $first == '-'; // Is it negative? - - // Early check for errors - @if not index($allowed, $first) { - @return _throw("Unexpected token `" + $first + "`.", $pointer); - } - - // Find the integer part - $find-integer: _find-integer($source, $pointer); - $pointer: nth($find-integer, 1); - $result: nth($find-integer, 2); - @if not $result { // Error occured - @return $find-integer; - } - - // Find digits - @if str-slice($source, $pointer, $pointer) == '.' { - $find-digits: _find-digits($source, $pointer); - $pointer: nth($find-digits, 1); - $digits: nth($find-digits, 2); - - @if $digits == null { // Empty digits, throw error - @return _throw("Unexpected end of stream.", $pointer); - } - @else if $digits == false { // Error occured, return it - @return $find-digits; - } - - $result: $result + $digits; - } - - // Find exponent - @if to-lower-case(str-slice($source, $pointer, $pointer)) == 'e' { - $find-exponent: _find-exponent($source, $pointer); - $pointer: nth($find-exponent, 1); - $exponent: nth($find-exponent, 2); - - @if $exponent == null { // Empty exponent, throw error - @return _throw("Unexpected end of stream.", $pointer); - } - @else if $exponent == false { // Error occured, return it - @return $find-exponent; - } - - $result: $result * _pow(10, $exponent); - } - - @return ($pointer, if($minus, $result * -1, $result)); -} - -// Parses a JSON encoded array -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected comma in array literal." -// @throw "Missing comma in array literal." -// @throw "Unterminated array literal." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, parsed list) - -@function _json-decode--list($source, $pointer) { - $length: str-length($source); - $list: (); - $needs-comma: false; - - @if $pointer <= $length and str-slice($source, $pointer, $pointer) == "]" { - @return ($pointer + 1, $list); - } - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - - @if $token == "]" { - @if not $needs-comma and length($list) != 0 { - @return _throw("Unexpected comma in array literal.", $pointer); - } - - // Do it the Sass way and destruct a single item array to an element. - @return ($pointer + 1, if(length($list) == 1, nth($list, 1), $list)); - } - @else if $token == " " or $token == " " { - $pointer: $pointer + 1; - } - @else if $token == "," { - @if not $needs-comma { - @return _throw("Unexpected comma in array literal.", $pointer); - } - $needs-comma: false; - $pointer: $pointer + 1; - } - @else { - @if $needs-comma { - @return _throw("Missing comma in array literal.", $pointer); - } - $read: _json-decode--value($source, $pointer); - $pointer: nth($read, 1); - $list: append($list, nth($read, 2)); - $needs-comma: true; - } - } - - @return _throw("Unterminated array literal.", $pointer); -} - -// Parses a JSON encoded object -// -------------------------------------------------------------------------------- -// @param [string] $source: JSON complete source -// @param [number] $pointer: current pointer -// -------------------------------------------------------------------------------- -// @throw "Unexpected comma in object literal." -// @throw "Unexpected token $token in object literal." -// @throw "Missing comma in object literal." -// @throw "Unterminated object literal." -// @throw "Consuming token `:` failed." -// -------------------------------------------------------------------------------- -// @return [list|false] (new pointer, map) - -@function _json-decode--map($source, $pointer) { - $length: str-length($source); - $map: (); - $needs-comma: false; - - // Deal with empty map - @if $pointer <= $length and str-slice($source, $pointer, $pointer) == "}" { - @return ($pointer + 1, $map); - } - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $token == "}" { - @if not $needs-comma and length($map) != 0 { - @return _throw("Unexpected comma in object literal.", $pointer); - } - @return ($pointer, $map); - } - - @else if $token == " " or $token == " " { - // @continue; - } - - @else if $token == "," { - @if not $needs-comma { - @return _throw("Unexpected comma in object literal.", $pointer); - } - $needs-comma: false; - } - - @else if $token == '"' { - @if $needs-comma { - @return _throw("Missing comma in object literal.", $pointer); - } - - // Read key - $read-key: _json-decode--string($source, $pointer); - $pointer: nth($read-key, 1); - $key: nth($read-key, 2); - - // Remove colon - $pointer: _consume($source, $pointer, ":"); - @if length($pointer) > 1 { // If consume has failed - @return _throw("Consuming token `:` failed.", 0); - } - - // Read value - $read-value: _json-decode--value($source, $pointer); - $pointer: nth($read-value, 1); - $value: nth($read-value, 2); - - // Add pair to map - $map: map-merge($map, ($key: $value)); - $needs-comma: true; - } - - @else { - @return _throw("Unexpected token `" + $token + "` in object literal.", $pointer); - } - } - - @return _throw("Unterminated object literal.", $pointer); -} - -// Parse a JSON string -// -------------------------------------------------------------------------------- -// @param $json: JSON string to parse -// -------------------------------------------------------------------------------- -// @throw "Input string may not be null" -// -------------------------------------------------------------------------------- -// @return [literal|false] - -@function json-decode($json) { - $length: str-length($json); - $pointer: 1; - $value: null; - - @if $json == null { - @return _throw("Input string may not be null.", $pointer); - } - - @while $value != false // Stop if error - and $pointer <= $length { - $read: _json-decode--value($json, $pointer); - $pointer: nth($read, 1); - $value: nth($read, 2); - } - - @return $value; -} - -// Proof quote a value -// -------------------------------------------------------------------------------- -// @param $value: value to be quoted -// -------------------------------------------------------------------------------- -// @return [string] quoted value - -@function _proof-quote($value) { - @return '"' + $value + '"'; -} - -// Encode a bool to JSON -// -------------------------------------------------------------------------------- -// @param $bool: bool to be encoded -// -------------------------------------------------------------------------------- -// @return [bool] boolean - -@function _json-encode--bool($boolean) { - @return $boolean; -} - -// Encode a color to JSON -// -------------------------------------------------------------------------------- -// @param $color: color to be encoded -// -------------------------------------------------------------------------------- -// @return [string] encoded color - -@function _json-encode--color($color) { - @return _proof-quote($color); -} - -// Encode a list to JSON -// -------------------------------------------------------------------------------- -// @param $list: list to be encoded -// -------------------------------------------------------------------------------- -// @return [string] encoded list - -@function _json-encode--list($list) { - $str: ""; - @each $item in $list { - $str: $str + ', ' + json-encode($item); - } - @return '[' + str-slice($str, 3) + ']'; -} - -// Encode a map to JSON -// -------------------------------------------------------------------------------- -// @param $map: map to be encoded -// -------------------------------------------------------------------------------- -// @return [string] encoded map - -@function _json-encode--map($map) { - $str: ""; - @each $key, $value in $map { - $str: $str + ', ' + _proof-quote($key) + ': ' + json-encode($value); - } - @return '{' + str-slice($str, 3) + '}'; -} - -// Encode a number to JSON -// -------------------------------------------------------------------------------- -// @param $number: number to be encoded -// -------------------------------------------------------------------------------- -// @return [string] encoded number - -@function _json-encode--number($number) { - @return if(unitless($number), $number, _proof-quote($number)); -} - -// Encode a string to JSON -// -------------------------------------------------------------------------------- -// @param $string: string to be encoded -// -------------------------------------------------------------------------------- -// @return [string] encoded string - -@function _json-encode--string($string) { - @return _proof-quote($string); -} - -// Encode `null` to JSON -// -------------------------------------------------------------------------------- -// @param $null: `null` -// -------------------------------------------------------------------------------- -// @return [string] `null` - -@function _json-encode--null($null) { - @return "null"; -} - -// JSON.stringify a value and pass it as a font-family of head element -// -------------------------------------------------------------------------------- -// @param $value: value to be stringified -// @parem $flag: output driver - -@mixin json-encode($value, $flag: all) { - $flag: if(not index(all regular media comment, $flag), all, $flag); - $json: json-encode($value); - - // Persistent comment - @if $flag == comment or $flag == all { - /*! json-encode: #{$json} */ - } - // Regular property value pair - @if $flag == regular or $flag == all { - // All browsers except IE8- - body::before { - // This element must be in the render tree to get it via getComputedStyle(document.body, ':before'); - content: json-encode($value); - display: block; - height: 0; - overflow: hidden; - width: 0; - } - - // All browsers except Opera (Presto based) - head { - font-family: json-encode($value); - } - } - - // Falsy media query - @if $flag == media or $flag == all { - @media -json-encode { - json { - json: $json; - } - } - } -} - -// Delay the encoding of ta literal to JSON -// to a type-specific method -// -------------------------------------------------------------------------------- -// @param $value: value to be stringified -// -------------------------------------------------------------------------------- -// @throw "Unknown type for $value ( {x} )." -// -------------------------------------------------------------------------------- -// @return [string|false] JSON encoded string - -@function json-encode($value) { - $type: type-of($value); - @if function_exists('_json-encode--#{$type}') { - @return call('_json-encode--#{$type}', $value); - } - @warn "Unknown type for #{$value} (#{$type})."; - @return false; -} From 14379ba7dab626bff0c9e161f8c1e4583d699932 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Thu, 11 Feb 2016 22:50:13 +0000 Subject: [PATCH 10/29] removing stuff we don't need --- CHANGELOG.md | 24 -- Gruntfile.js | 177 -------------- SassyJSON.gemspec | 38 --- bower.json | 24 -- lib/JsonImporter.rb | 227 ------------------ lib/SassyJSON.rb | 12 - sache.json | 5 - src/_SassyJSON.scss | 2 + {stylesheets => src}/encode/api/_json.scss | 0 {stylesheets => src}/encode/encode.scss | 0 .../encode/helpers/_quote.scss | 0 .../encode/helpers/_to-string.scss | 0 {stylesheets => src}/encode/mixins/_json.scss | 0 {stylesheets => src}/encode/types/_bool.scss | 0 {stylesheets => src}/encode/types/_color.scss | 0 {stylesheets => src}/encode/types/_list.scss | 0 {stylesheets => src}/encode/types/_map.scss | 0 {stylesheets => src}/encode/types/_null.scss | 0 .../encode/types/_number.scss | 0 .../encode/types/_string.scss | 0 stylesheets/_SassyJSON.scss | 5 - stylesheets/decode/api/_json.scss | 24 -- stylesheets/decode/decode.scss | 28 --- stylesheets/decode/helpers/all/_throw.scss | 7 - stylesheets/decode/helpers/all/_value.scss | 46 ---- stylesheets/decode/helpers/color/_color.scss | 43 ---- .../helpers/color/_get-color-value.scss | 21 -- .../decode/helpers/color/_hex-to-dec.scss | 18 -- stylesheets/decode/helpers/color/_hex.scss | 43 ---- stylesheets/decode/helpers/color/_hsl.scss | 43 ---- stylesheets/decode/helpers/color/_rgb.scss | 43 ---- stylesheets/decode/helpers/map/_consume.scss | 27 --- .../decode/helpers/number/_find-digits.scss | 36 --- .../decode/helpers/number/_find-exponent.scss | 45 ---- .../decode/helpers/number/_find-integer.scss | 34 --- stylesheets/decode/helpers/number/_pow.scss | 20 -- .../helpers/string/_find-ending-quote.scss | 49 ---- .../decode/helpers/string/_length.scss | 40 --- .../decode/helpers/string/_strip-token.scss | 15 -- stylesheets/decode/types/_bool.scss | 38 --- stylesheets/decode/types/_list.scss | 51 ---- stylesheets/decode/types/_map.scss | 70 ------ stylesheets/decode/types/_null.scss | 18 -- stylesheets/decode/types/_number.scss | 62 ----- stylesheets/decode/types/_string.scss | 39 --- test/decode/_index.scss | 27 --- test/decode/api/_json.scss | 18 -- test/decode/fixtures/test.json | 3 - test/decode/helpers/all/_value.scss | 12 - test/decode/helpers/color/_color.scss | 35 --- .../helpers/color/_get-color-value.scss | 30 --- test/decode/helpers/color/_hex-to-dec.scss | 7 - test/decode/helpers/color/_hex.scss | 16 -- test/decode/helpers/color/_hsl.scss | 21 -- test/decode/helpers/color/_rgb.scss | 21 -- test/decode/helpers/map/_consume.scss | 11 - test/decode/helpers/number/_find-digits.scss | 26 -- .../decode/helpers/number/_find-exponent.scss | 39 --- test/decode/helpers/number/_find-integer.scss | 32 --- test/decode/helpers/number/_pow.scss | 18 -- .../helpers/string/_find-ending-quote.scss | 13 - test/decode/helpers/string/_length.scss | 54 ----- test/decode/helpers/string/_strip-token.scss | 13 - test/decode/test.scss | 8 - test/decode/types/_bool.scss | 14 -- test/decode/types/_list.scss | 30 --- test/decode/types/_map.scss | 23 -- test/decode/types/_null.scss | 9 - test/decode/types/_number.scss | 104 -------- test/decode/types/_string.scss | 21 -- test/encode/_index.scss | 14 -- test/encode/api/_json.scss | 29 --- test/encode/helpers/_quote.scss | 6 - test/encode/test.scss | 8 - test/encode/types/_bool.scss | 6 - test/encode/types/_color.scss | 7 - test/encode/types/_list.scss | 25 -- test/encode/types/_map.scss | 17 -- test/encode/types/_null.scss | 8 - test/encode/types/_number.scss | 68 ------ test/encode/types/_string.scss | 9 - test/test.scss | 12 - 82 files changed, 2 insertions(+), 2186 deletions(-) delete mode 100644 CHANGELOG.md delete mode 100644 Gruntfile.js delete mode 100644 SassyJSON.gemspec delete mode 100644 bower.json delete mode 100644 lib/JsonImporter.rb delete mode 100644 lib/SassyJSON.rb delete mode 100644 sache.json create mode 100755 src/_SassyJSON.scss rename {stylesheets => src}/encode/api/_json.scss (100%) rename {stylesheets => src}/encode/encode.scss (100%) rename {stylesheets => src}/encode/helpers/_quote.scss (100%) rename {stylesheets => src}/encode/helpers/_to-string.scss (100%) rename {stylesheets => src}/encode/mixins/_json.scss (100%) rename {stylesheets => src}/encode/types/_bool.scss (100%) rename {stylesheets => src}/encode/types/_color.scss (100%) rename {stylesheets => src}/encode/types/_list.scss (100%) rename {stylesheets => src}/encode/types/_map.scss (100%) rename {stylesheets => src}/encode/types/_null.scss (100%) rename {stylesheets => src}/encode/types/_number.scss (100%) rename {stylesheets => src}/encode/types/_string.scss (100%) delete mode 100755 stylesheets/_SassyJSON.scss delete mode 100755 stylesheets/decode/api/_json.scss delete mode 100755 stylesheets/decode/decode.scss delete mode 100755 stylesheets/decode/helpers/all/_throw.scss delete mode 100755 stylesheets/decode/helpers/all/_value.scss delete mode 100755 stylesheets/decode/helpers/color/_color.scss delete mode 100755 stylesheets/decode/helpers/color/_get-color-value.scss delete mode 100755 stylesheets/decode/helpers/color/_hex-to-dec.scss delete mode 100755 stylesheets/decode/helpers/color/_hex.scss delete mode 100755 stylesheets/decode/helpers/color/_hsl.scss delete mode 100755 stylesheets/decode/helpers/color/_rgb.scss delete mode 100755 stylesheets/decode/helpers/map/_consume.scss delete mode 100755 stylesheets/decode/helpers/number/_find-digits.scss delete mode 100755 stylesheets/decode/helpers/number/_find-exponent.scss delete mode 100755 stylesheets/decode/helpers/number/_find-integer.scss delete mode 100755 stylesheets/decode/helpers/number/_pow.scss delete mode 100755 stylesheets/decode/helpers/string/_find-ending-quote.scss delete mode 100755 stylesheets/decode/helpers/string/_length.scss delete mode 100755 stylesheets/decode/helpers/string/_strip-token.scss delete mode 100755 stylesheets/decode/types/_bool.scss delete mode 100755 stylesheets/decode/types/_list.scss delete mode 100755 stylesheets/decode/types/_map.scss delete mode 100755 stylesheets/decode/types/_null.scss delete mode 100755 stylesheets/decode/types/_number.scss delete mode 100755 stylesheets/decode/types/_string.scss delete mode 100644 test/decode/_index.scss delete mode 100644 test/decode/api/_json.scss delete mode 100644 test/decode/fixtures/test.json delete mode 100644 test/decode/helpers/all/_value.scss delete mode 100644 test/decode/helpers/color/_color.scss delete mode 100644 test/decode/helpers/color/_get-color-value.scss delete mode 100644 test/decode/helpers/color/_hex-to-dec.scss delete mode 100644 test/decode/helpers/color/_hex.scss delete mode 100644 test/decode/helpers/color/_hsl.scss delete mode 100644 test/decode/helpers/color/_rgb.scss delete mode 100644 test/decode/helpers/map/_consume.scss delete mode 100644 test/decode/helpers/number/_find-digits.scss delete mode 100644 test/decode/helpers/number/_find-exponent.scss delete mode 100644 test/decode/helpers/number/_find-integer.scss delete mode 100644 test/decode/helpers/number/_pow.scss delete mode 100644 test/decode/helpers/string/_find-ending-quote.scss delete mode 100644 test/decode/helpers/string/_length.scss delete mode 100644 test/decode/helpers/string/_strip-token.scss delete mode 100644 test/decode/test.scss delete mode 100644 test/decode/types/_bool.scss delete mode 100644 test/decode/types/_list.scss delete mode 100644 test/decode/types/_map.scss delete mode 100644 test/decode/types/_null.scss delete mode 100644 test/decode/types/_number.scss delete mode 100644 test/decode/types/_string.scss delete mode 100644 test/encode/_index.scss delete mode 100644 test/encode/api/_json.scss delete mode 100644 test/encode/helpers/_quote.scss delete mode 100644 test/encode/test.scss delete mode 100644 test/encode/types/_bool.scss delete mode 100644 test/encode/types/_color.scss delete mode 100644 test/encode/types/_list.scss delete mode 100644 test/encode/types/_map.scss delete mode 100644 test/encode/types/_null.scss delete mode 100644 test/encode/types/_number.scss delete mode 100644 test/encode/types/_string.scss delete mode 100644 test/test.scss diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 4abe87a..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,24 +0,0 @@ -# Changelog -* `1.1.8`: Solved an issue with tabs -* `1.1.7`: Included cosmetic changes made after linting with [scss-lint](https://github.com/causes/scss-lint) -* `1.1.6`: JSON files that are loaded via `@import "data.json?varname` can be pretty printed now. -* `1.1.5`: Fixed `json-encode` mixin to keep `body::before` in the render tree. Making it possible to access via `getComputedStyle(document.body, ':before')` -* `1.1.4`: Small fix for the `npm` release -* `1.1.3`: fixed error in `_pow` introduced after updating to Sass 3.3.0.rc.3 -* `1.1.2`: Made it possible to import JSON files via `@import 'relative/path/to/file.json?variable-name'` -* `1.1.1`: fixing a minor issue with the gem -* `1.1.0`: adding the ability to import a JSON file -* `1.0.11`: fixing an issue with scientific number parsing -* `1.0.10`: improving number and string helpers -* `1.0.9`: fixing a bug in `_find-exponent` -* `1.0.8`: fixing a major issue in Ruby Gem -* `1.0.7`: minor fixes and stable Ruby Gem -* `1.0.6`: released a Ruby Gem -* `1.0.5`: improved the encoding mixin -* `1.0.4`: fixed an error in map parsing -* `1.0.3`: slightly edited the mixin to dump JSON to CSS -* `1.0.2`: fixed an issue with string parsing -* `1.0.1`: fixed an issue with alpha color parsing -* `1.0.0`: Stable API. `json-encode` and `json-decode` -* `0.0.2`: added `json-decode` and test -* `0.0.1`: initial commit diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index f9b85eb..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,177 +0,0 @@ -module.exports = function(grunt) { - - // Modules - grunt.loadNpmTasks('grunt-contrib-sass'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-scsslint'); - grunt.loadNpmTasks('bootcamp'); - - // Grunt Tasks - grunt.initConfig({ - dir : { - src : 'stylesheets', - dist : 'dist' - }, - pkg: grunt.file.readJSON('package.json'), - - concat: { - options: { - banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n', - }, - dist: { - src: [ - // Decoder - '<%= dir.src %>/decode/helpers/all/_throw.scss', - '<%= dir.src %>/decode/helpers/all/_value.scss', - '<%= dir.src %>/decode/helpers/map/_consume.scss', - '<%= dir.src %>/decode/helpers/string/_find-ending-quote.scss', - '<%= dir.src %>/decode/helpers/string/_strip-token.scss', - '<%= dir.src %>/decode/helpers/string/_length.scss', - '<%= dir.src %>/decode/helpers/color/_color.scss', - '<%= dir.src %>/decode/helpers/color/_get-color-value.scss', - '<%= dir.src %>/decode/helpers/color/_hsl.scss', - '<%= dir.src %>/decode/helpers/color/_rgb.scss', - '<%= dir.src %>/decode/helpers/color/_hex.scss', - '<%= dir.src %>/decode/helpers/color/_hex-to-dec.scss', - '<%= dir.src %>/decode/helpers/number/_pow.scss', - '<%= dir.src %>/decode/helpers/number/_find-integer.scss', - '<%= dir.src %>/decode/helpers/number/_find-digits.scss', - '<%= dir.src %>/decode/helpers/number/_find-exponent.scss', - '<%= dir.src %>/decode/types/_string.scss', - '<%= dir.src %>/decode/types/_bool.scss', - '<%= dir.src %>/decode/types/_null.scss', - '<%= dir.src %>/decode/types/_number.scss', - '<%= dir.src %>/decode/types/_list.scss', - '<%= dir.src %>/decode/types/_map.scss', - '<%= dir.src %>/decode/api/_json.scss', - - // Encoder - '<%= dir.src %>/encode/helpers/_quote.scss', - '<%= dir.src %>/encode/types/_bool.scss', - '<%= dir.src %>/encode/types/_color.scss', - '<%= dir.src %>/encode/types/_list.scss', - '<%= dir.src %>/encode/types/_map.scss', - '<%= dir.src %>/encode/types/_number.scss', - '<%= dir.src %>/encode/types/_string.scss', - '<%= dir.src %>/encode/types/_null.scss', - '<%= dir.src %>/encode/mixins/_json.scss', - '<%= dir.src %>/encode/api/_json.scss' - ], - dest: '<%= dir.dist %>/_<%= pkg.name %>.scss', - }, - }, - - // Sass - sass: { - options: { - style: 'expanded', - require : './lib/JsonImporter.rb', - loadPath: ['./node_modules/bootcamp/dist', './<%= dir.src %>'] - }, - all: { - files: { - './tmp/all.css': './test/test.scss' - } - }, - decoder: { - files: { - './tmp/decode.css': './test/decode/test.scss' - } - }, - encoder: { - files: { - './tmp/encode.css': './test/encode/test.scss' - } - } - }, - - scsslint : { - options : { - excludeLinter : [ - 'ColorKeyword', - 'NameFormat', - 'StringQuotes', - 'SpaceAfterComma', - 'Comment', - 'PropertySpelling' - ] - }, - all: { - src : ['<%= dir.src %>/**/*'] - }, - decoder: { - src : ['<%= dir.src %>/decoder/**/*'] - }, - encoder: { - src : ['<%= dir.src %>/encoder/**/*'] - } - }, - - // Bootcamp - bootcamp: { - all: { - files: { - src: ['./tmp/all.css'] - } - }, - decoder:{ - files: { - src: ['./tmp/decode.css'] - } - }, - encoder:{ - files: { - src: ['./tmp/encode.css'] - } - } - }, - - // Watch - watch: { - all: { - files: [ - './test/**/*.scss', - './<%= dir.src %>/**/*.scss' - ], - tasks: ['test'] - }, - decoder: { - files: [ - './test/decode/**/*.scss', - './<%= dir.src %>/**/*.scss' - ], - tasks: ['test:decoder'] - }, - encoder: { - files: [ - './test/encode/**/*.scss', - './<%= dir.src %>/**/*.scss' - ], - tasks: ['test:encode'] - } - } - }); - - // Tasks - grunt.registerTask('test', function (arg){ - arg = arg || "all"; - - var tasks = ['scsslint', 'sass', 'bootcamp'].map(function (item){ - return item + ":" + arg; - }); - - - grunt.task.run(tasks); - }); - grunt.registerTask('dev', function (arg ){ - arg = arg || "all"; - - var tasks = ['test', 'watch'].map(function (item){ - return item + ":" + arg; - }); - - grunt.task.run(tasks); - }); - grunt.registerTask('build', ['test:all', 'concat']); -}; diff --git a/SassyJSON.gemspec b/SassyJSON.gemspec deleted file mode 100644 index 7c2c55a..0000000 --- a/SassyJSON.gemspec +++ /dev/null @@ -1,38 +0,0 @@ -require './lib/SassyJSON' - -Gem::Specification.new do |s| - # Release Specific Information - s.version = SassyJSON::VERSION - s.date = SassyJSON::DATE - - # Gem Details - s.name = "SassyJSON" - s.rubyforge_project = "SassyJSON" - s.description = %q{Sass API for JSON} - s.summary = %q{SassyJSON is a Sass-powered API for JSON. It provides you the classic json-encode and json-decode directly from your Sass files.} - s.authors = ["Hugo Giraudel", "Fabrice Weinberg"] - s.email = ["hugo.giraudel@gmail.com", "fabrice@weinberg.me"] - s.homepage = "https://github.com/HugoGiraudel/SassyJSON/" - - # README file - s.files = ["README.md"] - - # CHANGELOG - s.files += ["CHANGELOG.md"] - - # Library Files - s.files += Dir.glob("lib/**/*.*") - - # Sass Files - s.files += Dir.glob("stylesheets/**/*.*") - - # Add to require - s.require_paths = ["lib", "stylesheets"] - - # Gem Bookkeeping - s.required_rubygems_version = ">= 1.3.6" - s.rubygems_version = %q{1.3.6} - - # Deps - #s.add_runtime_dependency 'sass', '>= 3.3.0' -end \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index 4d23ebf..0000000 --- a/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name":"Modular-SassyJSON", - "description":"A fork of SassyJSON for Modular.", - "version":"1.0.0", - "main":[ - "stylesheets/_SassyJSON.scss" - ], - "keywords":[ - "css", - "sass", - "scss", - "module", - "modular", - "components", - "scalable" - ], - "homepage":"https://github.com/esr360/SassyJSON", - "ignore":[ - ".gitattributes", - ".gitignore", - "bower.json", - "prepros.cfg" - ] -} \ No newline at end of file diff --git a/lib/JsonImporter.rb b/lib/JsonImporter.rb deleted file mode 100644 index 7fe7228..0000000 --- a/lib/JsonImporter.rb +++ /dev/null @@ -1,227 +0,0 @@ -require 'sass' - - -# Monkey Path Sass -# Adapted from: https://github.com/chriseppstein/sass-css-importer -class Sass::Engine - alias initialize_without_json_importer initialize - - def initialize(template, options={}) - initialize_without_json_importer(template, options) - - json_importer = self.options[:load_paths].find {|lp| lp.is_a?(Sass::Importers::JsonImporter) } - - unless json_importer - root = File.dirname(options[:filename] || ".") - self.options[:load_paths] << Sass::Importers::JsonImporter.new(root) - end - end -end - -module Sass - module Importers - # The default importer, used for any strings found in the load path. - # Simply loads Sass files from the filesystem using the default logic. - class JsonImporter < Base - - attr_accessor :root - - # Creates a new filesystem importer that imports files relative to a given path. - # - # @param root [String] The root path. - # This importer will import files relative to this path. - def initialize(root) - @root = File.expand_path(root) - @same_name_warnings = Set.new - end - - # Enable watching of json files in Sass 3.3+ - def watched_directories - [root] - end - - # Enable watching of json files in Sass 3.3+ - def watched_file?(file) - file.start_with?(root+File::SEPARATOR) && File.extname(file) == ".json" - end - # @see Base#find_relative - def find_relative(name, base, options) - _find(File.dirname(base), name, options) - end - - # @see Base#find - def find(name, options) - _find(@root, name, options) - end - - # @see Base#mtime - def mtime(name, options) - name = strip_varname(name); - file, _ = Sass::Util.destructure(find_real_file(@root, name, options)) - File.mtime(file) if file - rescue Errno::ENOENT - nil - end - - # @see Base#key - def key(name, options) - name = strip_varname(name); - [self.class.name + ":" + File.dirname(File.expand_path(name)), - File.basename(name)] - end - - # @see Base#to_s - def to_s - @root - end - - def hash - @root.hash - end - - def eql?(other) - root.eql?(other.root) - end - - protected - - # If a full uri is passed, this removes the root from it - # otherwise returns the name unchanged - def remove_root(name) - if name.index(@root + "/") == 0 - name[(@root.length + 1)..-1] - else - name - end - end - - # A hash from file extensions to the syntaxes for those extensions. - # The syntaxes must be `:sass` or `:scss`. - # - # This can be overridden by subclasses that want normal filesystem importing - # with unusual extensions. - # - # @return [{String => Symbol}] - def extensions - {'json' => :scss} - end - - # Given an `@import`ed path, returns an array of possible - # on-disk filenames and their corresponding syntaxes for that path. - # - # @param name [String] The filename. - # @return [Array(String, Symbol)] An array of pairs. - # The first element of each pair is a filename to look for; - # the second element is the syntax that file would be in (`:sass` or `:scss`). - def possible_files(name) - name = escape_glob_characters(name) - dirname, basename, extname = split(name) - sorted_exts = extensions.sort - syntax = extensions[extname] - - if syntax - ret = [["#{dirname}/{_,}#{basename}.#{extensions.invert[syntax]}", syntax]] - else - ret = sorted_exts.map {|ext, syn| ["#{dirname}/{_,}#{basename}.#{ext}", syn]} - end - - # JRuby chokes when trying to import files from JARs when the path starts with './'. - ret.map {|f, s| [f.sub(%r{^\./}, ''), s]} - end - - def escape_glob_characters(name) - name.gsub(/[\*\[\]\{\}\?]/) do |char| - "\\#{char}" - end - end - - REDUNDANT_DIRECTORY = %r{#{Regexp.escape(File::SEPARATOR)}\.#{Regexp.escape(File::SEPARATOR)}} - # Given a base directory and an `@import`ed name, - # finds an existant file that matches the name. - # - # @param dir [String] The directory relative to which to search. - # @param name [String] The filename to search for. - # @return [(String, Symbol)] A filename-syntax pair. - def find_real_file(dir, name, options) - # on windows 'dir' can be in native File::ALT_SEPARATOR form - dir = dir.gsub(File::ALT_SEPARATOR, File::SEPARATOR) unless File::ALT_SEPARATOR.nil? - - found = possible_files(remove_root(name)).map do |f, s| - path = (dir == "." || Pathname.new(f).absolute?) ? f : "#{escape_glob_characters(dir)}/#{f}" - Dir[path].map do |full_path| - full_path.gsub!(REDUNDANT_DIRECTORY, File::SEPARATOR) - [Pathname.new(full_path).cleanpath.to_s, s] - end - end - found = Sass::Util.flatten(found, 1) - return if found.empty? - - if found.size > 1 && !@same_name_warnings.include?(found.first.first) - found.each {|(f, _)| @same_name_warnings << f} - relative_to = Pathname.new(dir) - if options[:_line] - # If _line exists, we're here due to an actual import in an - # import_node and we want to print a warning for a user writing an - # ambiguous import. - candidates = found.map {|(f, _)| " " + Pathname.new(f).relative_path_from(relative_to).to_s}.join("\n") - Sass::Util.sass_warn < extension_path) - -# Version is a number. If a version contains alphas, it will be created as a prerelease version -# Date is in the form of YYYY-MM-DD -module SassyJSON - VERSION = "1.1.8" - DATE = "2014-06-01" -end diff --git a/sache.json b/sache.json deleted file mode 100644 index 383d085..0000000 --- a/sache.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "SassyJSON", - "description": "SassyJSON is a Sass-powered API for JSON. It provides you the classic json-encode and json-decode directly from your Sass files. We'll leave you the only judges of the point of this.", - "tags": ["json", "sass"] -} diff --git a/src/_SassyJSON.scss b/src/_SassyJSON.scss new file mode 100755 index 0000000..e9e56ea --- /dev/null +++ b/src/_SassyJSON.scss @@ -0,0 +1,2 @@ +// Encoder +@import "encode/encode"; \ No newline at end of file diff --git a/stylesheets/encode/api/_json.scss b/src/encode/api/_json.scss similarity index 100% rename from stylesheets/encode/api/_json.scss rename to src/encode/api/_json.scss diff --git a/stylesheets/encode/encode.scss b/src/encode/encode.scss similarity index 100% rename from stylesheets/encode/encode.scss rename to src/encode/encode.scss diff --git a/stylesheets/encode/helpers/_quote.scss b/src/encode/helpers/_quote.scss similarity index 100% rename from stylesheets/encode/helpers/_quote.scss rename to src/encode/helpers/_quote.scss diff --git a/stylesheets/encode/helpers/_to-string.scss b/src/encode/helpers/_to-string.scss similarity index 100% rename from stylesheets/encode/helpers/_to-string.scss rename to src/encode/helpers/_to-string.scss diff --git a/stylesheets/encode/mixins/_json.scss b/src/encode/mixins/_json.scss similarity index 100% rename from stylesheets/encode/mixins/_json.scss rename to src/encode/mixins/_json.scss diff --git a/stylesheets/encode/types/_bool.scss b/src/encode/types/_bool.scss similarity index 100% rename from stylesheets/encode/types/_bool.scss rename to src/encode/types/_bool.scss diff --git a/stylesheets/encode/types/_color.scss b/src/encode/types/_color.scss similarity index 100% rename from stylesheets/encode/types/_color.scss rename to src/encode/types/_color.scss diff --git a/stylesheets/encode/types/_list.scss b/src/encode/types/_list.scss similarity index 100% rename from stylesheets/encode/types/_list.scss rename to src/encode/types/_list.scss diff --git a/stylesheets/encode/types/_map.scss b/src/encode/types/_map.scss similarity index 100% rename from stylesheets/encode/types/_map.scss rename to src/encode/types/_map.scss diff --git a/stylesheets/encode/types/_null.scss b/src/encode/types/_null.scss similarity index 100% rename from stylesheets/encode/types/_null.scss rename to src/encode/types/_null.scss diff --git a/stylesheets/encode/types/_number.scss b/src/encode/types/_number.scss similarity index 100% rename from stylesheets/encode/types/_number.scss rename to src/encode/types/_number.scss diff --git a/stylesheets/encode/types/_string.scss b/src/encode/types/_string.scss similarity index 100% rename from stylesheets/encode/types/_string.scss rename to src/encode/types/_string.scss diff --git a/stylesheets/_SassyJSON.scss b/stylesheets/_SassyJSON.scss deleted file mode 100755 index 28dc5d2..0000000 --- a/stylesheets/_SassyJSON.scss +++ /dev/null @@ -1,5 +0,0 @@ -// Encoder -@import "encode/encode"; - -// Decoder -@import "decode/decode"; \ No newline at end of file diff --git a/stylesheets/decode/api/_json.scss b/stylesheets/decode/api/_json.scss deleted file mode 100755 index 3ea9b2b..0000000 --- a/stylesheets/decode/api/_json.scss +++ /dev/null @@ -1,24 +0,0 @@ -/// Parse a JSON string -/// @access public -/// @param {String} $json - JSON string to parse -/// @throw Input string may not be null. -/// @return {*} -/// @require {function} _json-decode--value -@function json-decode($json) { - $length: str-length($json); - $pointer: 1; - $value: null; - - @if $json == null { - @return _throw("Input string may not be null.", $pointer); - } - - @while $value != false // Stop if error - and $pointer <= $length { - $read: _json-decode--value($json, $pointer); - $pointer: nth($read, 1); - $value: nth($read, 2); - } - - @return $value; -} diff --git a/stylesheets/decode/decode.scss b/stylesheets/decode/decode.scss deleted file mode 100755 index 14dfe30..0000000 --- a/stylesheets/decode/decode.scss +++ /dev/null @@ -1,28 +0,0 @@ -// Helpers -@import "helpers/all/throw"; -@import "helpers/all/value"; -@import "helpers/map/consume"; -@import "helpers/number/pow"; -@import "helpers/number/find-digits"; -@import "helpers/number/find-integer"; -@import "helpers/number/find-exponent"; -@import "helpers/color/color"; -@import "helpers/color/get-color-value"; -@import "helpers/color/rgb"; -@import "helpers/color/hsl"; -@import "helpers/color/hex"; -@import "helpers/color/hex-to-dec"; -@import "helpers/string/length"; -@import "helpers/string/strip-token"; -@import "helpers/string/find-ending-quote"; - -// Type specific decoding functions -@import "types/bool"; -@import "types/null"; -@import "types/list"; -@import "types/map"; -@import "types/number"; -@import "types/string"; - -// Public API -@import "api/json"; \ No newline at end of file diff --git a/stylesheets/decode/helpers/all/_throw.scss b/stylesheets/decode/helpers/all/_throw.scss deleted file mode 100755 index 4e3dad7..0000000 --- a/stylesheets/decode/helpers/all/_throw.scss +++ /dev/null @@ -1,7 +0,0 @@ -/// Logs an error at `$pointer` with `$string` message -/// @access private -/// @param {String} $string - error message -/// @param {Number} $pointer - pointer position -@function _throw($string, $pointer) { - @error "ERROR::#{$pointer}::#{$string}"; -} diff --git a/stylesheets/decode/helpers/all/_value.scss b/stylesheets/decode/helpers/all/_value.scss deleted file mode 100755 index 1437e44..0000000 --- a/stylesheets/decode/helpers/all/_value.scss +++ /dev/null @@ -1,46 +0,0 @@ -/// Delay parsing to type-specific function -/// @access private -/// according to found character -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token $token. -/// @throw Empty JSON string. -/// @return {List} - (new pointer, parsed value) -/// @require {function} _throw -/// @require {function} _json-decode--map -/// @require {function} _json-decode--list -/// @require {function} _json-decode--true -/// @require {function} _json-decode--false -/// @require {function} _json-decode--string -/// @require {function} _json-decode--null -/// @require {function} _json-decode--number -@function _json-decode--value($source, $pointer) { - $length: str-length($source); - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $token == '{' { - @return _json-decode--map($source, $pointer); - } @else if $token == '[' { - @return _json-decode--list($source, $pointer); - } @else if $token == 't' { - @return _json-decode--true($source, $pointer); - } @else if $token == 'f' { - @return _json-decode--false($source, $pointer); - } @else if $token == '"' { - @return _json-decode--string($source, $pointer); - } @else if $token == 'n' { - @return _json-decode--null($source, $pointer); - } @else if index('1' '2' '3' '4' '5' '6' '7' '8' '9' '0' '-' '.', $token) { - @return _json-decode--number($source, $pointer); - } @else if $token == ' ' or $token == " " { - // @continue; - } @else { - @return _throw("Unexpected token `#{$token}`.", $pointer); - } - } - - @return _throw("Empty JSON string.", $pointer); -} diff --git a/stylesheets/decode/helpers/color/_color.scss b/stylesheets/decode/helpers/color/_color.scss deleted file mode 100755 index 59ef9f0..0000000 --- a/stylesheets/decode/helpers/color/_color.scss +++ /dev/null @@ -1,43 +0,0 @@ -/// Parses a JSON encoded string to see if it's a CSS color -/// @access private -/// @param {String} $string - JSON string -/// @return {Color | String} - string or number, depending on the match -/// @require {function} _from-hex -/// @require {function} _from-rgb -/// @require {function} _from-hsl -@function _color($string) { - @if type-of($string) == "color" { - @return $string; - } - - $string-lower: to-lower-case($string); - $colors: transparent black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen; - $keywords: (); - - // Filling $keywords with stringified color keywords - @each $color in $colors { - $keywords: append($keywords, $color + ""); - } - - // Deal with inherit keyword - @if $string-lower == "inherit" { - @return unquote($string); - } - - @if index($keywords, $string-lower) { - // Deal with color keywords - @return nth($colors, index($keywords, $string-lower)); - } @else if str-slice($string-lower, 1, 1) == '#' { - // Deal with hexadecimal triplets - @return _from-hex($string); - } @else if str-slice($string-lower, 1, 3) == 'rgb' { - // Deal with rgb(a) colors - @return _from-rgb($string); - } @else if str-slice($string-lower, 1, 3) == 'hsl' { - // Deal with hsl(a) colors - @return _from-hsl($string); - } @else { - // Return string - @return $string; - } -} diff --git a/stylesheets/decode/helpers/color/_get-color-value.scss b/stylesheets/decode/helpers/color/_get-color-value.scss deleted file mode 100755 index d8b8215..0000000 --- a/stylesheets/decode/helpers/color/_get-color-value.scss +++ /dev/null @@ -1,21 +0,0 @@ -/// Cast a stringified number / stringified percentage into number type -/// @access private -/// @param {String} $string - JSON string -/// @return {Number} - unitless number or percentage -/// @require {function} _json-decode--number -@function _get-color-value($string) { - $first: str-slice($string, 1, 1); - - // Pad <1 values with a leading 0 - @if $first == '.' { - $string: '0' + $string; - } - - $last: str-slice($string, -1, -1); - - @return if( - $last == '%', - nth(_json-decode--number(str-slice($string, 1, -2), 2), 2) * 1%, - nth(_json-decode--number($string, 2), 2) - ); -} diff --git a/stylesheets/decode/helpers/color/_hex-to-dec.scss b/stylesheets/decode/helpers/color/_hex-to-dec.scss deleted file mode 100755 index 7879dda..0000000 --- a/stylesheets/decode/helpers/color/_hex-to-dec.scss +++ /dev/null @@ -1,18 +0,0 @@ -/// Convert an hexadecimal number to a decimal number -/// @access private -/// @param {String} $string - hexadecimal value -/// @return {Number} - decimal number -@function _hex-to-dec($string) { - $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; - $string: to-lower-case($string); - $length: str-length($string); - - $dec: 0; - @for $i from 1 through $length { - $factor: 1 + (15 * ($length - $i)); - $index: index($hex, str-slice($string, $i, $i)); - $dec: $dec + $factor * ($index - 1); - } - - @return $dec; -} diff --git a/stylesheets/decode/helpers/color/_hex.scss b/stylesheets/decode/helpers/color/_hex.scss deleted file mode 100755 index 602e741..0000000 --- a/stylesheets/decode/helpers/color/_hex.scss +++ /dev/null @@ -1,43 +0,0 @@ -/// Cast a JSON encoded string into a hexadecimal color -/// @access private -/// @param {String} $string - JSON string -/// @return {Color | String} - string or hex color depending on the match -/// @require {function} _hex-to-dec -@function _from-hex($string) { - $string-lower: to-lower-case($string); - $r: ""; $g: ""; $b: ""; - $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; - $length: str-length($string); - $max: if($length == 4, 1, 2); - - // Check for length accuracy - @if $length != 4 and $length != 7 { - @return $string; - } - - // Loop from the second character (omitting #) - @for $i from 2 through $length { - $c: str-slice($string-lower, $i, $i); - - // If wrong character, return - @if index($hex, $c) == null { - @return $string; - } - - @if str-length($r) < $max { - $r: $r + $c; - } @else if str-length($g) < $max { - $g: $g + $c; - } @else if str-length($b) < $max { - $b: $b + $c; - } - } - - @if $length == 4 { - $r: $r + $r; - $g: $g + $g; - $b: $b + $b; - } - - @return rgb(_hex-to-dec($r), _hex-to-dec($g), _hex-to-dec($b)); -} diff --git a/stylesheets/decode/helpers/color/_hsl.scss b/stylesheets/decode/helpers/color/_hsl.scss deleted file mode 100755 index bafae8e..0000000 --- a/stylesheets/decode/helpers/color/_hsl.scss +++ /dev/null @@ -1,43 +0,0 @@ -/// Cast a JSON encoded string into a hsl(a) color -/// @access private -/// @param {String} $string - JSON string -/// @return {Color | String} - string or hsl(a) color, depending on the match -/// @require {function} _get-color-value -@function _from-hsl($string) { - $frags: (); - $string-lower: to-lower-case($string); - $is-alpha: str-slice($string-lower, 4, 4) == 'a'; - $length: str-length($string); - $start: str-index($string, "("); - - @for $i from $start through $length { - $token: str-slice($string-lower, $i, $i); - @if $token == ' ' or $token == " " { - // @continue; - } @else if $token == '(' or $token == ',' { - $frags: append($frags, ""); - } @else if $token == ')' { - @if length($frags) != if($is-alpha, 4, 3) { @return $string; } // Parsing error - $hue: _get-color-value(nth($frags, 1)); - $saturation: _get-color-value(nth($frags, 2)); - $lightness: _get-color-value(nth($frags, 3)); - - @if not $hue or not $saturation or not $lightness { - @return $string; - } - - @if $is-alpha { - @if length($frags) != 4 { @return $string; } // No alpha channel found - $alpha: _get-color-value(nth($frags, 4)); - @if not $alpha { @return $string; } // Error parsing alpha channel - @return hsla($hue, $saturation, $lightness, $alpha); - } - - @return hsl($hue, $saturation, $lightness); - } @else { - $frags: set-nth($frags, length($frags), nth($frags, length($frags)) + $token); - } - } - - @return $string; -} diff --git a/stylesheets/decode/helpers/color/_rgb.scss b/stylesheets/decode/helpers/color/_rgb.scss deleted file mode 100755 index 1eae163..0000000 --- a/stylesheets/decode/helpers/color/_rgb.scss +++ /dev/null @@ -1,43 +0,0 @@ -/// Cast a JSON encoded string into a rgb(a) color -/// @access private -/// @param {String} $string - JSON string -/// @return {Color | String} - string or rgb(a) color depending on the match -/// @require {function} _get-color-value -@function _from-rgb($string) { - $string-lower: to-lower-case($string); - $frags: (); - $is-alpha: str-slice($string-lower, 4, 4) == 'a'; - $start: str-index($string, "("); - $length: str-length($string); - - @for $i from $start through $length { - $token: str-slice($string-lower, $i, $i); - @if $token == ' ' or $token == " " { - // @continue; - } @else if $token == '(' or $token == ',' { - $frags: append($frags, ""); - } @else if $token == ')' { - @if length($frags) != if($is-alpha, 4, 3) { @return $string; } // Parsing error - $red: _get-color-value(nth($frags, 1)); - $green: _get-color-value(nth($frags, 2)); - $blue: _get-color-value(nth($frags, 3)); - - @if not $red or not $green or not $blue { - @return $string; - } - - @if $is-alpha { - @if length($frags) != 4 { @return $string; } // No alpha channel found - $alpha: _get-color-value(nth($frags, 4)); - @if not $alpha { @return $string; } // Error parsing alpha channel - @return rgba($red, $green, $blue, $alpha); - } - - @return rgb($red, $green, $blue); - } @else { - $frags: set-nth($frags, length($frags), nth($frags, length($frags)) + $token); - } - } - - @return $string; -} diff --git a/stylesheets/decode/helpers/map/_consume.scss b/stylesheets/decode/helpers/map/_consume.scss deleted file mode 100755 index 52ef403..0000000 --- a/stylesheets/decode/helpers/map/_consume.scss +++ /dev/null @@ -1,27 +0,0 @@ -/// Move pointer to position of token -/// @access private -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @param {String} $token - token to reach -/// @throw Expected $token; found $char. -/// @throw Expected $token but reached end of stream. -/// @return {Number} - new pointer -/// @require {function} _throw -@function _consume($source, $pointer, $token) { - $length: str-length($source); - - @while $pointer <= $length { - $char: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $char == $token { - @return $pointer; - } @else if $char == " " or $char == " " { - // @continue; - } @else { - @return _throw("Expected `#{$token}`; found `#{$char}`.", $pointer); - } - } - - @return _throw("Expected `#{$token}` but reached end of stream.", $pointer); -} diff --git a/stylesheets/decode/helpers/number/_find-digits.scss b/stylesheets/decode/helpers/number/_find-digits.scss deleted file mode 100755 index 8165a43..0000000 --- a/stylesheets/decode/helpers/number/_find-digits.scss +++ /dev/null @@ -1,36 +0,0 @@ -/// Parses a JSON encoded number to find the digits -/// @access private -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token $token. -/// @return {List} (new pointer, parsed number) -/// @require {function} _throw -@function _find-digits($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: null; - $runs: 1; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == '.' { - // @continue; - } @else if $index and $index > 0 { - $runs: $runs * 10; - $result: if($result == null, ($index - 1), $result * 10 + ($index - 1)); - } @else { - @if index('e' '.' ' ' ',' ']' '}', $token) { - @return $pointer, if($result != null, $result / $runs, $result); - } - - @return _throw("Unexpected token `#{$token}`.", $pointer); - } - - $pointer: $pointer + 1; - } - - @return $pointer, if($result != null, $result / $runs, $result); -} diff --git a/stylesheets/decode/helpers/number/_find-exponent.scss b/stylesheets/decode/helpers/number/_find-exponent.scss deleted file mode 100755 index ab4d986..0000000 --- a/stylesheets/decode/helpers/number/_find-exponent.scss +++ /dev/null @@ -1,45 +0,0 @@ -/// Parses a JSON encoded number to find the exponent part -/// @access private -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token $token. -/// @return {List} - (new pointer, parsed number) -/// @require {function} _throw -@function _find-exponent($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: null; - $minus: null; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == 'e' { - // @continue; - } @else if $token == '-' { - @if $minus != null { - @return _throw("Unexpected token `-`.", $pointer); - } - $minus: true; - } @else if $token == '+' { - @if $minus != null { - @return _throw("Unexpected token `+`.", $pointer); - } - $minus: false; - } @else if $index and $index > 0 { - $result: if($result == null, ($index - 1), $result * 10 + ($index - 1)); - } @else { - @if index(' ' ',' ']' '}', $token) == null { - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - - @return $pointer, if($minus and $result != null, $result * -1, $result); - } - - $pointer: $pointer + 1; - } - - @return $pointer, if($minus and $result != null, $result * -1, $result); -} diff --git a/stylesheets/decode/helpers/number/_find-integer.scss b/stylesheets/decode/helpers/number/_find-integer.scss deleted file mode 100755 index cd20370..0000000 --- a/stylesheets/decode/helpers/number/_find-integer.scss +++ /dev/null @@ -1,34 +0,0 @@ -/// Parses a JSON encoded number to find the integer part -/// @access private -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token $token. -/// @return {List} (new pointer, parsed number) -/// @require {function} _throw -@function _find-integer($source, $pointer) { - $source: to-lower-case($source); - $length: str-length($source); - $numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; - $result: 0; - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $index: index($numbers, $token); - - @if $token == '-' { - // do nothing - } @else if $index { - $result: $result * 10 + ($index - 1); - } @else { - @if index('e' '.' ' ' ',' ']' '}', $token) { - @return $pointer, $result; - } - - @return _throw("Unexpected token `" + $token + "`.", $pointer); - } - - $pointer: $pointer + 1; - } - - @return $pointer, $result; -} diff --git a/stylesheets/decode/helpers/number/_pow.scss b/stylesheets/decode/helpers/number/_pow.scss deleted file mode 100755 index 69e3081..0000000 --- a/stylesheets/decode/helpers/number/_pow.scss +++ /dev/null @@ -1,20 +0,0 @@ -/// Power function -/// @access private -/// @param {Number} $x - number -/// @param {Number} $n - power -/// @return {Number} -@function _pow($x, $n) { - @if $n == 0 { @return 1; } - $ret: 1; - @if $n >= 0 { - @for $i from 1 through $n { - $ret: $ret * $x; - } - } @else { - @for $i from $n to 0 { - $ret: $ret / $x; - } - } - - @return $ret; -} diff --git a/stylesheets/decode/helpers/string/_find-ending-quote.scss b/stylesheets/decode/helpers/string/_find-ending-quote.scss deleted file mode 100755 index b03eab8..0000000 --- a/stylesheets/decode/helpers/string/_find-ending-quote.scss +++ /dev/null @@ -1,49 +0,0 @@ -/// Will find the first non escaped quote in a JSON String -/// @access private -/// @param {String} $string - to search in -/// @return {Number} - position of the first non escaped quote -@function _find-ending-quote($string) { - $backslash: str-slice('\\', 1, 1); // Dirty hack to have a single backslash - $escaped-chars: '"\/bfnrtu'; // Characters that can be escaped in JSON - $hexadecimal-chars: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' 'a' 'b' 'c' 'd' 'e' 'f'; - - $pos: 1; - $length: str-length($string); - $backslash-found: false; - - @while $pos <= $length { - $char: to-lower-case(str-slice($string, $pos, $pos)); - - // Previous char was a backslash - @if $backslash-found { - - // Special case, the 'u' character - @if $char == 'u' { - // Next 4 characters must be hexadecimal - @if not index($hexadecimal-chars, str-slice($string, $pos + 1, $pos + 1)) or - not index($hexadecimal-chars, str-slice($string, $pos + 2, $pos + 2)) or - not index($hexadecimal-chars, str-slice($string, $pos + 3, $pos + 3)) or - not index($hexadecimal-chars, str-slice($string, $pos + 4, $pos + 4)) { - @return 0; - } - - $pos: $pos + 4; - } @else if not str-index($escaped-chars, $char) { - // Invalid character escaped - @return 0; - } - - $backslash-found: false; - } @else if $char == $backslash { - $backslash-found: true; - } @else if $char == '"' { - // Unescaped quote found - @return $pos; - } - - $pos: $pos + 1; - } - - // No end of string found - @return 0; -} diff --git a/stylesheets/decode/helpers/string/_length.scss b/stylesheets/decode/helpers/string/_length.scss deleted file mode 100755 index de5582b..0000000 --- a/stylesheets/decode/helpers/string/_length.scss +++ /dev/null @@ -1,40 +0,0 @@ -/// Parses a JSON encoded string to see if it's a CSS length -/// @access private -/// @param {String} $string - JSON string -/// @return {Number | String} - string or number, depending on the match -/// @require {function} _json-decode--number -@function _length($string) { - @if type-of($string) == "number" { - @return $string; - } - - $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax'; - $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax; - $number: ""; - $unit: ""; - - @for $i from 1 through str-length($string) { - $c: str-slice($string, $i, $i); - @if $c == ' ' or $c == " " { - @if $number != "" { - @return $string; - } - } @else if index('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '-' '.', $c) { - $number: $number + $c; - } @else { - @if $number == "" { - @return $string; - } - $unit: $unit + $c; - } - } - - $number: nth(_json-decode--number($number, 2), 2); - $index: index($strings, to-lower-case($unit)); - - @if $index and $index > 0 { - @return $number * nth($units, $index); - } - - @return $string; -} diff --git a/stylesheets/decode/helpers/string/_strip-token.scss b/stylesheets/decode/helpers/string/_strip-token.scss deleted file mode 100755 index 9a1946d..0000000 --- a/stylesheets/decode/helpers/string/_strip-token.scss +++ /dev/null @@ -1,15 +0,0 @@ -/// Strip special carriage return characters -/// @access private -/// @param {String} $string - string to parse -/// @param {String} $search - char to strip -/// @param {String} $replace ('') - new substring -/// @return {String} - new string -@function _strip-token($string, $search, $replace: '') { - $index: str-index($string, $search); - - @if $index { - @return str-slice($string, 1, $index - 1) + $replace + _strip-token(str-slice($string, $index + str-length($search)), $search, $replace); - } - - @return $string; -} diff --git a/stylesheets/decode/types/_bool.scss b/stylesheets/decode/types/_bool.scss deleted file mode 100755 index c61d06a..0000000 --- a/stylesheets/decode/types/_bool.scss +++ /dev/null @@ -1,38 +0,0 @@ -/// Parses a JSON encoded `true` -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token `t`. -/// @return {List} - (new pointer, true) -/// @require {function} _throw -@function _json-decode--true($source, $pointer) { - $length: str-length($source); - - @if $length - $pointer < 2 - or str-slice($source, $pointer, $pointer) != 'r' - or str-slice($source, $pointer + 1, $pointer + 1) != 'u' - or str-slice($source, $pointer + 2, $pointer + 2) != 'e' { - @return _throw("Unexpected token: `t`.", $pointer); - } - - @return ($pointer + 3, true); -} - -/// Parses a JSON encoded `false` -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected token `f`. -/// @return {List} - (new pointer, false) -/// @require {function} _throw -@function _json-decode--false($source, $pointer) { - $length: str-length($source); - - @if $length - $pointer < 3 - or str-slice($source, $pointer, $pointer) != 'a' - or str-slice($source, $pointer + 1, $pointer + 1) != 'l' - or str-slice($source, $pointer + 2, $pointer + 2) != 's' - or str-slice($source, $pointer + 3, $pointer + 3) != 'e' { - @return _throw("Unexpected token: `f`.", $pointer); - } - - @return ($pointer + 4, false); -} diff --git a/stylesheets/decode/types/_list.scss b/stylesheets/decode/types/_list.scss deleted file mode 100755 index c148aca..0000000 --- a/stylesheets/decode/types/_list.scss +++ /dev/null @@ -1,51 +0,0 @@ -/// Parses a JSON encoded array -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected comma in array literal. -/// @throw Missing comma in array literal. -/// @throw Unterminated array literal. -/// @return {List} (new pointer, parsed list) -/// @require {function} _throw -/// @require {function} _json-decode--value -@function _json-decode--list($source, $pointer) { - $length: str-length($source); - $list: (); - $needs-comma: false; - - @if $pointer <= $length and str-slice($source, $pointer, $pointer) == "]" { - @return ($pointer + 1, $list); - } - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - - @if $token == "]" { - @if not $needs-comma and length($list) != 0 { - @return _throw("Unexpected comma in array literal.", $pointer); - } - - // Do it the Sass way and destruct a single item array to an element. - @return ($pointer + 1, if(length($list) == 1, nth($list, 1), $list)); - } @else if $token == " " or $token == " " { - $pointer: $pointer + 1; - } @else if $token == "," { - @if not $needs-comma { - @return _throw("Unexpected comma in array literal.", $pointer); - } - - $needs-comma: false; - $pointer: $pointer + 1; - } @else { - @if $needs-comma { - @return _throw("Missing comma in array literal.", $pointer); - } - - $read: _json-decode--value($source, $pointer); - $pointer: nth($read, 1); - $list: append($list, nth($read, 2)); - $needs-comma: true; - } - } - - @return _throw("Unterminated array literal.", $pointer); -} diff --git a/stylesheets/decode/types/_map.scss b/stylesheets/decode/types/_map.scss deleted file mode 100755 index 46178f4..0000000 --- a/stylesheets/decode/types/_map.scss +++ /dev/null @@ -1,70 +0,0 @@ -/// Parses a JSON encoded object -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unexpected comma in object literal. -/// @throw Unexpected token $token in object literal. -/// @throw Missing comma in object literal. -/// @throw Unterminated object literal. -/// @throw Consuming token `:` failed. -/// @return {List} (new pointer, map) -/// @require {function} _throw -/// @require {function} _consume -/// @require {function} _json-decode--value -/// @require {function} _json-decode--string -@function _json-decode--map($source, $pointer) { - $length: str-length($source); - $map: (); - $needs-comma: false; - - // Deal with empty map - @if $pointer <= $length and str-slice($source, $pointer, $pointer) == "}" { - @return ($pointer + 1, $map); - } - - @while $pointer <= $length { - $token: str-slice($source, $pointer, $pointer); - $pointer: $pointer + 1; - - @if $token == "}" { - @if not $needs-comma and length($map) != 0 { - @return _throw("Unexpected comma in object literal.", $pointer); - } - @return ($pointer, $map); - } @else if $token == " " or $token == " " { - // @continue; - } @else if $token == "," { - @if not $needs-comma { - @return _throw("Unexpected comma in object literal.", $pointer); - } - $needs-comma: false; - } @else if $token == '"' { - @if $needs-comma { - @return _throw("Missing comma in object literal.", $pointer); - } - - // Read key - $read-key: _json-decode--string($source, $pointer); - $pointer: nth($read-key, 1); - $key: nth($read-key, 2); - - // Remove colon - $pointer: _consume($source, $pointer, ":"); - @if length($pointer) > 1 { // If consume has failed - @return _throw("Consuming token `:` failed.", 0); - } - - // Read value - $read-value: _json-decode--value($source, $pointer); - $pointer: nth($read-value, 1); - $value: nth($read-value, 2); - - // Add pair to map - $map: map-merge($map, ($key: $value)); - $needs-comma: true; - } @else { - @return _throw("Unexpected token `" + $token + "` in object literal.", $pointer); - } - } - - @return _throw("Unterminated object literal.", $pointer); -} diff --git a/stylesheets/decode/types/_null.scss b/stylesheets/decode/types/_null.scss deleted file mode 100755 index 2b23511..0000000 --- a/stylesheets/decode/types/_null.scss +++ /dev/null @@ -1,18 +0,0 @@ -/// Parses a JSON encoded `null` -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw "Unexpected token `n`." -/// @return {List} (new pointer, null) -/// @require {function} _throw -@function _json-decode--null($source, $pointer) { - $length: str-length($source); - - @if $length - $pointer < 2 - or str-slice($source, $pointer, $pointer) != 'u' - or str-slice($source, $pointer + 1, $pointer + 1) != 'l' - or str-slice($source, $pointer + 2, $pointer + 2) != 'l' { - @return _throw("Unexpected token: `n`.", $pointer); - } - - @return ($pointer + 3, null); -} diff --git a/stylesheets/decode/types/_number.scss b/stylesheets/decode/types/_number.scss deleted file mode 100755 index 6948973..0000000 --- a/stylesheets/decode/types/_number.scss +++ /dev/null @@ -1,62 +0,0 @@ -/// Parses a JSON encoded number -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw "Unexpected token $token." -/// @throw "Unexpected end of stream." -/// @return {List} (new pointer, parsed number) -/// @require {function} _throw -/// @require {function} _find-integer -/// @require {function} _find-digits -/// @require {function} _find-exponent -/// @require {function} _pow -@function _json-decode--number($source, $pointer) { - $pointer: $pointer - 1; // Move back pointer to begininng of number - $allowed: '-' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; // Allowed characted to start with - $first: str-slice($source, $pointer, $pointer); // First character of the number - $minus: $first == '-'; // Is it negative? - - // Early check for errors - @if not index($allowed, $first) { - @return _throw("Unexpected token `" + $first + "`.", $pointer); - } - - // Find the integer part - $find-integer: _find-integer($source, $pointer); - $pointer: nth($find-integer, 1); - $result: nth($find-integer, 2); - @if not $result { // Error occured - @return $find-integer; - } - - // Find digits - @if str-slice($source, $pointer, $pointer) == '.' { - $find-digits: _find-digits($source, $pointer); - $pointer: nth($find-digits, 1); - $digits: nth($find-digits, 2); - - @if $digits == null { // Empty digits, throw error - @return _throw("Unexpected end of stream.", $pointer); - } @else if $digits == false { // Error occured, return it - @return $find-digits; - } - - $result: $result + $digits; - } - - // Find exponent - @if to-lower-case(str-slice($source, $pointer, $pointer)) == 'e' { - $find-exponent: _find-exponent($source, $pointer); - $pointer: nth($find-exponent, 1); - $exponent: nth($find-exponent, 2); - - @if $exponent == null { // Empty exponent, throw error - @return _throw("Unexpected end of stream.", $pointer); - } @else if $exponent == false { // Error occured, return it - @return $find-exponent; - } - - $result: $result * _pow(10, $exponent); - } - - @return ($pointer, if($minus, $result * -1, $result)); -} diff --git a/stylesheets/decode/types/_string.scss b/stylesheets/decode/types/_string.scss deleted file mode 100755 index 0cb246e..0000000 --- a/stylesheets/decode/types/_string.scss +++ /dev/null @@ -1,39 +0,0 @@ -/// Parses a JSON encoded string -/// @param {String} $source - JSON complete source -/// @param {Number} $pointer - current pointer -/// @throw Unterminated string. -/// @return {List} (new pointer, parsed string / color / length) -/// @require {function} _throw -/// @require {function} _find-ending-quote -/// @require {function} _strip-token -/// @require {function} _color -/// @require {function} _length -@function _json-decode--string($source, $pointer) { - // Check for the end of the string - $temp: str-slice($source, $pointer); - $end: _find-ending-quote($temp); - $string: ""; - - // If no end is found - @if not $end or $end == 0 { - @return _throw("Unterminated string.", $pointer); - } @else if $end > 1 { - // If string is not empty - $string: str-slice($temp, 1, $end - 1); - - $cr: ""; - $string: _strip-token($string, "\\\r", $cr); - $string: _strip-token($string, "\\\n", $cr); - $string: _strip-token($string, '\\\"', '"'); - - // Test whether the string could be a CSS length - $string: _length($string); - - // Test whether the string could be a CSS color - @if type-of($string) == "string" { - $string: _color($string); - } - } - - @return ($pointer + $end, $string); -} diff --git a/test/decode/_index.scss b/test/decode/_index.scss deleted file mode 100644 index f19135d..0000000 --- a/test/decode/_index.scss +++ /dev/null @@ -1,27 +0,0 @@ -//Helper -@import "helpers/map/consume"; -@import "helpers/all/value"; -@import "helpers/number/pow"; -@import "helpers/number/find-integer"; -@import "helpers/number/find-exponent"; -@import "helpers/number/find-digits"; -@import "helpers/string/length"; -@import "helpers/string/strip-token"; -@import "helpers/string/find-ending-quote"; -@import "helpers/color/get-color-value"; -@import "helpers/color/color"; -@import "helpers/color/hex"; -@import "helpers/color/rgb"; -@import "helpers/color/hsl"; -@import "helpers/color/hex-to-dec"; - -//Types -@import "types/string"; -@import "types/number"; -@import "types/bool"; -@import "types/list"; -@import "types/map"; -@import "types/null"; - -//API -@import "api/json"; diff --git a/test/decode/api/_json.scss b/test/decode/api/_json.scss deleted file mode 100644 index 2e879dc..0000000 --- a/test/decode/api/_json.scss +++ /dev/null @@ -1,18 +0,0 @@ -// Relative to test/test.scss -@import "decode/fixtures/test.json?testvar"; - -@include describe("The json-decode should handle any JSON input") { - - @include it("should work for valid JSON") { - $string: '{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'; - @include should(expect(json-encode(json-decode($string))), to(equal($string))); - @include should(expect(json-decode('{"a":[1,2,3],"b":"#000000"}')), to(equal((a:(1 2 3), b: black)))); - @include should(expect(json-decode('{"a":"green","b":"blue"}')), to(equal((a:green, b: blue)))); - @include should(expect(json-decode('[1,2,3,4]')), to(equal((1 2 3 4)))); - } - - // See fixtures - @include it("should load json from files") { - @include should(expect($testvar), to(equal(("test": 1)))); - } -} diff --git a/test/decode/fixtures/test.json b/test/decode/fixtures/test.json deleted file mode 100644 index 8cbe1ff..0000000 --- a/test/decode/fixtures/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "test":1 -} \ No newline at end of file diff --git a/test/decode/helpers/all/_value.scss b/test/decode/helpers/all/_value.scss deleted file mode 100644 index 6181d94..0000000 --- a/test/decode/helpers/all/_value.scss +++ /dev/null @@ -1,12 +0,0 @@ -@include describe("The _json-decode--value function") { - @include it("should return a two element list") { - @include should(expect(length(_json-decode--value('"test"', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('42', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('true', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('false', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('[0, 1]', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('{"a": 1}', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('null', 1))), to(equal(2))); - @include should(expect(length(_json-decode--value('"error"', 1))), to(equal(2))); - } -} diff --git a/test/decode/helpers/color/_color.scss b/test/decode/helpers/color/_color.scss deleted file mode 100644 index 824e28c..0000000 --- a/test/decode/helpers/color/_color.scss +++ /dev/null @@ -1,35 +0,0 @@ -@include describe("The _color function") { - @include it("should decode CSS colors to color type") { - @include should(expect(type-of(_color('#ff0'))), to(equal('color'))); - @include should(expect(type-of(_color('#000000'))), to(equal('color'))); - @include should(expect(type-of(_color('#ffffff'))), to(equal('color'))); - @include should(expect(type-of(_color('#1a1a1a'))), to(equal('color'))); - @include should(expect(type-of(_color('rgb(100, 100, 100)'))), to(equal('color'))); - @include should(expect(type-of(_color('rgb(100%, 100%, 100%)'))), to(equal('color'))); - @include should(expect(type-of(_color('rgba(100, 100, 100, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_color('rgba(100, 100, 100, .5)'))), to(equal('color'))); - @include should(expect(type-of(_color('rgba(100%, 100%, 100%, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_color('hsl(100, 100, 100)'))), to(equal('color'))); - @include should(expect(type-of(_color('hsl(100, 100%, 100%)'))), to(equal('color'))); - @include should(expect(type-of(_color('hsla(100, 100, 100, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_color('hsla(100, 100%, 100%, 0.5)'))), to(equal('color'))); - - $keywords: transparent black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen; - @each $color in $keywords { - @include should(expect(type-of(_color($color))), to(equal('color'))); - } - } - - @include it("should decode CSS colors properly when caps are used") { - @include should(expect(type-of(_color('BLACK'))), to(equal('color'))); - @include should(expect(type-of(_color('transparent'))), to(equal('color'))); - @include should(expect(type-of(_color('#FFFFFF'))), to(equal('color'))); - @include should(expect(type-of(_color('RGB(100, 100, 100)'))), to(equal('color'))); - } - - @include it("should decode properly when weird spaces are used") { - @include should(expect(type-of(_color('rgb( 100 , 100 , 100 )'))), to(equal('color'))); - @include should(expect(type-of(_color('hsl( 100 , 100 , 100 )'))), to(equal('color'))); - } - -} diff --git a/test/decode/helpers/color/_get-color-value.scss b/test/decode/helpers/color/_get-color-value.scss deleted file mode 100644 index 00146a8..0000000 --- a/test/decode/helpers/color/_get-color-value.scss +++ /dev/null @@ -1,30 +0,0 @@ -@include describe("The _get-color-value function") { - @include it("should convert stringified number into an actual number") { - @include should(expect(_get-color-value('0')), to(equal(0))); - @include should(expect(_get-color-value('100')), to(equal(100))); - @include should(expect(_get-color-value('255')), to(equal(255))); - @include should(expect(_get-color-value('0.5')), to(equal(0.5))); - @include should(expect(_get-color-value('.5')), to(equal(0.5))); - } - - @include it("should convert stringified percentage into an actual number") { - @include should(expect(_get-color-value('0%')), to(equal(0))); - @include should(expect(_get-color-value('100%')), to(equal(100))); - @include should(expect(_get-color-value('255%')), to(equal(255))); - @include should(expect(_get-color-value('0.5%')), to(equal(0.5))); - @include should(expect(_get-color-value('.5%')), to(equal(0.5))); - } - - @include it("should always convert to number type") { - @include should(expect(type-of(_get-color-value('0'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('100'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('255'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('0.5'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('.5'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('0%'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('100%'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('255%'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('0.5%'))), to(equal('number'))); - @include should(expect(type-of(_get-color-value('.5%'))), to(equal('number'))); - } -} diff --git a/test/decode/helpers/color/_hex-to-dec.scss b/test/decode/helpers/color/_hex-to-dec.scss deleted file mode 100644 index afbd17b..0000000 --- a/test/decode/helpers/color/_hex-to-dec.scss +++ /dev/null @@ -1,7 +0,0 @@ -@include describe("The _hex-to-dec function") { - @include it("should convert a hexadecimal string into a decimal number") { - @include should(expect(_hex-to-dec('00')), to(equal(0))); - @include should(expect(_hex-to-dec('ff')), to(equal(255))); - @include should(expect(_hex-to-dec('c8')), to(equal(200))); - } -} diff --git a/test/decode/helpers/color/_hex.scss b/test/decode/helpers/color/_hex.scss deleted file mode 100644 index 9f8448d..0000000 --- a/test/decode/helpers/color/_hex.scss +++ /dev/null @@ -1,16 +0,0 @@ -@include describe("The _from-hex function") { - @include it("should convert a stringified hexadecimal color into a color") { - @include should(expect(type-of(_from-hex('#000'))), to(equal('color'))); - @include should(expect(type-of(_from-hex('#000000'))), to(equal('color'))); - @include should(expect(type-of(_from-hex('#eFa01d'))), to(equal('color'))); - } - - @include it("should return a string if conversion cannot be done") { - @include should(expect(type-of(_from-hex('#00'))), to(equal('string'))); - @include should(expect(type-of(_from-hex('#00000'))), to(equal('string'))); - @include should(expect(type-of(_from-hex('#00000g'))), to(equal('string'))); - @include should(expect(type-of(_from-hex('00000g'))), to(equal('string'))); - @include should(expect(type-of(_from-hex('000000'))), to(equal('string'))); - @include should(expect(type-of(_from-hex('000'))), to(equal('string'))); - } -} diff --git a/test/decode/helpers/color/_hsl.scss b/test/decode/helpers/color/_hsl.scss deleted file mode 100644 index 1de8cca..0000000 --- a/test/decode/helpers/color/_hsl.scss +++ /dev/null @@ -1,21 +0,0 @@ -@include describe("The _from-hsl function") { - @include it("should convert a stringified hsl or hsla color into a color") { - @include should(expect(type-of(_from-hsl('hsl(0,0,0)'))), to(equal('color'))); - @include should(expect(type-of(_from-hsl('hsl(0, 0, 0)'))), to(equal('color'))); - @include should(expect(type-of(_from-hsl('hsla(0, 0, 0, .5)'))), to(equal('color'))); - @include should(expect(type-of(_from-hsl('hsla(0, 0, 0, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_from-hsl('hsla(100%, 100%, 100%, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_from-hsl('hsla(100%, 100%, 100%, .5)'))), to(equal('color'))); - } - - @include it("should return a string if conversion cannot be done") { - @include should(expect(type-of(_from-hsl('hsl(0, 0, 0, .5)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsla(0, 0, 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsla(0, 0, 0'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsl(0, 0 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsl(0 0 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsl(0 0, 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsl(0, 0, 0,)'))), to(equal('string'))); - @include should(expect(type-of(_from-hsl('hsl(,0, 0, 0,)'))), to(equal('string'))); - } -} diff --git a/test/decode/helpers/color/_rgb.scss b/test/decode/helpers/color/_rgb.scss deleted file mode 100644 index 8db10ea..0000000 --- a/test/decode/helpers/color/_rgb.scss +++ /dev/null @@ -1,21 +0,0 @@ -@include describe("The _from-rgb function") { - @include it("should convert a stringified rgb or rgba color into a color") { - @include should(expect(type-of(_from-rgb('rgb(0,0,0)'))), to(equal('color'))); - @include should(expect(type-of(_from-rgb('rgb(0, 0, 0)'))), to(equal('color'))); - @include should(expect(type-of(_from-rgb('rgba(0, 0, 0, .5)'))), to(equal('color'))); - @include should(expect(type-of(_from-rgb('rgba(0, 0, 0, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_from-rgb('rgba(100%, 100%, 100%, 0.5)'))), to(equal('color'))); - @include should(expect(type-of(_from-rgb('rgba(100%, 100%, 100%, .5)'))), to(equal('color'))); - } - - @include it("should return a string if conversion cannot be done") { - @include should(expect(type-of(_from-rgb('rgb(0, 0, 0, .5)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgba(0, 0, 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgba(0, 0, 0'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgb(0, 0 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgb(0 0 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgb(0 0, 0)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgb(0, 0, 0,)'))), to(equal('string'))); - @include should(expect(type-of(_from-rgb('rgb(,0, 0, 0,)'))), to(equal('string'))); - } -} diff --git a/test/decode/helpers/map/_consume.scss b/test/decode/helpers/map/_consume.scss deleted file mode 100644 index b69d421..0000000 --- a/test/decode/helpers/map/_consume.scss +++ /dev/null @@ -1,11 +0,0 @@ -@include describe("The _consume function") { - @include it("should return the index of the token plus one") { - @include should(expect(_consume(" : whatever", 1, ":")), to(equal(4))); - @include should(expect(_consume(" / test", 1, "/")), to(equal(7))); - } - - @include it("should always return a number") { - @include should(expect(type-of(_consume(" : whatever", 1, ":"))), to(equal('number'))); - @include should(expect(type-of(_consume(" / test", 1, "/"))), to(equal('number'))); - } -} diff --git a/test/decode/helpers/number/_find-digits.scss b/test/decode/helpers/number/_find-digits.scss deleted file mode 100644 index c20c632..0000000 --- a/test/decode/helpers/number/_find-digits.scss +++ /dev/null @@ -1,26 +0,0 @@ -@include describe("The _find-digits function") { - @include it("should always return a two item long list") { - @include should(expect(length(_find-digits('.5', 1))), to(equal(2))); - @include should(expect(length(_find-digits('.20', 1))), to(equal(2))); - @include should(expect(length(_find-digits('.101', 1))), to(equal(2))); - @include should(expect(length(_find-digits('.1337', 1))), to(equal(2))); - } - - @include it("should return the number found after the dot as a second argument") { - @include should(expect(nth(_find-digits('.1', 1), 2)), to(equal(0.1))); - @include should(expect(nth(_find-digits('.23', 1), 2)), to(equal(0.23))); - @include should(expect(nth(_find-digits('.456', 1), 2)), to(equal(0.456))); - @include should(expect(nth(_find-digits('.7890', 1), 2)), to(equal(0.7890))); - } - - @include it("should return a number as second argument") { - @include should(expect(type-of(nth(_find-digits('.1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-digits('.23', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-digits('.456', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-digits('.7890', 1), 2))), to(equal('number'))); - } - - @include it("should return null if error") { - @include should(expect(nth(_find-digits('.', 1), 2)), to(equal(null))); - } -} diff --git a/test/decode/helpers/number/_find-exponent.scss b/test/decode/helpers/number/_find-exponent.scss deleted file mode 100644 index 9707ad8..0000000 --- a/test/decode/helpers/number/_find-exponent.scss +++ /dev/null @@ -1,39 +0,0 @@ -@include describe("The _find-exponent function") { - @include it("should always return a two item long list") { - @include should(expect(length(_find-exponent('e1', 1))), to(equal(2))); - @include should(expect(length(_find-exponent('e2', 1))), to(equal(2))); - @include should(expect(length(_find-exponent('e5', 1))), to(equal(2))); - @include should(expect(length(_find-exponent('e10', 1))), to(equal(2))); - } - - @include it("should return the exponent part of a stringified number as a second argument") { - @include should(expect(nth(_find-exponent('e-1', 1), 2)), to(equal(-1))); - @include should(expect(nth(_find-exponent('e0', 1), 2)), to(equal(0))); - @include should(expect(nth(_find-exponent('e2', 1), 2)), to(equal(2))); - @include should(expect(nth(_find-exponent('e-3', 1), 2)), to(equal(-3))); - @include should(expect(nth(_find-exponent('e4', 1), 2)), to(equal(4))); - @include should(expect(nth(_find-exponent('e-5', 1), 2)), to(equal(-5))); - @include should(expect(nth(_find-exponent('e6', 1), 2)), to(equal(6))); - @include should(expect(nth(_find-exponent('e-7', 1), 2)), to(equal(-7))); - @include should(expect(nth(_find-exponent('e8', 1), 2)), to(equal(8))); - @include should(expect(nth(_find-exponent('e-9', 1), 2)), to(equal(-9))); - } - - @include it("should return a number as second argument") { - @include should(expect(type-of(nth(_find-exponent('e-1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e2', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e-3', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e4', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e-5', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e6', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e-7', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e8', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-exponent('e-9', 1), 2))), to(equal('number'))); - } - - @include it("should return null if error") { - @include should(expect(nth(_find-exponent('e', 1), 2)), to(equal(null))); - @include should(expect(nth(_find-exponent('e-', 1), 2)), to(equal(null))); - @include should(expect(nth(_find-exponent('e+', 1), 2)), to(equal(null))); - } -} diff --git a/test/decode/helpers/number/_find-integer.scss b/test/decode/helpers/number/_find-integer.scss deleted file mode 100644 index 4abf0df..0000000 --- a/test/decode/helpers/number/_find-integer.scss +++ /dev/null @@ -1,32 +0,0 @@ -@include describe("The _find-integer function") { - @include it("should always return a two item long list") { - @include should(expect(length(_find-integer('1', 1))), to(equal(2))); - @include should(expect(length(_find-integer('10', 1))), to(equal(2))); - @include should(expect(length(_find-integer('100', 1))), to(equal(2))); - @include should(expect(length(_find-integer('-1000', 1))), to(equal(2))); - } - - @include it("should return the positive integer part of a stringified number as a second argument") { - @include should(expect(nth(_find-integer('0', 1), 2)), to(equal(0))); - @include should(expect(nth(_find-integer('1', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('1.5', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('-1.5', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('-1', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('-1e1', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('-1e+1', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('1e-1', 1), 2)), to(equal(1))); - @include should(expect(nth(_find-integer('1e+1', 1), 2)), to(equal(1))); - } - - @include it("should return a number as second argument") { - @include should(expect(type-of(nth(_find-integer('0', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('1.5', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('-1.5', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('-1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('-1e1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('-1e+1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('1e-1', 1), 2))), to(equal('number'))); - @include should(expect(type-of(nth(_find-integer('1e+1', 1), 2))), to(equal('number'))); - } -} diff --git a/test/decode/helpers/number/_pow.scss b/test/decode/helpers/number/_pow.scss deleted file mode 100644 index ad46439..0000000 --- a/test/decode/helpers/number/_pow.scss +++ /dev/null @@ -1,18 +0,0 @@ -@include describe("The _pow function") { - @include it("should return the power of first argument per second argument") { - @include should(expect(_pow(10, 0)), to(equal(1))); - @include should(expect(_pow(2, 2)), to(equal(4))); - @include should(expect(_pow(2, 10)), to(equal(1024))); - @include should(expect(_pow(10, 2)), to(equal(100))); - @include should(expect(_pow(10, -2)), to(equal(0.01))); - @include should(expect(_pow(-2, 10)), to(equal(1024))); - } - - @include it("should always return a number") { - @include should(expect(type-of(_pow(2, 2))), to(equal('number'))); - @include should(expect(type-of(_pow(2, 10))), to(equal('number'))); - @include should(expect(type-of(_pow(10, 2))), to(equal('number'))); - @include should(expect(type-of(_pow(10, -2))), to(equal('number'))); - @include should(expect(type-of(_pow(-2, 10))), to(equal('number'))); - } -} diff --git a/test/decode/helpers/string/_find-ending-quote.scss b/test/decode/helpers/string/_find-ending-quote.scss deleted file mode 100644 index 4f749e6..0000000 --- a/test/decode/helpers/string/_find-ending-quote.scss +++ /dev/null @@ -1,13 +0,0 @@ -@include describe("The _find-ending-quote function finds the last unescaped quote") { - - @include it("do it with strange spacing") { - @include should(expect(_find-ending-quote('tes t\\\" "')), to(equal(10))); - @include should(expect(_find-ending-quote('tes t" "')), to(equal(8))); - @include should(expect(_find-ending-quote('tes\"\\\"\" t" "')), to(equal(4))); - } - @include it("should return zero if no quote was found") { - @include should(expect(_find-ending-quote('')), to(equal(0))); - @include should(expect(_find-ending-quote('safasfdasdf')), to(equal(0))); - @include should(expect(_find-ending-quote('safas\\"fdasdf')), to(equal(0))); - } -} diff --git a/test/decode/helpers/string/_length.scss b/test/decode/helpers/string/_length.scss deleted file mode 100644 index 3ea483a..0000000 --- a/test/decode/helpers/string/_length.scss +++ /dev/null @@ -1,54 +0,0 @@ -@include describe("The _color function") { - @include it("should decode CSS lengths to number type") { - $test-1: _length('-1%'); - $test-2: _length('1.5in'); - $test-3: _length('-1px'); - $test-4: _length('1.5em'); - $test-5: _length('-1mm'); - $test-6: _length('1.5cm'); - $test-7: _length('-1pt'); - $test-8: _length('1.5pc'); - $test-9: _length('-1ex'); - $test-10: _length('1.5ch'); - $test-11: _length('-1vh'); - $test-12: _length('1.5vw'); - $test-13: _length('-1rem'); - $test-14: _length('1.5vmin'); - $test-15: _length('-1vmax'); - $test-16: _length('1.5pica'); - - @include should(expect($test-1 ), to(equal(-1%))); - @include should(expect($test-2 ), to(equal(1.5in))); - @include should(expect($test-3 ), to(equal(-1px))); - @include should(expect($test-4 ), to(equal(1.5em))); - @include should(expect($test-5 ), to(equal(-1mm))); - @include should(expect($test-6 ), to(equal(1.5cm))); - @include should(expect($test-7 ), to(equal(-1pt))); - @include should(expect($test-8 ), to(equal(1.5pc))); - @include should(expect($test-9 ), to(equal(-1ex))); - @include should(expect($test-10), to(equal(1.5ch))); - @include should(expect($test-11), to(equal(-1vh))); - @include should(expect($test-12), to(equal(1.5vw))); - @include should(expect($test-13), to(equal(-1rem))); - @include should(expect($test-14), to(equal(1.5vmin))); - @include should(expect($test-15), to(equal(-1vmax))); - @include should(expect($test-16), to(equal(1.5pica))); - - @include should(expect(type-of($test-1 )), to(equal('number'))); - @include should(expect(type-of($test-2 )), to(equal('number'))); - @include should(expect(type-of($test-3 )), to(equal('number'))); - @include should(expect(type-of($test-4 )), to(equal('number'))); - @include should(expect(type-of($test-5 )), to(equal('number'))); - @include should(expect(type-of($test-6 )), to(equal('number'))); - @include should(expect(type-of($test-7 )), to(equal('number'))); - @include should(expect(type-of($test-8 )), to(equal('number'))); - @include should(expect(type-of($test-9 )), to(equal('number'))); - @include should(expect(type-of($test-10)), to(equal('number'))); - @include should(expect(type-of($test-11)), to(equal('number'))); - @include should(expect(type-of($test-12)), to(equal('number'))); - @include should(expect(type-of($test-13)), to(equal('number'))); - @include should(expect(type-of($test-14)), to(equal('number'))); - @include should(expect(type-of($test-15)), to(equal('number'))); - @include should(expect(type-of($test-16)), to(equal('number'))); - } -} \ No newline at end of file diff --git a/test/decode/helpers/string/_strip-token.scss b/test/decode/helpers/string/_strip-token.scss deleted file mode 100644 index 0af767a..0000000 --- a/test/decode/helpers/string/_strip-token.scss +++ /dev/null @@ -1,13 +0,0 @@ -@include describe("The _strip-token should replace tokes with CRs") { - $cr: " -"; // Carriage return - - @include it("should work") { - @include should(expect(_strip-token(' test \r test ', '\r', $cr)), to(equal(' test ' + $cr + ' test '))); - @include should(expect(_strip-token(' test \n test ', '\n', $cr)), to(equal(' test ' + $cr + ' test '))); - @debug _strip-token(' test \ n test ', '\n', $cr); - @include should(expect(_strip-token(' test \ n test ', '\n', $cr)), to(equal(' test \ n test '))); - @include should(expect(_strip-token(' abc \ n', '\n', $cr)), to(equal(' abc '))); - @include should(expect(_strip-token(_strip-token(' test \r\n test ', '\r', $cr), '\n', $cr)), to(equal(' test ' + $cr + $cr + ' test '))); - } -} diff --git a/test/decode/test.scss b/test/decode/test.scss deleted file mode 100644 index 78c6b86..0000000 --- a/test/decode/test.scss +++ /dev/null @@ -1,8 +0,0 @@ -@import "bootcamp"; -@import "sassyjson"; - -@include runner-start; - -@import "index"; - -@include runner-end; diff --git a/test/decode/types/_bool.scss b/test/decode/types/_bool.scss deleted file mode 100644 index 4e6e9e9..0000000 --- a/test/decode/types/_bool.scss +++ /dev/null @@ -1,14 +0,0 @@ -@include describe("The json-decode--bool function") { - @include it("should work for true with _json-decode--true"){ - @include should(expect(_json-decode--true('true', 2)), to(equal((5, true)))); - } - - @include it("should work for false with _json-decode--false"){ - @include should(expect(_json-decode--false('false', 2)), to(equal((6, false)))); - } - - @include it("should decode to bool type") { - @include should(expect(type-of(nth(_json-decode--true('true', 2), 2))), to(equal('bool'))); - @include should(expect(type-of(nth(_json-decode--true('true', 2), 2))), to(equal('bool'))); - } -} diff --git a/test/decode/types/_list.scss b/test/decode/types/_list.scss deleted file mode 100644 index d4bd627..0000000 --- a/test/decode/types/_list.scss +++ /dev/null @@ -1,30 +0,0 @@ -@include describe("The json-decode--list function") { - @include it("should properly decode arrays to lists") { - @include should(expect(nth(_json-decode--list('[0, 1, 2, 3]', 2), 2)), to(equal(0 1 2 3))); - @include should(expect(nth(_json-decode--list('["a", "b", "c", "d"]', 2), 2)), to(equal("a" "b" "c" "d"))); - @include should(expect(nth(_json-decode--list('[true, false, false, true, true]', 2), 2)), to(equal(true false false true true))); - @include should(expect(nth(_json-decode--list('["red", "#405060", "rgb(0, 0, 0)"]', 2), 2)), to(equal(red #405060 black))); - } - - @include it("should properly decode multi-dimensional arrays to nested lists") { - @include should(expect(nth(_json-decode--list('[0, 1, [2, 3, [4, 5], 6]]', 2), 2)), to(equal(0 1 (2 3 (4 5) 6)))); - @include should(expect(nth(_json-decode--list('[["a", "b", ["c", "d"]], "e"]', 2), 2)), to(equal(("a" "b" ("c" "d")) "e"))); - @include should(expect(nth(_json-decode--list('[true, false, [false, true], true]', 2), 2)), to(equal(true false (false true) true))); - @include should(expect(nth(_json-decode--list('[[true], [false], [false, true], true]', 2), 2)), to(equal((true) (false) (false true) true))); - } - - @include it("should properly decode arrays with weird spaces to lists") { - @include should(expect(nth(_json-decode--list('[ 0 , 1 , 2,3 ]', 2), 2)), to(equal(0 1 2 3))); - } - - @include it("should properly decode empty arrays") { - //@include should(expect(nth(_json-decode--list('[]', 2), 2)), to(equal(()))); - //@include should(expect(nth(_json-decode--list('[ ]', 2), 2)), to(equal(()))); - } - - @include it("should decode to list type") { - @include should(expect(type-of(nth(_json-decode--list('[0, 1, 2, 3]', 2), 2))), to(equal('list'))); - @include should(expect(type-of(nth(_json-decode--list('["a", "b", "c", "d"]', 2), 2))), to(equal('list'))); - @include should(expect(type-of(nth(_json-decode--list('[true, false, false, true, true]', 2), 2))), to(equal('list'))); - } -} diff --git a/test/decode/types/_map.scss b/test/decode/types/_map.scss deleted file mode 100644 index 7e8be68..0000000 --- a/test/decode/types/_map.scss +++ /dev/null @@ -1,23 +0,0 @@ -@include describe("The json-decode--map function") { - @include it("should properly decode objects to map type") { - @include should(expect(nth(_json-decode--map('{"a": 1}', 2), 2)), to(equal(("a": 1)))); - @include should(expect(nth(_json-decode--map('{"a": 1, "b": "string", "c": true}', 2), 2)), to(equal(("a": 1, "b": "string", "c": true)))); - } - @include it("should properly decode objects with weird spaces to map type") { - @include should(expect(nth(_json-decode--map(' {"a":1,"b":2}', 3), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{ "a":1,"b":2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a" :1,"b":2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a": 1,"b":2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1 ,"b":2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1, "b":2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1,"b" :2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1,"b": 2}', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1,"b":2 }', 2), 2)), to(equal(("a": 1, "b": 2)))); - @include should(expect(nth(_json-decode--map('{"a":1,"b":2} ', 2), 2)), to(equal(("a": 1, "b": 2)))); - } - - @include it("should decode to map type") { - @include should(expect(type-of(nth(_json-decode--map('{"a": 1}', 2), 2))), to(equal('map'))); - @include should(expect(type-of(nth(_json-decode--map('{"a": 1, "b": "string", "c": true}', 2), 2))), to(equal('map'))); - } -} diff --git a/test/decode/types/_null.scss b/test/decode/types/_null.scss deleted file mode 100644 index 6f417f8..0000000 --- a/test/decode/types/_null.scss +++ /dev/null @@ -1,9 +0,0 @@ -@include describe("The json-decode--null function") { - @include it("should properly decode null to null") { - @include should(expect(nth(_json-decode--null('null', 2), 2)), to(equal(null))); - } - - @include it("should decode to null type") { - @include should(expect(type-of(nth(_json-decode--null('null', 2), 2))), to(equal('null'))); - } -} diff --git a/test/decode/types/_number.scss b/test/decode/types/_number.scss deleted file mode 100644 index 070987b..0000000 --- a/test/decode/types/_number.scss +++ /dev/null @@ -1,104 +0,0 @@ -@include describe("The _json-decode--number function") { - $test-1: nth(_json-decode--number('0', 2), 2); - $test-2: nth(_json-decode--number('10', 2), 2); - $test-3: nth(_json-decode--number('123456789', 2), 2); - $test-4: nth(_json-decode--number('-0', 2), 2); - $test-5: nth(_json-decode--number('-10', 2), 2); - $test-6: nth(_json-decode--number('-123456789', 2), 2); - $test-7: nth(_json-decode--number('0.001', 2), 2); - $test-8: nth(_json-decode--number('-0.001', 2), 2); - $test-9: nth(_json-decode--number('1.5', 2), 2); - $test-10: nth(_json-decode--number('-1.5', 2), 2); - $test-11: nth(_json-decode--number('1e0', 2), 2); - $test-12: nth(_json-decode--number('1e1', 2), 2); - $test-13: nth(_json-decode--number('1e2', 2), 2); - $test-14: nth(_json-decode--number('1e+0', 2), 2); - $test-15: nth(_json-decode--number('1e+1', 2), 2); - $test-16: nth(_json-decode--number('1e+2', 2), 2); - $test-17: nth(_json-decode--number('1E0', 2), 2); - $test-18: nth(_json-decode--number('1E1', 2), 2); - $test-19: nth(_json-decode--number('1E2', 2), 2); - $test-20: nth(_json-decode--number('1E+0', 2), 2); - $test-21: nth(_json-decode--number('1E+1', 2), 2); - $test-22: nth(_json-decode--number('1E+2', 2), 2); - $test-23: nth(_json-decode--number('1e-0', 2), 2); - $test-24: nth(_json-decode--number('1e-1', 2), 2); - $test-25: nth(_json-decode--number('1e-2', 2), 2); - $test-26: nth(_json-decode--number('1E-0', 2), 2); - $test-27: nth(_json-decode--number('1E-1', 2), 2); - $test-28: nth(_json-decode--number('1E-2', 2), 2); - - @include it("should properly decode integers") { - @include should(expect($test-1), to(equal(0))); - @include should(expect($test-2), to(equal(10))); - @include should(expect($test-3), to(equal(123456789))); - } - - @include it("should properly decode negative numbers") { - @include should(expect($test-4), to(equal(0))); - @include should(expect($test-5), to(equal(-10))); - @include should(expect($test-6), to(equal(-123456789))); - } - - @include it("should properly decode numbers with digits") { - @include should(expect($test-7), to(equal(0.001))); - @include should(expect($test-8), to(equal(-0.001))); - @include should(expect($test-9), to(equal(1.5))); - @include should(expect($test-10), to(equal(-1.5))); - } - - @include it("should properly decode numbers with exponents") { - @include should(expect($test-11), to(equal(1))); - @include should(expect($test-12), to(equal(10))); - @include should(expect($test-13), to(equal(100))); - @include should(expect($test-14), to(equal(1))); - @include should(expect($test-15), to(equal(10))); - @include should(expect($test-16), to(equal(100))); - @include should(expect($test-17), to(equal(1))); - @include should(expect($test-18), to(equal(10))); - @include should(expect($test-19), to(equal(100))); - @include should(expect($test-20), to(equal(1))); - @include should(expect($test-21), to(equal(10))); - @include should(expect($test-22), to(equal(100))); - } - - @include it("should properly decode numbers with negative exponents") { - @include should(expect($test-23), to(equal(1))); - @include should(expect($test-24), to(equal(.1))); - @include should(expect($test-25), to(equal(.01))); - @include should(expect($test-26), to(equal(1))); - @include should(expect($test-27), to(equal(.1))); - @include should(expect($test-28), to(equal(.01))); - } - - @include it("should decode to number type") { - @include should(expect(type-of($test-1 )), to(equal('number'))); - @include should(expect(type-of($test-2 )), to(equal('number'))); - @include should(expect(type-of($test-3 )), to(equal('number'))); - @include should(expect(type-of($test-4 )), to(equal('number'))); - @include should(expect(type-of($test-5 )), to(equal('number'))); - @include should(expect(type-of($test-6 )), to(equal('number'))); - @include should(expect(type-of($test-7 )), to(equal('number'))); - @include should(expect(type-of($test-8 )), to(equal('number'))); - @include should(expect(type-of($test-9 )), to(equal('number'))); - @include should(expect(type-of($test-10)), to(equal('number'))); - @include should(expect(type-of($test-11)), to(equal('number'))); - @include should(expect(type-of($test-12)), to(equal('number'))); - @include should(expect(type-of($test-13)), to(equal('number'))); - @include should(expect(type-of($test-14)), to(equal('number'))); - @include should(expect(type-of($test-15)), to(equal('number'))); - @include should(expect(type-of($test-16)), to(equal('number'))); - @include should(expect(type-of($test-17)), to(equal('number'))); - @include should(expect(type-of($test-18)), to(equal('number'))); - @include should(expect(type-of($test-19)), to(equal('number'))); - @include should(expect(type-of($test-20)), to(equal('number'))); - @include should(expect(type-of($test-21)), to(equal('number'))); - @include should(expect(type-of($test-22)), to(equal('number'))); - @include should(expect(type-of($test-23)), to(equal('number'))); - @include should(expect(type-of($test-24)), to(equal('number'))); - @include should(expect(type-of($test-25)), to(equal('number'))); - @include should(expect(type-of($test-26)), to(equal('number'))); - @include should(expect(type-of($test-27)), to(equal('number'))); - @include should(expect(type-of($test-28)), to(equal('number'))); - } -} diff --git a/test/decode/types/_string.scss b/test/decode/types/_string.scss deleted file mode 100644 index f5a69a0..0000000 --- a/test/decode/types/_string.scss +++ /dev/null @@ -1,21 +0,0 @@ -@include describe("The json-decode--string function") { - @include it("should properly decode strings") { - @include should(expect(nth(_json-decode--string('""', 2), 2)), to(equal(""))); - @include should(expect(nth(_json-decode--string('"1 px"', 2), 2)), to(equal("1 px"))); - @include should(expect(nth(_json-decode--string('"test"', 2), 2)), to(equal("test"))); - @include should(expect(nth(_json-decode--string('"test with inner spaces"', 2), 2)), to(equal("test with inner spaces"))); - @include should(expect(nth(_json-decode--string('" test with outer spaces "', 2), 2)), to(equal(" test with outer spaces "))); - } - - @include it("should decode to string type") { - @include should(expect(type-of(nth(_json-decode--string('""', 2), 2))), to(equal('string'))); - @include should(expect(type-of(nth(_json-decode--string('"1 px"', 2), 2))), to(equal('string'))); - @include should(expect(type-of(nth(_json-decode--string('"test"', 2), 2))), to(equal('string'))); - @include should(expect(type-of(nth(_json-decode--string('"test with inner spaces"', 2), 2))), to(equal('string'))); - @include should(expect(type-of(nth(_json-decode--string('" test with outer spaces "', 2), 2))), to(equal('string'))); - } - - @include it("should work with escaped quotes in string") { - @include should(expect(nth(_json-decode--string('"test\\"test"', 2), 2)), to(equal('test\\"test'))); - } -} diff --git a/test/encode/_index.scss b/test/encode/_index.scss deleted file mode 100644 index 2347f27..0000000 --- a/test/encode/_index.scss +++ /dev/null @@ -1,14 +0,0 @@ -// Helpers -@import "helpers/quote"; - -// Types -@import "types/string"; -@import "types/number"; -@import "types/color"; -@import "types/bool"; -@import "types/list"; -@import "types/map"; -@import "types/null"; - -// API -@import "api/json"; diff --git a/test/encode/api/_json.scss b/test/encode/api/_json.scss deleted file mode 100644 index 097f197..0000000 --- a/test/encode/api/_json.scss +++ /dev/null @@ -1,29 +0,0 @@ -@include describe("The json-encode function") { - @include it("should return the same as json-encode--bool for a boolean") { - @include should(expect(json-encode(true)), to(equal(_json-encode--bool(true)))); - } - @include it("should return the same as json-encode--string for a string") { - @include should(expect(json-encode("test")), to(equal(_json-encode--string("test")))); - } - @include it("should return the same as json-encode--color for a color") { - @include should(expect(json-encode(#000)), to(equal(_json-encode--color("#000")))); - } - @include it("should return the same as json-encode--number for a number") { - @include should(expect(json-encode(1)), to(equal(_json-encode--number(1)))); - } - @include it("should return the same as json-encode--list for a list") { - @include should(expect(json-encode(1 2 3)), to(equal(_json-encode--list((1 2 3))))); - } - @include it("should return the same as json-encode--map for a map") { - @include should(expect(json-encode( (a: 1, b: 2, c: 3) )), to(equal(_json-encode--map((a: 1, b: 2, c: 3))))); - } - - @include it("should handle some complicated map"){ - $map-all: (a: (1 (a: (1 2 ( b : (1 2 3 4) )), b: ( #444444, false, ( a: 1, b: test ) ), c: (2 3 4 string)) ( b : 1 )), b: ( #444444, false, ( a: 1, b: test ) ), c: (2 (a: (1 2 ( b : 1 )), b: ( #444444, false, ( a: 1, b: test ) ), c: (2 3 4 string)) 4 string)); - @include should(expect(json-encode($map-all)), to(equal('{"a": [1, {"a": [1, 2, {"b": [1, 2, 3, 4]}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, {"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}, 4, "string"]}'))); - } - @include it("should handle null correctly"){ - $map-with-null: (a: null); - @include should(expect(json-encode($map-with-null)), to(equal('{"a": null}'))); - } -} diff --git a/test/encode/helpers/_quote.scss b/test/encode/helpers/_quote.scss deleted file mode 100644 index d67c9f9..0000000 --- a/test/encode/helpers/_quote.scss +++ /dev/null @@ -1,6 +0,0 @@ -@include describe("The _proof-quote function") { - @include it("should return a quoted string") { - @include should(expect(_proof-quote('test')), to(equal('"' + 'test' + '"'))); - @include should(expect(_proof-quote(1)), to(equal('"' + '1' + '"'))); - } -} \ No newline at end of file diff --git a/test/encode/test.scss b/test/encode/test.scss deleted file mode 100644 index 78c6b86..0000000 --- a/test/encode/test.scss +++ /dev/null @@ -1,8 +0,0 @@ -@import "bootcamp"; -@import "sassyjson"; - -@include runner-start; - -@import "index"; - -@include runner-end; diff --git a/test/encode/types/_bool.scss b/test/encode/types/_bool.scss deleted file mode 100644 index ab0dad3..0000000 --- a/test/encode/types/_bool.scss +++ /dev/null @@ -1,6 +0,0 @@ -@include describe("The _json-encode--bool function") { - @include it("should return the unchanged boolean") { - @include should(expect(_json-encode--bool(true)), to(equal(true))); - @include should(expect(_json-encode--bool(false)), to(equal(false))); - } -} \ No newline at end of file diff --git a/test/encode/types/_color.scss b/test/encode/types/_color.scss deleted file mode 100644 index a901ef8..0000000 --- a/test/encode/types/_color.scss +++ /dev/null @@ -1,7 +0,0 @@ -@include describe("The _json-encode--color function") { - @include it("should return a sass interpreted color wrapped in quotes") { - @include should(expect(_json-encode--color(#000)), to(equal('"' + '#000' + '"'))); - @include should(expect(_json-encode--color(rgba(255,255,225,1))), to(equal('"' + '#ffffe1' + '"'))); - @include should(expect(_json-encode--color(rgba(255,255,225,.5))), to(equal('"' + 'rgba(255, 255, 225, 0.5)' + '"'))); - } -} diff --git a/test/encode/types/_list.scss b/test/encode/types/_list.scss deleted file mode 100644 index 9687070..0000000 --- a/test/encode/types/_list.scss +++ /dev/null @@ -1,25 +0,0 @@ -@include describe("The _json-encode--list function") { - @include it("should return a JSON like array string") { - @include should(expect(_json-encode--list(1 2 3)), to(equal('[1, 2, 3]'))); - @include should(expect(_json-encode--list(a b c)), to(equal('["a", "b", "c"]'))); - @include should(expect(_json-encode--list(true false true)), to(equal("[true, false, true]"))); - } - - @include it("should encode sass datatypes to strings") { - @include should(expect(_json-encode--list(#000 green blue)), to(equal('["#000", "green", "blue"]'))); - } - - @include it("should properly encode a list with commas to JSON") { - @include should(expect(_json-encode--list((1, 2, 3))), to(equal('[1, 2, 3]'))); - @include should(expect(_json-encode--list((a, b, c))), to(equal('["a", "b", "c"]'))); - @include should(expect(_json-encode--list((true, false, true))), to(equal("[true, false, true]"))); - @include should(expect(_json-encode--list((#333, #444, #555))), to(equal('["#333", "#444", "#555"]'))); - } - - @include it("should properly encode nested lists to JSON") { - @include should(expect(_json-encode--list((1 2 (3 4 5 (6 7) 8) 9))), to(equal('[1, 2, [3, 4, 5, [6, 7], 8], 9]'))); - @include should(expect(_json-encode--list((a b (c d e (f g) h) i))), to(equal('["a", "b", ["c", "d", "e", ["f", "g"], "h"], "i"]'))); - @include should(expect(_json-encode--list((true (false true (false true) true false)))), to(equal("[true, [false, true, [false, true], true, false]]"))); - @include should(expect(_json-encode--list((#333 (#444 #555 #666) (#555 (#444 #333))))), to(equal('["#333", ["#444", "#555", "#666"], ["#555", ["#444", "#333"]]]'))); - } -} diff --git a/test/encode/types/_map.scss b/test/encode/types/_map.scss deleted file mode 100644 index dbede3a..0000000 --- a/test/encode/types/_map.scss +++ /dev/null @@ -1,17 +0,0 @@ -@include describe("The _json-encode--map function") { - $map: (a: 1, b: 2, c: 3); - $map-nested: (a: (b: 1 2 (c: test))); - $map-full: (a: (1 2 ( b : 1 )), b: ( #444444, false, ( a: 1, b: test ) ), c: (2 3 4 string)); - - @include it("should return a JSON object string") { - @include should(expect(_json-encode--map($map)), to(equal('{"a": 1, "b": 2, "c": 3}'))); - } - - @include it("should return a JSON object string for nested maps") { - @include should(expect(_json-encode--map($map-nested)), to(equal('{"a": {"b": [1, 2, {"c": "test"}]}}'))); - } - - @include it("should interpolate sass datatypes") { - @include should(expect(_json-encode--map($map-full)), to(equal('{"a": [1, 2, {"b": 1}], "b": ["#444444", false, {"a": 1, "b": "test"}], "c": [2, 3, 4, "string"]}'))); - } -} diff --git a/test/encode/types/_null.scss b/test/encode/types/_null.scss deleted file mode 100644 index 09504cc..0000000 --- a/test/encode/types/_null.scss +++ /dev/null @@ -1,8 +0,0 @@ -@include describe("The _json-encode--null function") { - @include it("should return a string null for every input") { - @include should(expect(_json-encode--null(true)), to(equal("null"))); - @include should(expect(_json-encode--null(false)), to(equal("null"))); - @include should(expect(_json-encode--null(1)), to(equal("null"))); - @include should(expect(_json-encode--null(null)), to(equal("null"))); - } -} diff --git a/test/encode/types/_number.scss b/test/encode/types/_number.scss deleted file mode 100644 index 7110b7d..0000000 --- a/test/encode/types/_number.scss +++ /dev/null @@ -1,68 +0,0 @@ -@include describe("The _json-encode--number function") { - @include it("should return a number if input is unitless") { - @include should(expect(_json-encode--number(42)), to(equal(42))); - @include should(expect(_json-encode--number(13.37)), to(equal(13.37))); - @include should(expect(_json-encode--number(-42)), to(equal(-42))); - @include should(expect(_json-encode--number(-13.37)), to(equal(-13.37))); - } - - @include it("should return encode a number to number type") { - @include should(expect(type-of(_json-encode--number(42))), to(equal('number'))); - @include should(expect(type-of(_json-encode--number(13.37))), to(equal('number'))); - @include should(expect(type-of(_json-encode--number(-42))), to(equal('number'))); - @include should(expect(type-of(_json-encode--number(-13.37))), to(equal('number'))); - } - - @include it("should return a string if input has a unit") { - $test-1: _json-encode--number(1%); - $test-2: _json-encode--number(1in); - $test-3: _json-encode--number(1px); - $test-4: _json-encode--number(1em); - $test-5: _json-encode--number(1mm); - $test-6: _json-encode--number(1cm); - $test-7: _json-encode--number(1pt); - $test-8: _json-encode--number(1pc); - $test-9: _json-encode--number(1ex); - $test-10: _json-encode--number(1ch); - $test-11: _json-encode--number(1vh); - $test-12: _json-encode--number(1vw); - $test-13: _json-encode--number(1rem); - $test-14: _json-encode--number(1vmin); - $test-15: _json-encode--number(1vmax); - $test-16: _json-encode--number(1pica); - - @include should(expect($test-1 ), to(equal('"1%"'))); - @include should(expect($test-2 ), to(equal('"1in"'))); - @include should(expect($test-3 ), to(equal('"1px"'))); - @include should(expect($test-4 ), to(equal('"1em"'))); - @include should(expect($test-5 ), to(equal('"1mm"'))); - @include should(expect($test-6 ), to(equal('"1cm"'))); - @include should(expect($test-7 ), to(equal('"1pt"'))); - @include should(expect($test-8 ), to(equal('"1pc"'))); - @include should(expect($test-9 ), to(equal('"1ex"'))); - @include should(expect($test-10), to(equal('"1ch"'))); - @include should(expect($test-11), to(equal('"1vh"'))); - @include should(expect($test-12), to(equal('"1vw"'))); - @include should(expect($test-13), to(equal('"1rem"'))); - @include should(expect($test-14), to(equal('"1vmin"'))); - @include should(expect($test-15), to(equal('"1vmax"'))); - @include should(expect($test-16), to(equal('"1pica"'))); - - @include should(expect(type-of($test-1 )), to(equal("string"))); - @include should(expect(type-of($test-2 )), to(equal("string"))); - @include should(expect(type-of($test-3 )), to(equal("string"))); - @include should(expect(type-of($test-4 )), to(equal("string"))); - @include should(expect(type-of($test-5 )), to(equal("string"))); - @include should(expect(type-of($test-6 )), to(equal("string"))); - @include should(expect(type-of($test-7 )), to(equal("string"))); - @include should(expect(type-of($test-8 )), to(equal("string"))); - @include should(expect(type-of($test-9 )), to(equal("string"))); - @include should(expect(type-of($test-10)), to(equal("string"))); - @include should(expect(type-of($test-11)), to(equal("string"))); - @include should(expect(type-of($test-12)), to(equal("string"))); - @include should(expect(type-of($test-13)), to(equal("string"))); - @include should(expect(type-of($test-14)), to(equal("string"))); - @include should(expect(type-of($test-15)), to(equal("string"))); - @include should(expect(type-of($test-16)), to(equal("string"))); - } -} \ No newline at end of file diff --git a/test/encode/types/_string.scss b/test/encode/types/_string.scss deleted file mode 100644 index b5d9181..0000000 --- a/test/encode/types/_string.scss +++ /dev/null @@ -1,9 +0,0 @@ -@include describe("The _json-encode--string function") { - @include it("should return a quoted string") { - @include should(expect(_json-encode--string("test")), to(equal('"' + 'test' + '"'))); - @include should(expect(_json-encode--string(test)), to(equal('"' + 'test' + '"'))); - @include should(expect(_json-encode--string("1")), to(equal('"' + '1' + '"'))); - @include should(expect(_json-encode--string("true")), to(equal('"' + 'true' + '"'))); - @include should(expect(_json-encode--string("false")), to(equal('"' + 'false' + '"'))); - } -} \ No newline at end of file diff --git a/test/test.scss b/test/test.scss deleted file mode 100644 index 5625bbc..0000000 --- a/test/test.scss +++ /dev/null @@ -1,12 +0,0 @@ -@import "bootcamp"; -@import "SassyJSON"; - -@include runner-start; - -// Encoder -@import "encode/index"; - -// Decoder -@import "decode/index"; - -@include runner-end; \ No newline at end of file From 5adf9a3a3654798421f93f2dc319fb4355e06367 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Sat, 13 Feb 2016 15:45:43 +0000 Subject: [PATCH 11/29] renaming stylesConfigJSON to modulesConfigJSON --- src/encode/mixins/_json.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/encode/mixins/_json.scss b/src/encode/mixins/_json.scss index 09525a9..63b7a5f 100755 --- a/src/encode/mixins/_json.scss +++ b/src/encode/mixins/_json.scss @@ -3,7 +3,7 @@ /// @param {*} $value - value to be stringified /// @param {String} $flag (all) - output driver /// @require {function} json-encode -@mixin json-encode($value, $flag: "pseudo", $selector: "#stylesConfigJSON") { +@mixin json-encode($value, $flag: "pseudo", $selector: "#modulesConfigJSON") { $json: json-encode($value); From 466e25529e3d1f06324b2b336b75a9b55860fa22 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Mon, 6 Jun 2016 11:03:43 +0100 Subject: [PATCH 12/29] removing old files --- .gitignore | 4 +--- .sassdocrc | 10 ---------- .travis.yml | 15 --------------- README.md | 2 +- 4 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 .sassdocrc delete mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 23ea15c..feb7dcf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,4 @@ node_modules tmp .sass-cache *.gem -npm-debug.log -.sassdoc -sassdocify +npm-debug.log \ No newline at end of file diff --git a/.sassdocrc b/.sassdocrc deleted file mode 100644 index b1bda79..0000000 --- a/.sassdocrc +++ /dev/null @@ -1,10 +0,0 @@ -basePath: "https://github.com/HugoGiraudel/SassyJSON/tree/master/stylesheets" -display: - access: ["public"] - alias: false - watermark: true - -package: "./package.json" -theme: "default" -groups: - undefined: "General" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 293a4a3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -branches: - only: - - master -git: - depth: 1 -node_js: - - '0.10' -env: - - SASS_VERSION=3.3.4 -before_script: - - gem update --system - - gem install sass -v $SASS_VERSION - - gem install scss-lint - - npm install -g grunt-cli diff --git a/README.md b/README.md index 8fc982c..f537f06 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # SassyJSON -This fork of SassyJSON has a few modifications from the original repo to make it compatible with [Modular](https://github.com/esr360/Modular). +This fork of SassyJSON has a few modifications from the original repo to make it compatible with [Synergy](https://github.com/esr360/Synergy). If you are looking to use SassyJSON in your own project it is recommended to use [@HugoGiraudel](https://github.com/HugoGiraudel/SassyJSON)'s original repo. \ No newline at end of file From 7a69544e72e30817ec89468ddadbed1b5f171996 Mon Sep 17 00:00:00 2001 From: Edmund Reed Date: Thu, 4 Aug 2016 21:08:57 +0100 Subject: [PATCH 13/29] adding group attribute to sassyjson files --- src/encode/api/_json.scss | 1 + src/encode/helpers/_quote.scss | 2 +- src/encode/helpers/_to-string.scss | 10 +++++----- src/encode/mixins/_json.scss | 1 + src/encode/types/_bool.scss | 1 + src/encode/types/_color.scss | 1 + src/encode/types/_list.scss | 1 + src/encode/types/_map.scss | 1 + src/encode/types/_null.scss | 1 + src/encode/types/_number.scss | 1 + src/encode/types/_string.scss | 1 + 11 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/encode/api/_json.scss b/src/encode/api/_json.scss index ee172ab..b8192a6 100755 --- a/src/encode/api/_json.scss +++ b/src/encode/api/_json.scss @@ -1,5 +1,6 @@ /// Delay the encoding of ta literal to JSON to a type-specific method /// @access public +/// @group SassyJSON /// @param {*} $value - value to be stringified /// @throw Unknown type for #{$value} (#{$type}). /// @return {String} - JSON encoded string diff --git a/src/encode/helpers/_quote.scss b/src/encode/helpers/_quote.scss index 73cd921..7839512 100755 --- a/src/encode/helpers/_quote.scss +++ b/src/encode/helpers/_quote.scss @@ -1,8 +1,8 @@ /// Proof quote a value /// @access private +/// @group SassyJSON /// @param {*} $value - value to be quoted /// @return {String} - quoted value - @function _proof-quote($value) { $value: to-string($value); @return '"' + $value + '"'; diff --git a/src/encode/helpers/_to-string.scss b/src/encode/helpers/_to-string.scss index 0d6a495..9acebaf 100644 --- a/src/encode/helpers/_to-string.scss +++ b/src/encode/helpers/_to-string.scss @@ -1,8 +1,8 @@ -// Joins all elements of `$list` with `$glue` -// @access private -// @param {List} $list - list to cast -// @param {String} $glue ('') - value to use as a join string - +/// Joins all elements of `$list` with `$glue` +/// @access private +/// @group SassyJSON +/// @param {List} $list - list to cast +/// @param {String} $glue ('') - value to use as a join string @function to-string($list, $glue: '', $is-nested: false, $recursive: false) { $result: ''; diff --git a/src/encode/mixins/_json.scss b/src/encode/mixins/_json.scss index 63b7a5f..d584c0a 100755 --- a/src/encode/mixins/_json.scss +++ b/src/encode/mixins/_json.scss @@ -1,5 +1,6 @@ /// JSON.stringify a value and pass it as a font-family of head element /// @access public +/// @group SassyJSON /// @param {*} $value - value to be stringified /// @param {String} $flag (all) - output driver /// @require {function} json-encode diff --git a/src/encode/types/_bool.scss b/src/encode/types/_bool.scss index 861653a..0c90cd9 100755 --- a/src/encode/types/_bool.scss +++ b/src/encode/types/_bool.scss @@ -1,5 +1,6 @@ /// Encode a bool to JSON /// @access private +/// @group SassyJSON /// @param {Bool} $bool - bool to be encoded /// @return {Bool} - encoded bool @function _json-encode--bool($boolean) { diff --git a/src/encode/types/_color.scss b/src/encode/types/_color.scss index 91b0f67..8e22977 100755 --- a/src/encode/types/_color.scss +++ b/src/encode/types/_color.scss @@ -1,5 +1,6 @@ /// Encode a color to JSON /// @access private +/// @group SassyJSON /// @param {Color} $color - color to be encoded /// @return {String} - encoded color /// @require {function} _proof-quote diff --git a/src/encode/types/_list.scss b/src/encode/types/_list.scss index fb177a6..4e9979c 100755 --- a/src/encode/types/_list.scss +++ b/src/encode/types/_list.scss @@ -1,5 +1,6 @@ /// Encode a list to JSON /// @access private +/// @group SassyJSON /// @param {List} $list - list to be encoded /// @return {String} - encoded list /// @require {function} json-encore diff --git a/src/encode/types/_map.scss b/src/encode/types/_map.scss index 80179a3..abe48ad 100755 --- a/src/encode/types/_map.scss +++ b/src/encode/types/_map.scss @@ -1,5 +1,6 @@ /// Encode a map to JSON /// @access private +/// @group SassyJSON /// @param {Map} $map - map to be encoded /// @return {String} - encoded map /// @require {function} _proof-quote diff --git a/src/encode/types/_null.scss b/src/encode/types/_null.scss index 4d3c691..3830560 100755 --- a/src/encode/types/_null.scss +++ b/src/encode/types/_null.scss @@ -1,5 +1,6 @@ /// Encode `null` to JSON /// @access private +/// @group SassyJSON /// @param {Null} $null - `null` /// @return {String} @function _json-encode--null($null) { diff --git a/src/encode/types/_number.scss b/src/encode/types/_number.scss index 4e2ab70..72487c0 100755 --- a/src/encode/types/_number.scss +++ b/src/encode/types/_number.scss @@ -1,5 +1,6 @@ /// Encode a number to JSON /// @access private +/// @group SassyJSON /// @param {Number} $number - number to be encoded /// @return {String} - encoded number /// @require {function} _proof-quote diff --git a/src/encode/types/_string.scss b/src/encode/types/_string.scss index 5a42780..880566d 100755 --- a/src/encode/types/_string.scss +++ b/src/encode/types/_string.scss @@ -1,5 +1,6 @@ /// Encode a string to JSON /// @access private +/// @group SassyJSON /// @param {String} $string - string to be encoded /// @return {String} - encoded string /// @require {function} _proof-quote From 120ce695392d93d0293da2c461def2a92c76bb33 Mon Sep 17 00:00:00 2001 From: Edmund Date: Sun, 16 Oct 2016 13:53:58 +0100 Subject: [PATCH 14/29] updating structure --- .gitignore | 5 --- .npmignore | 6 ---- LICENSE | 20 ----------- package.json | 35 ------------------ src/_SassyJSON.scss | 20 +++++++++-- src/{encode => }/api/_json.scss | 3 +- src/encode/encode.scss | 18 ---------- src/encode/mixins/_json.scss | 46 ------------------------ src/{encode => }/helpers/_quote.scss | 1 - src/{encode => }/helpers/_to-string.scss | 1 - src/mixins/_json.scss | 16 +++++++++ src/{encode => }/types/_bool.scss | 1 - src/{encode => }/types/_color.scss | 1 - src/{encode => }/types/_list.scss | 1 - src/{encode => }/types/_map.scss | 1 - src/{encode => }/types/_null.scss | 1 - src/{encode => }/types/_number.scss | 1 - src/{encode => }/types/_string.scss | 1 - 18 files changed, 35 insertions(+), 143 deletions(-) delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 LICENSE delete mode 100644 package.json rename src/{encode => }/api/_json.scss (90%) mode change 100755 => 100644 delete mode 100755 src/encode/encode.scss delete mode 100755 src/encode/mixins/_json.scss rename src/{encode => }/helpers/_quote.scss (91%) mode change 100755 => 100644 rename src/{encode => }/helpers/_to-string.scss (96%) create mode 100644 src/mixins/_json.scss rename src/{encode => }/types/_bool.scss (89%) mode change 100755 => 100644 rename src/{encode => }/types/_color.scss (92%) mode change 100755 => 100644 rename src/{encode => }/types/_list.scss (94%) mode change 100755 => 100644 rename src/{encode => }/types/_map.scss (94%) mode change 100755 => 100644 rename src/{encode => }/types/_null.scss (88%) mode change 100755 => 100644 rename src/{encode => }/types/_number.scss (93%) mode change 100755 => 100644 rename src/{encode => }/types/_string.scss (92%) mode change 100755 => 100644 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index feb7dcf..0000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -tmp -.sass-cache -*.gem -npm-debug.log \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index f8b0980..0000000 --- a/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -tmp -dist -.* -sache.json -.gemspec \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 9977750..0000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Hugo Giraudel - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json deleted file mode 100644 index d134b59..0000000 --- a/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "SassyJSON", - "name": "sassyjson", - "version": "1.1.8", - "description": "A Sass API for JSON.", - "scripts": { - "test": "grunt test" - }, - "repository": { - "type": "git", - "url": "https://github.com/HugoGiraudel/SassyJSON" - }, - "keywords": [ - "sass", - "scss", - "json" - ], - "author": "Hugo Giraudel, Fabrice Weinberg", - "license": "MIT", - "bugs": { - "url": "https://github.com/HugoGiraudel/SassyJSON/issues" - }, - "homepage": "https://github.com/HugoGiraudel/SassyJSON", - "devDependencies": { - "grunt-contrib-sass": "~0.8.0", - "grunt": "~0.4.2", - "bootcamp": "~1.1.4", - "grunt-contrib-watch": "~0.5.3", - "grunt-contrib-concat": "~0.3.0", - "grunt-scsslint": "0.1.0" - }, - "dependencies": { - "scsslint": "0.0.3" - } -} diff --git a/src/_SassyJSON.scss b/src/_SassyJSON.scss index e9e56ea..ca34fc2 100755 --- a/src/_SassyJSON.scss +++ b/src/_SassyJSON.scss @@ -1,2 +1,18 @@ -// Encoder -@import "encode/encode"; \ No newline at end of file +// Helpers +@import "helpers/quote"; +@import "helpers/to-string"; + +// Type specific encoding functions +@import "types/bool"; +@import "types/color"; +@import "types/list"; +@import "types/map"; +@import "types/number"; +@import "types/string"; +@import "types/null"; + +// Public API +@import "api/json"; + +// Mixin to pass the string to the DOM +@import "mixins/json"; \ No newline at end of file diff --git a/src/encode/api/_json.scss b/src/api/_json.scss old mode 100755 new mode 100644 similarity index 90% rename from src/encode/api/_json.scss rename to src/api/_json.scss index b8192a6..77a7434 --- a/src/encode/api/_json.scss +++ b/src/api/_json.scss @@ -1,6 +1,5 @@ /// Delay the encoding of ta literal to JSON to a type-specific method /// @access public -/// @group SassyJSON /// @param {*} $value - value to be stringified /// @throw Unknown type for #{$value} (#{$type}). /// @return {String} - JSON encoded string @@ -18,5 +17,5 @@ @return call('_json-encode--#{$type}', $value); } - @error "Unknown type for #{$value} (#{$type})."; + @error 'Unknown type for #{$value} (#{$type}).'; } diff --git a/src/encode/encode.scss b/src/encode/encode.scss deleted file mode 100755 index ca34fc2..0000000 --- a/src/encode/encode.scss +++ /dev/null @@ -1,18 +0,0 @@ -// Helpers -@import "helpers/quote"; -@import "helpers/to-string"; - -// Type specific encoding functions -@import "types/bool"; -@import "types/color"; -@import "types/list"; -@import "types/map"; -@import "types/number"; -@import "types/string"; -@import "types/null"; - -// Public API -@import "api/json"; - -// Mixin to pass the string to the DOM -@import "mixins/json"; \ No newline at end of file diff --git a/src/encode/mixins/_json.scss b/src/encode/mixins/_json.scss deleted file mode 100755 index d584c0a..0000000 --- a/src/encode/mixins/_json.scss +++ /dev/null @@ -1,46 +0,0 @@ -/// JSON.stringify a value and pass it as a font-family of head element -/// @access public -/// @group SassyJSON -/// @param {*} $value - value to be stringified -/// @param {String} $flag (all) - output driver -/// @require {function} json-encode -@mixin json-encode($value, $flag: "pseudo", $selector: "#modulesConfigJSON") { - - $json: json-encode($value); - - // Persistent comment - @if $flag == "comment" { - /*! json-encode: #{$json} */ - } - - // Regular property value pair - @if $flag == "pseudo" { - // All browsers except IE8- - #{$selector}::before { - // This element must be in the render tree to get it via getComputedStyle(document.body, ':before'); - content: json-encode($value); - display: block; - height: 0; - overflow: hidden; - width: 0; - } - } - - // Regular property value pair - @if $flag == "head" { - // All browsers except Opera (Presto based) - head { - font-family: json-encode($value); - } - } - - // Falsy media query - @if $flag == "media" { - @media -json-encode { - json { - json: $json; - } - } - } - -} diff --git a/src/encode/helpers/_quote.scss b/src/helpers/_quote.scss old mode 100755 new mode 100644 similarity index 91% rename from src/encode/helpers/_quote.scss rename to src/helpers/_quote.scss index 7839512..dd6b5fc --- a/src/encode/helpers/_quote.scss +++ b/src/helpers/_quote.scss @@ -1,6 +1,5 @@ /// Proof quote a value /// @access private -/// @group SassyJSON /// @param {*} $value - value to be quoted /// @return {String} - quoted value @function _proof-quote($value) { diff --git a/src/encode/helpers/_to-string.scss b/src/helpers/_to-string.scss similarity index 96% rename from src/encode/helpers/_to-string.scss rename to src/helpers/_to-string.scss index 9acebaf..a1177ee 100644 --- a/src/encode/helpers/_to-string.scss +++ b/src/helpers/_to-string.scss @@ -1,6 +1,5 @@ /// Joins all elements of `$list` with `$glue` /// @access private -/// @group SassyJSON /// @param {List} $list - list to cast /// @param {String} $glue ('') - value to use as a join string @function to-string($list, $glue: '', $is-nested: false, $recursive: false) { diff --git a/src/mixins/_json.scss b/src/mixins/_json.scss new file mode 100644 index 0000000..76ee52f --- /dev/null +++ b/src/mixins/_json.scss @@ -0,0 +1,16 @@ +/// JSON.stringify a value and pass it as a font-family of head element +/// @access public +/// @param {*} $value - value to be stringified +/// @param {string} $selector ['#modulesConfigJSON'] - DOM selector to hold config +/// @require {function} json-encode +@mixin json-encode($value, $selector: '#modulesConfigJSON') { + + #{$selector}::before { + content: json-encode($value); + display: block; + height: 0; + overflow: hidden; + width: 0; + } + +} diff --git a/src/encode/types/_bool.scss b/src/types/_bool.scss old mode 100755 new mode 100644 similarity index 89% rename from src/encode/types/_bool.scss rename to src/types/_bool.scss index 0c90cd9..861653a --- a/src/encode/types/_bool.scss +++ b/src/types/_bool.scss @@ -1,6 +1,5 @@ /// Encode a bool to JSON /// @access private -/// @group SassyJSON /// @param {Bool} $bool - bool to be encoded /// @return {Bool} - encoded bool @function _json-encode--bool($boolean) { diff --git a/src/encode/types/_color.scss b/src/types/_color.scss old mode 100755 new mode 100644 similarity index 92% rename from src/encode/types/_color.scss rename to src/types/_color.scss index 8e22977..91b0f67 --- a/src/encode/types/_color.scss +++ b/src/types/_color.scss @@ -1,6 +1,5 @@ /// Encode a color to JSON /// @access private -/// @group SassyJSON /// @param {Color} $color - color to be encoded /// @return {String} - encoded color /// @require {function} _proof-quote diff --git a/src/encode/types/_list.scss b/src/types/_list.scss old mode 100755 new mode 100644 similarity index 94% rename from src/encode/types/_list.scss rename to src/types/_list.scss index 4e9979c..fb177a6 --- a/src/encode/types/_list.scss +++ b/src/types/_list.scss @@ -1,6 +1,5 @@ /// Encode a list to JSON /// @access private -/// @group SassyJSON /// @param {List} $list - list to be encoded /// @return {String} - encoded list /// @require {function} json-encore diff --git a/src/encode/types/_map.scss b/src/types/_map.scss old mode 100755 new mode 100644 similarity index 94% rename from src/encode/types/_map.scss rename to src/types/_map.scss index abe48ad..80179a3 --- a/src/encode/types/_map.scss +++ b/src/types/_map.scss @@ -1,6 +1,5 @@ /// Encode a map to JSON /// @access private -/// @group SassyJSON /// @param {Map} $map - map to be encoded /// @return {String} - encoded map /// @require {function} _proof-quote diff --git a/src/encode/types/_null.scss b/src/types/_null.scss old mode 100755 new mode 100644 similarity index 88% rename from src/encode/types/_null.scss rename to src/types/_null.scss index 3830560..4d3c691 --- a/src/encode/types/_null.scss +++ b/src/types/_null.scss @@ -1,6 +1,5 @@ /// Encode `null` to JSON /// @access private -/// @group SassyJSON /// @param {Null} $null - `null` /// @return {String} @function _json-encode--null($null) { diff --git a/src/encode/types/_number.scss b/src/types/_number.scss old mode 100755 new mode 100644 similarity index 93% rename from src/encode/types/_number.scss rename to src/types/_number.scss index 72487c0..4e2ab70 --- a/src/encode/types/_number.scss +++ b/src/types/_number.scss @@ -1,6 +1,5 @@ /// Encode a number to JSON /// @access private -/// @group SassyJSON /// @param {Number} $number - number to be encoded /// @return {String} - encoded number /// @require {function} _proof-quote diff --git a/src/encode/types/_string.scss b/src/types/_string.scss old mode 100755 new mode 100644 similarity index 92% rename from src/encode/types/_string.scss rename to src/types/_string.scss index 880566d..5a42780 --- a/src/encode/types/_string.scss +++ b/src/types/_string.scss @@ -1,6 +1,5 @@ /// Encode a string to JSON /// @access private -/// @group SassyJSON /// @param {String} $string - string to be encoded /// @return {String} - encoded string /// @require {function} _proof-quote From 2bc8959c126d67bd03089779119c0196efb8d18c Mon Sep 17 00:00:00 2001 From: Edmund Date: Sun, 16 Oct 2016 14:10:00 +0100 Subject: [PATCH 15/29] adding bower file --- bower.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..e69de29 From 03a85bd4d8e70a1ce244e5eb22a41595f1c8c7db Mon Sep 17 00:00:00 2001 From: Edmund Date: Mon, 17 Oct 2016 00:00:56 +0100 Subject: [PATCH 16/29] adding build process stuff --- .gitignore | 1 + .scss-lint.yml | 233 ++++++++++++++++++++++ .travis.yml | 11 + Gruntfile.js | 111 +++++++++++ LICENSE.txt | 21 ++ README.md | 7 +- bower.json | 22 ++ docs/assets/css/main.css | 1 + docs/assets/images/favicon.png | Bin 0 -> 17676 bytes docs/assets/images/logo_full_compact.svg | 1 + docs/assets/images/logo_full_inline.svg | 1 + docs/assets/images/logo_light_compact.svg | 1 + docs/assets/images/logo_light_inline.svg | 1 + docs/assets/js/main.js | 56 ++++++ docs/assets/js/main.min.js | 1 + docs/assets/js/search.js | 146 ++++++++++++++ docs/assets/js/sidebar.js | 163 +++++++++++++++ docs/assets/js/vendor/fuse.min.js | 20 ++ docs/assets/js/vendor/jquery.min.js | 4 + docs/assets/js/vendor/prism.min.js | 9 + docs/index.html | 65 ++++++ package.json | 26 +++ src/{_SassyJSON.scss => _sass-json.scss} | 0 src/api/_json.scss | 6 +- src/types/_string.scss | 2 +- unit-testing/api/_json.scss | 0 unit-testing/helpers/_quote.scss | 0 unit-testing/helpers/_to-string.scss | 0 unit-testing/tests.js | 5 + unit-testing/tests.scss | 18 ++ unit-testing/types/_bool.scss | 0 unit-testing/types/_color.scss | 0 unit-testing/types/_list.scss | 0 unit-testing/types/_map.scss | 0 unit-testing/types/_null.scss | 0 unit-testing/types/_number.scss | 0 unit-testing/types/_string.scss | 0 37 files changed, 929 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 .scss-lint.yml create mode 100644 .travis.yml create mode 100644 Gruntfile.js create mode 100644 LICENSE.txt create mode 100644 docs/assets/css/main.css create mode 100644 docs/assets/images/favicon.png create mode 100644 docs/assets/images/logo_full_compact.svg create mode 100644 docs/assets/images/logo_full_inline.svg create mode 100644 docs/assets/images/logo_light_compact.svg create mode 100644 docs/assets/images/logo_light_inline.svg create mode 100644 docs/assets/js/main.js create mode 100644 docs/assets/js/main.min.js create mode 100644 docs/assets/js/search.js create mode 100644 docs/assets/js/sidebar.js create mode 100644 docs/assets/js/vendor/fuse.min.js create mode 100644 docs/assets/js/vendor/jquery.min.js create mode 100644 docs/assets/js/vendor/prism.min.js create mode 100644 docs/index.html create mode 100644 package.json rename src/{_SassyJSON.scss => _sass-json.scss} (100%) mode change 100755 => 100644 create mode 100644 unit-testing/api/_json.scss create mode 100644 unit-testing/helpers/_quote.scss create mode 100644 unit-testing/helpers/_to-string.scss create mode 100644 unit-testing/tests.js create mode 100644 unit-testing/tests.scss create mode 100644 unit-testing/types/_bool.scss create mode 100644 unit-testing/types/_color.scss create mode 100644 unit-testing/types/_list.scss create mode 100644 unit-testing/types/_map.scss create mode 100644 unit-testing/types/_null.scss create mode 100644 unit-testing/types/_number.scss create mode 100644 unit-testing/types/_string.scss diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.scss-lint.yml b/.scss-lint.yml new file mode 100644 index 0000000..48b2f6c --- /dev/null +++ b/.scss-lint.yml @@ -0,0 +1,233 @@ +linters: + BangFormat: + enabled: true + space_before_bang: true + space_after_bang: false + + BemDepth: + enabled: false + max_elements: 1 + + BorderZero: + enabled: true + convention: zero # or `none` + + ChainedClasses: + enabled: false + + ColorKeyword: + enabled: true + + ColorVariable: + enabled: true + + Comment: + enabled: true + style: silent + + DebugStatement: + enabled: true + + DeclarationOrder: + enabled: true + + DisableLinterReason: + enabled: false + + DuplicateProperty: + enabled: true + + ElsePlacement: + enabled: true + style: same_line # or 'new_line' + + EmptyLineBetweenBlocks: + enabled: true + ignore_single_line_blocks: true + + EmptyRule: + enabled: true + + ExtendDirective: + enabled: false + + FinalNewline: + enabled: true + present: false + + HexLength: + enabled: true + style: short # or 'long' + + HexNotation: + enabled: true + style: lowercase # or 'uppercase' + + HexValidation: + enabled: true + + IdSelector: + enabled: true + + ImportantRule: + enabled: true + + ImportPath: + enabled: true + leading_underscore: false + filename_extension: false + + Indentation: + enabled: true + allow_non_nested_indentation: false + character: space # or 'tab' + width: 4 + + LeadingZero: + enabled: true + style: include_zero # or 'include_zero' + + MergeableSelector: + enabled: true + force_nesting: true + + NameFormat: + enabled: true + allow_leading_underscore: true + convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern + + NestingDepth: + enabled: true + max_depth: 3 + ignore_parent_selectors: false + + PlaceholderInExtend: + enabled: false + + PropertyCount: + enabled: false + include_nested: false + max_properties: 10 + + PropertySortOrder: + enabled: true + ignore_unspecified: false + min_properties: 2 + separate_groups: false + + PropertySpelling: + enabled: true + extra_properties: [] + disabled_properties: [] + + PropertyUnits: + enabled: true + global: [ + 'ch', 'em', 'ex', 'rem', # Font-relative lengths + 'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths + 'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths + 'deg', 'grad', 'rad', 'turn', # Angle + 'ms', 's', # Duration + 'Hz', 'kHz', # Frequency + 'dpi', 'dpcm', 'dppx', # Resolution + '%'] # Other + properties: {} + + PseudoElement: + enabled: true + + QualifyingElement: + enabled: true + allow_element_with_attribute: false + allow_element_with_class: false + allow_element_with_id: false + + SelectorDepth: + enabled: true + max_depth: 3 + + SelectorFormat: + enabled: true + convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern + + Shorthand: + enabled: true + allowed_shorthands: [1, 2, 3] + + SingleLinePerProperty: + enabled: true + allow_single_line_rule_sets: true + + SingleLinePerSelector: + enabled: true + + SpaceAfterComma: + enabled: true + style: one_space # or 'no_space', or 'at_least_one_space' + + SpaceAfterPropertyColon: + enabled: true + style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned' + + SpaceAfterPropertyName: + enabled: true + + SpaceAfterVariableName: + enabled: false + + SpaceAroundOperator: + enabled: true + style: one_space # or 'at_least_one_space', or 'no_space' + + SpaceBeforeBrace: + enabled: true + style: space # or 'new_line' + allow_single_line_padding: false + + SpaceBetweenParens: + enabled: true + spaces: 0 + + StringQuotes: + enabled: true + style: single_quotes # or double_quotes + + TrailingSemicolon: + enabled: true + + TrailingWhitespace: + enabled: true + + TrailingZero: + enabled: false + + TransitionAll: + enabled: false + + UnnecessaryMantissa: + enabled: true + + UnnecessaryParentReference: + enabled: true + + UrlFormat: + enabled: true + + UrlQuotes: + enabled: true + + VariableForProperty: + enabled: false + properties: [] + + VendorPrefix: + enabled: true + identifier_list: base + additional_identifiers: [] + excluded_identifiers: [] + + ZeroUnit: + enabled: true + + Compass::*: + enabled: false \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5210dfb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - "4.4" +before_install: + - rvm install 2.2.2 + - gem install sass + - gem install scss_lint + - npm install -g grunt-cli +install: npm install +before_script: + - grunt compile \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..656cc4b --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,111 @@ +/****************************************************************** + * Sass-JSON + * Grunt Setup + * @uthor [@esr360](http://twitter.com/esr360) + ******************************************************************/ + +module.exports = function(grunt) { + + grunt.initConfig({ + + pkg: grunt.file.readJSON('package.json'), + + /** + * Scss Lint + * @see https://github.com/ahmednuaman/grunt-scss-lint + */ + scsslint: { + allFiles: [ + 'src/**/*.scss', + 'unit-testing/**/*.scss' + ], + options: { + config: '.scss-lint.yml', + colorizeOutput: false + }, + }, + + /** + * Mocha Cli + * @note used for Scss unit testing + * @see https://github.com/Rowno/grunt-mocha-cli + */ + mochacli: { + scss: ['unit-testing/tests.js'] + }, + + /** + * SassDoc + * @see https://github.com/SassDoc/grunt-sassdoc + */ + sassdoc: { + default: { + src: ['src/**/*.scss'], + options: { + dest: 'docs' + } + }, + }, + + /** + * Watch + * @see https://github.com/gruntjs/grunt-contrib-watch + */ + watch: { + options: { + spawn: false, + }, + scss: { + files: ['src/**/*.scss'], + tasks: [ + 'scsslint', + 'mochacli:scss', + 'sassdoc', + 'notify:css' + ], + }, + }, + + /** + * Notify + * @see https://github.com/dylang/grunt-notify + */ + notify: { + css: { + options: { + title: 'Success', + message: 'There were no errors running the compile tasks' + } + } + } + + }); + + /************************************************************** + * Load NPM Tasks + *************************************************************/ + + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-mocha-cli'); + grunt.loadNpmTasks('grunt-notify'); + grunt.loadNpmTasks('grunt-sassdoc'); + grunt.loadNpmTasks('grunt-scss-lint'); + + /************************************************************** + * Tasks + *************************************************************/ + + // Default Grunt task + grunt.registerTask('default', [ + 'compile', + 'watch' + ]); + + // Compile the app + grunt.registerTask('compile', [ + 'scsslint', + 'mochacli', + 'sassdoc' + ]); + +}; \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..7679684 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Edmund Reed + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index f537f06..3412da5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# SassyJSON +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/esr360/Sass-JSON/blob/master/LICENSE.txt) +[![GitHub license](https://api.travis-ci.org/esr360/Sass-JSON.svg)](https://travis-ci.org/esr360/Sass-JSON) +[![Bower version](https://badge.fury.io/bo/Sass-JSON.svg)](https://badge.fury.io/bo/Sass-JSON) +[![npm version](https://badge.fury.io/js/Sass-JSON.svg)](https://badge.fury.io/js/Sass-JSON) + +# Sass-JSON This fork of SassyJSON has a few modifications from the original repo to make it compatible with [Synergy](https://github.com/esr360/Synergy). diff --git a/bower.json b/bower.json index e69de29..b6038ae 100644 --- a/bower.json +++ b/bower.json @@ -0,0 +1,22 @@ +{ + "name": "Sass-JSON", + "version": "1.0.0", + "description": "Output information about your Sass modules as JSON data.", + "keywords": [ + "sass", + "scss", + "json", + "api" + ], + "authors": [ + "Hugo Giraudel", + "Edmund Reed (http://twitter.com/esr360)" + ], + "homepage": "https://github.com/esr360/Sass-JSON", + "main": "src/_sass-json.scss", + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules" + ] +} \ No newline at end of file diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css new file mode 100644 index 0000000..c30e6a0 --- /dev/null +++ b/docs/assets/css/main.css @@ -0,0 +1 @@ +.container:after,.header:after,.searchbar:after{content:"";display:table;clear:both}.visually-hidden{width:1px;height:1px;position:absolute;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);border:0}.sidebar__title{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}code[class*='language-'],pre[class*='language-']{color:black;text-shadow:0 1px white;font-family:Consolas, Monaco, 'Andale Mono', monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*='language-']::-moz-selection,pre[class*='language-'] ::-moz-selection,code[class*='language-']::-moz-selection,code[class*='language-'] ::-moz-selection{text-shadow:none;background:#b3d4fc}pre[class*='language-']::selection,pre[class*='language-'] ::selection,code[class*='language-']::selection,code[class*='language-'] ::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*='language-'],pre[class*='language-']{text-shadow:none}}pre[class*='language-']{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*='language-'],pre[class*='language-']{background:white}:not(pre)>code[class*='language-']{padding:.1em;border-radius:.3em}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol{color:#905}.token.selector,.token.attr-name,.token.string,.token.builtin{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable{color:#a67f59;background:rgba(255,255,255,0.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.regex,.token.important{color:#e90}.token.important{font-weight:bold}.token.entity{cursor:help}html{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*,*::after,*::before{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}body{font:1em/1.35 "Open Sans","Helvetica Neue Light","Helvetica Neue","Helvetica","Arial",sans-serif;overflow:auto;margin:0}a{transition:0.15s;text-decoration:none;color:#dd5a6f}a:hover,a:hover code{color:#333}table p{margin:0 0 0.5rem}:not(pre)>code{color:#dd5a6f;white-space:nowrap;font-weight:normal}@media (max-width: 800px){table,tbody,tr,td,th{display:block}thead{width:1px;height:1px;position:absolute;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);border:0}tr{padding-bottom:1em;margin-bottom:1em;border-bottom:2px solid #ddd}td::before,th::before{content:attr(data-label) ": ";text-transform:capitalize;font-weight:bold}td p,th p{display:inline}}.layout-toggle{display:none}@media (min-width: 801px){.layout-toggle{position:absolute;top:8px;left:20px;font-size:2em;cursor:pointer;color:white;display:block}}@media (min-width: 801px){.sidebar-closed .sidebar{-webkit-transform:translateX(-280px);-ms-transform:translateX(-280px);transform:translateX(-280px)}.sidebar-closed .main{padding-left:0}.sidebar-closed .header{left:0}}.list-unstyled{padding-left:0;list-style:none;line-height:1.5;margin-top:0;margin-bottom:1.5rem}.list-inline li{display:inline-block}.container{max-width:100%;width:1170px;margin:0 auto;padding:0 2rem}.relative{position:relative}.clear{clear:both}.header{position:fixed;top:0;right:0;left:280px;box-shadow:0 2px 5px rgba(0,0,0,0.26);padding:1em 0;background:#dd5a6f;color:#e0e0e0;z-index:4000}@media (max-width: 800px){.header{left:0}}@media (min-width: 801px){.header{transition:0.2s cubic-bezier(0.215, 0.61, 0.355, 1)}}.header__title{font-weight:500;text-align:center;margin:0 0 0.5em 0}.header__title a{color:#e0e0e0}@media (min-width: 801px){.header__title{float:left;font-size:1em;margin-top:.25em;margin-bottom:0}}.searchbar{display:inline-block;float:right}@media (max-width: 800px){.searchbar{display:block;float:none}}.searchbar__form{float:right;position:relative}@media (max-width: 800px){.searchbar__form{float:none}}@media (min-width: 801px){.searchbar__form{min-width:15em}}.searchbar__field{border:none;padding:0.5em;font-size:1em;margin:0;width:100%;box-shadow:0 1.5px 4px rgba(0,0,0,0.24),0 1.5px 6px rgba(0,0,0,0.12);border:1px solid #e0e0e0}.searchbar__suggestions{position:absolute;top:100%;right:0;left:0;box-shadow:0 1.5px 4px rgba(0,0,0,0.24),0 1.5px 6px rgba(0,0,0,0.12);border:1px solid #e0e0e0;background:white;padding:0;margin:0;list-style:none;z-index:2}.searchbar__suggestions:empty{display:none}.searchbar__suggestions .selected{background:#ddd}.searchbar__suggestions li{border-bottom:1px solid #e0e0e0}.searchbar__suggestions li:last-of-type{border:none}.searchbar__suggestions a{display:block;padding:0.5em;font-size:0.9em}.searchbar__suggestions a:hover,.searchbar__suggestions a:active,.searchbar__suggestions a:focus{background:#e0e0e0}.searchbar__suggestions code{margin-right:.5em}@media (min-width: 801px){.sidebar{position:fixed;top:0;bottom:0;left:0;overflow:auto;box-shadow:1px 0 1.5px rgba(0,0,0,0.12);width:280px;z-index:2;border-right:1px solid #e0e0e0;transition:0.2s cubic-bezier(0.215, 0.61, 0.355, 1)}}@media (max-width: 800px){.sidebar{margin-top:4em}}.sidebar__annotation{color:#5c4863}.sidebar__item{font-size:0.9em}.sidebar__item a{padding:0.5em 4.5em;display:block;text-decoration:none;color:#333}.sidebar__item:hover,.sidebar__item:active,.sidebar__item:focus{background:#e0e0e0}.sidebar__item.is-collapsed+*{display:none}.sidebar__item--heading{padding:1em 1.5em}.sidebar__item--heading a{font-weight:bold}.sidebar__item--sub-heading{padding:0.5em 2.5em}.sidebar__item--sub-heading a{color:#888}.sidebar__item--heading,.sidebar__item--sub-heading{position:relative}.sidebar__item--heading:after,.sidebar__item--sub-heading:after{position:absolute;top:50%;right:2em;content:'\25BC';margin-top:-0.5em;color:#ddd;font-size:0.7em}.sidebar__item--heading.is-collapsed:after,.sidebar__item--sub-heading.is-collapsed:after{content:'\25B6'}.sidebar__item--heading a,.sidebar__item--sub-heading a{padding:0;display:inline}.sidebar__description{color:#e0e0e0;padding-right:2em}.sidebar__header{border-bottom:1px solid #e0e0e0}.sidebar__title{font-size:1em;margin:0;padding:1.45em}.btn-toggle{background:#EFEFEF;border:none;border-bottom:1px solid #e0e0e0;display:block;padding:1em;width:100%;cursor:pointer;color:#999;font-weight:bold;margin:0;transition:0.15s ease-out}.btn-toggle:hover,.btn-toggle:active,.btn-toggle:focus{background:#DFDFDF}.main{background:#f9f9f9;position:relative}@media (min-width: 801px){.main{transition:0.2s cubic-bezier(0.215, 0.61, 0.355, 1);padding-left:280px;padding-top:4em;min-height:45em}}.main__section{margin-top:5em;border-top:5px solid rgba(92,72,99,0.2)}.header+.main__section{margin-top:0;border-top:none}.main__heading,.main__heading--secondary{padding:1em 0;margin-top:0}@media (min-width: 801px){.main__heading,.main__heading--secondary{padding:2em 0 0}}.main__heading{color:#5c4863;font-size:3.5em;text-align:center;border-bottom:5px solid rgba(92,72,99,0.2);padding-bottom:.5em;margin-bottom:1em;background:rgba(92,72,99,0.1)}.main__heading--secondary{font-size:3em;color:#dd5a6f;text-transform:uppercase;font-weight:bold;padding-top:0;margin-bottom:-3rem;position:relative}.main__heading--secondary .container{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.main__heading--secondary::before{content:'';position:absolute;left:0;right:0;bottom:0.15em;height:0.2em;background-color:#dd5a6f}.footer{background:#e0e0e0;padding:1em 0}.footer .container{position:relative}.footer__project-info{float:left}.footer__watermark{position:absolute;right:0;top:-0.7em}.footer__watermark img{display:block;max-width:7em}.project-info__name,.project-info__version,.project-info__license{display:inline-block}.project-info__version,.project-info__license{color:#555}.project-info__license{text-indent:-0.25em}.main__section{margin-bottom:4.5rem}.item__heading{color:#333;margin:4.5rem 0 1.5rem 0;position:relative;font-size:2em;font-weight:300;float:left}.item__name{color:#dd5a6f}.item__example{margin-bottom:1.5rem}.item__example,.item__code{box-shadow:0 1.5px 4px rgba(0,0,0,0.24),0 1.5px 6px rgba(0,0,0,0.12);border:1px solid #e0e0e0;word-wrap:break-word;line-height:1.42}.item__code{padding-right:7em;clear:both;cursor:pointer}.item__code--togglable::after{position:absolute;right:0;bottom:-2.5em;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;color:#c4c4c4;font-size:0.8em;transition:0.2s ease-out}.item__code--togglable:hover::after,.item__code--togglable:active::after,.item__code--togglable:focus::after{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";opacity:1}.item__code--togglable[data-current-state='expanded']::after{content:'Click to collapse.'}.item__code--togglable[data-current-state='collapsed']::after{content:'Click to expand.'}.example__description{padding:1em;background:#EFEFEF}.example__description p{margin:0}.example__code[class*='language-']{margin:0}.item__anchor{font-size:0.6em;color:#eeafb9}@media (min-width: 801px){.item__anchor{position:absolute;right:101%;bottom:0.25em;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0}.item:hover .item__anchor{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";opacity:1}}.item__deprecated{display:inline-block;overflow:hidden;margin-top:5.5em;margin-left:1em}.item__deprecated strong{float:left;color:#c00;text-transform:uppercase}.item__deprecated p{float:left;margin:0;padding-left:0.5em}.item__type{color:#ddd;text-transform:capitalize;font-size:0.75em}.item__alias,.item__aliased{color:#ddd;font-size:0.8em}.item__sub-heading{color:#333;margin-top:0;margin-bottom:1.5rem;font-size:1.2em}.item__parameters{width:100%;margin-bottom:1em;border-collapse:collapse}.item__parameters thead th{vertical-align:bottom;border-bottom:2px solid #ddd;border-top:none;text-align:left;color:#707070}.item__parameters tbody th{text-align:left}.item__parameters td,.item__parameters th{padding:0.5em 0.5em 0.5em 0;vertical-align:top}@media (min-width: 801px){tbody>.item__parameter:first-of-type>td{border-top:none}.item__parameters td,.item__parameters th{border-top:1px solid #ddd}}.item__access{text-transform:capitalize;color:#5c4863;font-size:0.8em}.item__since{float:right;padding-top:0.9em;color:#c4c4c4;margin-bottom:1em}.item__source-link{position:absolute;top:1px;right:1px;background:white;padding:1em;z-index:2;color:#c4c4c4}.item__cross-type{color:#4d4d4d;font-family:'Consolas', 'Monaco', 'Andale Mono', monospace;font-size:0.8em}.item__description{margin-bottom:1.5rem}li.item__description{margin-bottom:0}.item__description--inline>*{display:inline-block;margin:0}.item__code-wrapper{position:relative;clear:both;margin-bottom:1.5rem}.color-preview--inline{padding:2px 4px;border:1px solid rgba(0,0,0,0.1);border-radius:3px}.color-preview--block{width:2em;height:2em;position:absolute;top:140%;right:0;top:calc(100% + 20px);border:1px solid rgba(0,0,0,0.1);border-radius:3px} diff --git a/docs/assets/images/favicon.png b/docs/assets/images/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..585fb531409ea89d65ea605a31ac22e6b58886d5 GIT binary patch literal 17676 zcmV)kK%l>gP)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 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 \ No newline at end of file diff --git a/docs/assets/images/logo_full_inline.svg b/docs/assets/images/logo_full_inline.svg new file mode 100644 index 0000000..68b0103 --- /dev/null +++ b/docs/assets/images/logo_full_inline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/logo_light_compact.svg b/docs/assets/images/logo_light_compact.svg new file mode 100644 index 0000000..7f9ef80 --- /dev/null +++ b/docs/assets/images/logo_light_compact.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/logo_light_inline.svg b/docs/assets/images/logo_light_inline.svg new file mode 100644 index 0000000..120ffd2 --- /dev/null +++ b/docs/assets/images/logo_light_inline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/js/main.js b/docs/assets/js/main.js new file mode 100644 index 0000000..015842a --- /dev/null +++ b/docs/assets/js/main.js @@ -0,0 +1,56 @@ +/* global document */ + +(function ($, global) { + 'use strict'; + + // Constructor + var App = function (conf) { + this.conf = $.extend({ + // Search module + search: new global.Search(), + + // Sidebar module + sidebar: new global.Sidebar(), + + // Initialisation + init: true + }, conf || {}); + + // Launch the module + if (this.conf.init !== false) { + this.initialize(); + } + }; + + // Initialisation method + App.prototype.initialize = function () { + this.codePreview(); + }; + + // Toggle code preview collapsed/expanded modes + App.prototype.codePreview = function () { + var $item; + var $code; + var switchTo; + + $('.item__code--togglable').on('click', function () { + $item = $(this); + $code = $item.find('code'); + switchTo = $item.attr('data-current-state') === 'expanded' ? 'collapsed' : 'expanded'; + + $item.attr('data-current-state', switchTo); + $code.html($item.attr('data-' + switchTo)); + Prism.highlightElement($code[0]); + }); + }; + + global.App = App; +}(window.jQuery, window)); + +(function ($, global) { + + $(document).ready(function () { + var app = new global.App(); + }); + +}(window.jQuery, window)); \ No newline at end of file diff --git a/docs/assets/js/main.min.js b/docs/assets/js/main.min.js new file mode 100644 index 0000000..b81f9d4 --- /dev/null +++ b/docs/assets/js/main.min.js @@ -0,0 +1 @@ +!function(t){function e(t,n){this.list=t,this.options=n=n||{};var i,o,s;for(i=0,keys=["sort","includeScore","shouldSort"],o=keys.length;o>i;i++)s=keys[i],this.options[s]=s in n?n[s]:e.defaultOptions[s];for(i=0,keys=["searchFn","sortFn","keys","getFn"],o=keys.length;o>i;i++)s=keys[i],this.options[s]=n[s]||e.defaultOptions[s]}var n=function(t,e){if(e=e||{},this.options=e,this.options.location=e.location||n.defaultOptions.location,this.options.distance="distance"in e?e.distance:n.defaultOptions.distance,this.options.threshold="threshold"in e?e.threshold:n.defaultOptions.threshold,this.options.maxPatternLength=e.maxPatternLength||n.defaultOptions.maxPatternLength,this.pattern=e.caseSensitive?t:t.toLowerCase(),this.patternLen=t.length,this.patternLen>this.options.maxPatternLength)throw new Error("Pattern length is too long");this.matchmask=1<i;)this._bitapScore(e,l+o)<=u?i=o:d=o,o=Math.floor((d-i)/2+i);for(d=o,s=Math.max(1,l-o+1),r=Math.min(l+o,c)+this.patternLen,a=Array(r+2),a[r+1]=(1<=s;n--)if(p=this.patternAlphabet[t.charAt(n-1)],a[n]=0===e?(a[n+1]<<1|1)&p:(a[n+1]<<1|1)&p|((h[n+1]|h[n])<<1|1)|h[n+1],a[n]&this.matchmask&&(g=this._bitapScore(e,n-1),u>=g)){if(u=g,f=n-1,m.push(f),!(f>l))break;s=Math.max(1,2*l-f)}if(this._bitapScore(e+1,l)>u)break;h=a}return{isMatch:f>=0,score:g}};var i={deepValue:function(t,e){for(var n=0,e=e.split("."),i=e.length;i>n;n++){if(!t)return null;t=t[e[n]]}return t}};e.defaultOptions={id:null,caseSensitive:!1,includeScore:!1,shouldSort:!0,searchFn:n,sortFn:function(t,e){return t.score-e.score},getFn:i.deepValue,keys:[]},e.prototype.search=function(t){var e,n,o,s,r,a=new this.options.searchFn(t,this.options),h=this.list,p=h.length,c=this.options,l=this.options.keys,u=l.length,f=[],d={},g=[],m=function(t,e,n){void 0!==t&&null!==t&&"string"==typeof t&&(s=a.search(t),s.isMatch&&(r=d[n],r?r.score=Math.min(r.score,s.score):(d[n]={item:e,score:s.score},f.push(d[n]))))};if("string"==typeof h[0])for(var e=0;p>e;e++)m(h[e],e,e);else for(var e=0;p>e;e++)for(o=h[e],n=0;u>n;n++)m(this.options.getFn(o,l[n]),o,e);c.shouldSort&&f.sort(c.sortFn);for(var y=c.includeScore?function(t){return f[t]}:function(t){return f[t].item},L=c.id?function(t){return i.deepValue(y(t),c.id)}:function(t){return y(t)},e=0,v=f.length;v>e;e++)g.push(L(e));return g},"object"==typeof exports?module.exports=e:"function"==typeof define&&define.amd?define(function(){return e}):t.Fuse=e}(this);(function($,global){var Sidebar=function(conf){this.conf=$.extend({collapsedClass:"is-collapsed",storageKey:"_sassdoc_sidebar_index",indexAttribute:"data-slug",toggleBtn:".js-btn-toggle",init:true},conf||{});if(this.conf.init===true){this.initialize()}};Sidebar.prototype.initialize=function(){this.conf.nodes=$("["+this.conf.indexAttribute+"]");this.load();this.updateDOM();this.bind();this.loadToggle()};Sidebar.prototype.loadToggle=function(){$("",{"class":"layout-toggle",html:"×","data-alt":"→"}).appendTo($(".header"));$(".layout-toggle").on("click",function(){var $this=$(this);var alt;$("body").toggleClass("sidebar-closed");alt=$this.html();$this.html($this.data("alt"));$this.data("alt",alt)})};Sidebar.prototype.load=function(){var index="localStorage"in global?global.localStorage.getItem(this.conf.storageKey):null;this.index=index?JSON.parse(index):this.buildIndex()};Sidebar.prototype.buildIndex=function(){var index={};var $item;this.conf.nodes.each($.proxy(function(index,item){$item=$(item);index[$item.attr(this.conf.indexAttribute)]=!$item.hasClass(this.conf.collapsedClass)},this));return index};Sidebar.prototype.updateDOM=function(){var item;for(item in this.index){if(this.index[item]===false){$("["+this.conf.indexAttribute+'="'+item+'"]').addClass(this.conf.collapsedClass)}}};Sidebar.prototype.save=function(){if(!("localStorage"in global)){return}global.localStorage.setItem(this.conf.storageKey,JSON.stringify(this.index))};Sidebar.prototype.bind=function(){var $item,slug,fn,text;var collapsed=false;global.onbeforeunload=$.proxy(function(){this.save()},this);$(this.conf.toggleBtn).on("click",$.proxy(function(event){$node=$(event.target);text=$node.attr("data-alt");$node.attr("data-alt",$node.text());$node.text(text);fn=collapsed===true?"removeClass":"addClass";this.conf.nodes.each($.proxy(function(index,item){$item=$(item);slug=$item.attr(this.conf.indexAttribute);this.index[slug]=collapsed;$("["+this.conf.indexAttribute+'="'+slug+'"]')[fn](this.conf.collapsedClass)},this));collapsed=!collapsed;this.save()},this));this.conf.nodes.on("click",$.proxy(function(event){$item=$(event.target);slug=$item.attr(this.conf.indexAttribute);this.index[slug]=!this.index[slug];$item.toggleClass(this.conf.collapsedClass)},this))};global.Sidebar=Sidebar})(window.jQuery,window);(function($,global){var Search=function(conf){this.conf=$.extend({search:{items:".sassdoc__item",input:"#js-search-input",form:"#js-search",suggestionsWrapper:"#js-search-suggestions"},fuse:{keys:["name"],threshold:.3},init:true},conf||{});if(this.conf.init===true){this.initialize()}};Search.prototype.initialize=function(){this.index=new Fuse($.map($(this.conf.search.items),function(item){var $item=$(item);return{group:$item.data("group"),name:$item.data("name"),type:$item.data("type"),node:$item}}),this.conf.fuse);this.initializeSearch()};Search.prototype.fillSuggestions=function(items){var searchSuggestions=$(this.conf.search.suggestionsWrapper);searchSuggestions.html("");var suggestions=$.map(items.slice(0,10),function(item){var $li=$("
  • ",{"data-group":item.group,"data-type":item.type,"data-name":item.name,html:''+item.type.slice(0,3)+" "+item.name+""});searchSuggestions.append($li);return $li});return suggestions};Search.prototype.search=function(term){return this.fillSuggestions(this.index.search(term))};Search.prototype.initializeSearch=function(){var searchForm=$(this.conf.search.form);var searchInput=$(this.conf.search.input);var searchSuggestions=$(this.conf.search.suggestionsWrapper);var currentSelection=-1;var suggestions=[];var selected;var self=this;searchSuggestions.on("click",function(e){var target=$(event.target);if(target.nodeName==="A"){searchInput.val(target.parent().data("name"));suggestions=self.fillSuggestions([])}});searchForm.on("keyup",function(e){e.preventDefault();if(e.keyCode===13){if(selected){suggestions=self.fillSuggestions([]);searchInput.val(selected.data("name"));window.location=selected.children().first().attr("href")}e.stopPropagation()}if(e.keyCode===40){currentSelection=(currentSelection+1)%suggestions.length}if(e.keyCode===38){currentSelection=currentSelection-1;if(currentSelection<0){currentSelection=suggestions.length-1}}if(suggestions[currentSelection]){if(selected){selected.removeClass("selected")}selected=suggestions[currentSelection];selected.addClass("selected")}});searchInput.on("keyup",function(e){if(e.keyCode!==40&&e.keyCode!==38){currentSelection=-1;suggestions=self.search($(this).val())}else{e.preventDefault()}}).on("search",function(){suggestions=self.search($(this).val())})};global.Search=Search})(window.jQuery,window);(function($,global){"use strict";var App=function(conf){this.conf=$.extend({search:new global.Search,sidebar:new global.Sidebar,init:true},conf||{});if(this.conf.init!==false){this.initialize()}};App.prototype.initialize=function(){this.codePreview()};App.prototype.codePreview=function(){var $item;var $code;var switchTo;$(".item__code--togglable").on("click",function(){$item=$(this);$code=$item.find("code");switchTo=$item.attr("data-current-state")==="expanded"?"collapsed":"expanded";$item.attr("data-current-state",switchTo);$code.html($item.attr("data-"+switchTo));Prism.highlightElement($code[0])})};global.App=App})(window.jQuery,window);(function($,global){$(document).ready(function(){var app=new global.App})})(window.jQuery,window);var self=typeof window!="undefined"?window:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content)):t.util.type(e)==="Array"?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""};if(!self.document){if(!self.addEventListener)return self.Prism;self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return self.Prism}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}return self.Prism}();typeof module!="undefined"&&module.exports&&(module.exports=Prism);Prism.languages.markup={comment://g,prolog:/<\?.+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,"pseudo-class":/:[-\w]+(?:\(.*\))?/g,"class":/\.[-:\.\w]+/g,id:/#[-:\.\w]+/g}};Prism.languages.insertBefore("css","ignore",{hexcode:/#[\da-f]{3,6}/gi,entity:/\\[\da-f]{1,8}/gi,number:/[\d%\.]+/g});Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm});Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i});Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i});Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); diff --git a/docs/assets/js/search.js b/docs/assets/js/search.js new file mode 100644 index 0000000..a5009ca --- /dev/null +++ b/docs/assets/js/search.js @@ -0,0 +1,146 @@ +(function ($, global) { + + var Search = function (conf) { + this.conf = $.extend({ + // Search DOM + search: { + items: '.sassdoc__item', + input: '#js-search-input', + form: '#js-search', + suggestionsWrapper: '#js-search-suggestions' + }, + + // Fuse options + fuse: { + keys: ['name'], + threshold: 0.3 + }, + + init: true + }, conf || {}); + + if (this.conf.init === true) { + this.initialize(); + } + }; + + Search.prototype.initialize = function () { + // Fuse engine instanciation + this.index = new Fuse($.map($(this.conf.search.items), function (item) { + var $item = $(item); + + return { + group: $item.data('group'), + name: $item.data('name'), + type: $item.data('type'), + node: $item + }; + }), this.conf.fuse); + + this.initializeSearch(); + }; + + // Fill DOM with search suggestions + Search.prototype.fillSuggestions = function (items) { + var searchSuggestions = $(this.conf.search.suggestionsWrapper); + searchSuggestions.html(''); + + var suggestions = $.map(items.slice(0, 10), function (item) { + var $li = $('
  • ', { + 'data-group': item.group, + 'data-type': item.type, + 'data-name': item.name, + 'html': '' + item.type.slice(0, 3) + ' ' + item.name + '' + }); + + searchSuggestions.append($li); + return $li; + }); + + return suggestions; + }; + + // Perform a search on a given term + Search.prototype.search = function (term) { + return this.fillSuggestions(this.index.search(term)); + }; + + // Search logic + Search.prototype.initializeSearch = function () { + var searchForm = $(this.conf.search.form); + var searchInput = $(this.conf.search.input); + var searchSuggestions = $(this.conf.search.suggestionsWrapper); + + var currentSelection = -1; + var suggestions = []; + var selected; + + var self = this; + + // Clicking on a suggestion + searchSuggestions.on('click', function (e) { + var target = $(event.target); + + if (target.nodeName === 'A') { + searchInput.val(target.parent().data('name')); + suggestions = self.fillSuggestions([]); + } + }); + + // Filling the form + searchForm.on('keyup', function (e) { + e.preventDefault(); + + // Enter + if (e.keyCode === 13) { + if (selected) { + suggestions = self.fillSuggestions([]); + searchInput.val(selected.data('name')); + window.location = selected.children().first().attr('href'); + } + + e.stopPropagation(); + } + + // KeyDown + if (e.keyCode === 40) { + currentSelection = (currentSelection + 1) % suggestions.length; + } + + // KeyUp + if (e.keyCode === 38) { + currentSelection = currentSelection - 1; + + if (currentSelection < 0) { + currentSelection = suggestions.length - 1; + } + } + + if (suggestions[currentSelection]) { + if (selected) { + selected.removeClass('selected'); + } + + selected = suggestions[currentSelection]; + selected.addClass('selected'); + } + + }); + + searchInput.on('keyup', function (e) { + if (e.keyCode !== 40 && e.keyCode !== 38) { + currentSelection = -1; + suggestions = self.search($(this).val()); + } + + else { + e.preventDefault(); + } + }).on('search', function () { + suggestions = self.search($(this).val()); + }); + }; + + global.Search = Search; + +}(window.jQuery, window)); diff --git a/docs/assets/js/sidebar.js b/docs/assets/js/sidebar.js new file mode 100644 index 0000000..b85852b --- /dev/null +++ b/docs/assets/js/sidebar.js @@ -0,0 +1,163 @@ +(function ($, global) { + + var Sidebar = function (conf) { + this.conf = $.extend({ + + // Collapsed class + collapsedClass: 'is-collapsed', + + // Storage key + storageKey: '_sassdoc_sidebar_index', + + // Index attribute + indexAttribute: 'data-slug', + + // Toggle button + toggleBtn: '.js-btn-toggle', + + // Automatic initialization + init: true + }, conf || {}); + + if (this.conf.init === true) { + this.initialize(); + } + }; + + /** + * Initialize module + */ + Sidebar.prototype.initialize = function () { + this.conf.nodes = $('[' + this.conf.indexAttribute + ']'); + + this.load(); + this.updateDOM(); + this.bind(); + this.loadToggle(); + }; + + + /** + * Load sidebar toggle + */ + Sidebar.prototype.loadToggle = function () { + $('', { + 'class': 'layout-toggle', + 'html': '×', + 'data-alt': '→' + }).appendTo( $('.header') ); + + $('.layout-toggle').on('click', function () { + var $this = $(this); + var alt; + + $('body').toggleClass('sidebar-closed'); + + alt = $this.html(); + $this.html($this.data('alt')); + $this.data('alt', alt); + }); + }; + + /** + * Load data from storage or create fresh index + */ + Sidebar.prototype.load = function () { + var index = 'localStorage' in global ? + global.localStorage.getItem(this.conf.storageKey) : + null; + + this.index = index ? JSON.parse(index) : this.buildIndex(); + }; + + /** + * Build a fresh index + */ + Sidebar.prototype.buildIndex = function () { + var index = {}; + var $item; + + this.conf.nodes.each($.proxy(function (index, item) { + $item = $(item); + + index[$item.attr(this.conf.indexAttribute)] = !$item.hasClass(this.conf.collapsedClass); + }, this)); + + return index; + }; + + /** + * Update DOM based on index + */ + Sidebar.prototype.updateDOM = function () { + var item; + + for (item in this.index) { + if (this.index[item] === false) { + $('[' + this.conf.indexAttribute + '="' + item + '"]').addClass(this.conf.collapsedClass); + } + } + }; + + /** + * Save index in storage + */ + Sidebar.prototype.save = function () { + if (!('localStorage' in global)) { + return; + } + + global.localStorage.setItem(this.conf.storageKey, JSON.stringify(this.index)); + }; + + /** + * Bind UI events + */ + Sidebar.prototype.bind = function () { + var $item, slug, fn, text; + var collapsed = false; + + // Save index in localStorage + global.onbeforeunload = $.proxy(function () { + this.save(); + }, this); + + // Toggle all + $(this.conf.toggleBtn).on('click', $.proxy(function (event) { + $node = $(event.target); + + text = $node.attr('data-alt'); + $node.attr('data-alt', $node.text()); + $node.text(text); + + fn = collapsed === true ? 'removeClass' : 'addClass'; + + this.conf.nodes.each($.proxy(function (index, item) { + $item = $(item); + slug = $item.attr(this.conf.indexAttribute); + + this.index[slug] = collapsed; + + $('[' + this.conf.indexAttribute + '="' + slug + '"]')[fn](this.conf.collapsedClass); + }, this)); + + collapsed = !collapsed; + this.save(); + }, this)); + + // Toggle item + this.conf.nodes.on('click', $.proxy(function (event) { + $item = $(event.target); + slug = $item.attr(this.conf.indexAttribute); + + // Update index + this.index[slug] = !this.index[slug]; + + // Update DOM + $item.toggleClass(this.conf.collapsedClass); + }, this)); + }; + + global.Sidebar = Sidebar; + +}(window.jQuery, window)); diff --git a/docs/assets/js/vendor/fuse.min.js b/docs/assets/js/vendor/fuse.min.js new file mode 100644 index 0000000..79898e9 --- /dev/null +++ b/docs/assets/js/vendor/fuse.min.js @@ -0,0 +1,20 @@ +/** + * @license + * Fuse - Lightweight fuzzy-search + * + * Copyright (c) 2012 Kirollos Risk . + * All Rights Reserved. Apache Software License 2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +!function(t){function e(t,n){this.list=t,this.options=n=n||{};var i,o,s;for(i=0,keys=["sort","includeScore","shouldSort"],o=keys.length;o>i;i++)s=keys[i],this.options[s]=s in n?n[s]:e.defaultOptions[s];for(i=0,keys=["searchFn","sortFn","keys","getFn"],o=keys.length;o>i;i++)s=keys[i],this.options[s]=n[s]||e.defaultOptions[s]}var n=function(t,e){if(e=e||{},this.options=e,this.options.location=e.location||n.defaultOptions.location,this.options.distance="distance"in e?e.distance:n.defaultOptions.distance,this.options.threshold="threshold"in e?e.threshold:n.defaultOptions.threshold,this.options.maxPatternLength=e.maxPatternLength||n.defaultOptions.maxPatternLength,this.pattern=e.caseSensitive?t:t.toLowerCase(),this.patternLen=t.length,this.patternLen>this.options.maxPatternLength)throw new Error("Pattern length is too long");this.matchmask=1<i;)this._bitapScore(e,l+o)<=u?i=o:d=o,o=Math.floor((d-i)/2+i);for(d=o,s=Math.max(1,l-o+1),r=Math.min(l+o,c)+this.patternLen,a=Array(r+2),a[r+1]=(1<=s;n--)if(p=this.patternAlphabet[t.charAt(n-1)],a[n]=0===e?(a[n+1]<<1|1)&p:(a[n+1]<<1|1)&p|((h[n+1]|h[n])<<1|1)|h[n+1],a[n]&this.matchmask&&(g=this._bitapScore(e,n-1),u>=g)){if(u=g,f=n-1,m.push(f),!(f>l))break;s=Math.max(1,2*l-f)}if(this._bitapScore(e+1,l)>u)break;h=a}return{isMatch:f>=0,score:g}};var i={deepValue:function(t,e){for(var n=0,e=e.split("."),i=e.length;i>n;n++){if(!t)return null;t=t[e[n]]}return t}};e.defaultOptions={id:null,caseSensitive:!1,includeScore:!1,shouldSort:!0,searchFn:n,sortFn:function(t,e){return t.score-e.score},getFn:i.deepValue,keys:[]},e.prototype.search=function(t){var e,n,o,s,r,a=new this.options.searchFn(t,this.options),h=this.list,p=h.length,c=this.options,l=this.options.keys,u=l.length,f=[],d={},g=[],m=function(t,e,n){void 0!==t&&null!==t&&"string"==typeof t&&(s=a.search(t),s.isMatch&&(r=d[n],r?r.score=Math.min(r.score,s.score):(d[n]={item:e,score:s.score},f.push(d[n]))))};if("string"==typeof h[0])for(var e=0;p>e;e++)m(h[e],e,e);else for(var e=0;p>e;e++)for(o=h[e],n=0;u>n;n++)m(this.options.getFn(o,l[n]),o,e);c.shouldSort&&f.sort(c.sortFn);for(var y=c.includeScore?function(t){return f[t]}:function(t){return f[t].item},L=c.id?function(t){return i.deepValue(y(t),c.id)}:function(t){return y(t)},e=0,v=f.length;v>e;e++)g.push(L(e));return g},"object"==typeof exports?module.exports=e:"function"==typeof define&&define.amd?define(function(){return e}):t.Fuse=e}(this); \ No newline at end of file diff --git a/docs/assets/js/vendor/jquery.min.js b/docs/assets/js/vendor/jquery.min.js new file mode 100644 index 0000000..e5ace11 --- /dev/null +++ b/docs/assets/js/vendor/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
    ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) +},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("