Skip to content

Commit

Permalink
Migrate to Dart 2
Browse files Browse the repository at this point in the history
* Migrate to Dart 2.
* Use Pointer Events for Edge, Firefox, Chrome.
* Use Mouse/Touch Events for Safari and other browsers not supporting Pointer Events.
  • Loading branch information
marcojakob committed May 5, 2018
1 parent 6282ee7 commit 3f24e70
Show file tree
Hide file tree
Showing 81 changed files with 573 additions and 596 deletions.
7 changes: 0 additions & 7 deletions .analysis_options

This file was deleted.

14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
.buildlog
.DS_Store
.idea
# Files and directories created by pub
.packages
.pub/
build/
packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock
.packages

# Files generated by dart tools
.dart_tool

# Directory created by dartdoc
doc/api/
28 changes: 9 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,58 @@
# Changelog

## Version 1.0.0-alpha+1 (2018-05-05)

* Migrate to Dart 2.
* Use pointer events for Edge, Firefox, Chrome.

## Version 0.4.0 (2017-06-27)

* Fix strong mode errors (#20).


## Version 0.3.6 (2017-06-06)

* Fix bug: Provide reasonable fallback for event target when mouse position exits viewport (#19).


## Version 0.3.5 (2016-11-22)

* Handle the edge case where destroy is called while dragging an avatar (#17).


## Version 0.3.4 (2016-10-19)

* Fix strong-mode type errors (#15).
* Remove Shadow DOM example and (dev)dependency on Polymer (was causing some confusion).


## Version 0.3.3 (2016-09-22)

* Allow a configurable clickSuppression distance (#13). We found that the click
suppression was a little too aggressive for users with less mousing accuracy.
They would attempt to click and trigger a small drag. Which then suppressed the
click event and prevented the action they intended to complete.

suppression was a little too aggressive for users with less mousing accuracy.
They would attempt to click and trigger a small drag. Which then suppressed the
click event and prevented the action they intended to complete.

## Version 0.3.2 (2016-07-26)

* Remove null-aware operator since drone.io uses an old version of Dart that doesn't support this yet.


## Version 0.3.1 (2016-07-26)

* Support for programmatic drag abort (see issue #11).


## Version 0.3.0 (2015-04-18)

* BREAKING CHANGE: Refactoring the `AvatarHandler`. Only if you've
implemented a custom `AvatarHandler` you might need to do some changes:
* `setPointerEventsNone` and `resetPointerEvents` were removed and don't
need to be called any more. Pointer event styles are handled automatically.
* `setPointerEventsNone` and `resetPointerEvents` were removed and don't
need to be called any more. Pointer event styles are handled automatically.
* Fix `AvatarHandler` margin caching: The `AvatarHandler` only cached the
margins once for every `Draggable`. This caused problems when margins of
elements in the same `Draggable` had different margins or the margins were
changed. Now the margins are reset after every drag.


## Version 0.2.1 (2015-03-09)

* Fix #9: Using transformers in the main `pubspec.yaml` caused problems with
projects depending on the `dnd` package.


## Version 0.2.0 (2015-03-09)

* Fix #3: Shadow DOM is now supported. A `dnd-retarget` attribute must be added
Expand All @@ -66,21 +61,18 @@ click event and prevented the action they intended to complete.
* Fix #7: Add a css class (`dnd-invalid` by default) to dropzones when a
not-accepted draggable is dragged over.


## Version 0.1.4 (2014-10-20)

* Add a sortable example.
* Change comments according to new Dart Style Guide rule
(`///` instead of `/** */`).
* Move event dispatching calls from EventManager to Draggable (refactoring).


## Version 0.1.3 (2014-08-09)

* Fix #4: Problem when an ancestor of the dragged element was positioned
(relative, absolute, fixed).


## Version 0.1.2 (2014-07-22)

* Correcting small bug that occurred when setSelectionRange() was called on
Expand All @@ -90,15 +82,13 @@ click event and prevented the action they intended to complete.
* Adding a `cancelled` flag to `DraggableEvent` to indicate if a drag ended
because of a cancelling operation like `esc` key, etc.


## Version 0.1.1 (2014-07-21)

* Support for IE10 and IE11 touch screens through pointer events.
* Removed `disableTouch` and `disableMouse` options. The goal was to unify
touch and mouse dragging, so it should not be necessary to disable
one or the other.


## Version 0.1.0 (2014-07-17)

* First version.
15 changes: 15 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
analyzer:
strong-mode: true
errors:
uri_has_not_been_generated: ignore

# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
linter:
rules:
- cancel_subscriptions
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- test_types_in_equals
- unrelated_type_equality_checks
- valid_regexps
11 changes: 11 additions & 0 deletions build.debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
targets:
$default:
builders:
build_web_compilers|entrypoint:
generate_for:
- web/main.dart
options:
compiler: dartdevc
dart2js_args:
- --enable-asserts
- --preview-dart-2
15 changes: 15 additions & 0 deletions build.release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
targets:
$default:
builders:
build_web_compilers|entrypoint:
generate_for:
- web/main.dart
options:
compiler: dart2js
dart2js_args:
- --fast-startup
- --minify
- --trust-type-annotations
# Consult https://webdev.dartlang.org/tools/dart2js#size-and-speed-options
# before enabling the following option:
# - --trust-primitives
7 changes: 4 additions & 3 deletions example/basic/web/example.css → example/basic/example.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
}

.container {
max-width: 500px;
max-width: 400px;
padding: 15px 15px 0 15px;
}

Expand Down Expand Up @@ -40,7 +40,8 @@ body {
opacity: 0.5;
}

.dnd-dragging, .dnd-drag-occurring {
.dnd-dragging,
.dnd-drag-occurring {
cursor: url(packages/dnd/cursor/closedhand.cur), move; /* Cursor for IE. */
cursor: url(packages/dnd/cursor/closedhand.cur) 7 5, move; /* Cursor for FF and Chrome (setting midpoint). */
}
}
4 changes: 2 additions & 2 deletions example/basic/web/example.dart → example/basic/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:dnd/dnd.dart';
/// A basic example of how to use [Draggable]s and [Dropzone]s together.
main() {
// Install draggables (documents).
Draggable draggable = new Draggable(querySelectorAll('.document'),
new Draggable(querySelectorAll('.document'),
avatarHandler: new AvatarHandler.clone());

// Install dropzone (trash).
Expand All @@ -15,4 +15,4 @@ main() {
event.draggableElement.remove();
event.dropzoneElement.classes.add('full');
});
}
}
File renamed without changes.
File renamed without changes
File renamed without changes
36 changes: 36 additions & 0 deletions example/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>

<html>

<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">

<title>Dart Drag and Drop: Basic Example</title>

<link rel="stylesheet"
href="example.css">
<script defer
src="example.dart.js"></script>
</head>

<body>
<div class="container">
<a href="https://github.com/marcojakob/dart-dnd/tree/master/example/basic"
target="_parent">Example Source on GitHub</a>

<div class="trash"></div>
<img class="document"
src="images/document.png">
<img class="document"
src="images/document.png">
<img class="document"
src="images/document.png">
<img class="document"
src="images/document.png">

</div>
</body>

</html>
9 changes: 0 additions & 9 deletions example/basic/pubspec.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions example/basic/web/index.html

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:dnd/dnd.dart';
/// Example demonstrating how dragging can be prevented on some elements.
main() {
// Install draggable.
Draggable draggable = new Draggable(querySelector('.draggable'),
new Draggable(querySelector('.draggable'),
avatarHandler: new AvatarHandler.original(),
cancel: 'textarea, button, .no-drag');
}
}
21 changes: 12 additions & 9 deletions example/cancel/web/index.html → example/cancel/index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<!DOCTYPE html>

<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">

<title>Dart Drag and Drop: Cancel Example</title>
<title>Dart Drag and Drop: Cancel Example</title>

<link rel="stylesheet" href="example.css">
<link rel="stylesheet"
href="example.css">
<script defer
src="example.dart.js"></script>
</head>

<body>
<div class="container">
<a href="https://github.com/marcojakob/dart-dnd/tree/master/example/cancel"
target="_parent">Example Source on GitHub</a>
target="_parent">Example Source on GitHub</a>

<div class="draggable">
<div>Drag me!</div>
Expand All @@ -22,8 +27,6 @@
<button>No drag here!</button>
</div>
</div>

<script type="application/dart" src="example.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>

</html>
9 changes: 0 additions & 9 deletions example/cancel/pubspec.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions example/custom-acceptor/pubspec.yaml

This file was deleted.

Loading

0 comments on commit 3f24e70

Please sign in to comment.