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;
361 this.fillAugments(d,ext, cb)
371 fillDoc : function(d)
374 "name" : "Roo.bootstrap.Progress",
376 "Roo.bootstrap.Component",
378 "Roo.util.Observable"
380 "desc" : "Bootstrap Progress class",
384 document.body.scrollTop = 0;
385 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
386 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
387 Roo.docs.doc_extends.hide();
388 Roo.docs.doc_extends_sep.hide();
389 if (d.augments.length) {
390 Roo.docs.doc_extends.show();
391 Roo.docs.doc_extends_sep.show();
392 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
393 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
395 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
396 if (Roo.docs.init.prefix.length) {
397 Roo.docs.doc_source_row.hide();
401 if (d.augments.length) {
402 Roo.docs.augments.show();
403 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
405 Roo.docs.augments.hide();
410 Roo.docs.configTableContainer.hide();
411 Roo.docs.methodsTableContainer.hide();
412 Roo.docs.eventsTableContainer.hide();
413 if (d.config.length) {
414 Roo.docs.configTableContainer.show();
415 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
418 if (d.methods.length) {
419 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
420 Roo.docs.methodsTableContainer.show();
422 if (d.events.length) {
423 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
424 Roo.docs.eventsTableContainer.show();
429 onClick : function(e)
431 if (e.target.nodeName != 'A') {
434 if (!e.target.href.match(/#/)) {
438 var link = e.target.href.split('#')[1];
439 this.loadClass(link);
443 onHashChange : function()
445 if (this.hash == location.hash) {
451 loadHash : function()
453 if (location.hash.length < 2) {
456 this.loadClass(location.hash.substring(1));
457 this.hash = location.hash;
461 loadIntro : function()
468 success : function(res)
470 this.renderIntro(res.responseText);
479 // render the really simple markdown data
480 renderIntro : function(intro)
483 Roo.docs.doc_body_content.hide();
486 var lines = intro.split("\n");
487 var tree = { 'name' : 'root', cn : []};
488 var state = [ tree ];
489 for (var i=0;i< lines.length;i++) {
491 if (!line.length || line.match(/^\s+$/)) {
494 var sm = line.match(/^(\s+)(.*)/);
496 var sml = sm ? sm[1].length: 0;
498 sml = sml / 4; // 4 spaces indent?
499 var add = { name : sm ? sm[2] : line, cn : [] };
500 state[sml].cn.push(add);
506 for(var i = 0; i < tree.cn.length; i++) {
507 // make a container..
508 var treei = tree.cn[i];
523 for(var ii = 0; ii < treei.cn.length; ii++) {
524 var treeii = treei.cn[ii];
525 // another container..
527 header : treeii.name,
542 ctree.items[0].items.push(ctreei);
544 for(var iii = 0; iii < treeii.cn.length; iii++) {
545 var treeiii = treeii.cn[iii];
546 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
547 //Roo.log(treeiii.name);
548 if (treeiii.name == 'Examples') {
549 for (var j =0;j< treeiii.cn.length; j++) {
550 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
551 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
567 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
568 html : ll ? ll[1] : treeiii.name,
575 html : ll && ll[2].length ? ' - ' + ll[2] : '',
583 ctreei.items.push(ctreeii);
587 //Roo.log("footer:"+ footer);
588 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
597 Roo.docs.introBody.addxtypeChild(ctree);
609 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);