diff --git a/examples/home.sky b/examples/home.sky index 5cfbaecab44..7580b5eb72a 100644 --- a/examples/home.sky +++ b/examples/home.sky @@ -1,9 +1,9 @@ #!mojo mojo:sky - +
-

about:blank

-

Welcome to Sky!

- +
about:blank
+
Welcome to Sky!
+
diff --git a/specs/apis.md b/specs/apis.md index 71d003ef04f..d2701756d78 100644 --- a/specs/apis.md +++ b/specs/apis.md @@ -142,18 +142,25 @@ module 'sky:core' { Array findAll(ParentNode root); // O(N*F()) where N is the number of descendants } - // Built-in Elements + + // BUILT-IN ELEMENTS + class ImportElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "import" + constructor attribute Boolean shadow; // O(1) // false } class TemplateElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "template" + constructor attribute Boolean shadow; // O(1) // false + readonly attribute DocumentFragment content; // O(1) } class ScriptElement : Element { @@ -161,18 +168,25 @@ module 'sky:core' { constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "script" + constructor attribute Boolean shadow; // O(1) // false } class StyleElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "style" + constructor attribute Boolean shadow; // O(1) // false } class ContentElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "content" + constructor attribute Boolean shadow; // O(1) // false + Array getDistributedNodes(); // O(N) in distributed nodes } class ImgElement : Element { @@ -180,34 +194,70 @@ module 'sky:core' { constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "img" + constructor attribute Boolean shadow; // O(1) // false + } + class DivElement : Element { + constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants + constructor (ChildArguments... nodes); // shorthand + constructor (Dictionary attributes); // shorthand + constructor (); // shorthand + constructor attribute String tagName; // O(1) // "div" + constructor attribute Boolean shadow; // O(1) // false + } + class SpanElement : Element { + constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants + constructor (ChildArguments... nodes); // shorthand + constructor (Dictionary attributes); // shorthand + constructor (); // shorthand + constructor attribute String tagName; // O(1) // "span" + constructor attribute Boolean shadow; // O(1) // false } class IframeElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "iframe" + constructor attribute Boolean shadow; // O(1) // false } class TElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "t" + constructor attribute Boolean shadow; // O(1) // false } class AElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "a" + constructor attribute Boolean shadow; // O(1) // false } class TitleElement : Element { constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants constructor (ChildArguments... nodes); // shorthand constructor (Dictionary attributes); // shorthand constructor (); // shorthand + constructor attribute String tagName; // O(1) // "title" + constructor attribute Boolean shadow; // O(1) // false + } + class ErrorElement : Element { + constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants + constructor (ChildArguments... nodes); // shorthand + constructor (Dictionary attributes); // shorthand + constructor (); // shorthand + constructor attribute String tagName; // O(1) // "error" + constructor attribute Boolean shadow; // O(1) // false } + // MODULES + dictionary ElementRegistration { String tagName; Boolean shadow = false; @@ -224,20 +274,13 @@ module 'sky:core' { constructor attribute Boolean shadow; } - // MODULES abstract class AbstractModule : EventTarget { readonly attribute Document document; // O(1) // the Documentof the module or application Promise import(String url); // O(Yikes) // returns the module's exports readonly attribute String url; - // createElement() lets you create elements that will be upgraded later when you register the element - Element createElement(String tagName, Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants - Element createElement(String tagName, Dictionary attributes); // shorthand - Element createElement(String tagName, ChildArguments... nodes); // shorthand - Element createElement(String tagName); // shorthand - - ElementConstructor registerElement(ElementRegistration options); // O(N) in number of outstanding elements with that tag name to be upgraded + ElementConstructor registerElement(ElementRegistration options); // O(1) // if you call registerElement() with an object that was created by // registerElement(), it just returns the object after registering it, // rather than creating a new constructor diff --git a/specs/markup.md b/specs/markup.md index 7708c514c8c..29e92a4ac74 100644 --- a/specs/markup.md +++ b/specs/markup.md @@ -144,6 +144,11 @@ Sky Markup: Elements The Sky language consists of very few elements, since it is expected that everything of note would be provided by frameworks. +The following elements are implicitly registered by default, even if +you haven't imported anything. You can get to their constructors if +you import sky:core (basically, sky:core is always imported by defaul; +it's the runtime library). None of these elements have shadow trees. + ```` - Downloads and imports foo.sky in the background. @@ -176,6 +181,12 @@ that everything of note would be provided by frameworks. - Sky fetches the bits for foo.bin, looks for a decoder for those bits, and renders the bits that the decoder returns. +``
`` + - Element that does nothing. + +```` + - Element that does nothing. + ``