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);
50 // our classes witch children first..
51 d.forEach(function(e) {
53 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem', true );
58 d.forEach(function(e) {
60 this.addTreeItem(Roo.docs.navGroup, e, 'NavSidebarItem' ,true);
66 d.forEach(function(e) {
68 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
73 d.forEach(function(e) {
75 this.addTreeItem(Roo.docs.mobileNavGroup, e, 'NavSidebarItem', false);
79 var roo = Roo.docs.navGroup.items[1].menu;
80 if (!Roo.docs.init.prefix.length) {
81 roo.show(roo.triggerEl, '?', false);
84 if (location.hash.length) {
99 hideChildren : function(c)
104 for (var i =0; i < c.cn.length; i++) {
105 this.hideChildren(c.cn[i]);
111 addTreeItem : function(parent, e, type , parent_e) {
113 this.classes[e.name] = e;
115 var node = parent.addxtypeChild(Roo.factory({
116 html: e.name.split('.').pop(),
121 preventDefault : true,
122 // cls : type == 'NavSidebarItem' ? 'open' : '',
124 click : (function(mi,ev,c)
129 if (c.cn.length && mi.xtype == 'MenuItem') {
131 if (mi.menu.el.hasClass('show')) {
132 this.hideChildren(c); //mi.menu.hide();
133 // collapse children..
138 mi.menu.show(mi.menu.triggerEl,'?', false);
142 location.hash = '#' + c.name;
143 //Roo.docs.init.loadDoc(c);
145 }).createDelegate(this,[e], true)
148 fa : e.cn.length ? 'chevron-right' : '',
149 menu : !e.cn.length ? false : Roo.factory({
154 beforehide : (function(mi,c)
156 if (Roo.docs.init.prefix.length) {
160 if (c.name.split('.').length < 2) {
165 }).createDelegate(this,[e], true)
179 if (parent_e !== false) {
181 e.parent_menu = parent;
182 e.parent = parent_e == true ? null : parent_e;
185 parent.items.push(node);
186 if (e.cn.length && type == 'NavSidebarItem') {
187 this.topm = node.menu;
194 e.cn.forEach(function(ec) {
195 var cn = ec.name.split('.').pop();
197 if (cn == cn.toLowerCase()) {
198 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
202 e.cn.forEach(function(ec) {
203 var cn = ec.name.split('.').pop();
204 if (cn != cn.toLowerCase()) {
205 this.addTreeItem(node.menu, ec,'MenuItem', parent_e !== false ? e : false);
211 loadClass : function(name)
213 if(typeof(this.classes[name]) != 'undefined' && this.classes[name].is_class ) {
214 this.loadDoc(this.classes[name]);
221 loadSource : function( )
226 url : 'src/' +this.currentClass.replace(/\./g,'_') + '.js.html',
228 success : function(res, o)
230 Roo.docs.ViewSource.show({
231 source : res.responseText,
232 fname : this.currentClass.replace(/\./g,'/') + ".js"
242 loadDoc : function(cls)
244 if (this.currentClass == cls.name) {
247 //Roo.docs.mobileNavGroup.hide();
249 Roo.docs.doc_body_content.hide();
250 Roo.docs.navHeaderBar.collapse();
251 this.currentClass = cls.name;
253 Roo.docs.introBody.show();
259 var m = cls.parent_menu;
260 m.show(m.triggerEl,'?', false);
262 while ((mp = mp.parent)) {
264 m.show(m.triggerEl,'?', false);
266 cls.node.el.scrollIntoView(Roo.docs.sidebar.el,false);
267 Roo.docs.sidebar.el.select('.active').removeClass('active');
268 cls.node.el.addClass('active');
270 Roo.docs.introBody.hide();
271 Roo.docs.doc_body_content.show();
273 url : this.prefix + 'symbols/' + cls.name + '.json',
275 success : function(res, o)
278 var d = Roo.decode(res.responseText);
280 if (typeof(d.augments) == 'undefined') {
282 d.config = []; // props for ctor?
284 d.config= d.props; // hack..
286 this.fillAugments(d, d.extends, Roo.docs.init.fillDoc);
299 fillAugments : function(d, ext, cb )
302 if (Roo.docs.init.n > 20) {
309 var next = ext.shift();
310 d.augments.push(next);
311 var ax = new Roo.data.Connection({});
313 url : this.prefix + 'symbols/' + next + '.json',
315 success : function(res, o)
318 var r = Roo.decode(res.responseText);
321 // copy methods that are not constructors..
323 r.methods.forEach(function(m) {
325 if (d.methods.find(function(e) {
326 return e.name == m.name;
330 if (m.isConstructor || m.static) {
336 r.props.forEach(function(m) {
340 if (d.props.find(function(e) {
341 return e.name == m.name;
349 r.events.forEach(function(m) {
350 if (d.events.find(function(e) {
351 return e.name == m.name;
358 this.fillAugments(d,ext, cb)
368 fillDoc : function(d)
371 "name" : "Roo.bootstrap.Progress",
373 "Roo.bootstrap.Component",
375 "Roo.util.Observable"
377 "desc" : "Bootstrap Progress class",
381 document.body.scrollTop = 0;
382 Roo.docs.doc_name.el.dom.innerHTML = Roo.docs.template.resolveLinks(d.name);
383 Roo.docs.doc_desc.el.dom.innerHTML = Roo.docs.template.summary(d);
384 Roo.docs.doc_extends.hide();
385 Roo.docs.doc_extends_sep.hide();
386 if (d.augments.length) {
387 Roo.docs.doc_extends.show();
388 Roo.docs.doc_extends_sep.show();
389 Roo.docs.doc_extends.el.dom.innerHTML = d.augments[0];
390 Roo.docs.doc_extends.el.dom.href= '#' + d.augments[0];
392 Roo.docs.doc_source.el.dom.innerHTML = d.name.replace(/\./g,"/") + ".js";
393 if (Roo.docs.init.prefix.length) {
394 Roo.docs.doc_source_row.hide();
398 if (d.augments.length) {
399 Roo.docs.augments.show();
400 Roo.docs.augments.bodyEl().dom.innerHTML = Roo.docs.template.augments(d);
402 Roo.docs.augments.hide();
407 Roo.docs.configTableContainer.hide();
408 Roo.docs.methodsTableContainer.hide();
409 Roo.docs.eventsTableContainer.hide();
410 if (d.config.length) {
411 Roo.docs.configTableContainer.show();
412 Roo.docs.configTable.store.load( { params : { data : d.config.sort(Roo.docs.template.makeSortby("name")) }});
415 if (d.methods.length) {
416 Roo.docs.methodsTable.store.load( { params : { data : Roo.docs.template.methodsSort(d) }});
417 Roo.docs.methodsTableContainer.show();
419 if (d.events.length) {
420 Roo.docs.eventsTable.store.load( { params : { data : d.events.sort(Roo.docs.template.makeSortby("name")) }});
421 Roo.docs.eventsTableContainer.show();
426 onClick : function(e)
428 if (e.target.nodeName != 'A') {
431 if (!e.target.href.match(/#/)) {
435 var link = e.target.href.split('#')[1];
436 this.loadClass(link);
440 onHashChange : function()
442 if (this.hash == location.hash) {
448 loadHash : function()
450 if (location.hash.length < 2) {
453 this.loadClass(location.hash.substring(1));
454 this.hash = location.hash;
458 loadIntro : function()
465 success : function(res)
467 this.renderIntro(res.responseText);
476 // render the really simple markdown data
477 renderIntro : function(intro)
480 Roo.docs.doc_body_content.hide();
483 var lines = intro.split("\n");
484 var tree = { 'name' : 'root', cn : []};
485 var state = [ tree ];
486 for (var i=0;i< lines.length;i++) {
488 if (!line.length || line.match(/^\s+$/)) {
491 var sm = line.match(/^(\s+)(.*)/);
493 var sml = sm ? sm[1].length: 0;
495 sml = sml / 4; // 4 spaces indent?
496 var add = { name : sm ? sm[2] : line, cn : [] };
497 state[sml].cn.push(add);
503 for(var i = 0; i < tree.cn.length; i++) {
504 // make a container..
505 var treei = tree.cn[i];
520 for(var ii = 0; ii < treei.cn.length; ii++) {
521 var treeii = treei.cn[ii];
522 // another container..
524 header : treeii.name,
539 ctree.items[0].items.push(ctreei);
541 for(var iii = 0; iii < treeii.cn.length; iii++) {
542 var treeiii = treeii.cn[iii];
543 var ll = treeiii.name.match(/^(\S+)\s*(.*)$/);
544 //Roo.log(treeiii.name);
545 if (treeiii.name == 'Examples') {
546 for (var j =0;j< treeiii.cn.length; j++) {
547 var exs = treeiii.cn[j].name.match(/^\[([^\]]+)\](.*)$/);
548 footer += '<li><a target="_blank" href="../' + exs[1] + '">'+exs[2] + '</a></li>';
564 href : '#' + ( ll ? ll[1] : treeiii.name ) ,
565 html : ll ? ll[1] : treeiii.name,
572 html : ll && ll[2].length ? ' - ' + ll[2] : '',
580 ctreei.items.push(ctreeii);
584 //Roo.log("footer:"+ footer);
585 ctreei.footer = '<h5>Examples:</h5><ul>'+footer +'</ul>';
594 Roo.docs.introBody.addxtypeChild(ctree);
606 Roo.onReady(Roo.docs.init.onReady, Roo.docs.init);