Skip to content

Commit

Permalink
🧹 Cleaning client-side libraries
Browse files Browse the repository at this point in the history
📐 Importing passworless from local
🔼 Updating dependencies
  • Loading branch information
afonseca-aamva committed Mar 9, 2024
1 parent 347de2e commit bf50c4a
Show file tree
Hide file tree
Showing 60 changed files with 508 additions and 2,056 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.1" OutputItemType="Analyzer" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" OutputItemType="Analyzer" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
<PackageReference Include="SendGrid" Version="9.29.2" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/AnimeFeedManager.Web/AnimeFeedManager.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
<PackageReference Include="Passwordless" Version="1.0.2" />
</ItemGroup>

Expand Down
25 changes: 25 additions & 0 deletions src/AnimeFeedManager.Web/AnimeFeedManager.Web.sln
Original file line number Diff line number Diff line change
@@ -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
51 changes: 23 additions & 28 deletions src/AnimeFeedManager.Web/Features/Security/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,28 @@
<p class="py-6">Use your username (email) to access the system using your passkey</p>
</div>
<div class="card shrink-0 w-full max-w-sm shadow-2xl bg-base-100">
<form
method="post"
class="card-body"
x-data="login()"
x-on:submit.prevent="$event.target.checkValidity() ? login($event) : $event.target.reportValidity()"
@onsubmit="Submit"
@formname="login">
<AntiforgeryToken/>
<form method="post"
class="card-body"
x-data="login()"
x-on:submit.prevent="$event.target.checkValidity() ? login($event) : $event.target.reportValidity()"
@onsubmit="Submit"
@formname="login">
<AntiforgeryToken />
<fieldset class="form-control">
<label for="user-alias" class="label">
<span class="label-text">Please provide an email</span>
</label>

<input
@bind-value="Alias"
type="email"
id="user-alias"
name="alias"
required
x-model="alias"
x-ref="alias"
placeholder="Enter your Email"
class="input input-bordered invalid:input-error required:!input-bordered"/>
<input @bind-value="Id" name="id" type="hidden" id="id-value"/>
<input @bind-value="Alias"
type="email"
id="user-alias"
name="alias"
required
x-model="alias"
x-ref="alias"
placeholder="Enter your Email"
class="input input-bordered invalid:input-error required:!input-bordered" />
<input @bind-value="Id" name="id" type="hidden" id="id-value" />
</fieldset>
<div class="form-control">
<button class="btn btn-primary mt-4">Login</button>
Expand Down Expand Up @@ -75,14 +73,11 @@
</section>

<SectionContent SectionName="additional-scripts">
<script defer>
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
</script>
<script
defer
src="https://cdn.passwordless.dev/dist/1.1.0/umd/passwordless.umd.min.js"
crossorigin="anonymous"></script>
<script defer>
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
</script>
<script defer src="lib/passwordlessdev/passwordless-client/dist/umd/passwordless.umd.min.js"></script>
<script defer src="scripts/client-signin.js" type="module"></script>
<script src="./Features/Security/Login.razor.js" type="text/javascript"></script>
</SectionContent>
Expand Down Expand Up @@ -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("/");
}

Expand Down
5 changes: 1 addition & 4 deletions src/AnimeFeedManager.Web/Features/Security/Register.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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
</script>
<script
defer
src="https://cdn.passwordless.dev/dist/1.1.0/umd/passwordless.umd.min.js"
crossorigin="anonymous"></script>
<script defer src="lib/passwordlessdev/passwordless-client/dist/umd/passwordless.umd.min.js"></script>
<script src="./Features/Security/Register.razor.js" type="text/javascript"></script>
</SectionContent>
34 changes: 30 additions & 4 deletions src/AnimeFeedManager.Web/libman.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
40 changes: 24 additions & 16 deletions src/AnimeFeedManager.Web/wwwroot/lib/alpinejs/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@
});
});
}
function destroyTree(root) {
walk(root, (el) => {
function destroyTree(root, walker = walk) {
walker(root, (el) => {
cleanupAttributes(el);
cleanupElement(el);
});
Expand Down Expand Up @@ -413,15 +413,15 @@
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) {
if (name == "toJSON")
return collapseProxies;
return Reflect.get(
objects.find(
(obj) => Object.prototype.hasOwnProperty.call(obj, name)
(obj) => Reflect.has(obj, name)
) || {},
name,
thisProxy
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 = () => {
Expand Down
Loading

0 comments on commit bf50c4a

Please sign in to comment.