Skip to content

Commit 6647ad5

Browse files
committed
Initial commit
Broken out from `purescript-dom`, added some missing things, improved organisation of types and casts a bit.
0 parents  commit 6647ad5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2178
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Dependencies
2+
.psci_modules
3+
bower_components
4+
node_modules
5+
6+
# Generated files
7+
.psci
8+
output

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
dist: trusty
3+
sudo: required
4+
node_js: stable
5+
install:
6+
- npm install -g bower
7+
- npm install
8+
- bower install
9+
script:
10+
- npm run -s build
11+
after_success:
12+
- >-
13+
test $TRAVIS_TAG &&
14+
echo $GITHUB_TOKEN | pulp login &&
15+
echo y | pulp publish --no-push

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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# purescript-web-dom
2+
3+
[![Latest release](http://img.shields.io/github/release/purescript-web/purescript-web-dom.svg)](https://github.com/purescript-web/purescript-web-dom/releases)
4+
[![Build status](https://travis-ci.org/purescript-web/purescript-web-dom.svg?branch=master)](https://travis-ci.org/purescript-web/purescript-web-dom)
5+
[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-lightgrey.svg)](http://github.com/garyb)
6+
7+
Type definitions and low level interface implementations for the W3C DOM API.
8+
9+
## Installation
10+
11+
```
12+
bower install purescript-web-dom
13+
```
14+
15+
## Documentation
16+
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-web-dom).

bower.json

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

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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": "^4.19.1",
9+
"pulp": "^12.2.0",
10+
"purescript-psa": "^0.6.0",
11+
"purescript": "^0.11.7",
12+
"rimraf": "^2.6.2"
13+
}
14+
}

src/Web/DOM/CharacterData.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
"use strict";
2+
3+
exports.data_ = function (t) {
4+
return function () {
5+
return t.data;
6+
};
7+
};
8+
9+
exports.length = function (t) {
10+
return function () {
11+
return t.length;
12+
};
13+
};
14+
15+
exports.substringData = function (offset) {
16+
return function (count) {
17+
return function (cd) {
18+
return function () {
19+
cd.substringData(offset, count);
20+
};
21+
};
22+
};
23+
};
24+
25+
exports.appendData = function (data) {
26+
return function (cd) {
27+
return function () {
28+
cd.appendData(data);
29+
};
30+
};
31+
};
32+
33+
exports.insertData = function (offset) {
34+
return function (data) {
35+
return function (cd) {
36+
return function () {
37+
cd.insertData(offset, data);
38+
};
39+
};
40+
};
41+
};
42+
43+
exports.deleteData = function (offset) {
44+
return function (count) {
45+
return function (cd) {
46+
return function () {
47+
cd.deleteData(offset, count);
48+
};
49+
};
50+
};
51+
};
52+
53+
exports.replaceData = function (offset) {
54+
return function (count) {
55+
return function (data) {
56+
return function (cd) {
57+
return function () {
58+
cd.replaceData(offset, count, data);
59+
};
60+
};
61+
};
62+
};
63+
};

src/Web/DOM/CharacterData.purs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module Web.DOM.CharacterData where
2+
3+
import Prelude
4+
5+
import Effect (Effect)
6+
import Unsafe.Coerce (unsafeCoerce)
7+
import Web.DOM.Comment (Comment)
8+
import Web.DOM.ProcessingInstruction (ProcessingInstruction)
9+
import Web.DOM.Text (Text)
10+
11+
foreign import data CharacterData :: Type
12+
13+
fromText :: Text -> CharacterData
14+
fromText = unsafeCoerce
15+
16+
fromProcessingInstruction :: ProcessingInstruction -> CharacterData
17+
fromProcessingInstruction = unsafeCoerce
18+
19+
fromComment :: Comment -> CharacterData
20+
fromComment = unsafeCoerce
21+
22+
foreign import data_ :: CharacterData -> Effect String
23+
24+
foreign import length :: CharacterData -> Effect Int
25+
26+
foreign import substringData :: Int -> Int -> CharacterData -> Effect String
27+
28+
foreign import appendData :: String -> CharacterData -> Effect Unit
29+
30+
foreign import insertData :: Int -> String -> CharacterData -> Effect Unit
31+
32+
foreign import deleteData :: Int -> Int -> CharacterData -> Effect Unit
33+
34+
foreign import replaceData :: Int -> Int -> String -> CharacterData -> Effect Unit

src/Web/DOM/ChildNode.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
3+
exports.remove = function (node) {
4+
return function () {
5+
return node.remove();
6+
};
7+
};

0 commit comments

Comments
 (0)