Merge branch 'wh/sky-post-pokes' into lf/accel-rewrite

This commit is contained in:
Liam Fitzgerald 2024-06-04 06:21:24 -04:00
commit 611ab42c71
15 changed files with 524 additions and 459 deletions

View File

@ -1003,9 +1003,10 @@
^- form:neo
|_ [=bowl:neo =saga:neo]
++ poke
|= [s=stud:neo vax=^vase]
|= =pail:neo
^- (quip card:neo pail:neo)
`q.saga
?> =(p.pail stud)
`pail
++ init
|= pal=(unit pail:neo)
^- (quip card:neo pail:neo)
@ -1361,7 +1362,7 @@
(welp #/cod/grab (stud-to-pith:neo i.pos))
?: !=(~ (~(peek plow:aux loam) p/our.bowl pat))
$(pos t.pos)
=. run (on-dirt-card (do-grow-our pat vase/=>(..zuse !>(|=(~ *vase)))))
=. run (on-dirt-card (do-grow-our pat vase/=>(..zuse !>(|=(* *vase)))))
$(pos t.pos)
::
++ build-fars

View File

@ -15,9 +15,9 @@
:: manxes
++ friends-list
^- manx
;div.fc.g2
;div.fc.g2
;*
%+ turn
%+ turn
%+ murn
~ ::~(tap in ~(key by kids.bowl))
|= =pith ((soft ship) ->:pith)

View File

@ -7,14 +7,18 @@
|^
;div.p2
=label "Diary"
;div.ma.fc.g2
=style "max-width: 650px;"
;div.ma.fc.g2.mw-page
;+ form-put-entry
;*
%+ turn ~
:: %+ sort ~(tap of:neo kids.bowl)
:: |= [a=[=pith *] b=[=pith *]]
:: (gth ->.pith.a ->.pith.b)
%+ turn
%+ sort
%+ murn
~(tap of:neo kids.bowl)
|= [=pith =idea:neo]
?~ pith ~
`[pith idea]
|= [a=[=pith *] b=[=pith *]]
(gth ->.pith.a ->.pith.b)
link-entry
==
==
@ -22,10 +26,10 @@
::
;form.fc.g2
=style "margin-bottom: 30px;"
=hx-post "{(en-tape:pith:neo :(weld /neo/hawk here.bowl))}?stud=diary-diff"
=hx-post "/neo/hawk{(en-tape:pith:neo here.bowl)}?stud=diary-diff"
=hx-on-submit "this.reset()"
=hx-target "this"
=hx-swap "afterend"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "put-entry"
;date-now(name "id");
;textarea.p2.bd1.br1
@ -47,8 +51,8 @@
::
++ link-entry
::
|= [pax=pith =pail:neo]
=/ tape (trip !<(@t q.pail))
|= [pax=pith =idea:neo]
=/ tape (trip !<(@t q.pail.idea))
=/ subject-end (fall (find [10]~ tape) 56)
=/ subject (scag subject-end tape)
=/ id (trip (snag 0 (pout pax)))

View File

@ -1,13 +0,0 @@
/@ folder-diff
/- feather-icons
:- [%folder-diff %$ %htmx]
|= =folder-diff
|= =bowl:neo
;div.loading
=hx-get "/neo/hawk{(en-tape:pith:neo here.bowl)}"
=hx-target "closest .hawk"
=hx-indicator "closest .loader"
=hx-swap "innerHTML"
=hx-trigger "load"
;+ loading.feather-icons
==

View File

@ -13,7 +13,7 @@
++ id
^- tape
%- zing
%+ turn (pout here.bowl)
%+ turn (pout (slag 1 here.bowl))
|= smeg=@ta
%+ weld "--"
(trip smeg)
@ -28,7 +28,7 @@
;
==
;a.p2.b1.hover.loader.br2.bd1.fr.jc.ac.f3
=href "/neo/hawk/sky/settings"
=href "/neo/hawk/{<our.bowl>}/sky/settings"
;span.loaded
;+ settings.feather-icons
==

View File

@ -19,8 +19,7 @@
=type "text"
=name "text"
=value url
=is "atom-input"
=oninput "this.parentNode.nextElementSibling.src = this.value;"
=oninput "$(this).attr('value', this.value); this.parentNode.nextElementSibling.src = this.value;"
;
==
;button.p2.b1

View File

@ -8,8 +8,9 @@
=/ mu ~(. manx-utils nod)
=/ code
=/ raw=tape (need (val:mu "code"))
?: =((rear raw) '\0a') (crip (snip raw))
(crip raw)
?: =(0 (lent raw)) (crip raw)
?. =((rear raw) '\0a') (crip raw)
(crip (snip raw))
=/ class (vol:mu "classes")
[code class `(render-udon code)]
++ render-udon

View File

@ -125,7 +125,7 @@
=class "fr ac br1 {color}"
;button
=class "loader p2 tl br1 hover grow {color}"
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-post "/neo/hawk/{<our.bowl>}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "maximize"
@ -137,7 +137,7 @@
==
;button
=class "loader p2 tl br1 hover {color}"
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-post "/neo/hawk/{<our.bowl>}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "close"
@ -153,7 +153,7 @@
==
++ new-tab
;button.loader.b2.p2.tc.br1.hover.wfc.s-1
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-post "/neo/hawk/{<our.bowl>}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=type "button"

View File

@ -4,7 +4,7 @@
|%
++ state pro/%circle
++ poke (sy %circle-diff ~)
++ kids
++ kids
:+ ~ %y
%- ~(gas by *lads:neo)
:~ [[|/%p |] pro/%sig ~]
@ -19,7 +19,7 @@
=+ !<(=diff vax)
:_ pail
?- -.diff
%add
%add
%+ turn ~(tap by p.diff)
|= [=ship =made:neo]
[(snoc here.bowl p/ship) %make made]

View File

@ -1,5 +1,16 @@
/@ folder
/@ folder-diff
=>
|%
++ default-pails
%- malt
^- (list [stud:neo pail:neo])
:~
[%iframe iframe/!>('')]
[%txt txt/!>('')]
[%sail sail/!>(['' '' ~])]
==
--
^- kook:neo
|%
++ state pro/%folder
@ -26,7 +37,7 @@
?- -.poke
%make
:_ folder/!>([name.poke this])
:~ [(snoc here.bowl name.poke) %make stud.poke ~ ~]
:~ [(snoc here.bowl name.poke) %make stud.poke (~(get by default-pails) stud.poke) ~]
==
::
%tomb

View File

@ -1,176 +1,206 @@
/@ htmx
/@ htmx-type=htmx
/- feather-icons
/- serv=server
/> htmx
/< node
=>
|%
++ main
^- curb:neo
::[%or rol/[%ui-main pro/%htmx] pro/%htmx ~]
:: rol/[%ui-main pro/%htmx]
pro/%htmx
++ kids-curb
^- curb:neo
::[%or rol/[%ui-cell pro/%htmx] pro/%htmx ~]
pro/%htmx
:: rol/[%ui-list pro/%htmx]
++ manx-to-octs
|= man=manx
(as-octt:mimes:html (en-xml:html man))
::
++ render
|= [main=manx kids=marl]
;div
;+ main
|%
++ manx-to-octs
|= man=manx
(as-octt:mimes:html (en-xml:html man))
++ parse-url
|= =request:http
^- [pax=path pam=(map @t @t)]
=/ parsed
%+ rash url.request
;~ plug
;~(pfix fas (more fas smeg:de-purl:html))
yque:de-purl:html
==
:: strip first 2 segments (/neo/hawk)
:- (slag 2 -.parsed)
(malt +.parsed)
++ parse-body
|= =request:http
^- manx
%+ fall
(de-xml:html q:(fall body.request [p=0 q='']))
*manx
++ eyre-cards
|= [eyre-id=@ta =bowl:neo status=@ud =manx]
^- (list card:neo)
=/ =pith:neo #/[p/our.bowl]/$/eyre
=/ head=sign:eyre:neo [eyre-id %head [status [['content-type' 'text/html'] ~]]]
=/ data=sign:eyre:neo [eyre-id %data `(manx-to-octs manx)]
=/ done=sign:eyre:neo [eyre-id %done ~]
:~ [pith %poke eyre-sign/!>(head)]
[pith %poke eyre-sign/!>(data)]
[pith %poke eyre-sign/!>(done)]
[here.bowl %cull ~]
==
++ default-refresher
|= =pith
=/ tath (en-tape:pith:neo pith)
;div
=hx-get "/neo/hawk{tath}"
=hx-target "closest .hawk"
=hx-select ".hawk"
=hx-trigger "load once"
=hx-swap "outerHTML"
;
==
++ hawk
|_ [here=pith main=manx raw=manx has-app=?]
++ id *@da
++ our-tape
=/ f (snag 0 here)
?@(f (trip f) (scow f))
++ idt `tape`(zing (scan +:(scow %da id) (most dot (star ;~(less dot prn)))))
++ slot 0 :: XX fix sky positional saving
++ lift
;div.hawk.fc.wf.hf
=id "hawk-{idt}"
=hx-params "id,slot"
=hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<slot>}\"}"
;+ header
;div
;* kids
=class "raw p-page wf hf b0 scroll-y scroll-x {(trip ?:(has-app 'hidden' ''))}"
;+ raw
==
;div
=class "rendered wf hf b0 scroll-y scroll-x {(trip ?:(has-app '' 'hidden'))}"
=id "hawk-rendered-{idt}"
=morph-retain "class"
;+ main
==
==
++ hawk
|_ [here=pith main=manx raw=manx]
++ id *@da
++ idt `tape`(zing (scan +:(scow %da id) (most dot (star ;~(less dot prn)))))
++ has-app %.y :: XX : switch on it. make it real. etc
++ lift
;div.hawk.fc.wf.hf
=id "hawk-{idt}"
=hx-params "id,slot"
=hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<0>}\"}"
;+ header
::;+ raw
;div
=class "rendered wf hf b0 scroll-y scroll-x {(trip ?:(has-app '' 'hidden'))}"
=id "hawk-rendered-{idt}"
=morph-retain "class"
;+ main
==
++ header
;header.b2.p1.frw.g1.ac
=id "hawk-header-{idt}"
=style "border: 2px solid var(--b2);"
;button
=class "p1 hover b2 br1 bd0 {(trip ?:(has-app '' 'toggled'))}"
=onclick
"""
$(this).toggleClass('toggled');
$(this).closest('.hawk').find('.raw').toggleClass('hidden');
$(this).closest('.hawk').find('.rendered').toggleClass('hidden');
$(this).closest('header').children('.hawk-tog').toggleClass('hidden');
"""
;+ outline:feather-icons
==
++ header
;header.b2.p1.frw.g1.ac
=id "hawk-header-{idt}"
=style "border: 2px solid var(--b2);"
;button
=class "p1 hover b2 br1 bd0 {(trip ?:(has-app '' 'toggled'))}"
=onclick
"""
$(this).toggleClass('toggled');
$(this).closest('.hawk').find('.raw').toggleClass('hidden');
$(this).closest('.hawk').find('.rendered').toggleClass('hidden');
$(this).closest('header').children('.hawk-tog').toggleClass('hidden');
"""
;+ outline:feather-icons
==
;div
=class "hawk-tog frw g1 ac grow {(trip ?:(has-app '' 'hidden'))}"
;*
=< p
%^ spin here
0
|= [=iota a=@]
:_ +(a)
;div.fr.ac.g1
;div
=class "hawk-tog frw g1 ac grow {(trip ?:(has-app '' 'hidden'))}"
;*
=< p
%^ spin here
0
|= [=iota a=@]
:_ +(a)
;div.fr.ac.g1
=style "height: 2rem;"
;div.f4.s-1: >
;a.hover.b2.br1.p-1.s0.loader.fc.ac.jc
=style "height: 2rem;"
;div.f4.s-1: >
;a.hover.b2.br1.p-1.s0.loader.fc.ac.jc
=style "height: 2rem;"
=hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<slot>}\"}"
=href "/neo/hawk{(en-tape:pith:neo (scag +(a) here))}"
;span.loaded
;+ ;/
?: =(a 0) "/"
(trip ?@(iota iota (scot iota)))
==
;span.loading
;+ loading.feather-icons
==
=hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<slot>}\"}"
=href "/neo/hawk{(en-tape:pith:neo (scag +(a) here))}"
;span.loaded
;+ ;/
?: =(a 0) "/"
(trip ?@(iota iota (scot iota)))
==
==
;div.grow;
==
;form
=class "hawk-tog grow fr m0 relative {(trip ?:(has-app 'hidden' ''))}"
=style "height: 2rem;"
=hx-get "/neo/hawk"
=hx-target "closest .hawk"
;div.absolute
=style "top: 0.5rem; right: 0.5rem;"
;div.loader
;div.loaded(style "opacity: 0"): ---
;div.loading
;+ loading:feather-icons
;span.loading
;+ loading.feather-icons
==
==
==
;input.p-1.br1.b1.wf.s0.loaded.grow.bd0
=style "margin-left: 5px;"
=type "text"
=value (en-tape:pith:neo here)
=oninput
"""
$(this).attr('value', this.value);
$(this).parent().attr('hx-get', '/neo/hawk'+this.value);
htmx.process(document.body);
"""
;
;div.grow;
==
;form
=class "hawk-tog grow fr m0 relative {(trip ?:(has-app 'hidden' ''))}"
=style "height: 2rem;"
=hx-get "/neo/hawk"
=hx-target "closest .hawk"
;div.absolute
=style "top: 0.5rem; right: 0.5rem;"
;div.loader
;div.loaded(style "opacity: 0"): ---
;div.loading
;+ loading:feather-icons
==
==
==
;div.fr.ac.jc.g1.hawk-actions
=id "hawk-actions-{idt}"
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-slide-up-{idt}"
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "slide-up"
=hawk-slot "{<slot>}"
;span.loaded
;+ chevron-left:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-slide-down-{idt}"
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "slide-down"
=hawk-slot "{<slot>}"
;span.loaded
;+ chevron-right:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-close-{idt}"
=hx-post "/neo/hawk/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "minimize"
=hawk-slot "{<slot>}"
;span.loaded
;+ minimize:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;style
;+ ;/ %- trip
'''
@media(max-width: 900px) {
.hawk-actions {
display: none !important;
}
}
'''
==
;input.p-1.br1.b1.wf.s0.loaded.grow.bd0
=style "margin-left: 5px;"
=type "text"
=value (en-tape:pith:neo here)
=oninput
"""
$(this).attr('value', this.value);
$(this).parent().attr('hx-get', '/neo/hawk'+this.value);
htmx.process(document.body);
"""
;
==
==
--
;div.fr.ac.jc.g1.hawk-actions
=id "hawk-actions-{idt}"
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-slide-up-{idt}"
=hx-post "/neo/hawk/{our-tape}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "slide-up"
=hawk-slot "{<slot>}"
;span.loaded
;+ chevron-left:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-slide-down-{idt}"
=hx-post "/neo/hawk/{our-tape}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "slide-down"
=hawk-slot "{<slot>}"
;span.loaded
;+ chevron-right:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;button.p1.hover.b2.br1.loader.s-1
=id "hawk-close-{idt}"
=hx-post "/neo/hawk/{our-tape}/sky?stud=sky-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "minimize"
=hawk-slot "{<slot>}"
;span.loaded
;+ minimize:feather-icons
==
;span.loading
;+ loading.feather-icons
==
==
;style
;+ ;/ %- trip
'''
@media(max-width: 900px) {
.hawk-actions {
display: none !important;
}
}
'''
==
==
==
--
--
^- kook:neo
|%
++ state pro/%eyre-task
@ -185,12 +215,12 @@
^- fief:neo
:- req=|
^- quay:neo
:- [main ~]
:- [[%or rol/[%ui-main pro/%htmx] pro/%htmx ~] ~]
^- (unit port:neo)
:+ ~ %y
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[kids-curb ~]
`lash:neo`[any/~ ~]
==
==
::
@ -207,23 +237,68 @@
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
:_ [stud vase]
=/ =pith:neo #/[p/our.bowl]/$/eyre
=* eyre ~(. neo:serv pith)
=; =manx
%- ~(respond neo:serv pith)
[eyre-id (manx-response:gen:serv manx)]
(respond:eyre eyre-id (manx-response:gen:serv manx))
?. authenticated.req
(respond:eyre eyre-id invalid-req:gen:serv)
?~ src=(~(get by deps.bowl) %src)
;div: 404
=/ root=idea:neo (~(got of:neo q.u.src) /)
?> =(%htmx p.pail.root)
=/ bol *bowl:neo
=. here.bol p.u.src
=. our.bol our.bowl
=. now.bol now.bowl
=. eny.bol eny.bowl
=. kids.bol q.u.src
:: XX src.bowl
=/ main (!<(htmx q.pail.root) bol)
=/ raw *manx
~(lift hawk here.bol main raw)
=/ main
;div.wf.hf.fc.jc.ac: nothing here
=/ raw
;div.wf.hf.fc.jc.ac: raw view
(respond:eyre eyre-id (manx-response ~(lift hawk #[p/ur.bowl] main raw |)))
=/ here p.u.src
^- (list card:neo)
?+ method.request.req ~|(%unsupported-http-method !!)
%'GET'
=/ root=idea:neo (~(got of:neo q.u.src) /)
?> =(%htmx p.pail.root)
=/ bol *bowl:neo
=. here.bol here
=. our.bol our.bowl
=. now.bol now.bowl
=. eny.bol eny.bowl
=. kids.bol q.u.src
:: XX src.bowl
=/ main (!<(htmx-type q.pail.root) bol)
=/ raw
;div.wf.hf.fc.jc.ac: raw view
(respond:eyre eyre-id (manx-response ~(lift hawk here.bowl main raw &)))
::
%'POST'
=/ purl (parse-url request.req)
=/ body (parse-body request.req)
=/ poke-stud
^- stud:neo
~| %no-stud-specified
(~(got by pam.purl) 'stud')
::=/ mul `(each ^vase tang)`[%.y p=!>(~)] :: stub for build system bug
=/ mul (mule |.((node [poke-stud body])))
?- -.mul
%.n
(respond:eyre eyre-id invalid-req)
::
%.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 %poke pail]
(respond:eyre eyre-id (manx-response manx))
==
==
--
--

View File

@ -31,9 +31,9 @@
(~(respond neo:serv eyre) eyre-id (manx-response:gen:serv manx))
=/ args (~(gas by *(map @t @t)) args.lin)
=/ =crew:neo (~(gas by *crew:neo) src/inner ~)
~& crew/crew
=/ =made:neo [%hawk-eyre-handler `[stud vax] crew]
:_ sig/!>(~)
:~ [(welp here.bowl #/[uv/eny.bowl]) %make %hawk-eyre-handler `[stud vax] crew]
:~ [(welp here.bowl #/[uv/eny.bowl]) %make made]
==
==
++ init
@ -46,4 +46,3 @@
==
--
--

View File

@ -1,9 +1,7 @@
/@ htmx
/- serv=server
/- feather-icons
/- serv=server
/* date-now
/* atom-input
/* multiline-input
/* a-i-r
/* feather
/* reset
@ -12,242 +10,234 @@
/* htmx-js
/* htmx-response-targets
/* htmx-idiomorph
=>
=<
^- kook:neo
|%
++ main
^- curb:neo
pro/%htmx
:: [%or rol/[%ui-main pro/%htmx] pro/%htmx ~]
:: rol/[%ui-main pro/%htmx]
++ kids-curb
^- curb:neo
pro/%htmx
:: rol/[%ui-list pro/%htmx]
++ manx-to-octs
|= man=manx
%- as-octt:mimes:html
%+ welp "<!DOCTYPE html>"
(en-xml:html man)
++ state pro/%eyre-task
++ poke *(set stud:neo)
++ kids
:+ ~ %y
%- ~(gas by *lads:neo)
~
++ deps
%- ~(gas by *band:neo)
:~ :- %src
^- fief:neo
:- req=|
^- quay:neo
:- [pro/%htmx ~]
^- (unit port:neo)
:+ ~ %y
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[any/~ ~]
==
==
::
++ render
|= [main=manx kids=marl]
;div
;+ main
;div
;* kids
==
==
++ icon-url
^~
%- trip
%^ cat
3
'data:image/png;base64,'
%- ~(en base64:mimes:html & |)
(as-octs:mimes:html hawk-icon)
++ favicon
^~
=; m m(a.g [[%href icon-url] a.g.m])
^- manx
;link
=rel "icon"
=type "image/png"
;
==
++ manifest-url
^~
%- trip
%^ cat
3
'data:application/json;utf-8,'
%- en:json:html
%- pairs:enjs:format
:~
['name' s+'sky']
['description' s+'an urbit namespace viewer']
['start_url' s+'http://localhost/neo/sky'] :: XX
['display' s+'standalone']
['background_color' s+'black']
:+ 'icons' %a
:~
%- pairs:enjs:format
:~
['src' s+(crip icon-url)]
['sizes' s+'196x196']
['type' s+'image/png']
==
==
==
++ manifest
^~
=; m m(a.g [[%href manifest-url] a.g.m])
^- manx
;link
=rel "manifest"
;
==
++ htmx-extensions
:: htmx extension which encodes the request
:: as the serialized HTML of the calling element
%- trip
'''
htmx.defineExtension('html-enc', {
onEvent: function (name, evt) {
if (name === "htmx:configRequest") {
evt.detail.headers['Content-Type'] = "text/html";
}
},
encodeParameters : function(xhr, parameters, elt) {
xhr.overrideMimeType('text/html');
let xmls = new XMLSerializer();
return (xmls.serializeToString(elt));
}
});
Idiomorph.defaults.ignoreActive = true;
Idiomorph.defaults.callbacks.beforeAttributeUpdated = (name, node, type) => {
if (node.hasAttribute('morph-retain')) {
let ribs = node.getAttribute('morph-retain').split(',').map(t => t.trim());
if (ribs.includes(name)) {
return false;
}
}
}
Idiomorph.defaults.callbacks.beforeNodeMorphed = (oldNode, newNode) => {
if (oldNode?.nodeName !== "#text") {
if (oldNode.hasAttribute('morph-no-swap') && oldNode.id === newNode.id) {
return false;
}
else if (
newNode.hasAttribute('morph-if-class') &&
!oldNode.classList.contains(newNode.getAttribute('morph-if-class'))
) {
return false;
}
}
}
'''
::
++ lift
|= in=manx
^- manx
;html
;head
;meta(charset "UTF-8");
;title: s k y
;script: {(trip jquery)}
;script: {(trip htmx-js)}
;script: {(trip htmx-response-targets)}
;script: {(trip htmx-idiomorph)}
;script: {htmx-extensions}
;meta
=name "viewport"
=content
"""
width=device-width,
initial-scale=1.0,
maximum-scale=1.0
"""
;
==
;meta
=name "htmx-config"
=content (trip '{"ignoreTitle":"true"}')
;
==
::;style
:: ;+ ;/ %- trip
:: '''
:: @font-face {
:: font-family: 'Urbit Sans';
:: src: url("https://media.urbit.org/fonts/UrbitSans/UrbitSansVFWeb-Regular.woff2") format("woff2");
:: font-style: normal;
:: font-weight: 100 700;
:: }
:: '''
::==
;style: {(trip reset)}
;style: {(trip feather)}
;script
;+ ;/
"""
window.log=function()\{if(this.console)\{console.log(Array.prototype.slice.call(arguments));}};
jQuery.fn.log=function (msg)\{console.log(msg, this); return this;};
jQuery.fn.emit=function (name)\{(this[0]).dispatchEvent(new Event(name, \{ bubbles: true, cancelable: true, composed: true })); return this;};
"""
==
;script: {(trip a-i-r)}
;+ favicon
;+ manifest
==
;body
=hx-ext "html-enc,response-targets,morph"
=hx-swap "innerHTML"
=hx-boost "true"
=hx-history "false"
=hx-replace-url "/neo/sky"
=hx-target "closest .hawk"
=style
"""
background-color: var(--b1);
background-image: var(--sky-bg-url);
background-size: var(--sky-bg-size);
background-repeat: var(--sky-bg-repeat);
"""
;+ in
==
==
++ form
|_ [=bowl:neo =aeon:neo =pail:neo]
++ poke
|= [=stud:neo vax=vase]
^- (quip card:neo pail:neo)
`pail
++ init
|= pal=(unit pail:neo)
=/ [=stud:neo =vase] (need pal)
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
:_ [stud vase]
=/ =pith:neo #/[p/our.bowl]/$/eyre
=; =manx
%+ snoc
(~(respond neo:serv pith) eyre-id (manx-response:gen:serv manx))
[here.bowl %cull ~]
?~ src=(~(get by deps.bowl) %src)
;div: 404
=/ root=idea:neo (~(got of:neo q.u.src) /)
?> =(%htmx p.pail.root)
=/ bol *bowl:neo
=. here.bol p.u.src
=. our.bol our.bowl
=. now.bol now.bowl
=. eny.bol eny.bowl
=. kids.bol q.u.src
:: XX src.bowl
(lift (!<(htmx q.pail.root) bol))
--
--
^- kook:neo
|%
++ state pro/%eyre-task
++ poke *(set stud:neo)
++ kids
:+ ~ %y
%- ~(gas by *lads:neo)
~
++ deps
%- ~(gas by *band:neo)
:~ :- %src
^- fief:neo
:- req=|
^- quay:neo
:- [main ~]
^- (unit port:neo)
:+ ~ %z
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[kids-curb ~]
==
++ icon-url
^~
%- trip
%^ cat
3
'data:image/png;base64,'
%- ~(en base64:mimes:html & |)
(as-octs:mimes:html hawk-icon)
++ favicon
^~
=; m m(a.g [[%href icon-url] a.g.m])
^- manx
;link
=rel "icon"
=type "image/png"
;
==
++ manifest-url
^~
%- trip
%^ cat
3
'data:application/json;utf-8,'
%- en:json:html
%- pairs:enjs:format
:~
['name' s+'sky']
['description' s+'an urbit namespace viewer']
['start_url' s+'http://localhost/neo/sky'] :: XX
['display' s+'standalone']
['background_color' s+'black']
:+ 'icons' %a
:~
%- pairs:enjs:format
:~
['src' s+(crip icon-url)]
['sizes' s+'196x196']
['type' s+'image/png']
==
==
==
++ manifest
^~
=; m m(a.g [[%href manifest-url] a.g.m])
^- manx
;link
=rel "manifest"
;
==
++ htmx-extensions
:: htmx extension which encodes the request
:: as the serialized HTML of the calling element
%- trip
'''
htmx.defineExtension('html-enc', {
onEvent: function (name, evt) {
if (name === "htmx:configRequest") {
evt.detail.headers['Content-Type'] = "text/html";
}
},
encodeParameters : function(xhr, parameters, elt) {
xhr.overrideMimeType('text/html');
let xmls = new XMLSerializer();
return (xmls.serializeToString(elt));
}
});
Idiomorph.defaults.ignoreActive = true;
Idiomorph.defaults.callbacks.beforeAttributeUpdated = (name, node, type) => {
if (node.hasAttribute('morph-retain')) {
let ribs = node.getAttribute('morph-retain').split(',').map(t => t.trim());
if (ribs.includes(name)) {
return false;
}
}
}
Idiomorph.defaults.callbacks.beforeNodeMorphed = (oldNode, newNode) => {
if (oldNode?.nodeName !== "#text") {
if (oldNode.hasAttribute('morph-no-swap') && oldNode.id === newNode.id) {
return false;
}
else if (
newNode.hasAttribute('morph-if-class') &&
!oldNode.classList.contains(newNode.getAttribute('morph-if-class'))
) {
return false;
}
}
}
'''
::
++ form
|_ [=bowl:neo =aeon:neo =pail:neo]
++ poke
|= [=stud:neo vax=vase]
^- (quip card:neo pail:neo)
`pail
++ init
|= pal=(unit pail:neo)
=/ [=stud:neo =vase] (need pal)
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
:_ [stud vase]
=/ =pith:neo #/[p/our.bowl]/$/eyre
=; =manx
%+ snoc
(~(respond neo:serv pith) [eyre-id (manx-response:gen:serv manx)])
[here.bowl %cull ~]
?~ src=(~(get by deps.bowl) %src)
;div: 404
=/ root=idea:neo (~(got of:neo q.u.src) /)
?> =(%htmx p.pail.root)
=/ bol *bowl:neo
=. here.bol p.u.src
=. our.bol our.bowl
=. now.bol now.bowl
=. eny.bol eny.bowl
=. kids.bol q.u.src
~& kids/~(key by ~(tar of:neo kids.bol))
:: XX src.bowl
(lift (!<(htmx q.pail.root) bol))
--
++ lift
|= in=manx
^- manx
;html
;head
;meta(charset "UTF-8");
;title: s k y
;script: {(trip jquery)}
;script: {(trip htmx-js)}
;script: {(trip htmx-response-targets)}
;script: {(trip htmx-idiomorph)}
;script: {htmx-extensions}
;meta
=name "viewport"
=content
"""
width=device-width,
initial-scale=1.0,
maximum-scale=1.0
"""
;
==
;meta
=name "htmx-config"
=content (trip '{"ignoreTitle":"true"}')
;
==
::;style
:: ;+ ;/ %- trip
:: '''
:: @font-face {
:: font-family: 'Urbit Sans';
:: src: url("https://media.urbit.org/fonts/UrbitSans/UrbitSansVFWeb-Regular.woff2") format("woff2");
:: font-style: normal;
:: font-weight: 100 700;
:: }
:: '''
::==
;style: {(trip reset)}
;style: {(trip feather)}
;script
;+ ;/ %- trip
'''
window.log = function() {
if (this.console) {
console.log(Array.prototype.slice.call(arguments));
}
};
jQuery.fn.log = function (msg) {
console.log(msg, this);
return this;
};
jQuery.fn.emit = function (name) {
(this[0]).dispatchEvent(
new Event(
name,
{ bubbles: true, cancelable: true, composed: true }
)
);
return this;
};
'''
==
;script: {(trip a-i-r)}
;script: {(trip date-now)}
;+ favicon
;+ manifest
==
;body
=hx-ext "html-enc,response-targets,morph"
=hx-swap "innerHTML"
=hx-boost "true"
=hx-history "false"
=hx-replace-url "/neo/sky"
=hx-target "closest .hawk"
=style
"""
background-color: var(--b1);
background-image: var(--sky-bg-url);
background-size: var(--sky-bg-size);
background-repeat: var(--sky-bg-repeat);
"""
;+ in
==
==
--

View File

@ -8,7 +8,7 @@
:+ ~ %y
%- ~(gas by *lads:neo)
~
++ deps
++ deps
%- ~(gas by *band:neo)
~
::
@ -21,12 +21,11 @@
%eyre-task
=+ !<(=task:eyre:neo vax)
=/ [eyre-id=@ta req=inbound-request:eyre] task
=/ lin (parse-request-line:serv url.request.req)
=/ inner=pith:neo #/[p/our.bowl]/sky
=/ args (~(gas by *(map @t @t)) args.lin)
=/ =crew:neo (~(gas by *crew:neo) src/inner ~)
=/ =made:neo [%sky-eyre-handler `[stud vax] crew]
:_ sig/!>(~)
:~ [(welp here.bowl #/[uv/eny.bowl]) %make %sky-eyre-handler `[stud vax] crew]
:~ [(welp here.bowl #/[uv/eny.bowl]) %make made]
==
==
++ init
@ -39,4 +38,3 @@
==
--
--

View File

@ -25,7 +25,7 @@
?+ -.poke !!
%new-tab
:- ~
=. hawks.this [[now.bowl /home] hawks.this]
=. hawks.this [[now.bowl #/[p/our.bowl]/home] hawks.this]
=. open.this (min 4 +(open.this))
sky/!>(this)
%move-tab