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)
131 if (c.cn.length && mi.xtype == 'MenuItem') {
133 if (mi.menu.el.hasClass('show')) {
134 this.hideChildren(c); //mi.menu.hide();
135 // collapse children..
140 mi.menu.show(mi.menu.triggerEl,'?', false);
144 location.hash = '#' + c.name;
145 //Roo.docs.init.loadDoc(c);
147 }).createDelegate(this,[e], true)
150 fa : e.cn.length ? 'chevron-right' : '',
151 menu : !e.cn.length ? false : Roo.factory({
156 beforehide : (function(mi, c)
158 if (Roo.docs.init.prefix.length) {
162 if ( c.name.split('.').length < 2) {
167 }).createDelegate(this,[e], true)
181 if (parent_e !== false) {
183 e.parent_menu = parent;
184 e.parent = parent_e == true ? null : parent_e;
187 parent.items.push(node);
188 if (e.cn.length && type == 'NavSidebarItem') {
189 this.topm = node.menu;
196 e.cn.forEach(function(ec) {
197 var cn = ec.name.split('.').pop();
199 if (cn == cn.toLowerCase()) {
200 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
204 e.cn.forEach(function(ec) {
205 var cn = ec.name.split('.').pop();
206 if (cn != cn.toLowerCase()) {
207 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
213 loadClass : function(name)
215 if(typeof(this.classes[name]) != 'undefined' && this.classes[name].is_class ) {
216 this.loadDoc(this.classes[name]);
223 loadSource : function( )
228 url : 'src/' +this.currentClass.replace(/\./g,'_') + '.js.html',
230 success : function(res, o)
232 Roo.docs.ViewSource.show({
233 source : res.responseText,
234 fname : this.currentClass.replace(/\./g,'/') + ".js"
244 loadDoc : function(cls)
246 if (this.currentClass == cls.name) {
249 //Roo.docs.mobileNavGroup.hide();
251 Roo.docs.doc_body_content.hide();
252 Roo.docs.navHeaderBar.collapse();
253 this.currentClass = cls.name;
255 Roo.docs.introBody.show();
261 var m = cls.parent_menu;
262 m.show(m.triggerEl,'?', false);
264 while ((mp = mp.parent)) {
266 m.show(m.triggerEl,'?', false);
268 cls.node.el.scrollIntoView(Roo.docs.sidebar.el,false);
269 Roo.docs.sidebar.el.select('.active').removeClass('active');
270 cls.node.el.addClass('active');
272 Roo.docs.introBody.hide();
273 Roo.docs.doc_body_content.show();
275 url : this.prefix + 'symbols/' + cls.name + '.json',
277 success : function(res, o)
280 var d = Roo.decode(res.responseText);
282 if (typeof(d.augments) == 'undefined') {
284 d.config = []; // props for ctor?
286 d.config= d.props; // hack..
288 this.fillAugments(d, d.extends, Roo.docs.init.fillDoc);
301 fillAugments : function(d, ext, cb )
304 if (Roo.docs.init.n > 20) {
311 var next = ext.shift();
312 d.augments.push(next);
313 var ax = new Roo.data.Connection({});
315 url : this.prefix + 'symbols/' + next + '.json',
317 success : function(res, o)
320 var r = Roo.decode(res.responseText);
323 // copy methods that are not constructors..
325 r.methods.forEach(function(m) {
327 if (d.methods.find(function(e) {
328 return e.name == m.name;
332 if (m.isConstructor || m.static) {
338 r.props.forEach(function(m) {
342 if (d.props.find(function(e) {
343 return e.name == m.name;
351 r.events.forEach(function(m) {
352 if (d.events.find(function(e) {
353 return e.name == m.name;
362 this.fillAugments(d,ext, cb)
372 fillDoc : function(d)
375 "name" : "Roo.bootstrap.Progress",
377 "Roo.bootstrap.Component",
379 "Roo.util.Observable"
381 "desc" : "Bootstrap Progress class",
386 Roo.docs.classType.el.dom.firstChild.textContent = 'Class ';
388 Roo.docs.classType.el.dom.firstChild.textContent = 'abstract class ';
391 Roo.docs.classType.el.dom.firstChild.textContent = 'enum ';
394 Roo.docs.classType.el.dom.firstChild.textContent = 'mixin ';
396 document.body.scrollTop = 0;
397 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
398 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
399 Roo.docs.doc_extends.hide();
400 Roo.docs.doc_extends_sep.hide();
401 if (d.augments.length) {
402 Roo.docs.doc_extends.show();
403 Roo.docs.doc_extends_sep.show();
404 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
405 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
407 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
408 if (Roo.docs.init.prefix.length) {
409 Roo.docs.doc_source_row.hide();
413 if (d.augments.length) {
414 Roo.docs.augments.show();
415 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
417 Roo.docs.augments.hide();
420 if (d.realImplementors && d.realImplementors.length) {
421 Roo.docs.implementors.show();
422 Roo.docs.implementors.bodyEl().dom.innerHTML = Roo.docs.template.implementors(d);
424 Roo.docs.implementors.hide();
428 Roo.docs.configTableContainer.hide();
429 Roo.docs.methodsTableContainer.hide();
430 Roo.docs.eventsTableContainer.hide();
431 if (d.config.length) {
432 Roo.docs.configTableContainer.show();
433 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
436 if (d.methods.length) {
437 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
438 Roo.docs.methodsTableContainer.show();
440 if (d.events.length) {
441 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
442 Roo.docs.eventsTableContainer.show();
447 onClick : function(e)
449 if (e.target.nodeName != 'A') {
452 if (!e.target.href.match(/#/)) {
456 var link = e.target.href.split('#')[1];
457 this.loadClass(link);
461 onHashChange : function()
463 if (this.hash == location.hash) {
469 loadHash : function()
471 if (location.hash.length < 2) {
474 this.loadClass(location.hash.substring(1));
475 this.hash = location.hash;
479 loadIntro : function()
486 success : function(res)
488 this.renderIntro(res.responseText);
497 // render the really simple markdown data
498 renderIntro : function(intro)
501 Roo.docs.doc_body_content.hide();
504 var lines = intro.split("\n");
505 var tree = { 'name' : 'root', cn : []};
506 var state = [ tree ];
507 for (var i=0;i< lines.length;i++) {
509 if (!line.length || line.match(/^\s+$/)) {
512 var sm = line.match(/^(\s+)(.*)/);
514 var sml = sm ? sm[1].length: 0;
516 sml = sml / 4; // 4 spaces indent?
517 var add = { name : sm ? sm[2] : line, cn : [] };
518 state[sml].cn.push(add);
524 for(var i = 0; i < tree.cn.length; i++) {
525 // make a container..
526 var treei = tree.cn[i];
541 for(var ii = 0; ii < treei.cn.length; ii++) {
542 var treeii = treei.cn[ii];
543 // another container..
545 header : treeii.name,
560 ctree.items[0].items.push(ctreei);
562 for(var iii = 0; iii < treeii.cn.length; iii++) {
563 var treeiii = treeii.cn[iii];
564 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
565 //Roo.log(treeiii.name);
566 if (treeiii.name == 'Examples') {
567 for (var j =0;j< treeiii.cn.length; j++) {
568 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
569 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
585 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
586 html : ll ? ll[1] : treeiii.name,
593 html : ll && ll[2].length ? ' - ' + ll[2] : '',
601 ctreei.items.push(ctreeii);
605 //Roo.log("footer:"+ footer);
606 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
615 Roo.docs.introBody.addxtypeChild(ctree);
627 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);