fix con/hoon-htmx

This commit is contained in:
Will Hanlen 2024-06-18 16:48:15 -04:00
parent c353ab69ca
commit 7acd7896e7
5 changed files with 138 additions and 34 deletions

View File

@ -45,6 +45,7 @@
%iframe
%task
%txt
%hoon
%sail
%slideshow
==

View File

@ -4,7 +4,9 @@
|= =bowl:neo
=/ =name:neo
[our here]:bowl
=/ =file:ford:neo
=/ fool=(each file:ford:neo tang)
%- mule
|.
(scan (trip hon) (rein:ford:neo name))
=/ src=wain
(to-wain:format hon)
@ -23,38 +25,48 @@
::
++ apex
^- manx
;div.wf.hf.p3.hoon.fc.g2
;div.wf.hf.hoon.fc
;+ imports
;+ contents
;+ style
;+ script
==
++ imports
;div.frw.g2
;div.frw.g2.p2
;*
%+ turn pro.file
|= =pro:ford:neo
^- manx
;a.p2.br1.b1.hover.s-1
=href (spud (post-href %pro stud.pro))
=hx-target "closest .hawk"
=hx-swap "innerHTML"
; {<stud.pro>}
?- -.fool
%.n
:_ ~
(error p.fool)
::
%.y
%+ turn pro.p.fool
|= =pro:ford:neo
^- manx
;a.p2.br1.b1.hover.s-1
=href (spud (post-href %pro stud.pro))
=hx-target "closest .hawk"
=hx-swap "innerHTML"
; {<stud.pro>}
==
==
==
++ error
;details.error-parent.wf.br1.bd1(open "")
|= =tang
=/ =wall (zing (turn tang |=(t=tank (~(win re t) [0 80]))))
=/ =tape (zing (join "\0a" wall))
;details.wf.br1.bd1(open "")
=style "max-height: 220px;"
;summary.p2.br1.b-3.f-3: error
;div.p3
;div.error.empty;
;summary.p2.br1.b-3.f0: error
;div.pre.mono.p2.wf.scroll-y
;+ ;/ tape
==
==
++ contents
;form.fc.g2.wf.relative.grow.scroll-y
=style "border-top: 1px solid var(--b3);"
=hx-put "{(en-tape:pith:neo (welp /neo/hawk here.bowl))}?stud=hoon"
=hx-trigger "click from:find button, keydown[metaKey&&key=='Enter']"
=hx-target "closest .hoon"
=hx-target-error "find .error"
=hx-swap "morph"
;div.relative.grow.fc
;div.wfc.z1.absolute
@ -67,28 +79,51 @@
;span.loading: ...
==
==
;textarea.p2.bd1.br1.scroll-x.pre.mono.wf.grow
=style "outline:none;"
=autocomplete "off"
=rows "1"
=spellcheck "false"
=name "text"
=oninput "this.setAttribute('value', this.value);"
=value (trip hon)
;*
%+ turn src
|= lin=@t
;/ "{(trip lin)}\0a"
;div.fr.grow
;div.hf.f3.numbered
=style "min-width: 10px; padding: 8px 5px; border-right: 1px solid var(--b3);"
;*
%+ turn (gulf 1 (lent src))
|= n=@
;div.mono(style "line-height: 1.1;");
==
;textarea.p2.pre.mono.wf.grow
=id "bingo-bango"
=style "outline:none; line-height: 1.1; overflow-y: hidden;"
=autocomplete "off"
=rows "1"
=spellcheck "false"
=name "text"
=oninput "this.setAttribute('value', this.value); skyHoonRenumber(this);"
=value (trip hon)
;*
%+ turn src
|= lin=@t
;/ "{(trip lin)}\0a"
==
==
==
;+ error
==
++ style
;style
++ script
;script
;+ ;/ %- trip
'''
details.error-parent:has(.error:empty) {
display: none;
function skyHoonRenumber(el) {
// corrects the line numbers
let lines = 1 + el.value.split('\n').length;
let nums = $(el).parent().find('.numbered').get()[0];
let kids = nums.children.length + 1;
while (kids < lines) {
let div = document.createElement('div');
div.classList.add('mono');
div.style = 'line-height: 1.1;';
nums.appendChild(div);
kids = kids + 1;
}
while (kids > lines) {
nums.children[0].remove();
kids = kids - 1;
}
}
'''
==

View File

@ -1,5 +1,6 @@
/@ folder
/@ folder-diff
/@ tracer
=>
|%
++ default-pails
@ -7,6 +8,7 @@
^- (list [stud:neo pail:neo])
:~
[%iframe iframe/!>('')]
[%hoon hoon/!>('~')]
[%txt txt/!>('')]
==
--

View File

@ -179,6 +179,72 @@
manx
==
==
::
%'PUT'
=/ purl (parse-url:serv request.req)
=/ content-type (~(gut by pam.purl) 'content-type' 'text/html')
~& content-type
=/ body (parse-body:serv request.req)
=/ poke-stud
^- stud:neo
~| %no-stud-specified
(~(got by pam.purl) 'stud')
=/ mul
%- mule
|.
?: =(content-type 'application/x-www-form-urlencoded')
~& poke-stud
=/ fine (http-request [poke-stud `request:http`request.req])
fine
(node [poke-stud body])
?- -.mul
%.n
%: eyre-cards
eyre-id
bowl
500
:~
['content-type' 'text/html']
['HX-Reswap' 'outerHTML']
==
;div.b0.p-page.wf.hf.fc.g2.as
;a.p2.br1.bd1.b1.hover.loader.block
=href "/neo/hawk{(spud pax.purl)}"
;span.loaded: reload
;span.loading
;+ loading.feather-icons
==
==
;+ (print-tang (tang p.mul))
==
==
::
%.y
=/ =pail:neo [poke-stud p.mul]
=/ bol *bowl:neo
=. here.bol here
=. our.bol our.bowl
=. now.bol now.bowl
=. eny.bol eny.bowl
=/ =manx
?~ converter=(mole |.((htmx pail)))
(default-refresher here)
=/ mul
%- mule
|.((u.converter bol))
?- -.mul
%.y p.mul
%.n ;div: error
==
:- [here %make poke-stud `pail ~]
%: eyre-cards
eyre-id
bowl
200
['content-type' 'text/html']~
manx
==
==
==
--
--