194 Commits

Author SHA1 Message Date
Adam Barth
cc12331d63 Update references to Mojo core and bindings
Build fix after recent Dart bindings refactoring.  Now that these libraries are
not included in the snapshot, we need to load them from the mojo package.

R=zra@google.com
TBR=zra@chromium.org

Review URL: https://codereview.chromium.org/1029683002
2015-03-23 13:22:38 -07:00
Zachary Anderson
d83427c165 Dart: Removes all but native calls and the handle watcher from the snapshot.
The bindings, core, and application libraries are now referred to as, e.g.:

package:mojo/public/dart/core.dart

Since the handle watcher remains in the snapshot, it no
longer refers to types defined in core.dart. References to types defined
in core.dart are also removed from mojo_natives.cc.

In Dart packaged apps, the SDK is zipped up under mojo/public/dart.

For embedder tests, the SDK is copied into the generated source output directory.

A base_dir parameter is added to the 'dart_package' and 'mojom' GN macros so that
consumers of the Mojo SDK can all import using the same URIs regardless of where
the SDK lives in their source trees.

BUG=
R=erg@chromium.org

Review URL: https://codereview.chromium.org/1027603002
2015-03-23 11:04:03 -07:00
Adam Barth
9703e7f46f Load stocks data off the network
Instead of hard-coding the stock data in the Dart file, this CL moves the data
to a JSON file and loads that file over the network. This change improves load
time for the Stocks app from 3 seconds to 2 seconds.

Also, this CL removes shake-to-reload from the Stocks app because that also
slows down load time (due to the two module systems fighting each other).

R=rafaelw@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/1021723005
2015-03-23 09:59:50 -07:00
Rafael Weinstein
8eaeed7ba0 [Effen] Update README.md 2015-03-20 13:45:04 -07:00
Rafael Weinstein
5b9632b9d4 Update Effen README.md 2015-03-20 13:43:55 -07:00
Rafael Weinstein
ad8f8a6ea5 [Effen] Move README.md to correct directory
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/1024183002
2015-03-20 13:24:10 -07:00
Rafael Weinstein
d702c848e4 [Effen] minor cleanup
This patch adds an assert that the mount/unmount queues are not subject to concurrent modification and refactors the sync-tracing to avoid the cost of string interpolation if tracing is disabled.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1020103004
2015-03-20 10:20:05 -07:00
Adam Barth
f8b3596df6 Use StyleNode in StockMenu
StockMenu was creating a container for the sole purpose of applying style to
PopupMenu. Now we just use a StyleNode.

Also, I've reverted the change to make box-sizing default to border-box. It
turns out that CL wasn't effective because we didn't use the initialBoxSizing
function to initialize box sizing. I've made us use initialBoxSizing but switch
the default back to content-box because actually using border-box breaks a
bunch of stuff.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1024083003
2015-03-20 10:16:24 -07:00
Adam Barth
9a5aea3737 Introduce Scaffold to Sky framework
This CL extracts a Scaffold component from StockApp. The Scaffold component
lets you create an "app-like" layout with an action bar, a drawer, etc.

R=ojan@chromium.org, rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1027813002
2015-03-20 09:34:06 -07:00
Rafael Weinstein
082ca7c2c0 [Effen] add StyleNode
This patch adds a new (non-Render) StyleNode which takes two arguments: A (content) node, which it wraps and a Style object.

This allows for styles to be applied to Nodes which are constructed elsewhere (e.g. passed in as arguments).

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1027653002
2015-03-16 12:27:25 -07:00
Rafael Weinstein
86dc24f938 [Effen] Add AnimatedComponent base class
This patch adds a base AnimatedComponent from which most components that animated should derive. It takes care of listening & unlistening from the animations during did(Un)mount as well as binding the animated value to a private field and scheduling the component for build.

Note that this patch removes the did(Un)mount overridable methods from Component and replaces them with a callback mechanism which is less brittle.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1027633003
2015-03-16 03:18:17 -07:00
Rafael Weinstein
f7a1477d26 [Effen] Add _syncChild assert and cleanup trace output
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/1021113002
2015-03-16 01:19:26 -07:00
Rafael Weinstein
486d0c1ce9 Added render tracing to Effen
TBR=abarth

Review URL: https://codereview.chromium.org/1023063003
2015-03-16 00:49:09 -07:00
Rafael Weinstein
216f9b143c [Effen] Slightly cleaner enforcement of App lifetime signals
TBR=hansmuller

Review URL: https://codereview.chromium.org/1028473003
2015-03-15 23:26:41 -07:00
Hans Muller
2239d67032 Call _notifyMountStatusChanged() on App startup
A recent change caused my scrolling app to fail because
didMount() was no longer called on my Scrollable subclass
at startup time.

I haven't been able to sort out how this used to work.
This CL is a hack to make it work again.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1019973003
2015-03-19 14:05:44 -07:00
Adam Barth
97abc0dadd Improve Material ink effects
1) Factors InkWell out of Material so that components can use an ink well
   without needing the shadow/level machinery.

2) Makes the ink effect move at a different velocity once the tap has actually
   occurred, converging with the spec. We don't have the right speeds yet, but
   at least we're approaching the right shape.

3) To support (2), added a primaryPointer attribute to GestureEvents to let
   authors coorelate gesturetapdown events with later gesturetap events.

4) To support (2), modernized SplashAnimation to used AnimatedValue and friends.

5) Added more constants to view-configuration.dart that match Android.

I've also removed the cancelling of the ink effect on scroll. The proper way to
do that is to notice that someone in the event chain is listening for
scrollstart and delay the beginning of the ink effect for some period of time.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1019023003
2015-03-19 11:17:48 -07:00
Adam Barth
953145ba63 Default box-sizing to border-box
content-box is crazy banana-pants.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1015253002
2015-03-19 10:55:03 -07:00
Rafael Weinstein
7230f65ca9 Turn off Effen render times printing
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/1023673004
2015-03-15 13:08:26 -07:00
Hans Muller
cc4f7d0db0 Added a positional Component.fromArgs() constructor
To define a Component subclass with mixins, a constructor without optional parameters is needed.

Added Component.fromArgs() which just delegates to the main constructor.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1017353002
2015-03-19 08:06:23 -07:00
Rafael Weinstein
e8318f65a7 Change how events are handled in Effen
This patch removes the mutable API to event handling (Nodes no longer have a events object with which to add listeners).

Instead, a new (non-Render) Node is introduced: EventTarget. This node represents a location in the Effen tree which can handle events as they bubble.

Note that this also changes the implementation to use event delegation (one set of listeners at the sky.document level) rather than direct listeners on leaf nodes.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1019633004
2015-03-15 12:33:30 -07:00
Adam Barth
420098c97c Improve the openning animation for PopupMenu
We're now doing all of the elements of the popup menu entrance animation from
the material design spec, but our timing and curves might not be exactly right
yet. I haven't started on the exit animation.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1017193004
2015-03-18 15:21:48 -07:00
Eric Seidel
03407ba35e Remove custom elements examples, they are no longer maintained
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1022613002
2015-03-18 13:38:17 -07:00
Rafael Weinstein
8879e082ef Refactor Effen to make explicit the distinction between render & non-render nodes.
All Effen which can directly create a sky.Node are now derived from RenderNode. In contrast, Component now derives from the (now) base Node class which simply represents a position in the Effen hierarchy.

A fair amount of clean-up & refactoring went into this change, simplifying & unifying the "sync" logic between Element & Component as well as making the Component.didMount/didUnmount signals async WRT component building.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1009543008
2015-03-14 17:27:27 -07:00
Adam Barth
10d63a0744 Begin work on the PopupMenu entrance animation
This CL also refactors how animations work, particularly for the Drawer. I've
renamed DrawerAnimation to DrawerController and switched it from being an
Animation to having an Animation. I've also renamed Animation to AnimatedValue
to capture the idea that the class actually presents the value being animated.
Finally, I've factored AnimatedValueListener out of Drawer so that it can be
used by PopupMenuItem as well.

Finally, I've added a scheduleBuild convienence function to Component instead
of having to call setState(() {}), which has come up a couple times.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1016093002
2015-03-18 11:31:07 -07:00
Adam Barth
4b6783ceee Add a menu to the stocks app
We should probably move this menu into a view for an individual stock, but for
now add it to the main stock screen.

R=ojan@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1008003007
2015-03-17 19:21:36 -07:00
Adam Barth
4d6063101b Add a basic popup menu widget
Currently this widget is demoed in widgets-fn, but I'll move it into stocks-fn
soon.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1017873002
2015-03-17 14:18:13 -07:00
Adam Barth
28d09890e3 Cleanup events related to material splashes
This CL is a warmup for using a more sophisticated gesture disambiguation.

1) Use gesturetap instead of click. We should probably remove click events
   because folks should use gesturetap to integrate with the gesture system.

2) Handle the case where you swipe the drawer during an animation. Previously
   we had an assert which triggered in some multitouch scenarios. We'll
   eventually move this over to gestureswipe.

3) Remove an extra container for ink splashes. There's no need to group all the
   ink splashes in a container. They can all just be children of the Material
   component itself. This structure is left over from when Material was a base
   class.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1013713005
2015-03-16 20:53:55 -07:00
Adam Barth
a2904c14d3 Introduce sky/framework/theme/typography.dart
This CL adds typography information to the Sky theme. The values are from the
Material Design spec. I've also applied these values to the stocks app and the
various components.

We're not geting precisely the right typography in some cases because of
https://github.com/domokit/mojo/issues/65.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1006363004
2015-03-16 20:53:26 -07:00
Rafael Weinstein
8a9a12b10f Sky/Effen refactor: all nodes receive _mount/_unmount signal.
This patch refactors Effen in advance of allowing a final transform step from Effen nodes to sky nodes. The central changes here are:

1) Effen nodes get a _parentNode pointer
2) The lifetime of effen nodes is
  ->_sync (0 to N times)
     -> the first _sync() causes a _mount()
  ->_unmount
3) Node should expect to sync even when they are first inserted (in which case they sync against a prototypical empty node which their class must provide).
4) Subclasses now override _syncNode() no longer takes host & insertBefore (_mount does). In the one case that a node must be replaced without being unmounted (inside _syncInternal), the old node is inspected for it's sky position.

TBR=abarth

Review URL: https://codereview.chromium.org/996103008
2015-03-13 00:29:41 -07:00
Adam Barth
cf1f36f69e Fix the alignment of the title in Stock app
The left edge of the title should be on the 72px vertical keyline according to
the Material Design spec.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1010443005
2015-03-16 13:44:10 -07:00
Adam Barth
f867498266 Rename Sky's Toolbar to ActionBar
This naming matches the naming in Material Design.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1010913002
2015-03-16 13:26:06 -07:00
Adam Barth
6eb32909c4 Fix some checked mode errors in drawer.dart
We need to use the more generic type Curve. Also, added an assert to catch this
earlier.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1017463002
2015-03-16 12:56:18 -07:00
Adam Barth
be7eb7fbfa Make the status bar translucent
This CL lets Sky apps draw behind the Android status bar, better matching the
material design spec.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1010493007
2015-03-16 11:14:04 -07:00
Adam Barth
9cae912b49 Make Sky's drawer match Material Design spec
This CL makes the drawer the correct size and use the correct animation curve.
Also, remove the hard-coded z-index values now that hit testing works again.
This CL adjusts the mask's opacity to match the drawer in Gmail.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1012463003
2015-03-16 10:16:45 -07:00
Adam Barth
c385c6abdc Remove the "min velocity" hack from ParticleClimbingRamp
Previously, we had a problem with this physics simulation not actually hitting
the edge of the box and causing the scrollable contents to fall back down. To
avoid that problem, we enforced a minimum velocity for the particle to ensure
that it always hit the edge of the box. However, when that min velocity kicked
in, the results were visually unappealing.

This CL fixes the underlying problem. The fix is to apply the impluse from
gravity after updating the particle's position. In that way, we slightly over
estimate the particle's position in every step of the simulation, ensuring that
we don't miss the edge of the box due to errors in our simulation. With this
change, we no longer need the min velocity hack.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1008423002
2015-03-16 09:15:53 -07:00
Eric Seidel
8ad5f14611 Currently we use package: to mean "/gen", which is not at all how
Dart actually expects package: to work.  This CL makes package:foo
map to /packages/foo, similar to how Dartium or bin/dart would expect.

This also means overlaying the /gen directory over the actual package
outputs (as consumers of an SDK would expect) as well as adding
an additional /lib indirection for the actual package source as
the Dart pub tool will expect.

This is far from perfect, but it unlocks us actually producing a
sky SDK.

I expect there may be some fallout from this change as I'm sure I
missed some package: uses.  We also don't have a general solution
for all /foo/bar/baz includes which randomly included parts
of mojo's source directory.  Those will need to be updated to use
a package: and deploy_sdk.py taught how to build a package for them.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/990493002
2015-03-13 16:58:53 -07:00
Adam Barth
85d02799fd Improve Sky's Scrollable physics
We now use a physics simulationt to drive the scroll fling. We're also closer
to integrating fling into overscroll.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1004363002
2015-03-13 15:57:41 -07:00
Rafael Weinstein
0765e85bf5 Allow Effen Styles to be extendable
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1006053002
2015-03-13 14:08:24 -07:00
Adam Barth
a8aeed8a0d Add missing import 2015-03-13 10:15:36 -07:00
Adam Barth
1eb13d0112 Organize sky/framework/animation
This CL cleans up the sky/framework/animation as follows:

1) I've moved code that's used only by the custom elements framework into
   sky/framework/elements/animation. This code is based on AnimationDelegates
   rather than Streams.
2) Rename ScrollCurve to ScrollBehavior because it encapsulates more behavior
   than just a curve.
3) Make the Generator interface explicit and mark subclasses as actual
   subclasses.
4) Move Simulation into generators.dart because it implements the Generator
   interface.
5) Move Animation out of generators.dart because it does not implement the
   Generator interface.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1001373002
2015-03-13 10:04:56 -07:00
Adam Barth
06bfddff81 Drive overscroll animations with a physics simulation
This CL uses a simple physics simulation to drive overscroll animations.
We model settling the overscroll as a particle climbing a hill, which
gives us a pleasing parabolic trajectory.

This CL also includes machinery for spring-based simulations. We'll use
these to drive the drawer animation.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/999423004
2015-03-13 09:31:10 -07:00
Adam Barth
70aa7795c7 Scrollable should settle back to 0.0
This CL teaches Scrollable how to settle back to a scroll offset of 0.0 after a
fling or a scroll. There's still some room for improvement:

1) Some of this logic should be factored out into the scroll curve object.
2) We don't produce the correct animation curves when we fling into the
   overscroll region because we wait for the fling velocity to reach zero
   before we start the settling animation.

R=ojan@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1005753002
2015-03-12 14:33:37 -07:00
Adam Barth
52d2d67754 Implement an OverscrollCurve for Scrollable
When using OverscrollCurve, we continue to scroll beyond the top of the
scrollable area but the scroll delta is reduced by 2x. A future CL will add an
animation at gesturescrollend to relax back to scroll position 0.0.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1002953003
2015-03-12 13:08:44 -07:00
Adam Barth
7cb9edebe1 Factor ScrollCurve out of Scrollable
Intead of hard-coding the notion of bounded scrolling into Scrollable, this CL
factors out a ScrollCurve class that applies the bounds. In the future, we'll
refine this mechanism to implement overflow scrolling.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1005633002
2015-03-12 10:36:09 -07:00
Adam Barth
e39868357a Factor a Scrollable base class out of FixedHeightScrollable
This class encapsulates the scrolling behavior but not the mechanism for
building the visual components.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1006533002
2015-03-12 10:10:04 -07:00
Adam Barth
111a25a569 Rename fling-curve.dart to fling_curve.dart
We're using underscores as word separators per Dart style.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/998373002
2015-03-12 09:40:43 -07:00
Adam Barth
deb2f1b757 Fix errors in Sky detected by Dart analyzer
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1000863002
2015-03-11 22:04:22 -07:00
Zachary Anderson
3cc4de9295 Dart: Rename mojo:X -> dart:mojo.X
This is to better support integration with Dart SDK tools.

BUG=
R=erg@chromium.org

Review URL: https://codereview.chromium.org/998933005
2015-03-11 16:22:21 -07:00
Viet-Trung Luu
27ba430a4d Fix some imports in sky/framework/elements.
TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1004533002
2015-03-11 15:01:38 -07:00
Adam Barth
24a53815a0 Update Button to be made of Material
To accomplish this, I made the following changes:

1) Material is now in charge of drawing the material shadows.
2) In order to mix in the style for the shadow, Element now takes a list of
   Styles instead of a single style.
3) Update all clients of Element#style to understand that we now have a list.
4) Update components that drawer shadows to have Material do that work instead.
   a) One exception: FloatingActionButton draws its own shadow because of its
      crazy clip requirements. We'll probably want to find a better way for
      FloatingActionButton to clip in the future.

I've also added a widgets-fn example to demo the fn material widgets.

This CL introduces a bug into Drawer whereby you can get ink splashes
everywhere in the drawer. In the future, we'll need to separate out the
different material aspects to get non-splashable materials.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1003553002
2015-03-11 14:20:11 -07:00