diff --git a/pkg/arvo/app/neo.hoon b/pkg/arvo/app/neo.hoon index f88345867a..2e7edf05cb 100644 --- a/pkg/arvo/app/neo.hoon +++ b/pkg/arvo/app/neo.hoon @@ -1564,14 +1564,16 @@ =. run (emit do-std-warp) =. run (emit (do-card #/[p/our.bowl] %make %root ~ ~)) + =. run + (emit (do-card #/[p/our.bowl]/cod/std/src/imp %make %sig `sig/!>(~) ~)) =. run (emit (do-card #/[p/our.bowl]/sky %make %sky ~ ~)) =. run (emit (do-card #/[p/our.bowl]/srv/hawk %make %hawk-eyre ~ ~)) =. run - (emit (do-card #/[p/our.bowl]/blue %make %blue ~ ~)) + (emit (do-card #/[p/our.bowl]/blue %make %blue ~ (~(gas by *crew:neo) src/#/[p/our.bowl]/cod/std/src/imp ~))) =. run - (emit (do-card #/[p/our.bowl]/mast %make %mast ~ ~)) + (emit (do-card #/[p/our.bowl]/mast %make %mast ~ (~(gas by *crew:neo) src/#/[p/our.bowl]/cod/std/src/imp ~))) =. run (emit (do-card #/[p/our.bowl]/self %make %self ~ ~)) =. run diff --git a/pkg/arvo/neo/cod/std/src/fil/wi-nd.js b/pkg/arvo/neo/cod/std/src/fil/wi-nd.js index 9848f7c886..032efd3f81 100644 --- a/pkg/arvo/neo/cod/std/src/fil/wi-nd.js +++ b/pkg/arvo/neo/cod/std/src/fil/wi-nd.js @@ -126,6 +126,27 @@ customElements.define( ` this.intervalId = null } + connectedCallback() { + $(this.gid('searchbar')).off() + $(this.gid('searchbar')).on('submit', (e) => { + e.preventDefault() + this.setAttribute('here', $(this.gid('input-here')).val()) + this.setAttribute('renderer', this.strategies[0]) + this.rebuildIframe() + }) + $(this.gid('input-here')).off() + $(this.gid('input-here')).on('focusout', (e) => { + $(this).removeAttr('searching') + }) + $(this.gid('input-here')).on('blur', (e) => { + $(this).removeAttr('searching') + }) + $(this.gid('menu-toggle')).off() + $(this.gid('menu-toggle')).on('click', (e) => { + this.toggleAttribute('menu') + }) + this.intervalId = null + } connectedCallback() { $(this.gid('searchbar')).off() $(this.gid('searchbar')).on('submit', (e) => { @@ -146,6 +167,19 @@ customElements.define( this.toggleAttribute('menu') }) + $(this.gid('dragger')).off() + $(this.gid('dragger')).on('dragstart', (e) => { + e.originalEvent.dataTransfer.setData( + 'text/plain', + this.getAttribute('wid') + ) + }) + $(this.gid('dragger')).on('dragenter', (e) => { + $(this).emit('drag-start') + }) + $(this.gid('dragger')).on('dragend', (e) => { + $(this).emit('drag-end') + }) $(this.gid('dragger')).off() $(this.gid('dragger')).on('dragstart', (e) => { e.originalEvent.dataTransfer.setData( @@ -202,6 +236,22 @@ customElements.define( this.setAttribute('wid', `${Date.now()}`) this.buildMenu() + // poll iframes for changes every 350ms + this.intervalId = setInterval(() => { + let here = this.getAttribute('here') + let favicon = this.getAttribute('favicon') + let tabTitle = this.getAttribute('tab-title') + $(this.gid('tabs')) + .children() + .each(function () { + this.contentWindow.postMessage({ + messagetype: 'sky-poll', + here, + favicon, + tabTitle + }) + }) + }, 350) // poll iframes for changes every 350ms this.intervalId = setInterval(() => { let here = this.getAttribute('here') @@ -402,6 +452,7 @@ customElements.define( if (words.length != 2) { words = ['b', 'b-error'] } + return words[1].split('-').slice(1).join(' ') } } } @@ -419,6 +470,23 @@ customElements.define( } return r } + async checkUrl(url) { + try { + let response = await fetch(url, { method: 'GET' }) + if (response.ok) { + if (response.redirected) { + return false + } else { + return true + } + } else { + return false + } + } catch (error) { + console.error('Fetch error:', error) + return false + } + } createIframe(prefix, here, open) { let el = document.createElement('iframe') el.setAttribute('prefix', prefix) @@ -436,10 +504,22 @@ customElements.define( }) return el } - rebuildIframe() { - $(this.gid('tabs')).children().remove() - let frame = this.createIframe(this.renderer, this.here, true) - $(this.gid('tabs')).append(frame) + async rebuildIframe() { + let url = + this.renderer === '/self' + ? window.location.origin + this.here + : window.location.origin + this.renderer + this.here + let isLoading = await this.checkUrl(url) + if (isLoading) { + $(this.gid('tabs')).children().remove() + let frame = this.createIframe(this.renderer, this.here, true) + $(this.gid('tabs')).append(frame) + } else { + $(this.gid('tabs')).children().remove() + let frame = this.createIframe(`/tree`, this.here, true) + $(this.gid('menu-toggle')).text(`tree`) + $(this.gid('tabs')).append(frame) + } } registerServiceWorker(iframe, prefix) { // for convenience, this part is inject by wi-nd. @@ -540,6 +620,43 @@ customElements.define( }) breadcrumbs.append(spacer) } + buildMenu() { + let menu = this.gid('menu') + $(menu).children().remove() + // + /*let top = $(` + ` + iframeDoc.body.appendChild(inlineScript) + } + buildBreadcrumbs() { + let breadcrumbs = $(this.gid('breadcrumbs')) + breadcrumbs.children().remove() + // + this.path.forEach((p, i) => { + let chevron = $(document.createElement('span')) + chevron.addClass('s-2 f4 o6 fc ac jc no-select') + if (i > 0) { + chevron.text('›') + } + breadcrumbs.append(chevron) + // + let crumb = $(document.createElement('button')) + crumb.addClass((i === 0 ? 'p-1' : 'p1') + ' b2 hover br1 s-1 f2') + crumb.text(i === 0 && this.path[0].startsWith('~') ? '/' : this.path[i]) + crumb.on('click', () => { + $(this).attr('here', '/' + this.path.slice(0, i + 1).join('/')) + $(this).attr('renderer', this.strategies[0]) + this.rebuildIframe() + }) + breadcrumbs.append(crumb) + }) + let spacer = $(document.createElement('button')) + spacer.addClass('grow b2 br1 hover') + spacer.on('click', () => { + $(this).attr('searching', '') + }) + breadcrumbs.append(spacer) + } buildMenu() { let menu = this.gid('menu') $(menu).children().remove() @@ -573,6 +690,7 @@ customElements.define( `);*/ + let top = $(` let top = $(`