Specs: define how importing element registrations works, move built-in elements to a separate module so dart:sky can be a simple library

Review URL: https://codereview.chromium.org/944873007
This commit is contained in:
Hixie 2015-02-20 16:40:07 -08:00
parent 7d00bd5e06
commit 40f162c096
4 changed files with 17 additions and 119 deletions

View File

@ -2,10 +2,6 @@ Sky DOM APIs
============
```dart
SKY MODULE
<!-- part of dart:sky -->
<script>
// ELEMENT TREE API
abstract class Node extends EventTarget {
@ -278,108 +274,6 @@ class ApplicationRoot extends Root {
Type rootLayoutManager = BlockLayoutManager; // O(1)
// BUILT-IN ELEMENTS
@tagname('import')
class ImportElement extends Element {
ImportElement = Element;
@override
Type getLayoutManager() => null; // O(1)
}
@tagname('template')
class TemplateElement extends Element {
TemplateElement = Element;
// TODO(ianh): convert <template> to using a token stream instead of a Fragment
external Fragment get content; // O(1)
@override
Type getLayoutManager() => null; // O(1)
}
@tagname('script')
class ScriptElement extends Element {
ScriptElement = Element;
@override
Type getLayoutManager() => null; // O(1)
}
@tagname('style')
class StyleElement extends Element {
StyleElement = Element;
external List<Rule> getRules(); // O(N) in rules
@override
Type getLayoutManager() => null; // O(1)
}
@tagname('content')
class ContentElement extends Element {
ContentElement = Element;
external List<Node> getDistributedNodes(); // O(N) in distributed nodes
@override
Type getLayoutManager() => null; // O(1)
}
@tagname('img')
class ImgElement extends Element {
ImgElement = Element;
@override
Type getLayoutManager() => ImgElementLayoutManager; // O(1)
}
@tagname('div')
class DivElement extends Element {
DivElement = Element;
}
@tagname('span')
class SpanElement extends Element {
SpanElement = Element;
}
@tagname('iframe')
class IframeElement extends Element {
IframeElement = Element;
@override
Type getLayoutManager() => IframeElementLayoutManager; // O(1)
}
@tagname('t')
class TElement extends Element {
TElement = Element;
}
@tagname('a')
class AElement extends Element {
AElement = Element;
}
@tagname('title')
class TitleElement extends Element {
TitleElement = Element;
@override
Type getLayoutManager() => null; // O(1)
}
class _ErrorElement extends Element {
_ErrorElement._create();
@override
Type getLayoutManager() => _ErrorElementLayoutManager; // O(1)
}
class SelectorQuery {
external SelectorQuery(String selector); // O(F()) where F() is the complexity of the selector
@ -391,5 +285,4 @@ class SelectorQuery {
// - Fragment
// - Root
}
</script>
```

View File

@ -2,10 +2,6 @@ Sky Event Model
===============
```dart
SKY MODULE
<!-- part of dart:sky -->
<script>
import 'dart:collection';
import 'dart:async';
@ -199,5 +195,4 @@ class EventTarget {
_eventsController.add(event);
}
}
</script>
```

View File

@ -2,10 +2,6 @@ Gestures
========
```dart
SKY MODULE
<!-- part of dart:sky -->
<script>
abstract class GestureEvent extends Event {
Gesture _gesture;
Gesture get gesture => _gesture;
@ -253,7 +249,6 @@ class GestureManager {
}
/*
</script>
```
Gestures defined in the framework

View File

@ -31,21 +31,36 @@ imported module:
<import src="path/to/chocolate.sky" as="chocolate" />
```
Each module implicitly imports the [Built-In Elements
Module](builtins.md).
When a module imports another, and the ``import`` element has no
``as`` attribute, then any elements registered in that module whose
tag names do not begin with an underscore must be registered on the
importing module. (If multiple elements are registered with the same
name, that name gets marked as dead for that module and all the
registrations for that name are discarded.)
TODO(ianh): decide if elements imported with "as" should be imported
but with the "as" name prefixed, as in ``<foo.button>``
Module API
----------
Each module consists of one or more libraries. The first library in a
module is the *element tree library*, which imports the dart:sky
module and then consists of the following code for a Sky module:
module is the *element tree library*, which consists of the following
code for a Sky module:
```dart
import 'dart:sky';
final Module module = new Module();
```
...and the following code for a Sky application:
```dart
import 'dart:sky';
final Module module = new Application();
```