diff --git a/.analysis_options b/.analysis_options deleted file mode 100644 index ceee449..0000000 --- a/.analysis_options +++ /dev/null @@ -1,7 +0,0 @@ -analyzer: - strong-mode: true -linter: - rules: - - annotate_overrides - - cancel_subscriptions - - close_sinks diff --git a/.gitignore b/.gitignore index 8e69451..09239b7 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2167436..eb56f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -66,7 +61,6 @@ 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. @@ -74,13 +68,11 @@ click event and prevented the action they intended to complete. (`///` 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 @@ -90,7 +82,6 @@ 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. @@ -98,7 +89,6 @@ click event and prevented the action they intended to complete. 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. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..6dd0787 --- /dev/null +++ b/analysis_options.yaml @@ -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 diff --git a/build.debug.yaml b/build.debug.yaml new file mode 100644 index 0000000..ceb3d78 --- /dev/null +++ b/build.debug.yaml @@ -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 diff --git a/build.release.yaml b/build.release.yaml new file mode 100644 index 0000000..8a1656b --- /dev/null +++ b/build.release.yaml @@ -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 diff --git a/example/basic/web/example.css b/example/basic/example.css similarity index 94% rename from example/basic/web/example.css rename to example/basic/example.css index cb4703e..c9c6f1a 100644 --- a/example/basic/web/example.css +++ b/example/basic/example.css @@ -8,7 +8,7 @@ body { } .container { - max-width: 500px; + max-width: 400px; padding: 15px 15px 0 15px; } @@ -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). */ -} \ No newline at end of file +} diff --git a/example/basic/web/example.dart b/example/basic/example.dart similarity index 87% rename from example/basic/web/example.dart rename to example/basic/example.dart index 64b735d..2aebb05 100644 --- a/example/basic/web/example.dart +++ b/example/basic/example.dart @@ -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). @@ -15,4 +15,4 @@ main() { event.draggableElement.remove(); event.dropzoneElement.classes.add('full'); }); -} \ No newline at end of file +} diff --git a/example/basic/web/images/README.md b/example/basic/images/README.md similarity index 100% rename from example/basic/web/images/README.md rename to example/basic/images/README.md diff --git a/example/basic/web/images/document.png b/example/basic/images/document.png similarity index 100% rename from example/basic/web/images/document.png rename to example/basic/images/document.png diff --git a/example/basic/web/images/trash.png b/example/basic/images/trash.png similarity index 100% rename from example/basic/web/images/trash.png rename to example/basic/images/trash.png diff --git a/example/basic/index.html b/example/basic/index.html new file mode 100644 index 0000000..088cce7 --- /dev/null +++ b/example/basic/index.html @@ -0,0 +1,36 @@ + + + + +
+ + + +