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.childClasses && typeof(d.childClasses[d.name]) != 'undefined') {
421 Roo.docs.implementors.show();
422 Roo.docs.implementors.bodyEl().dom.innerHTML = Roo.docs.template.implementors(d);
424 Roo.docs.implementors.hide();
427 if (d.tree_children && d.tree_children.length > 0) {
428 Roo.docs.doc_children.show();
429 Roo.docs.doc_children.bodyEl().dom.innerHTML = Roo.docs.template.doc_children(d);
431 Roo.docs.doc_children.hide();
435 Roo.docs.configTableContainer.hide();
436 Roo.docs.methodsTableContainer.hide();
437 Roo.docs.eventsTableContainer.hide();
438 if (d.config.length) {
439 Roo.docs.configTableContainer.show();
440 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
443 if (d.methods.length) {
444 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
445 Roo.docs.methodsTableContainer.show();
447 if (d.events.length) {
448 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
449 Roo.docs.eventsTableContainer.show();
454 onClick : function(e)
456 if (e.target.nodeName != 'A') {
459 if (!e.target.href.match(/#/)) {
463 var link = e.target.href.split('#')[1];
464 this.loadClass(link);
468 onHashChange : function()
470 if (this.hash == location.hash) {
476 loadHash : function()
478 if (location.hash.length < 2) {
481 this.loadClass(location.hash.substring(1));
482 this.hash = location.hash;
486 loadIntro : function()
493 success : function(res)
495 this.renderIntro(res.responseText);
504 // render the really simple markdown data
505 renderIntro : function(intro)
508 Roo.docs.doc_body_content.hide();
511 var lines = intro.split("\n");
512 var tree = { 'name' : 'root', cn : []};
513 var state = [ tree ];
514 for (var i=0;i< lines.length;i++) {
516 if (!line.length || line.match(/^\s+$/)) {
519 var sm = line.match(/^(\s+)(.*)/);
521 var sml = sm ? sm[1].length: 0;
523 sml = sml / 4; // 4 spaces indent?
524 var add = { name : sm ? sm[2] : line, cn : [] };
525 state[sml].cn.push(add);
531 for(var i = 0; i < tree.cn.length; i++) {
532 // make a container..
533 var treei = tree.cn[i];
548 for(var ii = 0; ii < treei.cn.length; ii++) {
549 var treeii = treei.cn[ii];
550 // another container..
552 header : treeii.name,
567 ctree.items[0].items.push(ctreei);
569 for(var iii = 0; iii < treeii.cn.length; iii++) {
570 var treeiii = treeii.cn[iii];
571 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
572 //Roo.log(treeiii.name);
573 if (treeiii.name == 'Examples') {
574 for (var j =0;j< treeiii.cn.length; j++) {
575 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
576 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
592 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
593 html : ll ? ll[1] : treeiii.name,
600 html : ll && ll[2].length ? ' - ' + ll[2] : '',
608 ctreei.items.push(ctreeii);
612 //Roo.log("footer:"+ footer);
613 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
622 Roo.docs.introBody.addxtypeChild(ctree);
634 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);