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",
386 document.body.scrollTop = 0;
387 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
388 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
389 Roo.docs.doc_extends.hide();
390 Roo.docs.doc_extends_sep.hide();
391 if (d.augments.length) {
392 Roo.docs.doc_extends.show();
393 Roo.docs.doc_extends_sep.show();
394 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
395 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
397 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
398 if (Roo.docs.init.prefix.length) {
399 Roo.docs.doc_source_row.hide();
403 if (d.augments.length) {
404 Roo.docs.augments.show();
405 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
407 Roo.docs.augments.hide();
410 if (d.implementors.length) {
411 Roo.docs.implementors.show();
412 Roo.docs.implementors.bodyEl().dom.innerHTML = Roo.docs.template.implementors(d);
414 Roo.docs.implementors.hide();
418 Roo.docs.configTableContainer.hide();
419 Roo.docs.methodsTableContainer.hide();
420 Roo.docs.eventsTableContainer.hide();
421 if (d.config.length) {
422 Roo.docs.configTableContainer.show();
423 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
426 if (d.methods.length) {
427 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
428 Roo.docs.methodsTableContainer.show();
430 if (d.events.length) {
431 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
432 Roo.docs.eventsTableContainer.show();
437 onClick : function(e)
439 if (e.target.nodeName != 'A') {
442 if (!e.target.href.match(/#/)) {
446 var link = e.target.href.split('#')[1];
447 this.loadClass(link);
451 onHashChange : function()
453 if (this.hash == location.hash) {
459 loadHash : function()
461 if (location.hash.length < 2) {
464 this.loadClass(location.hash.substring(1));
465 this.hash = location.hash;
469 loadIntro : function()
476 success : function(res)
478 this.renderIntro(res.responseText);
487 // render the really simple markdown data
488 renderIntro : function(intro)
491 Roo.docs.doc_body_content.hide();
494 var lines = intro.split("\n");
495 var tree = { 'name' : 'root', cn : []};
496 var state = [ tree ];
497 for (var i=0;i< lines.length;i++) {
499 if (!line.length || line.match(/^\s+$/)) {
502 var sm = line.match(/^(\s+)(.*)/);
504 var sml = sm ? sm[1].length: 0;
506 sml = sml / 4; // 4 spaces indent?
507 var add = { name : sm ? sm[2] : line, cn : [] };
508 state[sml].cn.push(add);
514 for(var i = 0; i < tree.cn.length; i++) {
515 // make a container..
516 var treei = tree.cn[i];
531 for(var ii = 0; ii < treei.cn.length; ii++) {
532 var treeii = treei.cn[ii];
533 // another container..
535 header : treeii.name,
550 ctree.items[0].items.push(ctreei);
552 for(var iii = 0; iii < treeii.cn.length; iii++) {
553 var treeiii = treeii.cn[iii];
554 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
555 //Roo.log(treeiii.name);
556 if (treeiii.name == 'Examples') {
557 for (var j =0;j< treeiii.cn.length; j++) {
558 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
559 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
575 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
576 html : ll ? ll[1] : treeiii.name,
583 html : ll && ll[2].length ? ' - ' + ll[2] : '',
591 ctreei.items.push(ctreeii);
595 //Roo.log("footer:"+ footer);
596 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
605 Roo.docs.introBody.addxtypeChild(ctree);
617 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);