Skip to content

Updates for 0.7 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
bower_components
coverage
dist
node_modules
public
.psci
.psci_modules
.publish
site/psc.js
/.*
!/.gitignore
!/.travis.yml
/bower_components/
/node_modules/
/output/
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
sudo: false
node_js:
- 0.10
env:
- TAG=v0.7.0 PATH=$HOME/bin:$PATH
install:
- mkdir $HOME/bin
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar zxvf $HOME/purescript.tar.gz -C $HOME/bin purescript/psc{,i,-docs,-bundle,-publish} --strip-components=1
- chmod a+x $HOME/bin/psc{,i,-docs,-bundle,-publish}
- npm install bower gulp -g
- npm install && bower install
script:
- gulp
15 changes: 6 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "purescript-css",
"version": "0.0.0",
"authors": [
"Brian McKenna <brian@brianmckenna.org>"
],
Expand All @@ -18,15 +17,13 @@
"tests"
],
"dependencies": {
"purescript-math": "~0.1.1",
"purescript-nonempty-arrays": "~0.2.0",
"purescript-profunctor": "~0.2.1",
"purescript-strings": "~0.4.5",
"purescript-these": "~0.2.0",
"purescript-transformers": "~0.5.4"
"purescript-nonempty-arrays": "garyb/purescript-nonempty-array#0.7-updates",
"purescript-profunctor": "^0.3.0",
"purescript-strings": "^0.5.2",
"purescript-these": "^0.3.0",
"purescript-transformers": "^0.6.1"
},
"devDependencies": {
"purescript-exceptions": "~0.2.3",
"purescript-dom": "~0.1.2"
"purescript-exceptions": "^0.3.0"
}
}
42 changes: 29 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
var gulp = require('gulp')
, browserify = require('gulp-browserify')
, purescript = require('gulp-purescript')
, ghPages = require('gulp-gh-pages');
/* jshint node: true */
"use strict";

require("mandragora-bucket")(gulp);
var gulp = require("gulp");
var purescript = require("gulp-purescript");
var run = require("gulp-run");

gulp.task('site', function() {
return gulp.src(['site/Main.purs', 'src/**/*.purs', 'bower_components/purescript-*/src/**/*.purs']).pipe(purescript.psc({
main: 'Site',
modules: ['Site']
})).pipe(browserify({})).pipe(gulp.dest('site'));
var sources = [
"src/**/*.purs",
"bower_components/purescript-*/src/**/*.purs",
"test/**/*.purs"
];

var foreigns = [
"src/**/*.js",
"bower_components/purescript-*/src/**/*.js",
"test/**/*.js"
];

gulp.task("make", function() {
return purescript.psc({ src: sources, ffi: foreigns });
});

gulp.task('deploy', ['site'], function() {
return gulp.src('site/**/*')
.pipe(ghPages());
gulp.task("test", ["make"], function() {
return purescript.pscBundle({ src: "output/**/*.js", main: "Test.Main" })
.pipe(run("node"));
});

gulp.task("dotpsci", function () {
return purescript.psci({ src: sources, ffi: foreigns })
.pipe(gulp.dest("."));
});

gulp.task("default", ["test", "dotpsci"]);
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"dependencies": {
"gulp": "^3.8.11",
"mandragora-bucket": "^0.2.3"
},
"private": true,
"devDependencies": {
"gulp-browserify": "^0.5.1",
"gulp-gh-pages": "^0.5.0",
"gulp-purescript": "^0.3.1"
"gulp": "^3.8.11",
"gulp-jscs": "^1.6.0",
"gulp-jshint": "^1.11.2",
"gulp-purescript": "^0.5.0",
"gulp-run": "^1.6.8"
}
}
1 change: 1 addition & 0 deletions src/Css/Animation.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Animation where

import Prelude
import Css.Property
import Css.String
import Css.Stylesheet
Expand Down
1 change: 1 addition & 0 deletions src/Css/Background.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Background where

import Prelude
import Css.Color
import Css.Property
import Css.String
Expand Down
1 change: 1 addition & 0 deletions src/Css/Border.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Border where

import Prelude
import Css.Color
import Css.Property
import Css.Size
Expand Down
12 changes: 6 additions & 6 deletions src/Css/Color.purs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Css.Color where

import Prelude
import Css.Property
import Css.String
import Data.Foldable
import Math hiding (tan)

data Color = Rgba Number Number Number Number
data Color = Rgba Int Int Int Int
| Hsla Number Number Number Number
| Other Value

Expand All @@ -17,14 +17,14 @@ instance valColor :: Val Color where
value (Rgba r g b a) = Value <<< fromString $ "rgba(" <> intercalate ", " [show r, show g, show b, show a] <> ")"
value (Other v) = v

rgba :: Number -> Number -> Number -> Number -> Color
rgba :: Int -> Int -> Int -> Int -> Color
rgba = Rgba

rgb :: Number -> Number -> Number -> Color
rgb :: Int -> Int -> Int -> Color
rgb r g b = Rgba r g b 255

clamp :: Number -> Number
clamp = max 0 <<< min 255
clamp :: Int -> Int
clamp n = if n < 0 then 0 else if n > 255 then 255 else n

aliceblue = rgb 240 248 255
antiquewhite = rgb 250 235 215
Expand Down
1 change: 1 addition & 0 deletions src/Css/Display.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Display where

import Prelude
import Css.Property
import Css.String
import Css.Stylesheet
Expand Down
1 change: 1 addition & 0 deletions src/Css/Elements.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Elements where

import Prelude
import Css.Selector
import Css.String

Expand Down
3 changes: 2 additions & 1 deletion src/Css/Font.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Font where

import Prelude
import Css.Color
import Css.Property
import Css.Size
Expand All @@ -18,7 +19,7 @@ instance valGenericFontFamily :: Val GenericFontFamily where
sansSerif :: GenericFontFamily
sansSerif = GenericFontFamily $ fromString "sans-serif"

fontFamily :: [String] -> NEL.NonEmpty GenericFontFamily -> Css
fontFamily :: Array String -> NEL.NonEmpty GenericFontFamily -> Css
fontFamily a b = key (fromString "font-family") <<< value $ (value <<< quote <$> a) <> NEL.toArray (value <$> b)

fontSize :: forall a. Size a -> Css
Expand Down
1 change: 1 addition & 0 deletions src/Css/FontFace.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.FontFace where

import Prelude
import Css.Property
import Css.String
import Css.Stylesheet
Expand Down
1 change: 1 addition & 0 deletions src/Css/Geometry.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Geometry where

import Prelude hiding (top, bottom)
import Css.Size
import Css.String
import Css.Stylesheet
Expand Down
3 changes: 2 additions & 1 deletion src/Css/Gradient.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Gradient where

import Prelude
import Css.Background
import Css.Color
import Css.Property
Expand All @@ -9,7 +10,7 @@ import Data.Foldable

data ColorPoint = ColorPoint Color (Size Rel)

linearGradient :: forall a. Angle a -> ColorPoint -> [ColorPoint] -> ColorPoint-> BackgroundImage
linearGradient :: forall a. Angle a -> ColorPoint -> Array ColorPoint -> ColorPoint-> BackgroundImage
linearGradient a b cs e = BackgroundImage $ fromString "linear-gradient(" <> value a <> fromString ", " <> points <> fromString ")"
where colorPoint (ColorPoint a b) = value a <> fromString " " <> value b
points = intercalate (fromString ", ") $ [colorPoint b] <> (colorPoint <$> cs) <> [colorPoint e]
1 change: 1 addition & 0 deletions src/Css/Media.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Media where

import Prelude
import Css.Property
import Css.Size
import Css.String
Expand Down
15 changes: 8 additions & 7 deletions src/Css/Property.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Property where

import Prelude
import Css.String
import Data.Foldable
import Data.Maybe
Expand All @@ -8,16 +9,16 @@ import Data.Profunctor.Strong
import Data.Tuple
import qualified Data.Array.NonEmpty as NEL

data Prefixed = Prefixed [Tuple String String]
data Prefixed = Prefixed (Array (Tuple String String))
| Plain String

instance isStringPrefixed :: IsString Prefixed where
fromString = Plain

instance semigroupPrefixed :: Semigroup Prefixed where
(<>) (Plain x) (Plain y) = Plain $ x <> y
(<>) (Plain x) (Prefixed ys) = Prefixed $ second (x <>) <$> ys
(<>) (Prefixed xs) (Plain y) = Prefixed $ second (y <>) <$> xs
append (Plain x) (Plain y) = Plain $ x <> y
append (Plain x) (Prefixed ys) = Prefixed $ second (x <>) <$> ys
append (Prefixed xs) (Plain y) = Prefixed $ second (y <>) <$> xs
-- (<>) (Prefixed xs) (Prefixed ys)

instance monoidPrefixed :: Monoid Prefixed where
Expand Down Expand Up @@ -45,7 +46,7 @@ instance isStringValue :: IsString Value where
fromString = Value <<< fromString

instance semigroupValue :: Semigroup Value where
(<>) (Value a) (Value b) = Value $ a <> b
append (Value a) (Value b) = Value $ a <> b

instance monoidValue :: Monoid Value where
mempty = Value mempty
Expand All @@ -70,11 +71,11 @@ instance valTuple :: (Val a, Val b) => Val (Tuple a b) where
instance valNumber :: Val Number where
value = fromString <<< show

instance valList :: (Val a) => Val [a] where
instance valList :: (Val a) => Val (Array a) where
value = intercalate (fromString ", ") <<< (value <$>)

instance valNonEmpty :: (Val a) => Val (NEL.NonEmpty a) where
value = value <<< NEL.toArray

noCommas :: forall a. (Val a) => [a] -> Value
noCommas :: forall a. (Val a) => Array a -> Value
noCommas = intercalate (fromString " ") <<< (value <$>)
1 change: 1 addition & 0 deletions src/Css/Pseudo.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Css.Pseudo where

import Prelude
import Css.Selector
import Css.String

Expand Down
Loading