From bf50c4adb9ad197bbcea10118c5e800bddbac30f Mon Sep 17 00:00:00 2001 From: Alex Fonseca Date: Fri, 8 Mar 2024 16:20:00 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Cleaning=20client-side=20librari?= =?UTF-8?q?es=20=F0=9F=93=90=20Importing=20passworless=20from=20local=20?= =?UTF-8?q?=F0=9F=94=BC=20Updating=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnimeFeedManager.Functions.csproj | 2 +- .../AnimeFeedManager.Web.csproj | 1 + .../AnimeFeedManager.Web.sln | 25 + .../Features/Security/Login.razor | 51 +- .../Features/Security/Register.razor | 5 +- src/AnimeFeedManager.Web/libman.json | 34 +- .../wwwroot/lib/alpinejs/cdn.js | 40 +- .../wwwroot/lib/alpinejs/cdn.min.js | 4 +- .../wwwroot/lib/alpinejs/module.cjs.js | 40 +- .../wwwroot/lib/alpinejs/module.cjs.min.js | 4 +- .../wwwroot/lib/alpinejs/module.esm.js | 40 +- .../wwwroot/lib/alpinejs/module.esm.min.js | 4 +- .../wwwroot/lib/htmx/ext/ajax-header.js | 7 - .../wwwroot/lib/htmx/ext/ajax-header.min.js | 1 - .../wwwroot/lib/htmx/ext/alpine-morph.js | 16 - .../wwwroot/lib/htmx/ext/alpine-morph.min.js | 1 - .../wwwroot/lib/htmx/ext/class-tools.js | 92 ---- .../wwwroot/lib/htmx/ext/class-tools.min.js | 1 - .../lib/htmx/ext/client-side-templates.js | 96 ---- .../lib/htmx/ext/client-side-templates.min.js | 1 - .../wwwroot/lib/htmx/ext/debug.js | 11 - .../wwwroot/lib/htmx/ext/debug.min.js | 1 - .../wwwroot/lib/htmx/ext/disable-element.js | 18 - .../lib/htmx/ext/disable-element.min.js | 1 - .../wwwroot/lib/htmx/ext/event-header.js | 37 -- .../wwwroot/lib/htmx/ext/event-header.min.js | 1 - .../wwwroot/lib/htmx/ext/head-support.js | 141 ------ .../wwwroot/lib/htmx/ext/head-support.min.js | 1 - .../wwwroot/lib/htmx/ext/include-vals.js | 24 - .../wwwroot/lib/htmx/ext/include-vals.min.js | 1 - .../wwwroot/lib/htmx/ext/json-enc.js | 12 - .../wwwroot/lib/htmx/ext/json-enc.min.js | 1 - .../wwwroot/lib/htmx/ext/loading-states.js | 183 ------- .../lib/htmx/ext/loading-states.min.js | 1 - .../wwwroot/lib/htmx/ext/method-override.js | 11 - .../lib/htmx/ext/method-override.min.js | 1 - .../wwwroot/lib/htmx/ext/morphdom-swap.js | 17 - .../wwwroot/lib/htmx/ext/morphdom-swap.min.js | 1 - .../wwwroot/lib/htmx/ext/multi-swap.js | 45 -- .../wwwroot/lib/htmx/ext/multi-swap.min.js | 1 - .../wwwroot/lib/htmx/ext/path-deps.js | 60 --- .../wwwroot/lib/htmx/ext/path-deps.min.js | 1 - .../wwwroot/lib/htmx/ext/path-params.js | 11 - .../wwwroot/lib/htmx/ext/path-params.min.js | 1 - .../wwwroot/lib/htmx/ext/preload.js | 147 ------ .../wwwroot/lib/htmx/ext/preload.min.js | 1 - .../wwwroot/lib/htmx/ext/rails-method.js | 10 - .../wwwroot/lib/htmx/ext/rails-method.min.js | 1 - .../wwwroot/lib/htmx/ext/remove-me.js | 27 - .../wwwroot/lib/htmx/ext/remove-me.min.js | 1 - .../wwwroot/lib/htmx/ext/response-targets.js | 130 ----- .../lib/htmx/ext/response-targets.min.js | 1 - .../wwwroot/lib/htmx/ext/restored.js | 15 - .../wwwroot/lib/htmx/ext/restored.min.js | 1 - .../wwwroot/lib/htmx/ext/sse.js | 355 ------------- .../wwwroot/lib/htmx/ext/ws.js | 477 ------------------ .../dist/umd/passwordless.umd.js | 346 +++++++++++++ .../dist/umd/passwordless.umd.min.js | 1 + .../AnimeFeedManager.WebApp.Tests.csproj | 2 +- .../AnimeFeedManager.WebApp.csproj | 2 +- 60 files changed, 508 insertions(+), 2056 deletions(-) create mode 100644 src/AnimeFeedManager.Web/AnimeFeedManager.Web.sln delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/ajax-header.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/ajax-header.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/alpine-morph.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/alpine-morph.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/class-tools.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/class-tools.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/client-side-templates.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/client-side-templates.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/debug.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/debug.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/disable-element.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/disable-element.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/event-header.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/event-header.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/head-support.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/head-support.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/include-vals.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/include-vals.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/json-enc.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/json-enc.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/loading-states.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/loading-states.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/method-override.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/method-override.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/morphdom-swap.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/morphdom-swap.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/multi-swap.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/multi-swap.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/path-deps.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/path-deps.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/path-params.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/path-params.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/preload.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/preload.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/rails-method.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/rails-method.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/remove-me.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/remove-me.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/response-targets.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/response-targets.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/restored.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/restored.min.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/sse.js delete mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/htmx/ext/ws.js create mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/passwordlessdev/passwordless-client/dist/umd/passwordless.umd.js create mode 100644 src/AnimeFeedManager.Web/wwwroot/lib/passwordlessdev/passwordless-client/dist/umd/passwordless.umd.min.js diff --git a/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj b/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj index 2b6661a1..68d89829 100644 --- a/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj +++ b/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/AnimeFeedManager.Web/AnimeFeedManager.Web.csproj b/src/AnimeFeedManager.Web/AnimeFeedManager.Web.csproj index 60483ac5..be0ff62b 100644 --- a/src/AnimeFeedManager.Web/AnimeFeedManager.Web.csproj +++ b/src/AnimeFeedManager.Web/AnimeFeedManager.Web.csproj @@ -14,6 +14,7 @@ + diff --git a/src/AnimeFeedManager.Web/AnimeFeedManager.Web.sln b/src/AnimeFeedManager.Web/AnimeFeedManager.Web.sln new file mode 100644 index 00000000..9fc643cc --- /dev/null +++ b/src/AnimeFeedManager.Web/AnimeFeedManager.Web.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnimeFeedManager.Web", "AnimeFeedManager.Web.csproj", "{F017D765-0889-4B75-80DD-E94C384E503E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F017D765-0889-4B75-80DD-E94C384E503E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F017D765-0889-4B75-80DD-E94C384E503E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F017D765-0889-4B75-80DD-E94C384E503E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F017D765-0889-4B75-80DD-E94C384E503E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FFE2FED1-AAC6-450F-AC76-8A40A4D08702} + EndGlobalSection +EndGlobal diff --git a/src/AnimeFeedManager.Web/Features/Security/Login.razor b/src/AnimeFeedManager.Web/Features/Security/Login.razor index 59af8923..e0ed373f 100644 --- a/src/AnimeFeedManager.Web/Features/Security/Login.razor +++ b/src/AnimeFeedManager.Web/Features/Security/Login.razor @@ -20,30 +20,28 @@

Use your username (email) to access the system using your passkey

-
- + +
- - + +
@@ -75,14 +73,11 @@ - - + + @@ -111,7 +106,7 @@ private async Task CompleteLogin(ClaimsPrincipal principal) { - await HttpContext.SignInAsync(principal, new AuthenticationProperties {IsPersistent = true}); + await HttpContext.SignInAsync(principal, new AuthenticationProperties { IsPersistent = true }); NavigationManager.NavigateTo("/"); } diff --git a/src/AnimeFeedManager.Web/Features/Security/Register.razor b/src/AnimeFeedManager.Web/Features/Security/Register.razor index 0c89659f..a4926734 100644 --- a/src/AnimeFeedManager.Web/Features/Security/Register.razor +++ b/src/AnimeFeedManager.Web/Features/Security/Register.razor @@ -73,9 +73,6 @@ const PASSWORDLESS_API_URL = "https://v4.passwordless.dev"; // For self-hosting, change this. This is always the default value. const API_KEY = "@PasswordlessOptions.Value.ApiKey"; // Replace this value with your API Key - + \ No newline at end of file diff --git a/src/AnimeFeedManager.Web/libman.json b/src/AnimeFeedManager.Web/libman.json index f3675bb4..b8355d06 100644 --- a/src/AnimeFeedManager.Web/libman.json +++ b/src/AnimeFeedManager.Web/libman.json @@ -3,12 +3,38 @@ "defaultProvider": "cdnjs", "libraries": [ { - "library": "alpinejs@3.13.5", - "destination": "wwwroot\\lib\\alpinejs" + "provider": "cdnjs", + "library": "htmx@1.9.10", + "destination": "wwwroot/lib/htmx/", + "files": [ + "htmx.min.js", + "htmx.js", + "ext/ws.min.js", + "ext/sse.min.js" + ] }, { - "library": "htmx@1.9.10", - "destination": "wwwroot\\lib\\htmx" + "provider": "cdnjs", + "library": "alpinejs@3.13.7", + "destination": "wwwroot/lib/alpinejs/", + "files": [ + "cdn.js", + "cdn.min.js", + "module.cjs.js", + "module.cjs.min.js", + "module.esm.js", + "module.esm.min.js" + ] } + , +{ + "provider": "unpkg", + "library": "@passwordlessdev/passwordless-client@1.1.2", + "destination": "wwwroot/lib/passwordlessdev/passwordless-client/", + "files": [ + "dist/umd/passwordless.umd.js", + "dist/umd/passwordless.umd.min.js" ] +} +] } \ No newline at end of file diff --git a/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.js b/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.js index 50470c93..5d43f61e 100644 --- a/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.js +++ b/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.js @@ -211,8 +211,8 @@ }); }); } - function destroyTree(root) { - walk(root, (el) => { + function destroyTree(root, walker = walk) { + walker(root, (el) => { cleanupAttributes(el); cleanupElement(el); }); @@ -413,7 +413,7 @@ if (name == Symbol.unscopables) return false; return objects.some( - (obj) => Object.prototype.hasOwnProperty.call(obj, name) + (obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name) ); }, get({ objects }, name, thisProxy) { @@ -421,7 +421,7 @@ return collapseProxies; return Reflect.get( objects.find( - (obj) => Object.prototype.hasOwnProperty.call(obj, name) + (obj) => Reflect.has(obj, name) ) || {}, name, thisProxy @@ -452,6 +452,8 @@ Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => { if (enumerable === false || value === void 0) return; + if (typeof value === "object" && value !== null && value.__v_skip) + return; let path = basePath === "" ? key : `${basePath}.${key}`; if (typeof value === "object" && value !== null && value._x_interceptor) { obj[key] = value.initialize(data2, path, key); @@ -1619,7 +1621,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.13.5", + version: "3.13.7", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -2423,12 +2425,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); function getArrayOfRefObject(el) { let refObjects = []; - let currentEl = el; - while (currentEl) { - if (currentEl._x_refs) - refObjects.push(currentEl._x_refs); - currentEl = currentEl.parentNode; - } + findClosest(el, (i) => { + if (i._x_refs) + refObjects.push(i._x_refs); + }); return refObjects; } @@ -3088,13 +3088,21 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); if (isObject2(items)) { items = Object.entries(items).map(([key, value]) => { let scope2 = getIterationScopeVariables(iteratorNames, value, key, items); - evaluateKey((value2) => keys.push(value2), { scope: { index: key, ...scope2 } }); + evaluateKey((value2) => { + if (keys.includes(value2)) + warn("Duplicate key on x-for", el); + keys.push(value2); + }, { scope: { index: key, ...scope2 } }); scopes.push(scope2); }); } else { for (let i = 0; i < items.length; i++) { let scope2 = getIterationScopeVariables(iteratorNames, items[i], i, items); - evaluateKey((value) => keys.push(value), { scope: { index: i, ...scope2 } }); + evaluateKey((value) => { + if (keys.includes(value)) + warn("Duplicate key on x-for", el); + keys.push(value); + }, { scope: { index: i, ...scope2 } }); scopes.push(scope2); } } @@ -3142,7 +3150,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); let marker = document.createElement("div"); mutateDom(() => { if (!elForSpot) - warn(`x-for ":key" is undefined or invalid`, templateEl); + warn(`x-for ":key" is undefined or invalid`, templateEl, keyForSpot, lookup); elForSpot.after(marker); elInSpot.after(elForSpot); elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl); @@ -3169,7 +3177,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }; mutateDom(() => { lastEl.after(clone2); - initTree(clone2); + skipDuringClone(() => initTree(clone2))(); }); if (typeof key === "object") { warn("x-for key cannot be an object, it must be a string or an integer", templateEl); @@ -3253,7 +3261,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); addScopeToNode(clone2, {}, el); mutateDom(() => { el.after(clone2); - initTree(clone2); + skipDuringClone(() => initTree(clone2))(); }); el._x_currentIfEl = clone2; el._x_undoIf = () => { diff --git a/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.min.js b/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.min.js index 7cb64450..f750e645 100644 --- a/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.min.js +++ b/src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.min.js @@ -1,5 +1,5 @@ -(()=>{var rt=!1,nt=!1,q=[],it=-1;function Vt(e){Sn(e)}function Sn(e){q.includes(e)||q.push(e),An()}function ve(e){let t=q.indexOf(e);t!==-1&&t>it&&q.splice(t,1)}function An(){!nt&&!rt&&(rt=!0,queueMicrotask(On))}function On(){rt=!1,nt=!0;for(let e=0;ee.effect(t,{scheduler:r=>{ot?Vt(r):r()}}),st=e.raw}function at(e){N=e}function Wt(e){let t=()=>{};return[n=>{let i=N(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),L(i))},i},()=>{t()}]}function Se(e,t){let r=!0,n,i=N(()=>{let o=e();JSON.stringify(o),r?n=o:queueMicrotask(()=>{t(o,n),n=o}),r=!1});return()=>L(i)}function U(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function O(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>O(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)O(n,t,!1),n=n.nextElementSibling}function v(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Gt=!1;function Jt(){Gt&&v("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Gt=!0,document.body||v("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `