Vendor htmx 2.0.6 (#57)
This commit is contained in:
1 parent
e8953d6072
commit
87fbb1a8c7
5 files changed
+27
-7
No files matched your search
@@ -8,6 +8,7 @@ open MyWebLog
|
|||||||
/// Module to resolve routes that do not match any other known route (web blog content)
|
/// Module to resolve routes that do not match any other known route (web blog content)
|
||||||
module CatchAll =
|
module CatchAll =
|
||||||
|
|
||||||
|
open System.IO
|
||||||
open MyWebLog.ViewModels
|
open MyWebLog.ViewModels
|
||||||
|
|
||||||
/// Sequence where the first returned value is the proper handler for the link
|
/// Sequence where the first returned value is the proper handler for the link
|
||||||
@@ -22,6 +23,20 @@ module CatchAll =
|
|||||||
let await it = (Async.AwaitTask >> Async.RunSynchronously) it
|
let await it = (Async.AwaitTask >> Async.RunSynchronously) it
|
||||||
seq {
|
seq {
|
||||||
debug (fun () -> $"Considering URL {textLink}")
|
debug (fun () -> $"Considering URL {textLink}")
|
||||||
|
let staticFileName =
|
||||||
|
[ ctx.GetWebHostEnvironment().ContentRootPath
|
||||||
|
"wwwroot"
|
||||||
|
if textLink.Length > 1 then textLink[1..] else textLink ]
|
||||||
|
|> String.concat (string Path.DirectorySeparatorChar)
|
||||||
|
match File.Exists staticFileName with
|
||||||
|
| true ->
|
||||||
|
debug (fun () -> $"File {textLink} is a static file")
|
||||||
|
yield
|
||||||
|
File.GetLastWriteTimeUtc staticFileName
|
||||||
|
|> System.DateTimeOffset
|
||||||
|
|> Some
|
||||||
|
|> streamFile true staticFileName None
|
||||||
|
| false -> ()
|
||||||
// Home page directory without the directory slash
|
// Home page directory without the directory slash
|
||||||
if textLink = "" then yield redirectTo true (webLog.RelativeUrl Permalink.Empty)
|
if textLink = "" then yield redirectTo true (webLog.RelativeUrl Permalink.Empty)
|
||||||
let permalink = Permalink textLink[1..]
|
let permalink = Permalink textLink[1..]
|
||||||
@@ -84,9 +99,11 @@ module CatchAll =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET {all-of-the-above}
|
// GET {all-of-the-above}
|
||||||
let route : HttpHandler = fun next ctx ->
|
let route : HttpHandler = fun next ctx -> task {
|
||||||
match deriveAction ctx |> Seq.tryHead with Some handler -> handler next ctx | None -> Error.notFound next ctx
|
match deriveAction ctx |> Seq.tryHead with
|
||||||
|
| Some handler -> return! handler next ctx
|
||||||
|
| None -> return None // Error.notFound next ctx
|
||||||
|
}
|
||||||
|
|
||||||
/// Serve theme assets
|
/// Serve theme assets
|
||||||
module Asset =
|
module Asset =
|
||||||
@@ -242,7 +259,7 @@ let router : HttpHandler = choose [
|
|||||||
]
|
]
|
||||||
])
|
])
|
||||||
GET_HEAD >=> CatchAll.route
|
GET_HEAD >=> CatchAll.route
|
||||||
Error.notFound
|
//Error.notFound
|
||||||
]
|
]
|
||||||
|
|
||||||
/// Wrap a router in a sub-route
|
/// Wrap a router in a sub-route
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
<Compile Include="DotLiquidBespoke.fs" />
|
<Compile Include="DotLiquidBespoke.fs" />
|
||||||
<Compile Include="Maintenance.fs" />
|
<Compile Include="Maintenance.fs" />
|
||||||
<Compile Include="Program.fs" />
|
<Compile Include="Program.fs" />
|
||||||
|
<Content Include="wwwroot\htmx.min.js" CopyToOutputDirectory="Always" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ open System.IO
|
|||||||
open System.Text
|
open System.Text
|
||||||
open Fluid
|
open Fluid
|
||||||
open Fluid.Values
|
open Fluid.Values
|
||||||
open Giraffe.ViewEngine
|
|
||||||
open Microsoft.AspNetCore.Antiforgery
|
open Microsoft.AspNetCore.Antiforgery
|
||||||
open Microsoft.Extensions.FileProviders
|
open Microsoft.Extensions.FileProviders
|
||||||
open MyWebLog
|
open MyWebLog
|
||||||
@@ -237,7 +236,9 @@ let parser =
|
|||||||
fun writer encoder context ->
|
fun writer encoder context ->
|
||||||
let webLog = context.App.WebLog
|
let webLog = context.App.WebLog
|
||||||
if webLog.AutoHtmx then
|
if webLog.AutoHtmx then
|
||||||
writer.WriteLine $"{s}{RenderView.AsString.htmlNode Htmx.Script.minified}"
|
context.App.WebLog.RelativeUrl(Permalink "htmx.min.js")
|
||||||
|
|> sprintf "%s<script src=\"%s\"></script>" s
|
||||||
|
|> writer.WriteLine
|
||||||
if assetExists "script.js" webLog then
|
if assetExists "script.js" webLog then
|
||||||
themeAsset (StringValue "script.js") context
|
themeAsset (StringValue "script.js") context
|
||||||
|> sprintf "%s<script src=\"%s\"></script>" s
|
|> sprintf "%s<script src=\"%s\"></script>" s
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ module Layout =
|
|||||||
script [ _src "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
script [ _src "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||||
_integrity "sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
_integrity "sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||||
_crossorigin "anonymous" ] []
|
_crossorigin "anonymous" ] []
|
||||||
Script.minified
|
script [ _src (relUrl app "htmx.min.js") ] []
|
||||||
script [ _src (relUrl app "themes/admin/admin.js") ] []
|
script [ _src (relUrl app "themes/admin/admin.js") ] []
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
var htmx=function(){"use strict";const Q={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){const n=dn(e,t||"post");return n.values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null,disableInheritance:false,responseHandling:[{code:"204",swap:false},{code:"[23]..",swap:true},{code:"[45]..",swap:false,error:true}],allowNestedOobSwaps:true,historyRestoreAsHxRequest:true},parseInterval:null,location:location,_:null,version:"2.0.6"};Q.onLoad=j;Q.process=Ft;Q.on=xe;Q.off=be;Q.trigger=ae;Q.ajax=Ln;Q.find=f;Q.findAll=x;Q.closest=g;Q.remove=z;Q.addClass=K;Q.removeClass=G;Q.toggleClass=W;Q.takeClass=Z;Q.swap=$e;Q.defineExtension=zn;Q.removeExtension=$n;Q.logAll=V;Q.logNone=_;Q.parseInterval=d;Q._=e;const n={addTriggerHandler:St,bodyContains:se,canAccessLocalStorage:B,findThisElement:Se,filterValues:yn,swap:$e,hasAttribute:s,getAttributeValue:a,getClosestAttributeValue:ne,getClosestMatch:q,getExpressionVars:Tn,getHeaders:mn,getInputValues:dn,getInternalData:oe,getSwapSpecification:bn,getTriggerSpecs:st,getTarget:Ee,makeFragment:P,mergeObjects:le,makeSettleInfo:Sn,oobSwap:He,querySelectorExt:ue,settleImmediately:Yt,shouldCancel:ht,triggerEvent:ae,triggerErrorEvent:fe,withExtensions:jt};const de=["get","post","put","delete","patch"];const T=de.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e instanceof Element&&e.getAttribute(t)}function s(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function a(e,t){return ee(e,t)||ee(e,"data-"+t)}function u(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function te(){return document}function y(e,t){return e.getRootNode?e.getRootNode({composed:t}):te()}function q(e,t){while(e&&!t(e)){e=u(e)}return e||null}function o(e,t,n){const r=a(t,n);const o=a(t,"hx-disinherit");var i=a(t,"hx-inherit");if(e!==t){if(Q.config.disableInheritance){if(i&&(i==="*"||i.split(" ").indexOf(n)>=0)){return r}else{return null}}if(o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return"unset"}}return r}function ne(t,n){let r=null;q(t,function(e){return!!(r=o(t,ce(e),n))});if(r!=="unset"){return r}}function h(e,t){return e instanceof Element&&e.matches(t)}function A(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else{return""}}function L(e){const t=new DOMParser;return t.parseFromString(e,"text/html")}function N(e,t){while(t.childNodes.length>0){e.append(t.childNodes[0])}}function r(e){const t=te().createElement("script");ie(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}return t}function i(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function I(e){Array.from(e.querySelectorAll("script")).forEach(e=>{if(i(e)){const t=r(e);const n=e.parentNode;try{n.insertBefore(t,e)}catch(e){R(e)}finally{e.remove()}}})}function P(e){const t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,"");const n=A(t);let r;if(n==="html"){r=new DocumentFragment;const i=L(e);N(r,i.body);r.title=i.title}else if(n==="body"){r=new DocumentFragment;const i=L(t);N(r,i.body);r.title=i.title}else{const i=L('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content;r.title=i.title;var o=r.querySelector("title");if(o&&o.parentNode===r){o.remove();r.title=o.innerText}}if(r){if(Q.config.allowScriptTags){I(r)}else{r.querySelectorAll("script").forEach(e=>e.remove())}}return r}function re(e){if(e){e()}}function t(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function D(e){return typeof e==="function"}function k(eLine truncated
|
||||||
Reference in new issue
Block a user