Skip to content

Commit 31f312c

Browse files
committed
init
0 parents  commit 31f312c

File tree

11 files changed

+160
-0
lines changed

11 files changed

+160
-0
lines changed

.eslintrc.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true,
8+
"browser": true
9+
},
10+
"rules": {
11+
"strict": [2, "global"],
12+
"block-scoped-var": 2,
13+
"consistent-return": 2,
14+
"eqeqeq": [2, "smart"],
15+
"guard-for-in": 2,
16+
"no-caller": 2,
17+
"no-extend-native": 2,
18+
"no-loop-func": 2,
19+
"no-new": 2,
20+
"no-param-reassign": 2,
21+
"no-return-assign": 2,
22+
"no-unused-expressions": 2,
23+
"no-use-before-define": 2,
24+
"radix": [2, "always"],
25+
"indent": [2, 2],
26+
"quotes": [2, "double"],
27+
"semi": [2, "always"]
28+
}
29+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.pulp-cache
2+
/bower_components
3+
/node_modules
4+
/output
5+
/generated-docs

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 PureScript
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# purescript-web-geometry
2+
3+
Type definitions and low level interface implementations for the [W3C Geometry Interfaces Module](https://www.w3.org/TR/geometry-1).
4+
5+
## Installation
6+
7+
```
8+
bower install purescript-web-geometry
9+
```
10+
11+
## Documentation
12+
13+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-web-geometry).

bower.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "purescript-web-geometry",
3+
"homepage": "https://github.com/keijokapp/purescript-web-geometry",
4+
"license": "MIT",
5+
"repository": {
6+
"type": "git",
7+
"url": "git://github.com/keijokapp/purescript-web-geometry.git"
8+
},
9+
"ignore": [
10+
"**/.*",
11+
"bower_components",
12+
"node_modules",
13+
"output",
14+
"bower.json",
15+
"package.json"
16+
]
17+
}

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"clean": "rimraf output && rimraf .pulp-cache",
5+
"build": "eslint src && pulp build -- --censor-lib --strict"
6+
},
7+
"devDependencies": {
8+
"eslint": "^6.0.1",
9+
"pulp": "^13.0.0",
10+
"purescript-psa": "^0.7.3",
11+
"rimraf": "^2.6.2"
12+
}
13+
}

src/Web/Geometry.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Web.Geometry (module Geometry) where
2+
3+
import Web.Geometry.DOMRect (DOMRect) as Geometry
4+
import Web.Geometry.DOMRectList (DOMRectList) as Geometry

src/Web/Geometry/DOMRect.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use strict";
2+
3+
function getter(property) {
4+
return function (domRect) {
5+
return domRect[property];
6+
};
7+
}
8+
9+
exports.new = function (x) {
10+
return function (y) {
11+
return function (width) {
12+
return function (height) {
13+
return new DOMRect(x, y, width, height);
14+
};
15+
};
16+
};
17+
};
18+
19+
exports.x = getter("x");
20+
exports.y = getter("y");
21+
exports.width = getter("width");
22+
exports.height = getter("height");
23+
exports.top = getter("top");
24+
exports.right = getter("right");
25+
exports.bottom = getter("bottom");
26+
exports.left = getter("left");

src/Web/Geometry/DOMRect.purs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Web.Geometry.DOMRect where
2+
3+
foreign import data DOMRect :: Type
4+
5+
foreign import new :: Number -> Number -> Number -> Number -> DOMRect
6+
foreign import x :: DOMRect -> Number
7+
foreign import y :: DOMRect -> Number
8+
foreign import width :: DOMRect -> Number
9+
foreign import height :: DOMRect -> Number
10+
foreign import top :: DOMRect -> Number
11+
foreign import right :: DOMRect -> Number
12+
foreign import bottom :: DOMRect -> Number
13+
foreign import left :: DOMRect -> Number

src/Web/Geometry/DOMRectList.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict";
2+
3+
exports.length = function (domRectList) {
4+
return domRectList.length;
5+
};
6+
7+
exports.item = function (domRectList) {
8+
return function (index) {
9+
return domRectList.item(index);
10+
};
11+
};

0 commit comments

Comments
 (0)