Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: sky/specs/apis.md

Issue 716013002: Specs: Initial hack at extensible style/layout (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/examples/style/toolbar-layout.sky ('k') | sky/specs/style.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 APIs 1 APIs
2 ==== 2 ====
3 3
4 The Sky core API 4 The Sky core API
5 ---------------- 5 ----------------
6 6
7 ```javascript 7 ```javascript
8 module 'sky:core' { 8 module 'sky:core' {
9 9
10 // EVENTS 10 // EVENTS
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 Element? find(TreeScope root); // O(N*F()) where N is the number of descenda nts 144 Element? find(TreeScope root); // O(N*F()) where N is the number of descenda nts
145 Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the numb er of descendants and M the average depth of the tree 145 Array<Element> findAll(Element root); // O(N*F())+O(N*M) where N is the numb er of descendants and M the average depth of the tree
146 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree 146 Array<Element> findAll(DocumentFragment root); // O(N*F())+O(N*M) where N is the number of descendants and M the average depth of the tree
147 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of descendants 147 Array<Element> findAll(TreeScope root); // O(N*F()) where N is the number of descendants
148 } 148 }
149 149
150 150
151 // BUILT-IN ELEMENTS 151 // BUILT-IN ELEMENTS
152 152
153 class ImportElement : Element { 153 class ImportElement : Element {
154 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 154 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
155 constructor (ChildArguments... nodes); // shorthand 155 constructor (ChildArguments... nodes); // shorthand
156 constructor (Dictionary attributes); // shorthand 156 constructor (Dictionary<String> attributes); // shorthand
157 constructor (); // shorthand 157 constructor (); // shorthand
158 constructor attribute String tagName; // O(1) // "import" 158 constructor attribute String tagName; // O(1) // "import"
159 constructor attribute Boolean shadow; // O(1) // false 159 constructor attribute Boolean shadow; // O(1) // false
160 } 160 }
161 class TemplateElement : Element { 161 class TemplateElement : Element {
162 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 162 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
163 constructor (ChildArguments... nodes); // shorthand 163 constructor (ChildArguments... nodes); // shorthand
164 constructor (Dictionary attributes); // shorthand 164 constructor (Dictionary<String> attributes); // shorthand
165 constructor (); // shorthand 165 constructor (); // shorthand
166 constructor attribute String tagName; // O(1) // "template" 166 constructor attribute String tagName; // O(1) // "template"
167 constructor attribute Boolean shadow; // O(1) // false 167 constructor attribute Boolean shadow; // O(1) // false
168 168
169 readonly attribute DocumentFragment content; // O(1) 169 readonly attribute DocumentFragment content; // O(1)
170 } 170 }
171 class ScriptElement : Element { 171 class ScriptElement : Element {
172 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 172 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
173 constructor (ChildArguments... nodes); // shorthand 173 constructor (ChildArguments... nodes); // shorthand
174 constructor (Dictionary attributes); // shorthand 174 constructor (Dictionary<String> attributes); // shorthand
175 constructor (); // shorthand 175 constructor (); // shorthand
176 constructor attribute String tagName; // O(1) // "script" 176 constructor attribute String tagName; // O(1) // "script"
177 constructor attribute Boolean shadow; // O(1) // false 177 constructor attribute Boolean shadow; // O(1) // false
178 } 178 }
179 class StyleElement : Element { 179 class StyleElement : Element {
180 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 180 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
181 constructor (ChildArguments... nodes); // shorthand 181 constructor (ChildArguments... nodes); // shorthand
182 constructor (Dictionary attributes); // shorthand 182 constructor (Dictionary<String> attributes); // shorthand
183 constructor (); // shorthand 183 constructor (); // shorthand
184 constructor attribute String tagName; // O(1) // "style" 184 constructor attribute String tagName; // O(1) // "style"
185 constructor attribute Boolean shadow; // O(1) // false 185 constructor attribute Boolean shadow; // O(1) // false
186 } 186 }
187 class ContentElement : Element { 187 class ContentElement : Element {
188 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 188 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
189 constructor (ChildArguments... nodes); // shorthand 189 constructor (ChildArguments... nodes); // shorthand
190 constructor (Dictionary attributes); // shorthand 190 constructor (Dictionary<String> attributes); // shorthand
191 constructor (); // shorthand 191 constructor (); // shorthand
192 constructor attribute String tagName; // O(1) // "content" 192 constructor attribute String tagName; // O(1) // "content"
193 constructor attribute Boolean shadow; // O(1) // false 193 constructor attribute Boolean shadow; // O(1) // false
194 194
195 Array<Node> getDistributedNodes(); // O(N) in distributed nodes 195 Array<Node> getDistributedNodes(); // O(N) in distributed nodes
196 } 196 }
197 class ImgElement : Element { 197 class ImgElement : Element {
198 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 198 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
199 constructor (ChildArguments... nodes); // shorthand 199 constructor (ChildArguments... nodes); // shorthand
200 constructor (Dictionary attributes); // shorthand 200 constructor (Dictionary<String> attributes); // shorthand
201 constructor (); // shorthand 201 constructor (); // shorthand
202 constructor attribute String tagName; // O(1) // "img" 202 constructor attribute String tagName; // O(1) // "img"
203 constructor attribute Boolean shadow; // O(1) // false 203 constructor attribute Boolean shadow; // O(1) // false
204 } 204 }
205 class DivElement : Element { 205 class DivElement : Element {
206 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 206 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
207 constructor (ChildArguments... nodes); // shorthand 207 constructor (ChildArguments... nodes); // shorthand
208 constructor (Dictionary attributes); // shorthand 208 constructor (Dictionary<String> attributes); // shorthand
209 constructor (); // shorthand 209 constructor (); // shorthand
210 constructor attribute String tagName; // O(1) // "div" 210 constructor attribute String tagName; // O(1) // "div"
211 constructor attribute Boolean shadow; // O(1) // false 211 constructor attribute Boolean shadow; // O(1) // false
212 } 212 }
213 class SpanElement : Element { 213 class SpanElement : Element {
214 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 214 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
215 constructor (ChildArguments... nodes); // shorthand 215 constructor (ChildArguments... nodes); // shorthand
216 constructor (Dictionary attributes); // shorthand 216 constructor (Dictionary<String> attributes); // shorthand
217 constructor (); // shorthand 217 constructor (); // shorthand
218 constructor attribute String tagName; // O(1) // "span" 218 constructor attribute String tagName; // O(1) // "span"
219 constructor attribute Boolean shadow; // O(1) // false 219 constructor attribute Boolean shadow; // O(1) // false
220 } 220 }
221 class IframeElement : Element { 221 class IframeElement : Element {
222 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 222 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
223 constructor (ChildArguments... nodes); // shorthand 223 constructor (ChildArguments... nodes); // shorthand
224 constructor (Dictionary attributes); // shorthand 224 constructor (Dictionary<String> attributes); // shorthand
225 constructor (); // shorthand 225 constructor (); // shorthand
226 constructor attribute String tagName; // O(1) // "iframe" 226 constructor attribute String tagName; // O(1) // "iframe"
227 constructor attribute Boolean shadow; // O(1) // false 227 constructor attribute Boolean shadow; // O(1) // false
228 } 228 }
229 class TElement : Element { 229 class TElement : Element {
230 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 230 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
231 constructor (ChildArguments... nodes); // shorthand 231 constructor (ChildArguments... nodes); // shorthand
232 constructor (Dictionary attributes); // shorthand 232 constructor (Dictionary<String> attributes); // shorthand
233 constructor (); // shorthand 233 constructor (); // shorthand
234 constructor attribute String tagName; // O(1) // "t" 234 constructor attribute String tagName; // O(1) // "t"
235 constructor attribute Boolean shadow; // O(1) // false 235 constructor attribute Boolean shadow; // O(1) // false
236 } 236 }
237 class AElement : Element { 237 class AElement : Element {
238 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 238 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
239 constructor (ChildArguments... nodes); // shorthand 239 constructor (ChildArguments... nodes); // shorthand
240 constructor (Dictionary attributes); // shorthand 240 constructor (Dictionary<String> attributes); // shorthand
241 constructor (); // shorthand 241 constructor (); // shorthand
242 constructor attribute String tagName; // O(1) // "a" 242 constructor attribute String tagName; // O(1) // "a"
243 constructor attribute Boolean shadow; // O(1) // false 243 constructor attribute Boolean shadow; // O(1) // false
244 } 244 }
245 class TitleElement : Element { 245 class TitleElement : Element {
246 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 246 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
247 constructor (ChildArguments... nodes); // shorthand 247 constructor (ChildArguments... nodes); // shorthand
248 constructor (Dictionary attributes); // shorthand 248 constructor (Dictionary<String> attributes); // shorthand
249 constructor (); // shorthand 249 constructor (); // shorthand
250 constructor attribute String tagName; // O(1) // "title" 250 constructor attribute String tagName; // O(1) // "title"
251 constructor attribute Boolean shadow; // O(1) // false 251 constructor attribute Boolean shadow; // O(1) // false
252 } 252 }
253 class ErrorElement : Element { 253 class ErrorElement : Element {
254 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 254 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
255 constructor (ChildArguments... nodes); // shorthand 255 constructor (ChildArguments... nodes); // shorthand
256 constructor (Dictionary attributes); // shorthand 256 constructor (Dictionary<String> attributes); // shorthand
257 constructor (); // shorthand 257 constructor (); // shorthand
258 constructor attribute String tagName; // O(1) // "error" 258 constructor attribute String tagName; // O(1) // "error"
259 constructor attribute Boolean shadow; // O(1) // false 259 constructor attribute Boolean shadow; // O(1) // false
260 } 260 }
261 261
262 262
263 263
264 // MODULES 264 // MODULES
265 265
266 callback InternalElementConstructor void (Module module); 266 callback InternalElementConstructor void (Module module);
267 dictionary ElementRegistration { 267 dictionary ElementRegistration {
268 String tagName; 268 String tagName;
269 Boolean shadow = false; 269 Boolean shadow = false;
270 InternalElementConstructor? constructor = null; 270 InternalElementConstructor? constructor = null;
271 } 271 }
272 272
273 interface ElementConstructor { 273 interface ElementConstructor {
274 constructor (Dictionary attributes, ChildArguments... nodes); // O(M+N), M = number of attributes, N = number of nodes plus all their descendants 274 constructor (Dictionary<String> attributes, ChildArguments... nodes); // O(M +N), M = number of attributes, N = number of nodes plus all their descendants
275 constructor (ChildArguments... nodes); // shorthand 275 constructor (ChildArguments... nodes); // shorthand
276 constructor (Dictionary attributes); // shorthand 276 constructor (Dictionary<String> attributes); // shorthand
277 constructor (); // shorthand 277 constructor (); // shorthand
278 278
279 constructor attribute String tagName; 279 constructor attribute String tagName;
280 constructor attribute Boolean shadow; 280 constructor attribute Boolean shadow;
281 } 281 }
282 282
283 abstract class AbstractModule : EventTarget { 283 abstract class AbstractModule : EventTarget {
284 readonly attribute Document document; // O(1) // the Documentof the module o r application 284 readonly attribute Document document; // O(1) // the Documentof the module o r application
285 Promise<any> import(String url); // O(Yikes) // returns the module's exports 285 Promise<any> import(String url); // O(Yikes) // returns the module's exports
286 286
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 foo[debug.Bar] 445 foo[debug.Bar]
446 </script> 446 </script>
447 ``` 447 ```
448 448
449 ### Types ### 449 ### Types ###
450 450
451 The following types are available: 451 The following types are available:
452 452
453 * ``Integer`` - WebIDL ``long long`` 453 * ``Integer`` - WebIDL ``long long``
454 * ``Float`` - WebIDL ``double`` 454 * ``Float`` - WebIDL ``double``
455 * ``Infinity`` - singleton type with value ``Infinity``
455 * ``String`` - WebIDL ``USVString`` 456 * ``String`` - WebIDL ``USVString``
456 * ``Boolean`` - WebIDL ``boolean`` 457 * ``Boolean`` - WebIDL ``boolean``
457 # ``Object`` - WebIDL ``object`` (``ClassName`` can be used as a literal for thi s type) 458 # ``Object`` - WebIDL ``object`` (``ClassName`` can be used as a literal for thi s type)
458 * ``ClassName`` - an instance of the class ClassName 459 * ``ClassName`` - an instance of the class ClassName
459 * ``DictionaryName`` - an instance of the dictionary DictionaryName 460 * ``DictionaryName`` - an instance of the dictionary DictionaryName
460 * ``Promise<Type>`` - WebIDL ``Promise<T>`` 461 * ``Promise<Type>`` - WebIDL ``Promise<T>``
462 * ``Generator<Type>`` - An ECMAScript generator function that returns data of th e given type
461 * ``Array<Type>`` - WebIDL ``sequence<T>`` 463 * ``Array<Type>`` - WebIDL ``sequence<T>``
462 * ``Dictionary`` - unordered set of name-value String-String pairs with no dupli cate names 464 * ``Dictionary<Type>`` - unordered set of name-value String-Type pairs with no d uplicate names
463 * ``Type?`` - union of Type and the singleton type with value ``null`` (WebIDL n ullable) 465 * ``Type?`` - union of Type and the singleton type with value ``null`` (WebIDL n ullable)
464 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union) 466 * ``(Type1 or Type2)`` - union of Type1 and Type2 (WebIDL union)
465 * ``any`` - union of all types (WebIDL ``any``) 467 * ``any`` - union of all types (WebIDL ``any``)
466 468
467 Methods that return nothing (undefined, in JS) use the keyword "void" 469 Methods that return nothing (undefined, in JS) use the keyword "void"
468 instead of a type. 470 instead of a type.
469 471
470 472
471 TODO(ianh): Define in detail how this actually works 473 TODO(ianh): Define in detail how this actually works
472 474
(...skipping 19 matching lines...) Expand all
492 the core mojo fabric JS API sky:mojo:fabric:core 494 the core mojo fabric JS API sky:mojo:fabric:core
493 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc 495 the asyncWait/cancelWait mojo fabric JS API (interface to IPC thread) sky:moj o:fabric:ipc
494 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell 496 the mojom for the shell, proxying through C++ so that the shell pipe isn't exp osed sky:mojo:shell
495 the sky API sky:core 497 the sky API sky:core
496 the sky debug symbols for private APIs sky:debug 498 the sky debug symbols for private APIs sky:debug
497 ``` 499 ```
498 500
499 TODO(ianh): determine if we want to separate the "this" from the 501 TODO(ianh): determine if we want to separate the "this" from the
500 Document, especially for Modules, so that exposing a module's element 502 Document, especially for Modules, so that exposing a module's element
501 doesn't expose the module's exports attribute. 503 doesn't expose the module's exports attribute.
OLDNEW
« no previous file with comments | « sky/examples/style/toolbar-layout.sky ('k') | sky/specs/style.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698