sky: interpret POST requests as pokes

on hearing a POST, the hawk will:

- find a poke-stud in the requesting url
- build a converstion from node to that poke-stud
- convert the body of the request (content-type=html) to the
  poke
- attempt to find a conversion from poke-stud to htmx
  - if none is found, a default refresher is returned
- "apply" the poke and return some html
This commit is contained in:
Will Hanlen 2024-05-30 16:00:21 +02:00 committed by SuperCoolYun
parent f4c0e25ea5
commit 9cf88d0932
2 changed files with 456 additions and 470 deletions

View File

@ -1,189 +1,221 @@
/@ htmx-type=htmx
/@ htmx-type=htmx
/@ htmx-type=htmx
/- feather-icons
/- serv=sky-server
/- serv=server
/> htmx
/< node
=>
|%
++ manx-to-octs
|= man=manx
(as-octt:mimes:html (en-xml:html man))
++ 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
|%
++ 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
;div
=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
;* kids
==
==
++ 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
++ 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
==
;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
:- (slag 2 -.parsed) :: strip first 2 segments (/neo/hawk)
(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]
++ 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
++ 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
::;+ 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
==
;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;"
=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.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
==
==
;span.loading
;+ loading.feather-icons
==
;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.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
;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/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
==
==
==
;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
;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
==
==
;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
==
==
==
;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;
;style
;+ ;/ %- trip
'''
@media(max-width: 900px) {
.hawk-actions {
display: none !important;
}
}
}
'''
'''
==
==
==
==
--
--
--
^- kook:neo
|%
++ state pro/%eyre-task
@ -219,24 +251,19 @@
=/ [=stud:neo =vase] (need pal)
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
:_ [stud vase]
::XX revive when auth
::?. authenticated.req
:: %: eyre-cards
:: eyre-id
:: bowl
:: 403
:: ;div: 403
:: ==
?~ src=(~(get by deps.bowl) %src)
=/ main
;div.wf.hf.fc.jc.ac: nothing here
=/ raw
;div.wf.hf.fc.jc.ac: raw view
?. authenticated.req
%: eyre-cards
eyre-id
bowl
200
~(lift hawk #/[p/our.bowl] main raw |)
403
;div: 40
==
?~ src=(~(get by deps.bowl) %src)
%: eyre-cards
eyre-id
bowl
404
;div: 404
==
=/ here p.u.src
^- (list card:neo)
@ -252,78 +279,38 @@
=. kids.bol q.u.src
:: XX src.bowl
=/ main (!<(htmx-type q.pail.root) bol)
=/ raw
;div.wf.hf.fc.jc.ac: raw view
=/ raw *manx
%: eyre-cards
eyre-id
bowl
200
~(lift hawk here.bol main raw &)
~(lift hawk here.bol main raw)
==
::
%'POST'
=/ purl (parse-url:serv request.req)
=/ body (parse-body:serv request.req)
=/ purl (parse-url request.req)
=/ body (parse-body request.req)
=/ poke-stud
^- stud:neo
~| %no-stud-specified
(~(got by pam.purl) 'stud')
=/ mul (mule |.((node [poke-stud body])))
?- -.mul
%.n
%: eyre-cards
eyre-id
bowl
400
;div
;*
%+ turn (tang p.mul)
|= =tank
;div: {(of-wall:format (~(win re tank) 0 55))}
==
==
%: eyre-cards
eyre-id
bowl
400
;div
;*
%+ turn (tang p.mul)
|= =tank
;div: {(of-wall:format (~(win re tank) 0 55))}
==
==
::
%.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]
%: eyre-cards
eyre-id
bowl
200
manx
==
%: eyre-cards
eyre-id
bowl
200
manx
==
=/ =pail:neo [poke-stud (node [poke-stud body])]
=/ 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)
:: XX virtualize
(u.converter bol)
:- [here %poke pail]
%: eyre-cards
eyre-id
bowl
200
manx
==
==
--

View File

@ -12,242 +12,241 @@
=<
^- 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
:- [pro/%htmx ~]
^- (unit port:neo)
:+ ~ %y
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[any/~ ~]
==
==
++ 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)
::
++ 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
=/ head=sign:eyre:neo [eyre-id %head [200 [['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 ~]
==
?~ 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))
--
--
|%
++ manx-to-octs
|= man=manx
%- as-octt:mimes:html
%+ welp "<!DOCTYPE html>"
(en-xml:html man)
::
++ 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
++ 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
:~
%- 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
:~
['src' s+(crip icon-url)]
['sizes' s+'196x196']
['type' s+'image/png']
%- 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)}
;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
==
==
--
^- 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 ~]
==
==
++ 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
;+ ;/ %- 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
==
==
++ 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))
--
--