Skip to content

Commit 118d2fd

Browse files
committed
Initial commit
0 parents  commit 118d2fd

File tree

10 files changed

+172
-0
lines changed

10 files changed

+172
-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-clipboard
2+
3+
[![Latest release](http://img.shields.io/github/release/purescript-web/purescript-web-clipboard.svg)](https://github.com/purescript-web/purescript-web-clipboard/releases)
4+
[![Build status](https://travis-ci.org/purescript-web/purescript-web-clipboard.svg?branch=master)](https://travis-ci.org/purescript-web/purescript-web-clipboard)
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 clipboard APIs spec.
8+
9+
## Installation
10+
11+
```
12+
bower install purescript-web-clipboard
13+
```
14+
15+
## Documentation
16+
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-web-clipboard).

bower.json

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

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/Clipboard/ClipboardEvent.js

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

src/Web/Clipboard/ClipboardEvent.purs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module Web.Clipboard.ClipboardEvent
2+
( ClipboardEvent
3+
, fromEvent
4+
, toEvent
5+
, clipboardData
6+
) where
7+
8+
import Prelude
9+
10+
import Data.Maybe (Maybe)
11+
import Data.Nullable (Nullable, toMaybe)
12+
import Unsafe.Coerce (unsafeCoerce)
13+
import Web.Event.Event (Event)
14+
import Web.HTML.Event.DataTransfer (DataTransfer)
15+
import Web.Internal.FFI (unsafeReadProtoTagged)
16+
17+
foreign import data ClipboardEvent :: Type
18+
19+
fromEvent :: Event -> Maybe ClipboardEvent
20+
fromEvent = unsafeReadProtoTagged "ClipboardEvent"
21+
22+
toEvent :: ClipboardEvent -> Event
23+
toEvent = unsafeCoerce
24+
25+
clipboardData :: ClipboardEvent -> Maybe DataTransfer
26+
clipboardData = toMaybe <<< _clipboardData
27+
28+
foreign import _clipboardData :: ClipboardEvent -> Nullable DataTransfer
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Web.Clipboard.ClipboardEvent.EventTypes where
2+
3+
import Web.Event.Event (EventType(..))
4+
5+
clipboardchange :: EventType
6+
clipboardchange = EventType "clipboardchange"
7+
8+
copy :: EventType
9+
copy = EventType "copy"
10+
11+
cut :: EventType
12+
cut = EventType "cut"
13+
14+
paste :: EventType
15+
paste = EventType "paste"

0 commit comments

Comments
 (0)