169 Commits

Author SHA1 Message Date
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
Eric Seidel
8be96a9e8d Move sky-*.sky into framework/elements
We're not actively developing these at the moment.

I could also just delete them, not sure if we're ready for that yet.

TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/999873002
2015-03-11 13:50:09 -07:00
Adam Barth
907231aad1 Make Stocks app search actually search
We don't yet reset the scroll offset, so sometimes you can't see your search
results properly.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1002453003
2015-03-11 12:07:24 -07:00
Adam Barth
35322ed08b Add placeholder text to the Input component
R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/996213004
2015-03-11 11:30:28 -07:00
Adam Barth
8c4edc7374 Re-work MaterialComponent
Instead of MaterialComponent being a base class, components that want material
behavior simply create a MaterialComponent during their render function. This
approach gives the component more flexibility as to its structure and gives
MaterialComponent more flexibility has to how the components it generates are
related to the existing children.

Also, I've improved some of the event delegation code. There's no reason to
attach event handlers to the root component you emit during |render| because
the framework already delegates events from your root component to you.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/983903003
2015-03-11 10:17:54 -07:00
Adam Barth
457da82302 Make the search box in the stocks app show a search field
The search field doesn't do anything, but it's there.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/998803002
2015-03-10 17:17:03 -07:00
Adam Barth
4fa137f50d Move example fn widgets into sky/framework/components
Moving these files into sky/framework will make them easier to use from the
SDK. Also, this CL also splits up the giant "widgets" library into smaller
libraries, one per component.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/993033003
2015-03-10 15:55:24 -07:00
Adam Barth
b3d20fac21 Move material Input component into sky/framework
The implementation details are in sky/framework/editing.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983213005
2015-03-10 15:03:10 -07:00
Rafael Weinstein
c7573c12a0 Add initialDelay to AnimationGenerator and add Animation class.
This patch allows for an initial delay before an animation begins and also adds an Animation class which encapsulates a value which is long-lived, can be explicitly set and also animated from its current value to another value.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/994143002
2015-03-10 12:22:15 -07:00
Rafael Weinstein
e109f30916 Change the name of Component.render to Component.build in Effen.
"Render" is misleading. "Build" may not be the best word either, it's closer to what's actually happening.

R=ojan@chromium.org
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/992033002
2015-03-09 13:30:13 -07:00
Rafael Weinstein
def96f0fd4 Ensure that sky Nodes are in the document when didMount() is fired. Refactor FixedHeightScrollable to inspect heights rather than having the passed in
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/994553003
2015-03-09 12:39:10 -07:00
Adam Barth
4bb0ff3875 Fix shake-to-reload
The Dart bindings changed syntax a bit. This CL updates shake-to-reload to
match the new names.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/987103003
2015-03-09 10:49:46 -07:00
Rafael Weinstein
a77b1efd52 Prevent already scheduled-for-render fn components which become removed from rendering
This can occur, for instance, if a child component runs before a parent component within a single animation frame, and the child does setState() while the parent removes it. The child will already have been entered into the rendering queue.

TBR=eseidel
BUG=

Review URL: https://codereview.chromium.org/983793004
2015-03-06 14:16:16 -08:00
Rafael Weinstein
21a3cbab83 Correctly allow components to return different top-level nodes during different renderings
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/984983004
2015-03-06 13:32:07 -08:00
Rafael Weinstein
c3823b9204 Add back didMount
Sorry I keep changing my mind about this. My thinking had been since this was computable by just setting a bit and checking it in render(), that it was silly, but I keep finding uses for it and it's annoying to re-implement in each component.

TBR=eseidel
BUG=

Review URL: https://codereview.chromium.org/986753002
2015-03-06 12:50:42 -08:00
Rafael Weinstein
2c788c3e6d Effen: willUmount->didUnmount, allow setState after didUnmount
This patch changes the timing of the unmount call until after the component is removed (and marked as such) and allows setState to be called after this point. If this happens, setState will still invoke the closer to do any neccesary cleanup, but doesn't schedule the component for render

R=eseidel@chromium.org, eseidel
BUG=

Review URL: https://codereview.chromium.org/985853002
2015-03-06 12:23:53 -08:00
Eric Seidel
e2a00dd49d Add an assert that we don't schedule a render during render
In production I added an early return.  I don't bother to log
in production since no one is looking at the log anyway.

Unfortunately this currently only fires when using a debug build
we should fix our Release build to have a checked-mode option
or consider hacks like having all localhost urls enable checked
mode, etc.

R=ianh@google.com, rafaelw@chromium.org
BUG=

Review URL: https://codereview.chromium.org/983973005
2015-03-06 10:42:49 -08:00
Eric Seidel
bbeb05afb7 Make stocksapp.dart almost pass the dart analyzer.
To test:
sky/tools/shelldb analyze sky/examples/stocks-fn/stocksapp.dart

It prints 600+ warnings about the "native" keyword, and after
this change only a couple warnings about missing library names
which I don't fully understand.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/987613002
2015-03-05 16:52:14 -08:00
Hixie
88df817d43 fix typo in _syncEvent; make it possible for a component to entirely change the class of its rendering's component
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/986463003
2015-03-05 16:06:33 -08:00
Adam Barth
270d658ad9 Sometimes the drawer doesn't fully close
The AnimationGenerator didn't always generate the |end| value because of
floating point rounding. This CL causes it to always generate |end| at the end.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983893002
2015-03-05 15:53:22 -08:00
Hixie
37c27faae4 fix the hang when clicking the drawer in the stocks app
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980043005
2015-03-05 15:46:21 -08:00
Adam Barth
ca60f330e9 Move animationgenerator.dart to sky/framework/animation/generator.dart
That's where it belongs.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/979283002
2015-03-05 11:40:35 -08:00
Adam Barth
1f77a79a2c fn.dart shouldn't spam the log
This CL introduces a flag to control whether fn.dart prints the render duration
to the console. By default, the flag is off to avoid log spam.

Also, improve the way we intialize _isInCheckedMode to make use of the fact
that Dart intializes final fields lazily.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/982073002
2015-03-05 11:38:17 -08:00
Adam Barth
e3812af9c0 Move fn.dart into /sky/framework
It's awkward to work on fn.dart in the examples directory so this CL moves it
to /sky/framework. Also, I've merged the whole library into one file instead of
using the |part| mechanism. The whole thing isn't that big.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/987463002
2015-03-05 10:53:01 -08:00
Adam Barth
4df0891248 Organize sky/framework a bit
- Removed out-of-date README.md
- Moved fling-curve into the animation directory because it's part of the
  animation behavior of the system.
- Moved view-configuration into the theme directory because it's a collection
  of constants similar in flavor to the colors and the shadows. Eventually
  we'll want to make the theme configurable and have these all together will
  hopefully make that easier.
- Moved dom-serializer into tests/resources because it is used only by tests.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980423002
2015-03-05 09:59:50 -08:00
Adam Barth
22f3af608c Add constants for material colors and shadows
This CL removes the hard-coded colors and shadows from the fn widgets and
replaces them with compile-time constants. The color values are from the
material spec:

http://www.google.com/design/spec/style/color.html#color-color-palette

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983733003
2015-03-05 09:58:23 -08:00