Commit 6fc343a0 authored by Adam Barth's avatar Adam Barth

Remove package:sky/base

These files really belong on other libraries.
parent 5108e15e
......@@ -8,12 +8,6 @@ The bottom-most layer is the Sky Platform, which is exposed to Dart
code as [various `dart:` packages](https://api.dartlang.org/),
including `dart:sky`.
The [base/](base/) directory contains libraries that extend these core
APIs to provide base classes for tree structures
([base/node.dart](base/node.dart)), hit testing
([base/hit_test.dart](base/hit_test.dart)), and debugging
([base/debug.dart](base/debug.dart)).
Above this layer is the [animation](animation.dart) library,
which provides core animation primitives, and the [gestures/](gestures/)
directory, which define a gesture recognition and disambiguation system.
......@@ -49,8 +43,8 @@ Here is a diagram summarizing all this:
| | | painting | |
+-+ +------------+ |
| gestures/ | animation | |
+-----------+---+--------+ |
| base/ | mojo/ |
+-----------+------------+ |
| mojo/ |
+------------+--+-+----+------+ -------
| dart:sky | | | Host |
+--------+---+ | | APIs | C++
......
Sky Base
========
AbstractNode
------------
The [node.dart](node.dart) file defines a class, `AbstractNode`, which
can be used to build mutable trees.
* When a subclass is changing the parent of a child, it should
call either parent.adoptChild(child) or parent.dropChild(child)
as appropriate. Subclasses should expose an API for
manipulating the tree if you want to (e.g. a setter for a
'child' property, or an 'add()' method to manipulate a list).
* You can see the current parent by querying 'parent'.
* You can see the current attachment state by querying
'attached'. The root of any tree that is to be considered
attached should be manually attached by calling 'attach()'.
Other than that, don't call 'attach()' or 'detach()'. This is
all managed automatically assuming you call the 'adoptChild()'
and 'dropChild()' methods appropriately.
* Subclasses that have children must override 'attach()' and
'detach()' as described below.
* Nodes always have a 'depth' greater than their ancestors'.
There's no guarantee regarding depth between siblings. The
depth of a node is used to ensure that nodes are processed in
depth order. The 'depth' of a child can be more than one
greater than the 'depth' of the parent, because the 'depth'
values are never decreased: all that matters is that it's
greater than the parent. Consider a tree with a root node A, a
child B, and a grandchild C. Initially, A will have 'depth' 0,
B 'depth' 1, and C 'depth' 2. If C is moved to be a child of A,
sibling of B, then the numbers won't change. C's 'depth' will
still be 2. This is all managed automatically assuming you call
'adoptChild()' and 'dropChild()' appropriately.
Dependencies
------------
No dependencies except for `dart:sky` and Dart's core libraries.
......@@ -4,9 +4,9 @@
import 'dart:sky' as sky;
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/constants.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/gestures/recognizer.dart';
typedef void GestureLongPressListener();
......
......@@ -5,11 +5,11 @@
import 'dart:async';
import 'dart:sky' as sky;
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/constants.dart';
import 'package:sky/gestures/pointer_router.dart';
export 'package:sky/base/pointer_router.dart' show PointerRouter;
export 'package:sky/gestures/pointer_router.dart' show PointerRouter;
abstract class GestureRecognizer extends GestureArenaMember {
GestureRecognizer({ PointerRouter router }) : _router = router;
......
......@@ -9,7 +9,7 @@ import 'dart:typed_data';
import 'package:mojo/core.dart' as core;
import 'package:mojo_services/mojo/asset_bundle/asset_bundle.mojom.dart';
import 'package:sky/base/image_resource.dart';
import 'package:sky/mojo/image_resource.dart';
import 'package:sky/mojo/net/fetch.dart';
import 'package:sky/mojo/net/image_cache.dart' as image_cache;
import 'package:sky/mojo/shell.dart' as shell;
......
......@@ -7,7 +7,7 @@ import 'dart:collection';
import 'dart:sky' as sky;
import 'package:mojo/mojo/url_response.mojom.dart';
import 'package:sky/base/image_resource.dart';
import 'package:sky/mojo/image_resource.dart';
import 'package:sky/mojo/net/fetch.dart';
final HashMap<String, ImageResource> _cache = new Map<String, ImageResource>();
......
......@@ -10,10 +10,13 @@ library rendering;
export 'package:sky/src/rendering/auto_layout.dart';
export 'package:sky/src/rendering/block.dart';
export 'package:sky/src/rendering/box.dart';
export 'package:sky/src/rendering/debug.dart';
export 'package:sky/src/rendering/flex.dart';
export 'package:sky/src/rendering/grid.dart';
export 'package:sky/src/rendering/hit_test.dart';
export 'package:sky/src/rendering/image.dart';
export 'package:sky/src/rendering/layer.dart';
export 'package:sky/src/rendering/node.dart';
export 'package:sky/src/rendering/object.dart';
export 'package:sky/src/rendering/paragraph.dart';
export 'package:sky/src/rendering/proxy_box.dart';
......
This directory contains painting-related libraries that only depend on
core Dart libraries, `../base/*`, and [animation.dart](../animation.dart). Note
that [animation.dart](../animation.dart) depends on the Newton Dart library.
core Dart libraries and [animation.dart](../../animation.dart). Note
that [animation.dart](../../animation.dart) depends on the Newton Dart library.
......@@ -6,7 +6,7 @@ import 'dart:math' as math;
import 'dart:sky' as sky;
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:sky/base/image_resource.dart';
import 'package:sky/mojo/image_resource.dart';
import 'package:sky/src/painting/shadows.dart';
/// An immutable set of offsets in each of the four cardinal directions
......
......@@ -385,6 +385,5 @@ Dependencies
------------
* [`package:sky/animation.dart`](../../animation.dart)
* [`package:sky/base`](../../base)
* [`package:sky/mojo`](../../mojo)
* [`package:sky/painting.dart`](../../painting.dart)
......@@ -5,8 +5,8 @@
import 'dart:math' as math;
import 'dart:sky' as sky;
import 'package:sky/base/debug.dart';
import 'package:sky/painting.dart';
import 'package:sky/src/rendering/debug.dart';
import 'package:sky/src/rendering/object.dart';
import 'package:vector_math/vector_math.dart';
......
......@@ -6,6 +6,37 @@
///
/// AbstractNode has as notion of depth, attachment, and parent, but does not
/// have a model for children.
///
/// * When a subclass is changing the parent of a child, it should
/// call either parent.adoptChild(child) or parent.dropChild(child)
/// as appropriate. Subclasses should expose an API for
/// manipulating the tree if you want to (e.g. a setter for a
/// 'child' property, or an 'add()' method to manipulate a list).
///
/// * You can see the current parent by querying 'parent'.
///
/// * You can see the current attachment state by querying
/// 'attached'. The root of any tree that is to be considered
/// attached should be manually attached by calling 'attach()'.
/// Other than that, don't call 'attach()' or 'detach()'. This is
/// all managed automatically assuming you call the 'adoptChild()'
/// and 'dropChild()' methods appropriately.
///
/// * Subclasses that have children must override 'attach()' and
/// 'detach()' as described below.
///
/// * Nodes always have a 'depth' greater than their ancestors'.
/// There's no guarantee regarding depth between siblings. The
/// depth of a node is used to ensure that nodes are processed in
/// depth order. The 'depth' of a child can be more than one
/// greater than the 'depth' of the parent, because the 'depth'
/// values are never decreased: all that matters is that it's
/// greater than the parent. Consider a tree with a root node A, a
/// child B, and a grandchild C. Initially, A will have 'depth' 0,
/// B 'depth' 1, and C 'depth' 2. If C is moved to be a child of A,
/// sibling of B, then the numbers won't change. C's 'depth' will
/// still be 2. This is all managed automatically assuming you call
/// 'adoptChild()' and 'dropChild()' appropriately.
class AbstractNode {
// AbstractNode represents a node in a tree.
......
......@@ -7,14 +7,14 @@ import 'dart:sky' as sky;
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:sky/animation.dart';
import 'package:sky/base/debug.dart';
import 'package:sky/base/hit_test.dart';
import 'package:sky/base/node.dart';
import 'package:sky/src/rendering/debug.dart';
import 'package:sky/src/rendering/hit_test.dart';
import 'package:sky/src/rendering/layer.dart';
import 'package:sky/src/rendering/node.dart';
import 'package:vector_math/vector_math.dart';
export 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
export 'package:sky/base/hit_test.dart' show EventDisposition, HitTestTarget, HitTestEntry, HitTestResult;
export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, HitTestTarget, HitTestEntry, HitTestResult;
/// Base class for data associated with a [RenderObject] by its parent
///
......
......@@ -5,10 +5,10 @@
import 'dart:sky' as sky;
import 'package:sky/animation.dart';
import 'package:sky/base/hit_test.dart';
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/hit_test.dart';
import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/view.dart';
......
......@@ -501,7 +501,6 @@ Dependencies
* `package:vector_math`
* [`package:sky/animation.dart`](../../animation.dart)
* [`package:sky/base`](../../base)
* [`package:sky/painting.dart`](../../painting.dart)
* [`package:sky/rendering.dart`](../../rendering.dart)
* [`package:sky/theme`](../../theme)
......@@ -6,8 +6,8 @@ import 'dart:sky' as sky;
import 'package:vector_math/vector_math.dart';
import 'package:sky/base/image_resource.dart';
import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/mojo/image_resource.dart';
import 'package:sky/mojo/net/image_cache.dart' as image_cache;
import 'package:sky/src/painting/text_painter.dart';
import 'package:sky/src/painting/text_style.dart';
......@@ -25,11 +25,11 @@ import 'package:sky/src/rendering/viewport.dart';
import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart';
export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/src/painting/text_style.dart';
export 'package:sky/src/rendering/block.dart' show BlockDirection;
export 'package:sky/src/rendering/box.dart' show BoxConstraints;
export 'package:sky/src/rendering/flex.dart' show FlexJustifyContent, FlexAlignItems, FlexDirection;
export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/src/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path;
export 'package:sky/src/rendering/proxy_box.dart' show BackgroundImage, BoxDecoration, BoxDecorationPosition, BoxShadow, Border, BorderSide, EdgeDims, Shape;
export 'package:sky/src/rendering/shifted_box.dart' show ShrinkWrap;
......
......@@ -4,9 +4,7 @@
import 'dart:collection';
import 'package:sky/base/hit_test.dart';
import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/sky_binding.dart';
import 'package:sky/rendering.dart';
import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart';
......
......@@ -7,15 +7,15 @@ import 'dart:collection';
import 'dart:sky' as sky;
import 'package:sky/animation.dart';
import 'package:sky/base/hit_test.dart';
import 'package:sky/mojo/activity.dart';
import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/hit_test.dart';
import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/sky_binding.dart';
import 'package:sky/src/rendering/view.dart';
export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/src/rendering/box.dart' show BoxConstraints, BoxDecoration, Border, BorderSide, EdgeDims;
export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/src/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path;
final bool _shouldLogRenderDuration = false; // see also 'enableProfilingLoop' argument to runApp()
......
import 'package:quiver/testing/async.dart';
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/long_press.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/gestures/show_press.dart';
import 'package:test/test.dart';
......
import 'dart:sky' as sky;
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:test/test.dart';
import '../engine/mock_events.dart';
......
import 'dart:sky' as sky;
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/gestures/scroll.dart';
import 'package:sky/gestures/tap.dart';
import 'package:test/test.dart';
......
import 'package:quiver/testing/async.dart';
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/gestures/show_press.dart';
import 'package:test/test.dart';
......
import 'package:sky/base/pointer_router.dart';
import 'package:sky/gestures/arena.dart';
import 'package:sky/gestures/pointer_router.dart';
import 'package:sky/gestures/tap.dart';
import 'package:test/test.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment