This commit is contained in:
Will Hanlen 2024-05-31 15:32:05 +02:00 committed by SuperCoolYun
parent 8c14d35181
commit c7bbfe4310
3 changed files with 461 additions and 448 deletions

View File

@ -5,216 +5,203 @@
/> htmx /> htmx
/< node /< node
=> =>
|% |%
++ main ++ manx-to-octs
^- curb:neo |= man=manx
::[%or rol/[%ui-main pro/%htmx] pro/%htmx ~] (as-octt:mimes:html (en-xml:html man))
:: rol/[%ui-main pro/%htmx] ++ parse-url
pro/%htmx |= =request:http
++ kids-curb ^- [pax=path pam=(map @t @t)]
^- curb:neo =/ parsed
::[%or rol/[%ui-cell pro/%htmx] pro/%htmx ~] %+ rash url.request
pro/%htmx ;~ plug
:: rol/[%ui-list pro/%htmx] ;~(pfix fas (more fas smeg:de-purl:html))
++ manx-to-octs yque:de-purl:html
|= man=manx ==
(as-octt:mimes:html (en-xml:html man)) :: strip first 2 segments (/neo/hawk)
:: :- (slag 2 -.parsed)
++ render (malt +.parsed)
|= [main=manx kids=marl] ++ parse-body
;div |= =request:http
;+ main ^- 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 ;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
== ==
== ==
++ parse-url ++ header
|= =request:http ;header.b2.p1.frw.g1.ac
^- [pax=path pam=(map @t @t)] =id "hawk-header-{idt}"
=/ parsed =style "border: 2px solid var(--b2);"
%+ rash url.request ;button
;~ plug =class "p1 hover b2 br1 bd0 {(trip ?:(has-app '' 'toggled'))}"
;~(pfix fas (more fas smeg:de-purl:html)) =onclick
yque:de-purl:html """
$(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
== ==
:- (slag 2 -.parsed) :: strip first 2 segments (/neo/hawk) ;div
(malt +.parsed) =class "hawk-tog frw g1 ac grow {(trip ?:(has-app '' 'hidden'))}"
++ parse-body ;*
|= =request:http =< p
^- manx %^ spin here
%+ fall 0
(de-xml:html q:(fall body.request [p=0 q=''])) |= [=iota a=@]
*manx :_ +(a)
++ eyre-cards ;div.fr.ac.g1
|= [eyre-id=@ta =bowl:neo status=@ud =manx] =style "height: 2rem;"
^- (list card:neo) ;div.f4.s-1: >
=/ =pith:neo #/[p/our.bowl]/$/eyre ;a.hover.b2.br1.p-1.s0.loader.fc.ac.jc
=/ 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;" =style "height: 2rem;"
;div.f4.s-1: > =hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<slot>}\"}"
;a.hover.b2.br1.p-1.s0.loader.fc.ac.jc =href "/neo/hawk{(en-tape:pith:neo (scag +(a) here))}"
=style "height: 2rem;" ;span.loaded
=hx-vals "\{\"id\": \"{<id>}\", \"slot\": \"{<slot>}\"}" ;+ ;/
=href "/neo/hawk{(en-tape:pith:neo (scag +(a) here))}" ?: =(a 0) "/"
;span.loaded (trip ?@(iota iota (scot iota)))
;+ ;/
?: =(a 0) "/"
(trip ?@(iota iota (scot iota)))
==
;span.loading
;+ loading.feather-icons
==
== ==
== ;span.loading
;div.grow; ;+ loading.feather-icons
==
;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 ;div.grow;
=style "margin-left: 5px;" ==
=type "text" ;form
=value (en-tape:pith:neo here) =class "hawk-tog grow fr m0 relative {(trip ?:(has-app 'hidden' ''))}"
=oninput =style "height: 2rem;"
""" =hx-get "/neo/hawk"
$(this).attr('value', this.value); =hx-target "closest .hawk"
$(this).parent().attr('hx-get', '/neo/hawk'+this.value); ;div.absolute
htmx.process(document.body); =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 ;input.p-1.br1.b1.wf.s0.loaded.grow.bd0
=id "hawk-actions-{idt}" =style "margin-left: 5px;"
;button.p1.hover.b2.br1.loader.s-1 =type "text"
=id "hawk-slide-up-{idt}" =value (en-tape:pith:neo here)
=hx-post "/neo/hawk/sky?stud=sky-diff" =oninput
=hx-target "find .loading" """
=hx-swap "outerHTML" $(this).attr('value', this.value);
=head "slide-up" $(this).parent().attr('hx-get', '/neo/hawk'+this.value);
=hawk-slot "{<slot>}" htmx.process(document.body);
;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;
}
}
'''
==
== ==
== ==
-- ;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 ^- kook:neo
|% |%
++ state pro/%eyre-task ++ state pro/%eyre-task
@ -255,7 +242,7 @@
eyre-id eyre-id
bowl bowl
403 403
;div: 40 ;div: 403
== ==
?~ src=(~(get by deps.bowl) %src) ?~ src=(~(get by deps.bowl) %src)
%: eyre-cards %: eyre-cards
@ -293,23 +280,46 @@
^- stud:neo ^- stud:neo
~| %no-stud-specified ~| %no-stud-specified
(~(got by pam.purl) 'stud') (~(got by pam.purl) 'stud')
=/ =pail:neo [poke-stud (node [poke-stud body])] ::=/ mul `(each ^vase tang)`[%.y p=!>(~)] :: stub for build system bug
=/ bol *bowl:neo =/ mul (mule |.((node [poke-stud body])))
=. here.bol here ?- -.mul
=. our.bol our.bowl %.n
=. now.bol now.bowl %: eyre-cards
=. eny.bol eny.bowl eyre-id
=/ =manx bowl
?~ converter=(mole |.((htmx pail))) 400
(default-refresher here) ;div
:: XX virtualize ;*
(u.converter bol) %+ turn (tang p.mul)
:- [here %poke pail] |= =tank
%: eyre-cards ;div: {(of-wall:format (~(win re tank) 0 55))}
eyre-id ==
bowl ==
200 ::
manx %.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
==
== ==
== ==
-- --

View File

@ -21,12 +21,14 @@
%eyre-task %eyre-task
=+ !<(=task:eyre:neo vax) =+ !<(=task:eyre:neo vax)
=/ [eyre-id=@ta req=inbound-request:eyre] task =/ [eyre-id=@ta req=inbound-request:eyre] task
=/ purl (parse-url:serv request.req) =/ lin (parse-request-line:serv url.request.req)
=/ inner=pith:neo (pave:neo pax.purl) =/ inner=pith:neo (pave:neo (slag 2 site.lin))
=/ =crew:neo (~(gas by *crew:neo) src/inner ~) =/ =crew:neo (~(gas by *crew:neo) src/inner ~)
=/ =made:neo [%hawk-eyre-handler `[stud vax] crew] =/ =made:neo [%hawk-eyre-handler `[stud vax] crew]
=/ =made:neo [%hawk-eyre-handler `[stud vax] crew]
:_ sig/!>(~) :_ sig/!>(~)
:~ [(welp here.bowl #/[uv/eny.bowl]) %make made] :~ [(welp here.bowl #/[uv/eny.bowl]) %make made]
:~ [(welp here.bowl #/[uv/eny.bowl]) %make made]
== ==
== ==
++ init ++ init

View File

@ -12,241 +12,242 @@
=< =<
^- kook:neo ^- kook:neo
|% |%
++ main ++ state pro/%eyre-task
^- curb:neo ++ poke *(set stud:neo)
pro/%htmx ++ kids
:: [%or rol/[%ui-main pro/%htmx] pro/%htmx ~] :+ ~ %y
:: rol/[%ui-main pro/%htmx] %- ~(gas by *lads:neo)
++ kids-curb ~
^- curb:neo ++ deps
pro/%htmx %- ~(gas by *band:neo)
:: rol/[%ui-list pro/%htmx] :~ :- %src
++ manx-to-octs ^- fief:neo
|= man=manx :- req=|
%- as-octt:mimes:html ^- quay:neo
%+ welp "<!DOCTYPE html>" :- [pro/%htmx ~]
(en-xml:html man) ^- (unit port:neo)
:+ ~ %y
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[any/~ ~]
==
==
:: ::
++ render ++ form
|= [main=manx kids=marl] |_ [=bowl:neo =aeon:neo =pail:neo]
;div ++ poke
;+ main |= [=stud:neo vax=vase]
;div ^- (quip card:neo pail:neo)
;* kids `pail
== ++ init
== |= pal=(unit pail:neo)
++ icon-url =/ [=stud:neo =vase] (need pal)
^~ =+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
%- trip :_ [stud vase]
%^ cat =/ =pith:neo #/[p/our.bowl]/$/eyre
3 =; =manx
'data:image/png;base64,' =/ head=sign:eyre:neo [eyre-id %head [200 [['content-type' 'text/html'] ~]]]
%- ~(en base64:mimes:html & |) =/ data=sign:eyre:neo [eyre-id %data `(manx-to-octs manx)]
(as-octs:mimes:html hawk-icon) =/ done=sign:eyre:neo [eyre-id %done ~]
++ favicon :~ [pith %poke eyre-sign/!>(head)]
^~ [pith %poke eyre-sign/!>(data)]
=; m m(a.g [[%href icon-url] a.g.m]) [pith %poke eyre-sign/!>(done)]
^- manx [here.bowl %cull ~]
;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']
== ==
== ?~ src=(~(get by deps.bowl) %src)
== ;div: 404
++ manifest =/ root=idea:neo (~(got of:neo q.u.src) /)
^~ ?> =(%htmx p.pail.root)
=; m m(a.g [[%href manifest-url] a.g.m]) =/ bol *bowl:neo
^- manx =. here.bol p.u.src
;link =. our.bol our.bowl
=rel "manifest" =. now.bol now.bowl
; =. eny.bol eny.bowl
== =. kids.bol q.u.src
++ htmx-extensions :: XX src.bowl
:: htmx extension which encodes the request (lift (!<(htmx q.pail.root) bol))
:: 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 ++ manx-to-octs
++ poke *(set stud:neo) |= man=manx
++ kids %- as-octt:mimes:html
:+ ~ %y %+ welp "<!DOCTYPE html>"
%- ~(gas by *lads:neo) (en-xml:html man)
~
++ deps
%- ~(gas by *band:neo)
:~ :- %src
^- fief:neo
:- req=|
^- quay:neo
:- [main ~]
^- (unit port:neo)
:+ ~ %z
%- ~(gas by *lads:neo)
:~ :- &
`lash:neo`[kids-curb ~]
==
==
:: ::
++ form ++ icon-url
|_ [=bowl:neo =aeon:neo =pail:neo] ^~
++ poke %- trip
|= [=stud:neo vax=vase] %^ cat
^- (quip card:neo pail:neo) 3
`pail 'data:image/png;base64,'
++ init %- ~(en base64:mimes:html & |)
|= pal=(unit pail:neo) (as-octs:mimes:html hawk-icon)
=/ [=stud:neo =vase] (need pal) ++ favicon
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase) ^~
:_ [stud vase] =; m m(a.g [[%href icon-url] a.g.m])
=/ =pith:neo #/[p/our.bowl]/$/eyre ^- manx
=; =manx ;link
%+ snoc =rel "icon"
(~(respond neo:serv pith) [eyre-id (manx-response:gen:serv manx)]) =type "image/png"
[here.bowl %cull ~] ;
?~ src=(~(get by deps.bowl) %src) ==
;div: 404 ++ manifest-url
=/ root=idea:neo (~(got of:neo q.u.src) /) ^~
?> =(%htmx p.pail.root) %- trip
=/ bol *bowl:neo %^ cat
=. here.bol p.u.src 3
=. our.bol our.bowl 'data:application/json;utf-8,'
=. now.bol now.bowl %- en:json:html
=. eny.bol eny.bowl %- pairs:enjs:format
=. kids.bol q.u.src :~
~& kids/~(key by ~(tar of:neo kids.bol)) ['name' s+'sky']
:: XX src.bowl ['description' s+'an urbit namespace viewer']
(lift (!<(htmx q.pail.root) bol)) ['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
;+ ;/ %- 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
==
==
-- --