From 00882d626a478a3ce391b736234a768b762c853a Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 23 Oct 2014 11:15:41 -0700 Subject: [PATCH 0001/1673] Open the Sky --- examples/README.md | 2 ++ examples/radio.sky | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/radio.sky diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000000..b027ed52f4 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,2 @@ +These are work-in-progress examples of how the language might look. +They won't currently work. diff --git a/examples/radio.sky b/examples/radio.sky new file mode 100644 index 0000000000..0cd15d04ff --- /dev/null +++ b/examples/radio.sky @@ -0,0 +1,78 @@ +SKY MODULE - radio button and radio button group + + + + + + + + + + From 928524947acf841d84f92dd595618d8bddb1bc06 Mon Sep 17 00:00:00 2001 From: Hixie Date: Thu, 23 Oct 2014 13:42:24 -0700 Subject: [PATCH 0002/1673] Placeholder Sky start page. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/677513002 --- examples/home.sky | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 examples/home.sky diff --git a/examples/home.sky b/examples/home.sky new file mode 100644 index 0000000000..3a447fd3db --- /dev/null +++ b/examples/home.sky @@ -0,0 +1,7 @@ +#!mojo mojo:sky + +

about:blank

+

Welcome to Sky!

From 86cd8beee788acec7abb668b7ad7bb7cef62523c Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Thu, 23 Oct 2014 14:56:44 -0700 Subject: [PATCH 0003/1673] Make skydb load examples/home.sky by default. I had to also register for the text/plain mime-type which turned out to be harder than expected. Mostly due to my confusion with mojo_shell using last-argument-wins argument parsing. R=ianh@google.com Review URL: https://codereview.chromium.org/672363002 --- examples/home.sky | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/home.sky b/examples/home.sky index 3a447fd3db..5cfbaecab4 100644 --- a/examples/home.sky +++ b/examples/home.sky @@ -1,7 +1,9 @@ #!mojo mojo:sky +

about:blank

Welcome to Sky!

+
From 3f008050a23d5f0506a00461353073eebbe8a2a7 Mon Sep 17 00:00:00 2001 From: Hixie Date: Fri, 24 Oct 2014 16:23:03 -0700 Subject: [PATCH 0004/1673] Enter a description of the change. Docs: Fix the script in the example to actually clone the template contents, not the template element itself. Review URL: https://codereview.chromium.org/680673002 --- examples/radio.sky | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/radio.sky b/examples/radio.sky index 0cd15d04ff..5920e50e97 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -14,7 +14,7 @@ SKY MODULE - radio button and radio button group module.exports.RadioElement = sky.registerElement('radio', class extends Element { constructor () { this.addEventListener('click', (event) => this.checked = true); - this.createShadowTree().appendChild(module.document.findId('radio-shadow').cloneNode(true)); + this.createShadowTree().appendChild(module.document.findId('radio-shadow').content.cloneNode(true)); } get checked () { return this.hasAttribute('checked'); From 5482eece0f4af94994825fdc4203acdc5e16ce0b Mon Sep 17 00:00:00 2001 From: Hixie Date: Wed, 29 Oct 2014 13:10:33 -0700 Subject: [PATCH 0005/1673] Docs: Update radio.sky to use the specced API for shadow roots Review URL: https://codereview.chromium.org/692563003 --- examples/radio.sky | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/radio.sky b/examples/radio.sky index 5920e50e97..a253af3121 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -14,7 +14,7 @@ SKY MODULE - radio button and radio button group module.exports.RadioElement = sky.registerElement('radio', class extends Element { constructor () { this.addEventListener('click', (event) => this.checked = true); - this.createShadowTree().appendChild(module.document.findId('radio-shadow').content.cloneNode(true)); + this.addShadowRoot(new sky.ShadowRoot(module.document.findId('radio-shadow').content.cloneNode(true))); } get checked () { return this.hasAttribute('checked'); @@ -48,7 +48,7 @@ SKY MODULE - radio button and radio button group @@ -47,34 +51,38 @@ SKY MODULE - radio button and radio button group From fe0d6c747fce8de75dfdf5d28b50b405b23a49af Mon Sep 17 00:00:00 2001 From: Rafael Weinstein Date: Fri, 31 Oct 2014 12:29:42 -0700 Subject: [PATCH 0008/1673] Add initial SkyElement & city-list example BUG= R=eseidel@chromium.org Review URL: https://codereview.chromium.org/698653002 --- examples/city-list/city-data-service.sky | 5048 ++++++++++++++++++++++ examples/city-list/city-list.sky | 595 +++ examples/city-list/city-sequence.sky | 64 + examples/city-list/index.sky | 33 + 4 files changed, 5740 insertions(+) create mode 100644 examples/city-list/city-data-service.sky create mode 100644 examples/city-list/city-list.sky create mode 100644 examples/city-list/city-sequence.sky create mode 100644 examples/city-list/index.sky diff --git a/examples/city-list/city-data-service.sky b/examples/city-list/city-data-service.sky new file mode 100644 index 0000000000..cd1855ff1d --- /dev/null +++ b/examples/city-list/city-data-service.sky @@ -0,0 +1,5048 @@ + + diff --git a/examples/city-list/city-list.sky b/examples/city-list/city-list.sky new file mode 100644 index 0000000000..0162f6c08d --- /dev/null +++ b/examples/city-list/city-list.sky @@ -0,0 +1,595 @@ + + + + + + + + + + + + + + + + + diff --git a/examples/city-list/city-sequence.sky b/examples/city-list/city-sequence.sky new file mode 100644 index 0000000000..2e82825a39 --- /dev/null +++ b/examples/city-list/city-sequence.sky @@ -0,0 +1,64 @@ + + diff --git a/examples/city-list/index.sky b/examples/city-list/index.sky new file mode 100644 index 0000000000..766ac8b670 --- /dev/null +++ b/examples/city-list/index.sky @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + From 956d7b3efc631face92ac58cd506424ad7dc2f71 Mon Sep 17 00:00:00 2001 From: Hixie Date: Fri, 31 Oct 2014 16:18:46 -0700 Subject: [PATCH 0009/1673] Specs: make element registrations be per-module, define how they are exported and reexported, rename 'interface' to 'class' in the IDL, add constructors to all registered elements R=esprehn@chromium.org Review URL: https://codereview.chromium.org/695043002 --- examples/radio.sky | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/radio.sky b/examples/radio.sky index 5c9be9dbf1..36daa1c349 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -1,6 +1,9 @@ SKY MODULE - radio button and radio button group - + + From 1befcbfe671397eee13c4e976640026b4ec3cec9 Mon Sep 17 00:00:00 2001 From: Hixie Date: Mon, 3 Nov 2014 16:52:47 -0800 Subject: [PATCH 0012/1673] Specs: Drop the concept of late-bound elements. An element can never be upgraded. This has the following implications: - There's no createElement() function any more. If you want to create an element from script, you have to use its constructor. - There's no async element registration. The parser will block until all the imports are imported when you use a tag name of a custom element that hasn't been registered yet, in case one of the imports defines it. - If you try to construct a non-registered element in markup, it turns into an element. -
, , and are new built-in elements. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/695423004 --- examples/home.sky | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/home.sky b/examples/home.sky index 5cfbaecab4..7580b5eb72 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!
+
From 44ac35308cf96fb6e0a180f5044859ac7d5df0fd Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 3 Nov 2014 19:05:48 -0800 Subject: [PATCH 0013/1673] Don't GC message pipes that have an in-flight request In mojom, there's a notion of a request/response pair. This CL teaches the JS bindings not to GC a message pipe after a request has been issued but before the response has been received. R=hansmuller@chromium.org Review URL: https://codereview.chromium.org/696373003 --- examples/file-browser.sky | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/file-browser.sky b/examples/file-browser.sky index 6d02f84839..43c1267b30 100644 --- a/examples/file-browser.sky +++ b/examples/file-browser.sky @@ -28,7 +28,7 @@ SkyElement({ directories: [], attached: function() { this.url = this.ownerDocument.URL; - var xhr = this.xhr_ = new XMLHttpRequest(); + var xhr = new XMLHttpRequest(); xhr.open('GET', this.url + '?format=json'); xhr.onload = (function() { var listing = JSON.parse(xhr.responseText); From 01f3d8fa67a93b0339e1266a6fc349062a15feea Mon Sep 17 00:00:00 2001 From: Hixie Date: Tue, 4 Nov 2014 11:57:02 -0800 Subject: [PATCH 0014/1673] Specs: define registerElement() more carefully; add an 'end tag parsed' callback; pass the element's module to the constructor when constructing a custom element (these are rather experimental changes and we may want to go a different way on this stuff) Review URL: https://codereview.chromium.org/701873004 --- examples/radio.sky | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/radio.sky b/examples/radio.sky index 36daa1c349..6cafa7199c 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -16,9 +16,9 @@ SKY MODULE - radio button and radio button group module.exports.RadioElement = module.registerElement({ tagName: 'radio', shadow: true, - prototype: class extends Element { - constructor () { - super(); + prototype: (class extends Element { + constructor (module) { + super(module); this.addEventListener('click', (event) => this.checked = true); this.shadowRoot.appendChild(module.document.findId('radio-shadow').content.cloneNode(true)); } @@ -42,7 +42,7 @@ SKY MODULE - radio button and radio button group if (this.parentNode instanceof module.exports.RadioGroupElement) this.parentNode.setChecked(this); } - }, + }).prototype, }); @@ -56,9 +56,9 @@ SKY MODULE - radio button and radio button group module.exports.RadioGroupElement = module.registerElement({ tagName: 'radiogroup', shadow: true, - prototype: class extends Element { - constructor () { - super(); + prototype: (class extends Element { + constructor (module) { + super(module); this.shadowRoot.appendChild(module.document.findId('radiogroup-shadow').content.cloneNode(true)); } get value () { @@ -85,6 +85,6 @@ SKY MODULE - radio button and radio button group if (child != radio) child.checked = false; } - }, + }).prototype, }); From 61f4494e255e5c29a2ba8db67716988aad1dc1a2 Mon Sep 17 00:00:00 2001 From: Hixie Date: Tue, 4 Nov 2014 12:16:49 -0800 Subject: [PATCH 0015/1673] Specs: define registerElement() a little differently, so that the code that uses it looks nicer; this moves the complexity to places that register elements without using 'class' (e.g. the internals of frameworks that create elements for defining elements) Review URL: https://codereview.chromium.org/699083005 --- examples/radio.sky | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/radio.sky b/examples/radio.sky index 6cafa7199c..b5b139bb73 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -16,7 +16,7 @@ SKY MODULE - radio button and radio button group module.exports.RadioElement = module.registerElement({ tagName: 'radio', shadow: true, - prototype: (class extends Element { + constructor: class extends Element { constructor (module) { super(module); this.addEventListener('click', (event) => this.checked = true); @@ -42,7 +42,7 @@ SKY MODULE - radio button and radio button group if (this.parentNode instanceof module.exports.RadioGroupElement) this.parentNode.setChecked(this); } - }).prototype, + }, }); @@ -53,10 +53,10 @@ SKY MODULE - radio button and radio button group From 1da15583c5bb968fdc0bce3bd8f40a8fcdbf480e Mon Sep 17 00:00:00 2001 From: Hixie Date: Tue, 4 Nov 2014 13:32:07 -0800 Subject: [PATCH 0016/1673] Docs: add an example that uses the current APIs to define an element; an example that uses that example to define some HTMLy elements; and an example to use those HTMLy elements to display a hello world doc. Highly incomplete WIP. Review URL: https://codereview.chromium.org/698293003 --- examples/htmlish/framework/element.sky | 72 ++++++++++++++++ examples/htmlish/framework/htmlish.sky | 109 +++++++++++++++++++++++++ examples/htmlish/samples/intro.sky | 11 +++ 3 files changed, 192 insertions(+) create mode 100644 examples/htmlish/framework/element.sky create mode 100644 examples/htmlish/framework/htmlish.sky create mode 100644 examples/htmlish/samples/intro.sky diff --git a/examples/htmlish/framework/element.sky b/examples/htmlish/framework/element.sky new file mode 100644 index 0000000000..ab792677d4 --- /dev/null +++ b/examples/htmlish/framework/element.sky @@ -0,0 +1,72 @@ +SKY MODULE - defines an element + + + + + diff --git a/examples/htmlish/framework/htmlish.sky b/examples/htmlish/framework/htmlish.sky new file mode 100644 index 0000000000..1baf62f5f0 --- /dev/null +++ b/examples/htmlish/framework/htmlish.sky @@ -0,0 +1,109 @@ +SKY MODULE - exports some basic HTML-like elements + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/htmlish/samples/intro.sky b/examples/htmlish/samples/intro.sky new file mode 100644 index 0000000000..c200e2d831 --- /dev/null +++ b/examples/htmlish/samples/intro.sky @@ -0,0 +1,11 @@ +#!mojo mojo:sky + + + + Welcome to Sky + + +

Introduction

+

Hello world.

+ + From 842d46667aea31501f4d0312a47db1076c342e3e Mon Sep 17 00:00:00 2001 From: Hixie Date: Tue, 4 Nov 2014 14:15:40 -0800 Subject: [PATCH 0017/1673] Docs: We renamed appendChild to append, so update this example which still uses the old name. Review URL: https://codereview.chromium.org/685063006 --- examples/radio.sky | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/radio.sky b/examples/radio.sky index b5b139bb73..cb39cdb0d7 100644 --- a/examples/radio.sky +++ b/examples/radio.sky @@ -20,7 +20,7 @@ SKY MODULE - radio button and radio button group constructor (module) { super(module); this.addEventListener('click', (event) => this.checked = true); - this.shadowRoot.appendChild(module.document.findId('radio-shadow').content.cloneNode(true)); + this.shadowRoot.append(module.document.findId('radio-shadow').content.cloneNode(true)); } get checked () { return this.hasAttribute('checked'); @@ -59,7 +59,7 @@ SKY MODULE - radio button and radio button group constructor: (class extends Element { constructor (module) { super(module); - this.shadowRoot.appendChild(module.document.findId('radiogroup-shadow').content.cloneNode(true)); + this.shadowRoot.append(module.document.findId('radiogroup-shadow').content.cloneNode(true)); } get value () { let children = this.getChildNodes(); From 018e6ba3bb0a867aaa7915ef39d31551cd394a04 Mon Sep 17 00:00:00 2001 From: Rafael Weinstein Date: Tue, 4 Nov 2014 15:21:57 -0800 Subject: [PATCH 0018/1673] fix file-browser R=eseidel@chromium.org, abarth BUG= Review URL: https://codereview.chromium.org/705683002 --- examples/file-browser.sky | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/file-browser.sky b/examples/file-browser.sky index 43c1267b30..ba456ae9e3 100644 --- a/examples/file-browser.sky +++ b/examples/file-browser.sky @@ -13,11 +13,11 @@ } File browser for {{ url }} -