5 classes : false, // flat version of list of classes
6 currentClass : '--none--', // currently viewed class name
15 Roo.XComponent.hideProgress = true;
16 Roo.XComponent.build();
19 Roo.XComponent.on('buildcomplete', function() {
21 //Roo.XComponent.modules[0].el.fireEvent('render');
23 if (window.location.search.length > 0) {
24 Roo.docs.roo_title.el.dom.innerHTML = "Flutter Documentation";
28 if (window.location.search.length > 0) {
29 this.prefix = "/flutter/";
33 window.onhashchange = function() { Roo.docs.init.onHashChange(); }
40 Roo.docs.doc_body_content.hide();
43 url : this.prefix + 'tree.json',
45 success : function(res, o)
47 var d = Roo.decode(res.responseText);
51 d = d.sort(Roo.docs.template.makeSortby("name"));
53 // our classes witch children first..
54 d.forEach(function(e) {
56 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem', true );
61 d.forEach(function(e) {
63 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem' ,true);
69 d.forEach(function(e) {
71 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
76 d.forEach(function(e) {
78 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
82 var roo = Roo.docs.navGroup.items[1].menu;
83 if (!Roo.docs.init.prefix.length) {
84 roo.show(roo.triggerEl, '?', false);
87 if (location.hash.length) {
102 hideChildren : function(c)
107 for (var i =0; i < c.cn.length; i++) {
108 this.hideChildren(c.cn[i]);
114 addTreeItem : function(parent, e, type , parent_e) {
116 this.classes[e.name] = e;
118 var node = parent.addxtypeChild(Roo.factory({
119 html: e.name.split('.').pop(),
124 preventDefault : true,
125 // cls : type == 'NavSidebarItem' ? 'open' : '',
127 click : (function(mi,ev,c)
132 if (c.cn.length && mi.xtype == 'MenuItem') {
134 if (mi.menu.el.hasClass('show')) {
135 this.hideChildren(c); //mi.menu.hide();
136 // collapse children..
141 mi.menu.show(mi.menu.triggerEl,'?', false);
145 location.hash = '#' + c.name;
146 //Roo.docs.init.loadDoc(c);
148 }).createDelegate(this,[e], true)
151 fa : e.cn.length ? 'chevron-right' : '',
152 menu : !e.cn.length ? false : Roo.factory({
157 beforehide : (function(mi,c)
159 if (Roo.docs.init.prefix.length) {
163 if (c.name.split('.').length < 2) {
168 }).createDelegate(this,[e], true)
182 if (parent_e !== false) {
184 e.parent_menu = parent;
185 e.parent = parent_e == true ? null : parent_e;
188 parent.items.push(node);
189 if (e.cn.length && type == 'NavSidebarItem') {
190 this.topm = node.menu;
197 e.cn.forEach(function(ec) {
198 var cn = ec.name.split('.').pop();
200 if (cn == cn.toLowerCase()) {
201 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
205 e.cn.forEach(function(ec) {
206 var cn = ec.name.split('.').pop();
207 if (cn != cn.toLowerCase()) {
208 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
214 loadClass : function(name)
216 if(typeof(this.classes[name]) != 'undefined' && this.classes[name].is_class ) {
217 this.loadDoc(this.classes[name]);
224 loadSource : function( )
229 url : 'src/' +this.currentClass.replace(/\./g,'_') + '.js.html',
231 success : function(res, o)
233 Roo.docs.ViewSource.show({
234 source : res.responseText,
235 fname : this.currentClass.replace(/\./g,'/') + ".js"
245 loadDoc : function(cls)
247 if (this.currentClass == cls.name) {
250 //Roo.docs.mobileNavGroup.hide();
252 Roo.docs.doc_body_content.hide();
253 Roo.docs.navHeaderBar.collapse();
254 this.currentClass = cls.name;
256 Roo.docs.introBody.show();
262 var m = cls.parent_menu;
263 m.show(m.triggerEl,'?', false);
265 while ((mp = mp.parent)) {
267 m.show(m.triggerEl,'?', false);
269 cls.node.el.scrollIntoView(Roo.docs.sidebar.el,false);
270 Roo.docs.sidebar.el.select('.active').removeClass('active');
271 cls.node.el.addClass('active');
273 Roo.docs.introBody.hide();
274 Roo.docs.doc_body_content.show();
276 url : this.prefix + 'symbols/' + cls.name + '.json',
278 success : function(res, o)
281 var d = Roo.decode(res.responseText);
283 if (typeof(d.augments) == 'undefined') {
285 d.config = []; // props for ctor?
287 d.config= d.props; // hack..
289 this.fillAugments(d, d.extends, Roo.docs.init.fillDoc);
302 fillAugments : function(d, ext, cb )
305 if (Roo.docs.init.n > 20) {
312 var next = ext.shift();
313 d.augments.push(next);
314 var ax = new Roo.data.Connection({});
316 url : this.prefix + 'symbols/' + next + '.json',
318 success : function(res, o)
321 var r = Roo.decode(res.responseText);
324 // copy methods that are not constructors..
326 r.methods.forEach(function(m) {
328 if (d.methods.find(function(e) {
329 return e.name == m.name;
333 if (m.isConstructor || m.static) {
339 r.props.forEach(function(m) {
343 if (d.props.find(function(e) {
344 return e.name == m.name;
352 r.events.forEach(function(m) {
353 if (d.events.find(function(e) {
354 return e.name == m.name;
363 this.fillAugments(d,ext, cb)
373 fillDoc : function(d)
376 "name" : "Roo.bootstrap.Progress",
378 "Roo.bootstrap.Component",
380 "Roo.util.Observable"
382 "desc" : "Bootstrap Progress class",
387 Roo.docs.classType.el.dom.firstChild.textContent = 'Class ';
389 Roo.docs.classType.el.dom.firstChild.textContent = 'abstract class ';
392 Roo.docs.classType.el.dom.firstChild.textContent = 'enum ';
395 Roo.docs.classType.el.dom.firstChild.textContent = 'mixin ';
397 document.body.scrollTop = 0;
398 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
399 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
400 Roo.docs.doc_extends.hide();
401 Roo.docs.doc_extends_sep.hide();
402 if (d.augments.length) {
403 Roo.docs.doc_extends.show();
404 Roo.docs.doc_extends_sep.show();
405 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
406 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
408 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
409 if (Roo.docs.init.prefix.length) {
410 Roo.docs.doc_source_row.hide();
414 if (d.augments.length) {
415 Roo.docs.augments.show();
416 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
418 Roo.docs.augments.hide();
421 if (d.realImplementors && d.realImplementors.length) {
422 Roo.docs.implementors.show();
423 Roo.docs.implementors.bodyEl().dom.innerHTML = Roo.docs.template.implementors(d);
425 Roo.docs.implementors.hide();
429 Roo.docs.configTableContainer.hide();
430 Roo.docs.methodsTableContainer.hide();
431 Roo.docs.eventsTableContainer.hide();
432 if (d.config.length) {
433 Roo.docs.configTableContainer.show();
434 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
437 if (d.methods.length) {
438 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
439 Roo.docs.methodsTableContainer.show();
441 if (d.events.length) {
442 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
443 Roo.docs.eventsTableContainer.show();
448 onClick : function(e)
450 if (e.target.nodeName != 'A') {
453 if (!e.target.href.match(/#/)) {
457 var link = e.target.href.split('#')[1];
458 this.loadClass(link);
462 onHashChange : function()
464 if (this.hash == location.hash) {
470 loadHash : function()
472 if (location.hash.length < 2) {
475 this.loadClass(location.hash.substring(1));
476 this.hash = location.hash;
480 loadIntro : function()
487 success : function(res)
489 this.renderIntro(res.responseText);
498 // render the really simple markdown data
499 renderIntro : function(intro)
502 Roo.docs.doc_body_content.hide();
505 var lines = intro.split("\n");
506 var tree = { 'name' : 'root', cn : []};
507 var state = [ tree ];
508 for (var i=0;i< lines.length;i++) {
510 if (!line.length || line.match(/^\s+$/)) {
513 var sm = line.match(/^(\s+)(.*)/);
515 var sml = sm ? sm[1].length: 0;
517 sml = sml / 4; // 4 spaces indent?
518 var add = { name : sm ? sm[2] : line, cn : [] };
519 state[sml].cn.push(add);
525 for(var i = 0; i < tree.cn.length; i++) {
526 // make a container..
527 var treei = tree.cn[i];
542 for(var ii = 0; ii < treei.cn.length; ii++) {
543 var treeii = treei.cn[ii];
544 // another container..
546 header : treeii.name,
561 ctree.items[0].items.push(ctreei);
563 for(var iii = 0; iii < treeii.cn.length; iii++) {
564 var treeiii = treeii.cn[iii];
565 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
566 //Roo.log(treeiii.name);
567 if (treeiii.name == 'Examples') {
568 for (var j =0;j< treeiii.cn.length; j++) {
569 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
570 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
586 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
587 html : ll ? ll[1] : treeiii.name,
594 html : ll && ll[2].length ? ' - ' + ll[2] : '',
602 ctreei.items.push(ctreeii);
606 //Roo.log("footer:"+ footer);
607 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
616 Roo.docs.introBody.addxtypeChild(ctree);
628 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);