1414
1515 var link = document . createElement ( 'link' ) ;
1616 link . setAttribute ( 'rel' , 'icon' ) ;
17- link . setAttribute ( 'href' , 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAAaVBMVEVHcExfpvhYpPxapPtZo/lZpfxYpPtZpfxjp/Rxsv1ZpPpZpPtZpPpZpfxbpPheqPxcpvxorf1jqvxoputao/lbpPhmrP1ZpPtYo/tZo/hZpPtZpPqcyf+Rw/6Xxv+KwP6EvP53tf19uf1CLkbiAAAAHHRSTlMADp1YNLp7swf+YpU/wizc0vrpAiIX84VvHKlK4cmJ4wAAAVdJREFUKM+1ktmShCAMRVU2ARFxb5tF/f+PHIK92j1vM6myKuQYkns1y/4i8mEof6dlobX4hWHc09GtzfVSDZ/0qlvNg/Wr0SO7nOmlWb2zEN55Lj+WUsFat3O+ems3+g2HViLBuLfbdKaz8X5EkMnNBl2961tMsOuSanXr7N6iHOL+klqt3Y8r8yZuwRtGCCPyxgl3di0ODdrZYGgdA5H8wLXk1rUVpBQykeqY5Q/dcXgjajyNcfRNN2Z9P3TJbhKnB96OWzSHzzesCSGyThOjodEyeOxWpJZsEHioKcGxW4zc7LEzbCNv8KtoCit3SFwX40NLq7l+8wSRu3fEGLC7r/p07mDxYXl8gZ7RWBGKKXEcJ0GJzB8XFdH2SuESK/AAN5Ocri/2A5Yga5ZJ9+nPi7hk0FgBebr2xN2S8NJ9wxIhBZtShRCi5IRREQO2FpAUc5n9e/wA3jcXGxBAlmMAAAAASUVORK5CYII =' ) ;
17+ link . setAttribute ( 'href' , 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAMAAABBJv+bAAAAQlBMVEVHcEwyODg0ODkzNzgxNzc0ODk0ODkzODgzODgzNzgyNzgzODg0ODkzODgyNzgzODgzODgzODk0ODk0ODkyNzg0ODmObyvDAAAAFXRSTlMABvaSDbPHe15GL5u9hRxvO6rn2VJXM6DpAAAAxElEQVQoz71TyRbDIAh0Ie6J2fz/Xy3Y2pDktZ5aTiODCAMK0QxAPoFsgNk0JrMEQmEwyU5ndt4K2khQEzLhdNeQTznCWREegNEOOe18fRO8i6ooz+gRw1k9gMkyo/E9zY5yKMX+ihbLq8mjFB5N4UepYLGRmdM7OnLlpYtJXWQQkFCIpHcpfBVpCxeRV/KuodHzmfaNxuTmlpxmoEzc5bs0rnGdQQZeybWxRX6Vxf5rJJ116CxTZxX5Isf7Ive+wadP9AAuFg97y3bd7gAAAABJRU5ErkJggg= =' ) ;
1818 document . head . append ( link ) ;
1919
2020 var link = document . createElement ( 'link' ) ;
2525
2626 var link = document . createElement ( 'link' ) ;
2727 link . setAttribute ( 'rel' , 'stylesheet' ) ;
28- link . setAttribute ( 'href' , '../css/component .css' ) ;
28+ link . setAttribute ( 'href' , '../../../ css/page .css' ) ;
2929 link . setAttribute ( 'crossorigin' , 'anonymous' ) ;
3030 document . head . append ( link ) ;
3131
4848
4949 var df = true , did = 'html' ;
5050
51- var base = 'https://libs .ext-code.com/html /' ;
51+ var base = 'https://code .ext-code.com/' ;
5252
5353 var ace ;
5454 var md ;
9292 async function load ( ) {
9393
9494 var list = [ ] ;
95- list . push ( get ( base + component + '/ readme.md') ) ;
96- list . push ( get ( base + component + '/ api.md') ) ;
95+ list . push ( get ( base + path + ' readme.md') ) ;
96+ list . push ( get ( base + path + ' api.md') ) ;
9797 var result = await Promise . all ( list ) ;
9898
9999 var { error, txt} = result [ 0 ] ;
127127
128128
129129
130- < html-components- hdr v2 .0 component =grp1 >
130+ < code- hdr v1 .0 component =grp2 >
131131 < h2 slot =title >
132- web-editor-x
133132 </ h2 >
134133 < time slot =date datetime =2026-02-10 >
135- 10 Feb 2026-x
136134 </ time >
137- </ html-components -hdr>
135+ </ code -hdr>
138136
139137 < script >
140138 {
141139 let $ = css => document . querySelector ( css ) ;
142- $ ( '[slot=title]' ) . textContent = component ;
140+ $ ( '[slot=title]' ) . textContent = filename ;
143141 $ ( 'time' ) . setAttribute ( 'datetime' , date ) ;
144142 var str = new Date ( date ) . toLocaleDateString ( 'en-GB' , { day :'2-digit' , month :'short' , year :'numeric' } ) ;
145143 $ ( 'time' ) . textContent = str ;
@@ -226,10 +224,15 @@ <h3>
226224 var files2 = dirtree . build ( files ) ;
227225 dirtree . display ( files2 , { callback} ) ;
228226
229-
227+ /*
230228 var keys = Object.keys(files.examples);
231229 var initial = keys[0];
232- await show . examples ( initial ) ;
230+ if(initial){
231+ show.examples(initial);
232+ return;
233+ }
234+ */
235+ show . source ( 'latest' ) ;
233236
234237
235238 } //initdom
@@ -238,6 +241,24 @@ <h3>
238241 //:
239242
240243
244+ btn . download = function ( ) {
245+
246+ var { txt, error} = get ( base + path + filename ) ;
247+ if ( error ) {
248+ log . red ( error ) ;
249+ return ;
250+ }
251+ var blob = new Blob ( [ txt ] ) ;
252+ var url = window . URL . createObjectURL ( blob ) ;
253+
254+ var a = document . createElement ( 'a' ) ;
255+ a . download = filename ;
256+ a . href = url ;
257+ a . click ( ) ;
258+
259+ } //download
260+
261+
241262 btn . tabs = function ( e ) {
242263
243264 var tab = e . target ;
257278 tab . classList . add ( 'active' ) ;
258279 $ ( `#view #${ tab . id } ` ) . style . display = '' ;
259280
260- } //tabss
281+ } //tabs
261282
262283 //:
263284
@@ -277,34 +298,35 @@ <h3>
277298
278299
279300 show . source = async function ( file ) {
280-
281- $ ( '#files-view-hdr' ) . textContent = 'source : ' + file ;
301+ debug ( 'show.source' , file ) ;
302+ $ ( '#files-view-hdr' ) . textContent = 'source : ' + file ;
282303 $ ( 'web-editor' ) . style . display = '' ;
283304 $ ( 'snippet-html-console' ) . style . display = 'none' ;
284305
285- var url = base + component + '/' ;
306+ var fn = filename . split ( '.' ) . at ( - 1 ) ;
307+ var url = base + path ;
286308 if ( file == 'latest' ) {
287- url += ` ${ component } .html` ;
309+ url += filename ;
288310 } else {
289- url += `${ file } /${ component } -${ file } .html` ;
311+ url += `${ file } /${ fn } -${ file } .html` ;
290312 }
291313
292314 var { txt} = await get ( url ) ;
293315 if ( ! txt ) return ;
294316 editor . setvalue ( txt ) ;
295317 editor . filename ( file ) ;
296- editor . mode = 'html ' ;
318+ editor . mode = 'js ' ;
297319
298320 } //source
299321
300322
301323 show . examples = async function ( file ) {
302-
303- $ ( '#files-view-hdr' ) . textContent = 'examples : ' + file ;
324+ debug ( 'show.examples' , file ) ;
325+ $ ( '#files-view-hdr' ) . textContent = 'examples : ' + file ;
304326 $ ( 'web-editor' ) . style . display = 'none' ;
305327 $ ( 'snippet-html-console' ) . style . display = '' ;
306328
307- var url = base + component + '/examples/' + file ;
329+ var url = base + path + '/examples/' + file ;
308330 var { txt} = await get ( url ) ;
309331 if ( ! txt ) return ;
310332
340362 }
341363 if ( ! res . ok ) {
342364 error = `( ${ res . status } ) ${ res . statusText } ` ;
343- cache [ url ] = error ;
365+ // cache[url] = error;
344366 //var error = await res.text();
345367 //log.red(error);
346368 return { error} ;
0 commit comments