Skip to content

Commit 9070536

Browse files
committed
chore(release): rename to "mobile-drag-drop"
preparing 2.0 release
1 parent 881c708 commit 9070536

29 files changed

+84
-71
lines changed

Gruntfile.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
var sourcemaps = require("rollup-plugin-sourcemaps");
55

6-
var fileName = "drag-drop-polyfill";
7-
var umdName = "DragDropPolyfill";
6+
var umdName = "MobileDragDrop";
87

98
module.exports = function (grunt) {
109
grunt.initConfig({
@@ -39,18 +38,18 @@ module.exports = function (grunt) {
3938
},
4039
main: {
4140
options: {
42-
banner: "/*! <%= pkg.name %> <%= pkg.version %> | Copyright (c) <%= grunt.template.today('yyyy') %> Tim Ruffles | BSD 2 License */",
43-
sourceMapIn: "src/drag-drop-polyfill.js.map"
41+
banner: "/*! <%= pkg.name %> <%= pkg.version %> | Copyright (c) <%= grunt.template.today('yyyy') %> Tim Ruffles | MIT License */",
42+
sourceMapIn: "src/index.js.map"
4443
},
45-
src: "src/drag-drop-polyfill.js",
46-
dest: "src/drag-drop-polyfill.min.js"
44+
src: "src/index.js",
45+
dest: "src/index.min.js"
4746
},
4847
scroll: {
4948
options: {
50-
sourceMapIn: "src/drag-drop-polyfill-scroll-behaviour.js.map"
49+
sourceMapIn: "src/scroll-behaviour.js.map"
5150
},
52-
src: "src/drag-drop-polyfill-scroll-behaviour.js",
53-
dest: "src/drag-drop-polyfill-scroll-behaviour.min.js"
51+
src: "src/scroll-behaviour.js",
52+
dest: "src/scroll-behaviour.min.js"
5453
}
5554
},
5655
// http server config for development and demo page
@@ -126,17 +125,17 @@ module.exports = function (grunt) {
126125
},
127126
build: {
128127
files: {
129-
"src/drag-drop-polyfill.js": "src/drag-drop-polyfill.js",
130-
"src/drag-drop-polyfill-scroll-behaviour.js": "src/drag-drop-polyfill-scroll-behaviour.js"
128+
"src/index.js": "src/index.js",
129+
"src/scroll-behaviour.js": "src/scroll-behaviour.js"
131130
}
132131
}
133132
},
134133
append: {
135134
umdDeclaration: {
136135
append: "export as namespace " + umdName + ";",
137136
files: {
138-
"src/drag-drop-polyfill.d.ts": "src/drag-drop-polyfill.d.ts",
139-
"src/drag-drop-polyfill-scroll-behaviour.d.ts": "src/drag-drop-polyfill-scroll-behaviour.d.ts"
137+
"src/index.d.ts": "src/index.d.ts",
138+
"src/scroll-behaviour.d.ts": "src/scroll-behaviour.d.ts"
140139
}
141140
}
142141
},

README.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
![dependencies](https://img.shields.io/david/timruffles/ios-html5-drag-drop-shim/rewrite.svg)
22
![devdependencies](https://img.shields.io/david/dev/timruffles/ios-html5-drag-drop-shim/rewrite.svg)
3-
[![npmversion](https://img.shields.io/npm/v/drag-drop-polyfill.svg)](https://www.npmjs.com/package/drag-drop-polyfill)
4-
![bowerversion](https://img.shields.io/bower/v/drag-drop-polyfill.svg)
5-
![license](https://img.shields.io/npm/l/drag-drop-polyfill.svg)
3+
[![npmversion](https://img.shields.io/npm/v/mobile-drag-drop.svg)](https://www.npmjs.com/package/mobile-drag-drop)
4+
![bowerversion](https://img.shields.io/bower/v/mobile-drag-drop.svg)
5+
![license](https://img.shields.io/npm/l/mobile-drag-drop.svg)
66
![issues](https://img.shields.io/github/issues/timruffles/ios-html5-drag-drop-shim.svg)
7-
![size](https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/drag-drop-polyfill.min.js)
8-
![gzippedsize](https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/drag-drop-polyfill.min.js?compression=gzip)
7+
![size](https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/index.min.js)
8+
![gzippedsize](https://badge-size.herokuapp.com/timruffles/ios-html5-drag-drop-shim/rewrite/release/index.min.js?compression=gzip)
99

1010

1111
# Polyfill for HTML 5 drag'n'drop
@@ -15,7 +15,7 @@ The HTML 5 drag'n'drop API allows you to implement drag'n'drop on [most desktop
1515
Unfortunately, you'll notice most mobile browsers don't support it, so no iPad (or Nexus) action for you!
1616

1717
Luckily, browsers give us enough tools to make it happen ourselves. If you drop
18-
this package in your page your existing HTML 5 drag'n'drop code should just work.
18+
this package in your page your existing HTML 5 drag'n'drop code should _just work_ ([*almost](#polyfill-requires-dragenter-listener)).
1919

2020

2121
## Demos
@@ -31,52 +31,52 @@ Check out the demo to see it in action and monitor the console to see the events
3131

3232
**bower**
3333

34-
`bower install drag-drop-polyfill#2.0.0-rc.0 --save`
34+
`bower install mobile-drag-drop --save`
3535

3636
**npm**
3737

38-
`npm install drag-drop[email protected] --save`
38+
`npm install mobile-drag-drop --save`
3939

4040
**jspm**
4141

42-
`jspm install npm:drag-drop-polyfill`
42+
`jspm install npm:mobile-drag-drop`
4343

4444

4545
### Include
4646

4747
**global**
4848

4949
```HTML
50-
<link rel="stylesheet" href="libs/drag-drop-polyfill/release/drag-drop-polyfill.css">
51-
<script src="libs/drag-drop-polyfill/release/drag-drop-polyfill.min.js"></script>
50+
<link rel="stylesheet" href="libs/mobile-drag-drop/release/default.css">
51+
<script src="libs/mobile-drag-drop/release/index.min.js"></script>
5252

5353
<!--optional import of scroll behaviour-->
54-
<script src="libs/drag-drop-polyfill/release/drag-drop-polyfill-scroll-behaviour.min.js"></script>
54+
<script src="libs/mobile-drag-drop/release/scroll-behaviour.min.js"></script>
5555

5656
<script>
5757
// options are optional ;)
58-
DragDropPolyfill.polyfill({
58+
MobileDragDrop.polyfill({
5959
// use this to make use of the scroll behaviour
60-
dragImageTranslateOverride: DragDropPolyfill.scrollBehaviourDragImageTranslateOverride
60+
dragImageTranslateOverride: MobileDragDrop.scrollBehaviourDragImageTranslateOverride
6161
});
6262
</script>
6363
```
6464

6565
**SystemJS/JSPM**
6666

6767
```JavaScript
68-
System.import("drag-drop-polyfill");
68+
System.import("mobile-drag-drop");
6969
// import css if using system-js css loader plugin
70-
System.import("drag-drop-polyfill/drag-drop-polyfill.css!");
70+
System.import("mobile-drag-drop/default.css!");
7171
```
7272

7373
**ES2015/TypeScript/webpack**
7474

75-
```JavaScript`
76-
import {polyfill} from "drag-drop-polyfill/drag-drop-polyfill";
75+
```JavaScript
76+
import {polyfill} from "mobile-drag-drop";
7777

7878
// optional import of scroll behaviour
79-
import {scrollBehaviourDragImageTranslateOverride} from "drag-drop-polyfill/drag-drop-polyfill-scroll-behaviour";
79+
import {scrollBehaviourDragImageTranslateOverride} from "mobile-drag-drop/scroll-behaviour";
8080

8181
// options are optional ;)
8282
polyfill({
@@ -85,13 +85,21 @@ polyfill({
8585
});
8686
```
8787

88+
**Make sure to implement a `dragenter`-listener!** ([read here why](#polyfill-requires-dragenter-listener))
89+
90+
```
91+
// dragenter listener
92+
(event)=> {
93+
event.preventDefault();
94+
}
95+
```
96+
8897
**webpack/scss**
8998

9099
```SCSS
91-
@import "~drag-drop-polyfill/drag-drop-polyfill.css";
100+
@import "~mobile-drag-drop/default.css";
92101
```
93102

94-
95103
## API & Options <a name="options"></a>
96104

97105
```TypeScript
@@ -164,11 +172,11 @@ Override the classes that are applied by the polyfill. Mind the `!important`.
164172
CSS classes are applied to the `dragImage`-element according to the
165173
current drop effect: `none`, `copy`, `move`, `link`.
166174

167-
There is `drag-drop-polyfill-icons.css` which defines default styles and icons.
175+
There is `icons.css` which defines default styles and icons.
168176
Feel free to use this as a starting point.
169177

170178
```HTML
171-
<link rel="stylesheet" href="[...]/drag-drop-polyfill/drag-drop-polyfill-icons.css">
179+
<link rel="stylesheet" href="[...]/mobile-drag-drop/icons.css">
172180
```
173181

174182
[setDragImage()](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage) is supported.
@@ -226,13 +234,19 @@ This table is an effort to list all things required to make drag'n'drop work in
226234

227235
_empty cells mean there is nothing special to take into account_
228236

237+
#### Polyfill requires dragenter listener
238+
239+
On desktop browsers if no `dragenter`-handler is registered the drag-operation is silently allowed. Browsers don't implement `dropzone`-attribute
240+
according to [caniuse](http://caniuse.com/#search=drag) which is why they allow it by default, which violates the spec.
241+
242+
If a handler is set up it has to call `event.preventDefault()` to allow dropping.
243+
244+
This is pretty bad for the polyfill since JS doesn't allow to check how many listeners were invoked when the event is dispatched,
245+
which forces the polyfill to rely on a listener being present calling `event.preventDefault()` to make it work.
246+
247+
229248
**Further notices:**
230249

231-
* If no `dragenter`-handler is registered the drag-operation is silently allowed. Browsers don't implement `dropzone`-attribute
232-
according to [caniuse](http://caniuse.com/#search=drag) so they allow it by default, which violates the spec.
233-
If a handler is set up it has to call `event.preventDefault()` to allow dropping.
234-
This is pretty bad for the polyfill since JS doesn't allow to check how many listeners were invoked when the event is dispatched,
235-
which forces the polyfill to rely on a listener being present calling `event.preventDefault()` to make it work.
236250
* FF:<a name="ff-quirk"></a> If `effectAllowed` or `dropEffect` is set in `dragstart` then `dragenter/dragover` also need to set it.
237251
* When using a MS Surface tablet a drag-operation is initiated by touch and hold on a draggable.
238252
* IE11 and Chrome scroll automatically when dragging close to a viewport edge.
File renamed without changes.
File renamed without changes.

release/drag-drop-polyfill-scroll-behaviour.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

release/drag-drop-polyfill-scroll-behaviour.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

release/drag-drop-polyfill-scroll-behaviour.min.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

release/drag-drop-polyfill.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)