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');
24 if (window.location.search.length > 0) {
25 this.prefix = "/flutter/";
26 Roo.docs.roo_title.el.dom.innerHTML = "Flutter Documentation";
29 window.onhashchange = function() { Roo.docs.init.onHashChange(); }
36 Roo.docs.doc_body_content.hide();
39 url : this.prefix + 'tree.json',
41 success : function(res, o)
43 var d = Roo.decode(res.responseText);
46 // our classes witch children first..
47 d.forEach(function(e) {
49 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem', true );
54 d.forEach(function(e) {
56 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem' ,true);
62 d.forEach(function(e) {
64 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
69 d.forEach(function(e) {
71 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
75 var roo = Roo.docs.navGroup.items[1].menu;
76 if (!Roo.docs.init.prefix.length) {
77 roo.show(roo.triggerEl, '?', false);
80 if (location.hash.length) {
95 hideChildren : function(c)
100 for (var i =0; i < c.cn.length; i++) {
101 this.hideChildren(c.cn[i]);
107 addTreeItem : function(parent, e, type , parent_e) {
109 this.classes[e.name] = e;
111 var node = parent.addxtypeChild(Roo.factory({
112 html: e.name.split('.').pop(),
117 preventDefault : true,
118 // cls : type == 'NavSidebarItem' ? 'open' : '',
120 click : (function(mi,ev,c)
125 if (c.cn.length && mi.xtype == 'MenuItem') {
127 if (mi.menu.el.hasClass('show')) {
128 this.hideChildren(c); //mi.menu.hide();
129 // collapse children..
134 mi.menu.show(mi.menu.triggerEl,'?', false);
138 location.hash = '#' + c.name;
139 //Roo.docs.init.loadDoc(c);
141 }).createDelegate(this,[e], true)
144 fa : e.cn.length ? 'chevron-right' : '',
145 menu : !e.cn.length ? false : Roo.factory({
150 beforehide : (function(mi,c)
152 if (Roo.docs.init.prefix.length) {
156 if (c.name.split('.').length < 2) {
161 }).createDelegate(this,[e], true)
175 if (parent_e !== false) {
177 e.parent_menu = parent;
178 e.parent = parent_e == true ? null : parent_e;
181 parent.items.push(node);
182 if (e.cn.length && type == 'NavSidebarItem') {
183 this.topm = node.menu;
190 e.cn.forEach(function(ec) {
191 var cn = ec.name.split('.').pop();
193 if (cn == cn.toLowerCase()) {
194 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
198 e.cn.forEach(function(ec) {
199 var cn = ec.name.split('.').pop();
200 if (cn != cn.toLowerCase()) {
201 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
207 loadClass : function(name)
209 if(typeof(this.classes[name]) != 'undefined' && this.classes[name].is_class ) {
210 this.loadDoc(this.classes[name]);
217 loadSource : function( )
222 url : 'src/' +this.currentClass.replace(/\./g,'_') + '.js.html',
224 success : function(res, o)
226 Roo.docs.ViewSource.show({
227 source : res.responseText,
228 fname : this.currentClass.replace(/\./g,'/') + ".js"
238 loadDoc : function(cls)
240 if (this.currentClass == cls.name) {
243 //Roo.docs.mobileNavGroup.hide();
245 Roo.docs.doc_body_content.hide();
246 Roo.docs.navHeaderBar.collapse();
247 this.currentClass = cls.name;
249 Roo.docs.introBody.show();
255 var m = cls.parent_menu;
256 m.show(m.triggerEl,'?', false);
258 while ((mp = mp.parent)) {
260 m.show(m.triggerEl,'?', false);
262 cls.node.el.scrollIntoView(Roo.docs.sidebar.el,false);
263 Roo.docs.sidebar.el.select('.active').removeClass('active');
264 cls.node.el.addClass('active');
266 Roo.docs.introBody.hide();
267 Roo.docs.doc_body_content.show();
269 url : this.prefix + 'symbols/' + cls.name + '.json',
271 success : function(res, o)
274 var d = Roo.decode(res.responseText);
276 if (typeof(d.augments) == 'undefined') {
278 d.config = []; // props for ctor?
280 d.config= d.props; // hack..
282 this.fillAugments(d, d.extends, Roo.docs.init.fillDoc);
295 fillAugments : function(d, ext, cb )
298 if (Roo.docs.init.n > 20) {
305 var next = ext.shift();
306 d.augments.push(next);
307 var ax = new Roo.data.Connection({});
309 url : this.prefix + 'symbols/' + next + '.json',
311 success : function(res, o)
314 var r = Roo.decode(res.responseText);
317 // copy methods that are not constructors..
319 r.methods.forEach(function(m) {
321 if (d.methods.find(function(e) {
322 return e.name == m.name;
326 if (m.isConstructor || m.static) {
332 r.props.forEach(function(m) {
336 if (d.props.find(function(e) {
337 return e.name == m.name;
345 r.events.forEach(function(m) {
346 if (d.events.find(function(e) {
347 return e.name == m.name;
354 this.fillAugments(d,ext, cb)
364 fillDoc : function(d)
367 "name" : "Roo.bootstrap.Progress",
369 "Roo.bootstrap.Component",
371 "Roo.util.Observable"
373 "desc" : "Bootstrap Progress class",
377 document.body.scrollTop = 0;
378 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
379 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
380 Roo.docs.doc_extends.hide();
381 Roo.docs.doc_extends_sep.hide();
382 if (d.augments.length) {
383 Roo.docs.doc_extends.show();
384 Roo.docs.doc_extends_sep.show();
385 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
386 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
388 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
389 if (Roo.docs.init.prefix.length) {
390 Roo.docs.doc_source_row.hide();
394 if (d.augments.length) {
395 Roo.docs.augments.show();
396 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
398 Roo.docs.augments.hide();
403 Roo.docs.configTableContainer.hide();
404 Roo.docs.methodsTableContainer.hide();
405 Roo.docs.eventsTableContainer.hide();
406 if (d.config.length) {
407 Roo.docs.configTableContainer.show();
408 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
411 if (d.methods.length) {
412 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
413 Roo.docs.methodsTableContainer.show();
415 if (d.events.length) {
416 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
417 Roo.docs.eventsTableContainer.show();
422 onClick : function(e)
424 if (e.target.nodeName != 'A') {
427 if (!e.target.href.match(/#/)) {
431 var link = e.target.href.split('#')[1];
432 this.loadClass(link);
436 onHashChange : function()
438 if (this.hash == location.hash) {
444 loadHash : function()
446 if (location.hash.length < 2) {
449 this.loadClass(location.hash.substring(1));
450 this.hash = location.hash;
454 loadIntro : function()
461 success : function(res)
463 this.renderIntro(res.responseText);
472 // render the really simple markdown data
473 renderIntro : function(intro)
476 Roo.docs.doc_body_content.hide();
479 var lines = intro.split("\n");
480 var tree = { 'name' : 'root', cn : []};
481 var state = [ tree ];
482 for (var i=0;i< lines.length;i++) {
484 if (!line.length || line.match(/^\s+$/)) {
487 var sm = line.match(/^(\s+)(.*)/);
489 var sml = sm ? sm[1].length: 0;
491 sml = sml / 4; // 4 spaces indent?
492 var add = { name : sm ? sm[2] : line, cn : [] };
493 state[sml].cn.push(add);
499 for(var i = 0; i < tree.cn.length; i++) {
500 // make a container..
501 var treei = tree.cn[i];
516 for(var ii = 0; ii < treei.cn.length; ii++) {
517 var treeii = treei.cn[ii];
518 // another container..
520 header : treeii.name,
535 ctree.items[0].items.push(ctreei);
537 for(var iii = 0; iii < treeii.cn.length; iii++) {
538 var treeiii = treeii.cn[iii];
539 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
540 //Roo.log(treeiii.name);
541 if (treeiii.name == 'Examples') {
542 for (var j =0;j< treeiii.cn.length; j++) {
543 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
544 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
560 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
561 html : ll ? ll[1] : treeiii.name,
568 html : ll && ll[2].length ? ' - ' + ll[2] : '',
576 ctreei.items.push(ctreeii);
580 //Roo.log("footer:"+ footer);
581 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
590 Roo.docs.introBody.addxtypeChild(ctree);
602 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);