John McCutchan b017dfd995 Rationalize Dart mojo and sky package structure.
NOTE: This CL appears far larger than it actually is for two reasons:

1) Many files were moved around to use the Dart package directory structure.
2) Many .dart files had to have import paths updated.

- Organize mojo/public/dart so that it uses standard Dart package layout
- Organize mojo/dart/apptest so that it uses a standard Dart package layout
- Organize sky/sdk so that it uses a standard Dart package layout
- Create a mojo/testing package (used by unittests)
- Introduce the 'dart_pkg' gn rule which populates gen/Config/dart-pkg
- All internally vended Dart packages must have a corresponding dart_pkg rule
- It is now possible to use dependency_overrides: in pubspec.yaml to mix internal and external package dependencies (enables analyzer, editor, webstorm usage for internal developers).
- Package root for dart content handler ends with "packages/"
- Imports of mojo package uris no longer need the "public/dart"
- mojo/public/tools/dart_package.py is a clone of mojo/public/tools/gn/zip.py
- Sky tests no longer run 'deploy_sdk' script.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1132063007
2015-05-18 14:41:39 -07:00

80 lines
1.9 KiB
Plaintext

<!--
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
<import src="sky-element.sky" />
<sky-element name="sky-input" attributes="value:string">
<template>
<style>
:host {
display: flex;
flex-direction: row;
}
#control {
margin: 8px;
padding: 8px;
border-bottom: 1px solid #E7E7E7;
flex: 1;
align-self: center;
height: 1.2em;
white-space: nowrap;
overflow: hidden;
}
#control.focused {
padding-bottom: 7px;
border-bottom: 2px solid #009cf3;
}
</style>
<div id="control" contenteditable />
</template>
<script>
import "dart:sky";
// TODO(abarth): Connect to the mojo:keyboard service.
@Tagname('sky-input')
class SkyInput extends SkyElement {
Element _control;
static String _textForValue(String value) => value == null ? '' : value;
shadowRootReady() {
_control = shadowRoot.getElementById('control');
_control.setChild(new Text(_textForValue(getAttribute('text'))));
_control.addEventListener('focus', _handleFocus);
_control.addEventListener('blur', _handleBlur);
_control.addEventListener('keydown', _handleKeyDown);
}
String get text => _control == null ? null : _control.textContent;
void textChanged(String oldValue, String newValue) {
if (_control != null)
_control.setChild(new Text(_textForValue(newValue)));
}
void _handleKeyDown(KeyboardEvent event) {
// TODO(abarth): You can still get newlines if the user pastes them.
if (event.key == 0xD)
event.preventDefault();
}
void _handleFocus(_) {
if (_control)
_control.setAttribute('class', 'focused');
// TODO(abarth): Show the keyboard.
}
void _handleBlur(_) {
if (_control)
_control.removeAttribute('class');
// TODO(abarth): Hide the keyboard.
}
}
_init(script) => register(script, SkyInput);
</script>
</sky-element>