Compare commits
20
Commits
v0.1.1
..
fa69e6ef3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa69e6ef3c | ||
|
|
91f372612a | ||
|
|
3f5ff73a49 | ||
|
|
fc0e376df8 | ||
|
|
d005ee6f51 | ||
|
|
e8a9b25037 | ||
|
|
4227293345 | ||
|
|
a53bafff3f | ||
|
|
c94f749430 | ||
|
|
a90f4eb71f | ||
|
|
6c364623fd | ||
|
|
5ebaafc113 | ||
|
|
61bed33c8a | ||
|
|
81077527ac | ||
|
|
d0b18a4902 | ||
|
|
e3544617e1 | ||
|
|
ce6db8a457 | ||
|
|
da1cdca3b2 | ||
|
|
df68167d04 | ||
|
|
9a79e6f649 |
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@gabriel20xx/web-ui": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add a shared `NotificationStack` component and `notify` API (`notify.success/error/warning/info`) for toast-style action feedback. `AppShell` now mounts `NotificationStack` automatically, so any application using `AppShell` gets it without further wiring.
|
||||||
@@ -50,17 +50,44 @@ jobs:
|
|||||||
|
|
||||||
- name: Publish npm packages
|
- name: Publish npm packages
|
||||||
env:
|
env:
|
||||||
|
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
|
||||||
|
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
|
||||||
NPM_REGISTRY: https://repos.gfranz.ch/api/packages/Gabriel20xx/npm/
|
NPM_REGISTRY: https://repos.gfranz.ch/api/packages/Gabriel20xx/npm/
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ -z "$PACKAGE_REGISTRY_USERNAME" ] || [ -z "$PACKAGE_REGISTRY_TOKEN" ]; then
|
||||||
|
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
for package in \
|
for package in \
|
||||||
@gabriel20xx/design-tokens \
|
@gabriel20xx/design-tokens \
|
||||||
@gabriel20xx/web-ui \
|
@gabriel20xx/web-ui \
|
||||||
@gabriel20xx/node-backend; do
|
@gabriel20xx/node-backend; do
|
||||||
version="$(npm pkg get version --workspace="$package" | tr -d '"[:space:]')"
|
version="$(npm pkg get version --workspace="$package" | tr -d '"[:space:]')"
|
||||||
if npm view "$package@$version" version --registry="$NPM_REGISTRY" >/dev/null 2>&1; then
|
package_path="${package//@/%40}"
|
||||||
|
package_path="${package_path//\//%2f}"
|
||||||
|
metadata_file="$(mktemp)"
|
||||||
|
metadata_status="$(curl --silent --show-error --fail-with-body \
|
||||||
|
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
|
||||||
|
--output "$metadata_file" \
|
||||||
|
--write-out '%{http_code}' \
|
||||||
|
"${NPM_REGISTRY}${package_path}" || true)"
|
||||||
|
case "$metadata_status" in
|
||||||
|
200)
|
||||||
|
if grep -Fq "\"$version\"" "$metadata_file"; then
|
||||||
echo "$package@$version is already published; skipping."
|
echo "$package@$version is already published; skipping."
|
||||||
else
|
rm -f "$metadata_file"
|
||||||
npm publish --workspace="$package" --registry="$NPM_REGISTRY"
|
continue
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
404)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cat "$metadata_file" >&2
|
||||||
|
echo "Gitea npm metadata lookup failed with HTTP status $metadata_status." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
npm publish --workspace="$package" --registry="$NPM_REGISTRY"
|
||||||
|
rm -f "$metadata_file"
|
||||||
done
|
done
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
repo_root="$(git rev-parse --show-toplevel)"
|
||||||
|
sync_script="$repo_root/scripts/sync-consumers.ps1"
|
||||||
|
|
||||||
|
if command -v pwsh >/dev/null 2>&1; then
|
||||||
|
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$sync_script" -Commit
|
||||||
|
elif command -v powershell.exe >/dev/null 2>&1; then
|
||||||
|
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$sync_script" -Commit
|
||||||
|
else
|
||||||
|
echo "shared synchronization requires pwsh or powershell.exe." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# SharedCode packages
|
# shared packages
|
||||||
|
|
||||||
This folder is the single source of truth for reusable web UI across the projects in this workspace.
|
This folder is the single source of truth for reusable web UI across the projects in this workspace.
|
||||||
|
|
||||||
@@ -33,30 +33,6 @@ go test ./...
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Consume from the Gitea repository
|
|
||||||
|
|
||||||
The repository is the canonical source and is installable directly from Gitea. The root package
|
|
||||||
builds the Svelte package during installation and exposes the runtime packages as subpaths:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install --save-exact git+https://repos.gfranz.ch/Gabriel20xx/shared#<commit>
|
|
||||||
```
|
|
||||||
|
|
||||||
Use the shared UI from the root package:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { AppShell, AuthPage, Header, SettingsDialog } from '@gabriel20xx/shared-code/web-ui';
|
|
||||||
```
|
|
||||||
|
|
||||||
Import the shared stylesheet once from the application's global stylesheet:
|
|
||||||
|
|
||||||
```css
|
|
||||||
@import '@gabriel20xx/shared-code/web-ui/styles.css';
|
|
||||||
```
|
|
||||||
|
|
||||||
The dependency should be pinned to a commit in application lockfiles. Update it when a new
|
|
||||||
SharedCode version has been validated.
|
|
||||||
|
|
||||||
## Publish the individual packages
|
## Publish the individual packages
|
||||||
|
|
||||||
The package names use the `@gabriel20xx` npm scope. The `publish-npm.yml` and
|
The package names use the `@gabriel20xx` npm scope. The `publish-npm.yml` and
|
||||||
@@ -220,11 +196,14 @@ The Node and Python packages intentionally expose the same infrastructure concep
|
|||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The shared profile menu exposes Profile, Settings, About, and Log out. It uses the `About` navigation item's href automatically; pass `aboutHref` or `onAbout` to `AppShell` when a project uses a custom About destination or dialog.
|
||||||
|
|
||||||
For authentication, use the same shell with `AuthPage` and connect the callbacks to the application's existing auth service:
|
For authentication, use the same shell with `AuthPage` and connect the callbacks to the application's existing auth service:
|
||||||
|
|
||||||
```svelte
|
```svelte
|
||||||
<AuthPage
|
<AuthPage
|
||||||
brand="My application"
|
brand="My application"
|
||||||
|
faviconHref="/favicon.svg"
|
||||||
onLogin={(credentials) => auth.login(credentials.identifier, credentials.password)}
|
onLogin={(credentials) => auth.login(credentials.identifier, credentials.password)}
|
||||||
onSetup={(credentials) => auth.setup(credentials)}
|
onSetup={(credentials) => auth.setup(credentials)}
|
||||||
onRequestReset={() => auth.requestAdminReset()}
|
onRequestReset={() => auth.requestAdminReset()}
|
||||||
|
|||||||
Generated
+16
-26
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/shared-code",
|
"name": "@gabriel20xx/shared-code",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@gabriel20xx/shared-code",
|
"name": "@gabriel20xx/shared-code",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@@ -776,7 +776,6 @@
|
|||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||||
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
|
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||||
@@ -787,7 +786,6 @@
|
|||||||
"version": "2.3.5",
|
"version": "2.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
|
||||||
"integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
|
"integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/gen-mapping": "^0.3.5",
|
"@jridgewell/gen-mapping": "^0.3.5",
|
||||||
@@ -798,7 +796,6 @@
|
|||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
@@ -808,20 +805,27 @@
|
|||||||
"version": "1.5.5",
|
"version": "1.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
||||||
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
|
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/trace-mapping": {
|
"node_modules/@jridgewell/trace-mapping": {
|
||||||
"version": "0.3.31",
|
"version": "0.3.31",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
|
||||||
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
|
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/resolve-uri": "^3.1.0",
|
"@jridgewell/resolve-uri": "^3.1.0",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@lucide/svelte": {
|
||||||
|
"version": "1.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lucide/svelte/-/svelte-1.28.0.tgz",
|
||||||
|
"integrity": "sha512-C1Ge84KW2z4q44/WDIEo/2KC2jby5u6mSlta7q+p6g7u0ld8sC/w1fMBiSswF+4bxAl9jlzzaVTpp79qqkiy5g==",
|
||||||
|
"license": "ISC",
|
||||||
|
"peerDependencies": {
|
||||||
|
"svelte": "^5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@manypkg/find-root": {
|
"node_modules/@manypkg/find-root": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@manypkg/find-root/-/find-root-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@manypkg/find-root/-/find-root-1.1.0.tgz",
|
||||||
@@ -1371,7 +1375,6 @@
|
|||||||
"version": "1.0.11",
|
"version": "1.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.11.tgz",
|
||||||
"integrity": "sha512-LFuZUkjJ9iF7JZye/aG5XM0SFcQ5VyL0oVX4WJ9dc0Va3R3s0OauX1BESVCb+YN/ol8TAfqGDDAQsTG627Y5kw==",
|
"integrity": "sha512-LFuZUkjJ9iF7JZye/aG5XM0SFcQ5VyL0oVX4WJ9dc0Va3R3s0OauX1BESVCb+YN/ol8TAfqGDDAQsTG627Y5kw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"acorn": "^8.9.0"
|
"acorn": "^8.9.0"
|
||||||
@@ -1453,21 +1456,18 @@
|
|||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
|
||||||
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
|
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/trusted-types": {
|
"node_modules/@types/trusted-types": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
|
||||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.18.0",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
|
||||||
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
|
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
@@ -1507,7 +1507,6 @@
|
|||||||
"version": "5.3.1",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz",
|
||||||
"integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==",
|
"integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==",
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -1527,7 +1526,6 @@
|
|||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
|
||||||
"integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==",
|
"integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -1586,7 +1584,6 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||||
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
@@ -1638,7 +1635,6 @@
|
|||||||
"version": "5.9.0",
|
"version": "5.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/devalue/-/devalue-5.9.0.tgz",
|
||||||
"integrity": "sha512-RWrqdArjvPbsATEhOPUo6Wndc/iWnkWKlhIrdlF3zMMYo/c3CVtoaVAyLtWxz5h8nSlkHzxnzV2uLydPXmtF+A==",
|
"integrity": "sha512-RWrqdArjvPbsATEhOPUo6Wndc/iWnkWKlhIrdlF3zMMYo/c3CVtoaVAyLtWxz5h8nSlkHzxnzV2uLydPXmtF+A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/dir-glob": {
|
"node_modules/dir-glob": {
|
||||||
@@ -1715,7 +1711,6 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz",
|
||||||
"integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==",
|
"integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/esprima": {
|
"node_modules/esprima": {
|
||||||
@@ -1736,7 +1731,6 @@
|
|||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/esrap/-/esrap-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/esrap/-/esrap-2.3.0.tgz",
|
||||||
"integrity": "sha512-GQ/7RN8uOtEfNpzZzBMTzW9JBcX42oaSVtPzdF+6cEL8pqIL094iUpr9jzYGn4O4P/1S60dJ6izyT8F4LYARng==",
|
"integrity": "sha512-GQ/7RN8uOtEfNpzZzBMTzW9JBcX42oaSVtPzdF+6cEL8pqIL094iUpr9jzYGn4O4P/1S60dJ6izyT8F4LYARng==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.15"
|
"@jridgewell/sourcemap-codec": "^1.4.15"
|
||||||
@@ -1975,7 +1969,6 @@
|
|||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz",
|
||||||
"integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==",
|
"integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "^1.0.6"
|
"@types/estree": "^1.0.6"
|
||||||
@@ -2058,7 +2051,6 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
|
||||||
"integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
|
"integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/locate-path": {
|
"node_modules/locate-path": {
|
||||||
@@ -2085,7 +2077,6 @@
|
|||||||
"version": "0.30.21",
|
"version": "0.30.21",
|
||||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||||
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
|
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||||
@@ -2821,7 +2812,6 @@
|
|||||||
"version": "5.56.8",
|
"version": "5.56.8",
|
||||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.56.8.tgz",
|
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.56.8.tgz",
|
||||||
"integrity": "sha512-PY8LOw7xP6c8IOiVqdo0sbbZVYhXRSfklOQLAUyGBKqjTX0wx/z4l/9J+PmBpmlLnxzEb1NqltxQ5/wZme/Cmg==",
|
"integrity": "sha512-PY8LOw7xP6c8IOiVqdo0sbbZVYhXRSfklOQLAUyGBKqjTX0wx/z4l/9J+PmBpmlLnxzEb1NqltxQ5/wZme/Cmg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/remapping": "^2.3.4",
|
"@jridgewell/remapping": "^2.3.4",
|
||||||
@@ -3108,17 +3098,16 @@
|
|||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.4.tgz",
|
||||||
"integrity": "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ==",
|
"integrity": "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"packages/design-tokens": {
|
"packages/design-tokens": {
|
||||||
"name": "@gabriel20xx/design-tokens",
|
"name": "@gabriel20xx/design-tokens",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"packages/node-backend": {
|
"packages/node-backend": {
|
||||||
"name": "@gabriel20xx/node-backend",
|
"name": "@gabriel20xx/node-backend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pg": "^8.17.2"
|
"pg": "^8.17.2"
|
||||||
@@ -3129,10 +3118,11 @@
|
|||||||
},
|
},
|
||||||
"packages/web-ui": {
|
"packages/web-ui": {
|
||||||
"name": "@gabriel20xx/web-ui",
|
"name": "@gabriel20xx/web-ui",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gabriel20xx/design-tokens": "0.1.0"
|
"@gabriel20xx/design-tokens": "0.1.1",
|
||||||
|
"@lucide/svelte": "1.28.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/package": "^2.5.0",
|
"@sveltejs/package": "^2.5.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/shared-code",
|
"name": "@gabriel20xx/shared-code",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Shared UI and backend packages for Gabriel20xx projects.",
|
"description": "Shared UI and backend packages for Gabriel20xx projects.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/design-tokens",
|
"name": "@gabriel20xx/design-tokens",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Shared visual tokens for Gabriel20xx web projects.",
|
"description": "Shared visual tokens for Gabriel20xx web projects.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ legacy package as a compatibility layer until every consumer has moved.
|
|||||||
Pass a service-specific `tableName` to `runMigrations` when multiple services
|
Pass a service-specific `tableName` to `runMigrations` when multiple services
|
||||||
share one PostgreSQL database, so their migration histories cannot collide.
|
share one PostgreSQL database, so their migration histories cannot collide.
|
||||||
|
|
||||||
Run `npm test` from this package or `npm run test --workspace=@gabriel20xx/node-backend` from `SharedCode`.
|
Run `npm test` from this package or `npm run test --workspace=@gabriel20xx/node-backend` from `shared`.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/node-backend",
|
"name": "@gabriel20xx/node-backend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Shared PostgreSQL, configuration, migration, and authentication primitives for Node.js services.",
|
"description": "Shared PostgreSQL, configuration, migration, and authentication primitives for Node.js services.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Shared Python backend infrastructure for services using `asyncpg`:
|
|||||||
- common account/session persistence for the single-admin or optional multi-user model.
|
- common account/session persistence for the single-admin or optional multi-user model.
|
||||||
|
|
||||||
HTTP framework adapters stay in each service. Install this package from the
|
HTTP framework adapters stay in each service. Install this package from the
|
||||||
published index or directly from the SharedCode repository with a subdirectory
|
published index or directly from the shared repository with a subdirectory
|
||||||
install during development:
|
install during development:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -43,7 +43,5 @@ class DatabaseConfig:
|
|||||||
min_size=min_size,
|
min_size=min_size,
|
||||||
max_size=max_size,
|
max_size=max_size,
|
||||||
timeout=float(_int_value(source, "DATABASE_CONNECT_TIMEOUT_SECONDS", 5, 1)),
|
timeout=float(_int_value(source, "DATABASE_CONNECT_TIMEOUT_SECONDS", 5, 1)),
|
||||||
command_timeout=float(
|
command_timeout=float(_int_value(source, "DATABASE_COMMAND_TIMEOUT_SECONDS", 15, 1)),
|
||||||
_int_value(source, "DATABASE_COMMAND_TIMEOUT_SECONDS", 15, 1)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/web-ui",
|
"name": "@gabriel20xx/web-ui",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "Shared Svelte UI, layout, authentication, and account components for Gabriel20xx web projects.",
|
"description": "Shared Svelte UI, layout, authentication, and account components for Gabriel20xx web projects.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
"svelte": "^5.0.0"
|
"svelte": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gabriel20xx/design-tokens": "0.1.0"
|
"@gabriel20xx/design-tokens": "0.1.1",
|
||||||
|
"@lucide/svelte": "1.28.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/package": "^2.5.0",
|
"@sveltejs/package": "^2.5.0",
|
||||||
|
|||||||
@@ -7,22 +7,37 @@
|
|||||||
brand = 'Application',
|
brand = 'Application',
|
||||||
children,
|
children,
|
||||||
description = '',
|
description = '',
|
||||||
|
icon,
|
||||||
links = [],
|
links = [],
|
||||||
|
onClose,
|
||||||
open = $bindable(false),
|
open = $bindable(false),
|
||||||
version = ''
|
version = ''
|
||||||
}: {
|
}: {
|
||||||
brand?: string;
|
brand?: string;
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
icon?: Snippet;
|
||||||
links?: AboutLink[];
|
links?: AboutLink[];
|
||||||
|
onClose?: () => void | Promise<void>;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
version?: string;
|
version?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
|
let wasOpen = false;
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (wasOpen && !open) void onClose?.();
|
||||||
|
wasOpen = open;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Dialog bind:open title={`About ${brand}`}>
|
<Dialog bind:open title={`About ${brand}`}>
|
||||||
<div class="sc-auth-brand">
|
<div class="sc-auth-brand">
|
||||||
|
{#if icon}
|
||||||
|
{@render icon()}
|
||||||
|
{:else}
|
||||||
<span aria-hidden="true" class="sc-brand-mark">{brand.slice(0, 1).toUpperCase()}</span>
|
<span aria-hidden="true" class="sc-brand-mark">{brand.slice(0, 1).toUpperCase()}</span>
|
||||||
|
{/if}
|
||||||
<strong>{brand}</strong>
|
<strong>{brand}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type {
|
||||||
|
UserCreateRequest,
|
||||||
|
UserDeleteRequest,
|
||||||
|
UserId,
|
||||||
|
UserListRequest,
|
||||||
|
UserRole,
|
||||||
|
UserUpdateRequest
|
||||||
|
} from '../types';
|
||||||
|
import Dialog from './Dialog.svelte';
|
||||||
|
import UserManagement from './UserManagement.svelte';
|
||||||
|
|
||||||
|
let {
|
||||||
|
currentRole = 'user',
|
||||||
|
currentUserId,
|
||||||
|
description = 'Manage accounts and access for this application.',
|
||||||
|
loginRequired = true,
|
||||||
|
onCreateUser,
|
||||||
|
onDeleteUser,
|
||||||
|
onLoginRequiredChange,
|
||||||
|
onListUsers,
|
||||||
|
onUpdateUser,
|
||||||
|
open = $bindable(false),
|
||||||
|
title = 'Admin'
|
||||||
|
}: {
|
||||||
|
currentRole?: UserRole;
|
||||||
|
currentUserId?: UserId;
|
||||||
|
description?: string;
|
||||||
|
loginRequired?: boolean;
|
||||||
|
onCreateUser?: UserCreateRequest;
|
||||||
|
onDeleteUser?: UserDeleteRequest;
|
||||||
|
onLoginRequiredChange?: (required: boolean) => void | Promise<void>;
|
||||||
|
onListUsers?: UserListRequest;
|
||||||
|
onUpdateUser?: UserUpdateRequest;
|
||||||
|
open?: boolean;
|
||||||
|
title?: string;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
let loginRequiredValue = $state<boolean>(true);
|
||||||
|
let loginSettingError = $state('');
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
loginRequiredValue = loginRequired;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function updateLoginRequired(required: boolean) {
|
||||||
|
const previous = loginRequiredValue;
|
||||||
|
loginRequiredValue = required;
|
||||||
|
loginSettingError = '';
|
||||||
|
try {
|
||||||
|
await onLoginRequiredChange?.(required);
|
||||||
|
} catch (error) {
|
||||||
|
loginRequiredValue = previous;
|
||||||
|
loginSettingError = error instanceof Error ? error.message : 'The setting could not be saved.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Dialog bind:open {description} {title}>
|
||||||
|
{#if onLoginRequiredChange}
|
||||||
|
<div class="sc-field">
|
||||||
|
<label class="flex items-center gap-3">
|
||||||
|
<input
|
||||||
|
class="size-4 accent-primary"
|
||||||
|
type="checkbox"
|
||||||
|
checked={loginRequiredValue}
|
||||||
|
onchange={(event) => updateLoginRequired((event.currentTarget as HTMLInputElement).checked)}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<span class="block font-medium">Require login to access app</span>
|
||||||
|
<span class="sc-muted">Admins and superadmins can change this setting.</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
{#if loginSettingError}<p class="sc-error" role="alert">{loginSettingError}</p>{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<UserManagement
|
||||||
|
currentRole={currentRole}
|
||||||
|
currentUserId={currentUserId}
|
||||||
|
onCreate={onCreateUser}
|
||||||
|
onDelete={onDeleteUser}
|
||||||
|
onList={onListUsers}
|
||||||
|
onUpdate={onUpdateUser}
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
@@ -2,47 +2,71 @@
|
|||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import type { NavItem } from '../types';
|
import type { NavItem } from '../types';
|
||||||
import Header from './Header.svelte';
|
import Header from './Header.svelte';
|
||||||
|
import NotificationStack from './NotificationStack.svelte';
|
||||||
|
import PageHeader from './PageHeader.svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
aboutHref,
|
||||||
brand = 'Application',
|
brand = 'Application',
|
||||||
brandHref = '/',
|
brandHref = '/',
|
||||||
children,
|
children,
|
||||||
class: className = '',
|
class: className = '',
|
||||||
currentPath = '',
|
currentPath = '',
|
||||||
|
faviconHref = '/favicon.svg',
|
||||||
headerActions,
|
headerActions,
|
||||||
navItems = [],
|
navItems = [],
|
||||||
|
onAbout,
|
||||||
|
onAdmin,
|
||||||
onLogout,
|
onLogout,
|
||||||
onNavigate,
|
onNavigate,
|
||||||
onProfile,
|
onProfile,
|
||||||
onSettings,
|
onSettings,
|
||||||
|
showPageHeader = true,
|
||||||
showSettings = true,
|
showSettings = true,
|
||||||
theme = 'dark',
|
theme = 'dark',
|
||||||
username = ''
|
username = '',
|
||||||
}: {
|
}: {
|
||||||
|
aboutHref?: string;
|
||||||
brand?: string;
|
brand?: string;
|
||||||
brandHref?: string;
|
brandHref?: string;
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
class?: string;
|
class?: string;
|
||||||
currentPath?: string;
|
currentPath?: string;
|
||||||
|
faviconHref?: string;
|
||||||
headerActions?: Snippet;
|
headerActions?: Snippet;
|
||||||
navItems?: NavItem[];
|
navItems?: NavItem[];
|
||||||
|
onAbout?: () => void | Promise<void>;
|
||||||
|
onAdmin?: () => void | Promise<void>;
|
||||||
onLogout?: () => void | Promise<void>;
|
onLogout?: () => void | Promise<void>;
|
||||||
onNavigate?: (item: NavItem) => void;
|
onNavigate?: (item: NavItem) => void;
|
||||||
onProfile?: () => void;
|
onProfile?: () => void;
|
||||||
onSettings?: () => void;
|
onSettings?: () => void;
|
||||||
|
showPageHeader?: boolean;
|
||||||
showSettings?: boolean;
|
showSettings?: boolean;
|
||||||
theme?: 'dark' | 'light' | 'system';
|
theme?: 'dark' | 'light' | 'system';
|
||||||
username?: string;
|
username?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
|
const activeNavItem = $derived(
|
||||||
|
navItems.find((item) =>
|
||||||
|
item.href === '/' ? currentPath === '/' : currentPath === item.href || currentPath.startsWith(`${item.href}/`),
|
||||||
|
),
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={`sc-root sc-app-shell ${className}`} data-theme={theme === 'system' ? undefined : theme}>
|
<div class={`sc-root sc-app-shell ${className}`} data-theme={theme === 'system' ? undefined : theme}>
|
||||||
|
<NotificationStack />
|
||||||
|
|
||||||
<Header
|
<Header
|
||||||
|
aboutHref={aboutHref ?? navItems.find((item) => item.label.toLowerCase() === 'about')?.href ?? '/about'}
|
||||||
{brand}
|
{brand}
|
||||||
{brandHref}
|
{brandHref}
|
||||||
{currentPath}
|
{currentPath}
|
||||||
|
{faviconHref}
|
||||||
actions={headerActions}
|
actions={headerActions}
|
||||||
{navItems}
|
{navItems}
|
||||||
|
{onAbout}
|
||||||
|
{onAdmin}
|
||||||
{onLogout}
|
{onLogout}
|
||||||
{onNavigate}
|
{onNavigate}
|
||||||
{onProfile}
|
{onProfile}
|
||||||
@@ -52,6 +76,13 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<main class="sc-main">
|
<main class="sc-main">
|
||||||
|
{#if showPageHeader && activeNavItem?.href !== '/about'}
|
||||||
|
<PageHeader
|
||||||
|
title={activeNavItem?.label ?? brand}
|
||||||
|
description={activeNavItem?.description ??
|
||||||
|
`Explore the ${activeNavItem?.label?.toLowerCase() ?? 'application'} section.`}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
brand = 'Application',
|
brand = 'Application',
|
||||||
children,
|
children,
|
||||||
error = '',
|
error = '',
|
||||||
|
faviconHref = '/favicon.svg',
|
||||||
loading = false,
|
loading = false,
|
||||||
onLogin,
|
onLogin,
|
||||||
onConfirmReset,
|
onConfirmReset,
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
brand?: string;
|
brand?: string;
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
faviconHref?: string;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
onLogin?: (input: AuthLoginInput) => void | Promise<void>;
|
onLogin?: (input: AuthLoginInput) => void | Promise<void>;
|
||||||
onConfirmReset?: AuthResetConfirm;
|
onConfirmReset?: AuthResetConfirm;
|
||||||
@@ -39,6 +41,7 @@
|
|||||||
let identifier = $state('');
|
let identifier = $state('');
|
||||||
let password = $state('');
|
let password = $state('');
|
||||||
let totpToken = $state('');
|
let totpToken = $state('');
|
||||||
|
let totpRequired = $state(false);
|
||||||
let confirmPassword = $state('');
|
let confirmPassword = $state('');
|
||||||
let submitError = $state('');
|
let submitError = $state('');
|
||||||
let submitting = $state(false);
|
let submitting = $state(false);
|
||||||
@@ -47,11 +50,27 @@
|
|||||||
let resetOpen = $state(false);
|
let resetOpen = $state(false);
|
||||||
let resetting = $state(false);
|
let resetting = $state(false);
|
||||||
|
|
||||||
|
// A failed status fetch tells us nothing about whether setup is actually required —
|
||||||
|
// defaulting to the setup view in that case would wrongly invite creating a new
|
||||||
|
// account when the real problem is that the server couldn't be reached.
|
||||||
|
let effectiveSetupRequired = $derived(error ? false : setupRequired);
|
||||||
|
|
||||||
|
function isTotpChallenge(caught: unknown): boolean {
|
||||||
|
if (!(caught instanceof Error)) return false;
|
||||||
|
const message = caught.message.toLowerCase();
|
||||||
|
return (
|
||||||
|
message.includes('two-factor authentication code required') ||
|
||||||
|
message.includes('multi-factor authentication code required') ||
|
||||||
|
(message.includes('totp') && message.includes('required')) ||
|
||||||
|
(message.includes('mfa') && message.includes('required'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function submit(event: SubmitEvent): Promise<void> {
|
async function submit(event: SubmitEvent): Promise<void> {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
submitError = '';
|
submitError = '';
|
||||||
|
|
||||||
if (setupRequired && password !== confirmPassword) {
|
if (effectiveSetupRequired && password !== confirmPassword) {
|
||||||
submitError = 'Passwords do not match.';
|
submitError = 'Passwords do not match.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -59,15 +78,28 @@
|
|||||||
submitting = true;
|
submitting = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (setupRequired) {
|
if (effectiveSetupRequired) {
|
||||||
if (!onSetup) throw new Error('The application has not configured its setup handler.');
|
if (!onSetup) throw new Error('The application has not configured its setup handler.');
|
||||||
await onSetup({ username, email, password });
|
await onSetup({ username, email, password });
|
||||||
} else {
|
} else {
|
||||||
if (!onLogin) throw new Error('The application has not configured its login handler.');
|
if (!onLogin) throw new Error('The application has not configured its login handler.');
|
||||||
|
if (totpRequired && !totpToken.trim()) {
|
||||||
|
submitError = 'Enter the six-digit authenticator code to continue.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
await onLogin({ identifier, password, totpToken: totpToken.trim() });
|
await onLogin({ identifier, password, totpToken: totpToken.trim() });
|
||||||
}
|
}
|
||||||
} catch (caught) {
|
} catch (caught) {
|
||||||
|
if (!effectiveSetupRequired && showTotp && isTotpChallenge(caught)) {
|
||||||
|
totpRequired = true;
|
||||||
|
submitError = 'Enter the six-digit authenticator code to continue.';
|
||||||
|
} else {
|
||||||
|
if (!effectiveSetupRequired) {
|
||||||
|
totpRequired = false;
|
||||||
|
totpToken = '';
|
||||||
|
}
|
||||||
submitError = caught instanceof Error ? caught.message : 'Authentication failed.';
|
submitError = caught instanceof Error ? caught.message : 'Authentication failed.';
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
submitting = false;
|
submitting = false;
|
||||||
}
|
}
|
||||||
@@ -107,19 +139,24 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="sc-root sc-auth-page">
|
<div class="sc-root sc-auth-page">
|
||||||
<section aria-labelledby="sc-auth-title" class="sc-auth-card">
|
<section aria-busy={loading} aria-labelledby="sc-auth-title" class="sc-auth-card">
|
||||||
<div class="sc-auth-brand">
|
<div class="sc-auth-brand">
|
||||||
<span aria-hidden="true" class="sc-brand-mark">{brand.slice(0, 1).toUpperCase()}</span>
|
<img alt="" aria-hidden="true" class="sc-auth-brand-icon" src={faviconHref} />
|
||||||
<span>{brand}</span>
|
<span>{brand}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 id="sc-auth-title">{setupRequired ? 'Create your account' : 'Welcome back'}</h1>
|
{#if loading}
|
||||||
|
<h1 id="sc-auth-title">Loading...</h1>
|
||||||
|
{:else}
|
||||||
|
<h1 id="sc-auth-title">{effectiveSetupRequired ? 'Create your account' : 'Welcome back'}</h1>
|
||||||
|
{/if}
|
||||||
|
{#if !loading}
|
||||||
{#if tagline}
|
{#if tagline}
|
||||||
<p class="sc-auth-subtitle">{tagline}</p>
|
<p class="sc-auth-subtitle">{tagline}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<form class="sc-form sc-auth-form" onsubmit={submit}>
|
<form class="sc-form sc-auth-form" onsubmit={submit}>
|
||||||
{#if setupRequired}
|
{#if effectiveSetupRequired}
|
||||||
<label class="sc-field">
|
<label class="sc-field">
|
||||||
<span class="sc-label">Username</span>
|
<span class="sc-label">Username</span>
|
||||||
<input
|
<input
|
||||||
@@ -160,7 +197,7 @@
|
|||||||
<label class="sc-field">
|
<label class="sc-field">
|
||||||
<span class="sc-label">Password</span>
|
<span class="sc-label">Password</span>
|
||||||
<input
|
<input
|
||||||
autocomplete={setupRequired ? 'new-password' : 'current-password'}
|
autocomplete={effectiveSetupRequired ? 'new-password' : 'current-password'}
|
||||||
class="sc-input"
|
class="sc-input"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
name="password"
|
name="password"
|
||||||
@@ -170,9 +207,9 @@
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{#if showTotp && !setupRequired}
|
{#if showTotp && !effectiveSetupRequired && totpRequired}
|
||||||
<label class="sc-field">
|
<label class="sc-field">
|
||||||
<span class="sc-label">Authenticator code <span class="sc-label-optional">(if enabled)</span></span>
|
<span class="sc-label">Authenticator code</span>
|
||||||
<input
|
<input
|
||||||
autocomplete="one-time-code"
|
autocomplete="one-time-code"
|
||||||
class="sc-input"
|
class="sc-input"
|
||||||
@@ -184,7 +221,7 @@
|
|||||||
</label>
|
</label>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if setupRequired}
|
{#if effectiveSetupRequired}
|
||||||
<label class="sc-field">
|
<label class="sc-field">
|
||||||
<span class="sc-label">Confirm password</span>
|
<span class="sc-label">Confirm password</span>
|
||||||
<input
|
<input
|
||||||
@@ -204,7 +241,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<Button disabled={loading || submitting} fullWidth size="lg" type="submit">
|
<Button disabled={loading || submitting} fullWidth size="lg" type="submit">
|
||||||
{loading || submitting ? 'Please wait…' : setupRequired ? 'Create account' : 'Log in'}
|
{loading || submitting ? 'Please wait…' : effectiveSetupRequired ? 'Create account' : 'Log in'}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -212,7 +249,7 @@
|
|||||||
<div class="sc-auth-extra">{@render children()}</div>
|
<div class="sc-auth-extra">{@render children()}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !setupRequired && onRequestReset && onConfirmReset}
|
{#if !effectiveSetupRequired && onRequestReset && onConfirmReset}
|
||||||
{#if resetOpen}
|
{#if resetOpen}
|
||||||
<div class="sc-auth-reset" aria-live="polite">
|
<div class="sc-auth-reset" aria-live="polite">
|
||||||
<p class="sc-auth-reset-hint">A reset code has been printed to the server console.</p>
|
<p class="sc-auth-reset-hint">A reset code has been printed to the server console.</p>
|
||||||
@@ -241,5 +278,6 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,34 +1,159 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import {
|
||||||
|
Activity,
|
||||||
|
Archive,
|
||||||
|
BarChart3,
|
||||||
|
Bot,
|
||||||
|
Box,
|
||||||
|
CircleAlert,
|
||||||
|
CircleHelp,
|
||||||
|
CircleUserRound,
|
||||||
|
CloudDownload,
|
||||||
|
Database,
|
||||||
|
FileCog,
|
||||||
|
FolderOpen,
|
||||||
|
Gamepad2,
|
||||||
|
GalleryHorizontalEnd,
|
||||||
|
HardDrive,
|
||||||
|
Image,
|
||||||
|
Info,
|
||||||
|
LayoutDashboard,
|
||||||
|
ListVideo,
|
||||||
|
LogOut,
|
||||||
|
Logs,
|
||||||
|
Magnet,
|
||||||
|
Map,
|
||||||
|
MapPinned,
|
||||||
|
MessageCircle,
|
||||||
|
MonitorPlay,
|
||||||
|
Play,
|
||||||
|
Plug,
|
||||||
|
RefreshCw,
|
||||||
|
ScanSearch,
|
||||||
|
ScrollText,
|
||||||
|
Send,
|
||||||
|
Server,
|
||||||
|
Settings2,
|
||||||
|
ShieldCheck,
|
||||||
|
SlidersHorizontal,
|
||||||
|
Sparkles,
|
||||||
|
Tags,
|
||||||
|
Upload,
|
||||||
|
Users,
|
||||||
|
WandSparkles,
|
||||||
|
Workflow,
|
||||||
|
Wrench,
|
||||||
|
} from '@lucide/svelte';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import type { NavItem } from '../types';
|
import type { NavItem } from '../types';
|
||||||
|
|
||||||
|
const icons: Record<string, typeof LayoutDashboard> = {
|
||||||
|
activity: Activity,
|
||||||
|
archive: Archive,
|
||||||
|
'bar-chart-3': BarChart3,
|
||||||
|
bot: Bot,
|
||||||
|
box: Box,
|
||||||
|
'circle-alert': CircleAlert,
|
||||||
|
'circle-help': CircleHelp,
|
||||||
|
'cloud-download': CloudDownload,
|
||||||
|
database: Database,
|
||||||
|
'file-cog': FileCog,
|
||||||
|
'folder-open': FolderOpen,
|
||||||
|
gamepad: Gamepad2,
|
||||||
|
'gallery-horizontal-end': GalleryHorizontalEnd,
|
||||||
|
'hard-drive': HardDrive,
|
||||||
|
image: Image,
|
||||||
|
info: Info,
|
||||||
|
'layout-dashboard': LayoutDashboard,
|
||||||
|
'list-video': ListVideo,
|
||||||
|
logs: Logs,
|
||||||
|
magnet: Magnet,
|
||||||
|
map: Map,
|
||||||
|
'map-pinned': MapPinned,
|
||||||
|
'message-circle': MessageCircle,
|
||||||
|
'monitor-play': MonitorPlay,
|
||||||
|
play: Play,
|
||||||
|
plug: Plug,
|
||||||
|
'refresh-cw': RefreshCw,
|
||||||
|
'scan-search': ScanSearch,
|
||||||
|
'scroll-text': ScrollText,
|
||||||
|
send: Send,
|
||||||
|
server: Server,
|
||||||
|
'settings-2': Settings2,
|
||||||
|
'shield-check': ShieldCheck,
|
||||||
|
'sliders-horizontal': SlidersHorizontal,
|
||||||
|
sparkles: Sparkles,
|
||||||
|
tags: Tags,
|
||||||
|
upload: Upload,
|
||||||
|
users: Users,
|
||||||
|
'wand-sparkles': WandSparkles,
|
||||||
|
workflow: Workflow,
|
||||||
|
wrench: Wrench,
|
||||||
|
};
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
aboutHref = '/about',
|
||||||
brand = 'Application',
|
brand = 'Application',
|
||||||
brandHref = '/',
|
brandHref = '/',
|
||||||
currentPath = '',
|
currentPath = '',
|
||||||
|
faviconHref = '/favicon.svg',
|
||||||
navItems = [],
|
navItems = [],
|
||||||
actions,
|
actions,
|
||||||
|
onAbout,
|
||||||
|
onAdmin,
|
||||||
onLogout,
|
onLogout,
|
||||||
onNavigate,
|
onNavigate,
|
||||||
onProfile,
|
onProfile,
|
||||||
onSettings,
|
onSettings,
|
||||||
showSettings = true,
|
showSettings = true,
|
||||||
username = ''
|
username = '',
|
||||||
}: {
|
}: {
|
||||||
|
aboutHref?: string;
|
||||||
brand?: string;
|
brand?: string;
|
||||||
brandHref?: string;
|
brandHref?: string;
|
||||||
currentPath?: string;
|
currentPath?: string;
|
||||||
|
faviconHref?: string;
|
||||||
navItems?: NavItem[];
|
navItems?: NavItem[];
|
||||||
actions?: Snippet;
|
actions?: Snippet;
|
||||||
|
onAbout?: () => void | Promise<void>;
|
||||||
|
onAdmin?: () => void | Promise<void>;
|
||||||
onLogout?: () => void | Promise<void>;
|
onLogout?: () => void | Promise<void>;
|
||||||
onNavigate?: (item: NavItem) => void;
|
onNavigate?: (item: NavItem) => void;
|
||||||
onProfile?: () => void;
|
onProfile?: () => void | Promise<void>;
|
||||||
onSettings?: () => void;
|
onSettings?: () => void | Promise<void>;
|
||||||
showSettings?: boolean;
|
showSettings?: boolean;
|
||||||
username?: string;
|
username?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let navOpen = $state(false);
|
let navOpen = $state(false);
|
||||||
|
let profileOpen = $state(false);
|
||||||
|
|
||||||
|
// onAdmin is only ever passed by the caller when the signed-in user's role qualifies, so its
|
||||||
|
// presence alone is enough to decide visibility here - same as onProfile/onLogout below.
|
||||||
|
const hasProfileMenu = $derived(
|
||||||
|
Boolean(
|
||||||
|
username && (onProfile || onAdmin || (showSettings && onSettings) || onAbout || aboutHref || onLogout),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
function closeMenus(): void {
|
||||||
|
navOpen = false;
|
||||||
|
profileOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWindowKeydown(event: KeyboardEvent): void {
|
||||||
|
if (event.key === 'Escape') closeMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWindowClick(event: MouseEvent): void {
|
||||||
|
if (event.target instanceof Element && !event.target.closest('[data-profile-menu]')) {
|
||||||
|
profileOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function iconFor(item: NavItem) {
|
||||||
|
return icons[item.icon ?? 'layout-dashboard'] ?? LayoutDashboard;
|
||||||
|
}
|
||||||
|
|
||||||
function isActive(item: NavItem): boolean {
|
function isActive(item: NavItem): boolean {
|
||||||
return item.href === '/'
|
return item.href === '/'
|
||||||
@@ -37,14 +162,17 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window onclick={handleWindowClick} onkeydown={handleWindowKeydown} />
|
||||||
|
|
||||||
<header class="sc-header">
|
<header class="sc-header">
|
||||||
<a class="sc-brand" href={brandHref} onclick={() => (navOpen = false)}>
|
<a class="sc-brand" href={brandHref} onclick={closeMenus}>
|
||||||
<span aria-hidden="true" class="sc-brand-mark">{brand.slice(0, 1).toUpperCase()}</span>
|
<img alt="" class="sc-brand-icon" src={faviconHref} />
|
||||||
<span>{brand}</span>
|
<span>{brand}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<nav aria-label="Primary navigation" class="sc-nav" data-open={navOpen}>
|
<nav aria-label="Primary navigation" class="sc-nav" data-open={navOpen}>
|
||||||
{#each navItems as item}
|
{#each navItems as item}
|
||||||
|
{@const Icon = iconFor(item)}
|
||||||
<a
|
<a
|
||||||
aria-current={isActive(item) ? 'page' : undefined}
|
aria-current={isActive(item) ? 'page' : undefined}
|
||||||
class="sc-nav-link"
|
class="sc-nav-link"
|
||||||
@@ -55,9 +183,10 @@
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onNavigate(item);
|
onNavigate(item);
|
||||||
}
|
}
|
||||||
navOpen = false;
|
closeMenus();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Icon aria-hidden="true" class="sc-nav-icon" size={16} strokeWidth={2} />
|
||||||
{item.label}
|
{item.label}
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -66,19 +195,104 @@
|
|||||||
<div class="sc-header-actions">
|
<div class="sc-header-actions">
|
||||||
{#if actions}{@render actions()}{/if}
|
{#if actions}{@render actions()}{/if}
|
||||||
|
|
||||||
{#if showSettings && onSettings}
|
{#if hasProfileMenu}
|
||||||
<button aria-label="Open settings" class="sc-icon-button" type="button" onclick={onSettings}>⚙</button>
|
<div class="sc-profile-menu" data-profile-menu>
|
||||||
|
<button
|
||||||
|
aria-expanded={profileOpen}
|
||||||
|
aria-haspopup="menu"
|
||||||
|
class="sc-profile-button"
|
||||||
|
type="button"
|
||||||
|
onclick={() => (profileOpen = !profileOpen)}
|
||||||
|
>
|
||||||
|
<CircleUserRound aria-hidden="true" class="sc-profile-icon" size={16} strokeWidth={2} />
|
||||||
|
<span>{username}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{#if profileOpen}
|
||||||
|
<div aria-label="Account menu" class="sc-profile-dropdown" role="menu">
|
||||||
|
{#if onProfile}
|
||||||
|
<button
|
||||||
|
class="sc-profile-menu-item"
|
||||||
|
role="menuitem"
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
profileOpen = false;
|
||||||
|
void onProfile?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircleUserRound aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
|
Profile
|
||||||
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if username && onProfile}
|
{#if onAdmin}
|
||||||
<button class="sc-profile-button" type="button" onclick={onProfile}>{username}</button>
|
<button
|
||||||
|
class="sc-profile-menu-item"
|
||||||
|
role="menuitem"
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
profileOpen = false;
|
||||||
|
void onAdmin?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ShieldCheck aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
|
Admin
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if showSettings && onSettings}
|
||||||
|
<button
|
||||||
|
class="sc-profile-menu-item"
|
||||||
|
role="menuitem"
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
profileOpen = false;
|
||||||
|
void onSettings?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Settings2 aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
|
Settings
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if onAbout}
|
||||||
|
<button
|
||||||
|
class="sc-profile-menu-item"
|
||||||
|
role="menuitem"
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
profileOpen = false;
|
||||||
|
void onAbout?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Info aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
|
About
|
||||||
|
</button>
|
||||||
|
{:else if aboutHref}
|
||||||
|
<a class="sc-profile-menu-item" href={aboutHref} role="menuitem" onclick={() => (profileOpen = false)}>
|
||||||
|
<Info aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
|
About
|
||||||
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if onLogout}
|
{#if onLogout}
|
||||||
<button class="sc-button sc-button-ghost sc-button-sm" type="button" onclick={() => void onLogout?.()}>
|
<button
|
||||||
|
class="sc-profile-menu-item"
|
||||||
|
role="menuitem"
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
profileOpen = false;
|
||||||
|
void onLogout?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LogOut aria-hidden="true" size={15} strokeWidth={2} />
|
||||||
Log out
|
Log out
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
aria-expanded={navOpen}
|
aria-expanded={navOpen}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { CircleAlert, CircleCheck, Info, OctagonAlert, X } from '@lucide/svelte';
|
||||||
|
import { fly } from 'svelte/transition';
|
||||||
|
import { notifications } from '../notifications.svelte';
|
||||||
|
import type { NotificationVariant } from '../notifications.svelte';
|
||||||
|
|
||||||
|
const icons: Record<NotificationVariant, typeof Info> = {
|
||||||
|
success: CircleCheck,
|
||||||
|
error: OctagonAlert,
|
||||||
|
warning: CircleAlert,
|
||||||
|
info: Info
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div aria-live="polite" class="sc-notification-stack" role="status">
|
||||||
|
{#each notifications.entries as entry (entry.id)}
|
||||||
|
{@const Icon = icons[entry.variant]}
|
||||||
|
<div class="sc-notification" data-variant={entry.variant} transition:fly={{ y: -12, duration: 180 }}>
|
||||||
|
<Icon aria-hidden="true" class="sc-notification-icon" size={18} />
|
||||||
|
<p class="sc-notification-message">{entry.message}</p>
|
||||||
|
<button
|
||||||
|
aria-label="Dismiss notification"
|
||||||
|
class="sc-notification-close"
|
||||||
|
type="button"
|
||||||
|
onclick={() => notifications.dismiss(entry.id)}
|
||||||
|
>
|
||||||
|
<X aria-hidden="true" size={16} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { ChevronFirst, ChevronLast, ChevronLeft, ChevronRight } from '@lucide/svelte';
|
||||||
|
|
||||||
|
const PAGE_SIZE_OPTIONS = [12, 24, 48, 96];
|
||||||
|
|
||||||
|
export type PaginationChange = {
|
||||||
|
page: number;
|
||||||
|
pageSize: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
let {
|
||||||
|
page,
|
||||||
|
pageSize = 24,
|
||||||
|
pageLength = 0,
|
||||||
|
totalLength = 0,
|
||||||
|
onPaging
|
||||||
|
}: {
|
||||||
|
page: number;
|
||||||
|
pageSize?: number;
|
||||||
|
pageLength?: number;
|
||||||
|
totalLength?: number;
|
||||||
|
onPaging: (change: PaginationChange) => void;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
const pageCount = $derived(Math.max(1, Math.ceil(totalLength / pageSize)));
|
||||||
|
const currentPage = $derived(Math.min(Math.max(1, page), pageCount));
|
||||||
|
const firstItemIndex = $derived(totalLength === 0 ? 0 : (currentPage - 1) * pageSize + 1);
|
||||||
|
const lastItemIndex = $derived(
|
||||||
|
totalLength === 0 ? 0 : Math.min(totalLength, (currentPage - 1) * pageSize + pageLength)
|
||||||
|
);
|
||||||
|
const hasPreviousPage = $derived(currentPage > 1);
|
||||||
|
const hasNextPage = $derived(currentPage < pageCount);
|
||||||
|
|
||||||
|
function goToPage(nextPage: number) {
|
||||||
|
onPaging({ page: Math.min(pageCount, Math.max(1, nextPage)), pageSize });
|
||||||
|
}
|
||||||
|
|
||||||
|
function changePageSize(event: Event) {
|
||||||
|
const nextPageSize = Number((event.currentTarget as HTMLSelectElement).value);
|
||||||
|
if (PAGE_SIZE_OPTIONS.includes(nextPageSize)) {
|
||||||
|
onPaging({ page: 1, pageSize: nextPageSize });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<nav class="sc-pagination" aria-label="Pagination">
|
||||||
|
<select
|
||||||
|
class="sc-pagination-page-size"
|
||||||
|
aria-label="Items per page"
|
||||||
|
value={String(pageSize)}
|
||||||
|
onchange={changePageSize}
|
||||||
|
>
|
||||||
|
{#each PAGE_SIZE_OPTIONS as option}
|
||||||
|
<option value={option}>{option}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<p class="sc-pagination-info">
|
||||||
|
{firstItemIndex.toLocaleString()}–{lastItemIndex.toLocaleString()} of {totalLength.toLocaleString()}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="sc-pagination-controls">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="sc-pagination-button"
|
||||||
|
aria-label="First page"
|
||||||
|
disabled={!hasPreviousPage}
|
||||||
|
onclick={() => goToPage(1)}
|
||||||
|
>
|
||||||
|
<ChevronFirst aria-hidden="true" size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="sc-pagination-button"
|
||||||
|
aria-label="Previous page"
|
||||||
|
disabled={!hasPreviousPage}
|
||||||
|
onclick={() => goToPage(currentPage - 1)}
|
||||||
|
>
|
||||||
|
<ChevronLeft aria-hidden="true" size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="sc-pagination-button"
|
||||||
|
aria-label="Next page"
|
||||||
|
disabled={!hasNextPage}
|
||||||
|
onclick={() => goToPage(currentPage + 1)}
|
||||||
|
>
|
||||||
|
<ChevronRight aria-hidden="true" size={16} />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="sc-pagination-button"
|
||||||
|
aria-label="Last page"
|
||||||
|
disabled={!hasNextPage}
|
||||||
|
onclick={() => goToPage(pageCount)}
|
||||||
|
>
|
||||||
|
<ChevronLast aria-hidden="true" size={16} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
@@ -1,51 +1,27 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {
|
import type { ProfileUpdateInput, TotpSetupRequest, TotpStatusRequest, TotpTokenAction } from '../types';
|
||||||
ProfileUpdateInput,
|
|
||||||
TotpSetupRequest,
|
|
||||||
TotpStatusRequest,
|
|
||||||
TotpTokenAction,
|
|
||||||
UserCreateRequest,
|
|
||||||
UserDeleteRequest,
|
|
||||||
UserId,
|
|
||||||
UserListRequest,
|
|
||||||
UserRole,
|
|
||||||
UserUpdateRequest
|
|
||||||
} from '../types';
|
|
||||||
import Button from './Button.svelte';
|
import Button from './Button.svelte';
|
||||||
import Dialog from './Dialog.svelte';
|
import Dialog from './Dialog.svelte';
|
||||||
import TotpSettings from './TotpSettings.svelte';
|
import TotpSettings from './TotpSettings.svelte';
|
||||||
import UserManagement from './UserManagement.svelte';
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
currentEmail = '',
|
currentEmail = '',
|
||||||
currentRole = 'user',
|
|
||||||
currentUserId,
|
|
||||||
onCreateUser,
|
|
||||||
onDeleteUser,
|
|
||||||
onListUsers,
|
|
||||||
currentUsername = '',
|
currentUsername = '',
|
||||||
onSave,
|
onSave,
|
||||||
onTotpDisable,
|
onTotpDisable,
|
||||||
onTotpEnable,
|
onTotpEnable,
|
||||||
onTotpSetup,
|
onTotpSetup,
|
||||||
onTotpStatus,
|
onTotpStatus,
|
||||||
onUpdateUser,
|
|
||||||
totpEnabled = false,
|
totpEnabled = false,
|
||||||
open = $bindable(false)
|
open = $bindable(false)
|
||||||
}: {
|
}: {
|
||||||
currentEmail?: string;
|
currentEmail?: string;
|
||||||
currentRole?: UserRole;
|
|
||||||
currentUserId?: UserId;
|
|
||||||
onCreateUser?: UserCreateRequest;
|
|
||||||
onDeleteUser?: UserDeleteRequest;
|
|
||||||
onListUsers?: UserListRequest;
|
|
||||||
currentUsername?: string;
|
currentUsername?: string;
|
||||||
onSave?: (input: ProfileUpdateInput) => void | Promise<void>;
|
onSave?: (input: ProfileUpdateInput) => void | Promise<void>;
|
||||||
onTotpDisable?: TotpTokenAction;
|
onTotpDisable?: TotpTokenAction;
|
||||||
onTotpEnable?: TotpTokenAction;
|
onTotpEnable?: TotpTokenAction;
|
||||||
onTotpSetup?: TotpSetupRequest;
|
onTotpSetup?: TotpSetupRequest;
|
||||||
onTotpStatus?: TotpStatusRequest;
|
onTotpStatus?: TotpStatusRequest;
|
||||||
onUpdateUser?: UserUpdateRequest;
|
|
||||||
totpEnabled?: boolean;
|
totpEnabled?: boolean;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -158,13 +134,4 @@
|
|||||||
enabled={totpEnabled}
|
enabled={totpEnabled}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<UserManagement
|
|
||||||
currentRole={currentRole}
|
|
||||||
currentUserId={currentUserId}
|
|
||||||
onCreate={onCreateUser}
|
|
||||||
onDelete={onDeleteUser}
|
|
||||||
onList={onListUsers}
|
|
||||||
onUpdate={onUpdateUser}
|
|
||||||
/>
|
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -1,36 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import type {
|
|
||||||
UserCreateRequest,
|
|
||||||
UserDeleteRequest,
|
|
||||||
UserId,
|
|
||||||
UserListRequest,
|
|
||||||
UserRole,
|
|
||||||
UserUpdateRequest
|
|
||||||
} from '../types';
|
|
||||||
import Dialog from './Dialog.svelte';
|
import Dialog from './Dialog.svelte';
|
||||||
import UserManagement from './UserManagement.svelte';
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
children,
|
children,
|
||||||
description = '',
|
description = '',
|
||||||
currentRole = 'user',
|
|
||||||
currentUserId,
|
|
||||||
onCreateUser,
|
|
||||||
onDeleteUser,
|
|
||||||
onListUsers,
|
|
||||||
onUpdateUser,
|
|
||||||
open = $bindable(false),
|
open = $bindable(false),
|
||||||
title = 'Settings'
|
title = 'Settings'
|
||||||
}: {
|
}: {
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
description?: string;
|
description?: string;
|
||||||
currentRole?: UserRole;
|
|
||||||
currentUserId?: UserId;
|
|
||||||
onCreateUser?: UserCreateRequest;
|
|
||||||
onDeleteUser?: UserDeleteRequest;
|
|
||||||
onListUsers?: UserListRequest;
|
|
||||||
onUpdateUser?: UserUpdateRequest;
|
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
title?: string;
|
title?: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -42,12 +21,4 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<p class="sc-muted">No settings have been configured for this application yet.</p>
|
<p class="sc-muted">No settings have been configured for this application yet.</p>
|
||||||
{/if}
|
{/if}
|
||||||
<UserManagement
|
|
||||||
currentRole={currentRole}
|
|
||||||
currentUserId={currentUserId}
|
|
||||||
onCreate={onCreateUser}
|
|
||||||
onDelete={onDeleteUser}
|
|
||||||
onList={onListUsers}
|
|
||||||
onUpdate={onUpdateUser}
|
|
||||||
/>
|
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export { default as AboutDialog } from './components/AboutDialog.svelte';
|
export { default as AboutDialog } from './components/AboutDialog.svelte';
|
||||||
|
export { default as AdminDialog } from './components/AdminDialog.svelte';
|
||||||
export { default as AppShell } from './components/AppShell.svelte';
|
export { default as AppShell } from './components/AppShell.svelte';
|
||||||
export { default as AuthPage } from './components/AuthPage.svelte';
|
export { default as AuthPage } from './components/AuthPage.svelte';
|
||||||
export { default as Badge } from './components/Badge.svelte';
|
export { default as Badge } from './components/Badge.svelte';
|
||||||
@@ -6,11 +7,15 @@ export { default as Button } from './components/Button.svelte';
|
|||||||
export { default as Card } from './components/Card.svelte';
|
export { default as Card } from './components/Card.svelte';
|
||||||
export { default as Dialog } from './components/Dialog.svelte';
|
export { default as Dialog } from './components/Dialog.svelte';
|
||||||
export { default as Header } from './components/Header.svelte';
|
export { default as Header } from './components/Header.svelte';
|
||||||
|
export { default as NotificationStack } from './components/NotificationStack.svelte';
|
||||||
export { default as PageHeader } from './components/PageHeader.svelte';
|
export { default as PageHeader } from './components/PageHeader.svelte';
|
||||||
|
export { default as Pagination } from './components/Pagination.svelte';
|
||||||
export { default as ProfileDialog } from './components/ProfileDialog.svelte';
|
export { default as ProfileDialog } from './components/ProfileDialog.svelte';
|
||||||
export { default as SettingsDialog } from './components/SettingsDialog.svelte';
|
export { default as SettingsDialog } from './components/SettingsDialog.svelte';
|
||||||
export { default as TotpSettings } from './components/TotpSettings.svelte';
|
export { default as TotpSettings } from './components/TotpSettings.svelte';
|
||||||
export { default as UserManagement } from './components/UserManagement.svelte';
|
export { default as UserManagement } from './components/UserManagement.svelte';
|
||||||
|
export { notifications, notify } from './notifications.svelte';
|
||||||
|
export type { NotificationEntry, NotificationVariant } from './notifications.svelte';
|
||||||
export type {
|
export type {
|
||||||
AboutLink,
|
AboutLink,
|
||||||
AsyncAction,
|
AsyncAction,
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
export type NotificationVariant = "success" | "error" | "warning" | "info";
|
||||||
|
|
||||||
|
export interface NotificationEntry {
|
||||||
|
id: number;
|
||||||
|
variant: NotificationVariant;
|
||||||
|
message: string;
|
||||||
|
duration: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_DURATION = 5000;
|
||||||
|
|
||||||
|
let entries = $state<NotificationEntry[]>([]);
|
||||||
|
let nextId = 0;
|
||||||
|
const timeouts = new Map<number, ReturnType<typeof setTimeout>>();
|
||||||
|
|
||||||
|
function dismissNotification(id: number): void {
|
||||||
|
const timeout = timeouts.get(id);
|
||||||
|
if (timeout !== undefined) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeouts.delete(id);
|
||||||
|
}
|
||||||
|
entries = entries.filter((entry) => entry.id !== id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushNotification(
|
||||||
|
variant: NotificationVariant,
|
||||||
|
message: string,
|
||||||
|
duration: number = DEFAULT_DURATION,
|
||||||
|
): number {
|
||||||
|
const id = ++nextId;
|
||||||
|
entries = [...entries, { id, variant, message, duration }];
|
||||||
|
if (duration > 0) {
|
||||||
|
timeouts.set(
|
||||||
|
id,
|
||||||
|
setTimeout(() => dismissNotification(id), duration),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const notifications = {
|
||||||
|
get entries() {
|
||||||
|
return entries;
|
||||||
|
},
|
||||||
|
dismiss: dismissNotification,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const notify = {
|
||||||
|
success: (message: string, duration?: number) => pushNotification("success", message, duration),
|
||||||
|
error: (message: string, duration?: number) => pushNotification("error", message, duration),
|
||||||
|
warning: (message: string, duration?: number) => pushNotification("warning", message, duration),
|
||||||
|
info: (message: string, duration?: number) => pushNotification("info", message, duration),
|
||||||
|
dismiss: dismissNotification,
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@import '@gabriel20xx/design-tokens/theme.css';
|
@import "@gabriel20xx/design-tokens/theme.css";
|
||||||
|
|
||||||
:where(.sc-root, .sc-root *) {
|
:where(.sc-root, .sc-root *) {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
.sc-main {
|
.sc-main {
|
||||||
width: min(100% - 2rem, 90rem);
|
width: min(100% - 2rem, 90rem);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem 0 3rem;
|
padding: 1rem 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-header {
|
.sc-header {
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-brand-mark {
|
.sc-brand-mark {
|
||||||
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 2rem;
|
width: 2rem;
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
@@ -73,6 +74,18 @@
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-brand-icon {
|
||||||
|
/* Fixed instead of percentage-based: the icon isn't wrapped in a sized container (unlike
|
||||||
|
.sc-brand-mark, which this rule mirrors), and .sc-brand's own width is content-driven, so
|
||||||
|
a percentage here has no definite box to resolve against and lets the image render at
|
||||||
|
whatever intrinsic size its source happens to have. */
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-nav {
|
.sc-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
@@ -85,7 +98,17 @@
|
|||||||
.sc-icon-button {
|
.sc-icon-button {
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
|
transition:
|
||||||
|
color 140ms ease,
|
||||||
|
background 140ms ease,
|
||||||
|
border-color 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-nav-link,
|
||||||
|
.sc-profile-button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav-link {
|
.sc-nav-link {
|
||||||
@@ -96,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav-link:hover,
|
.sc-nav-link:hover,
|
||||||
.sc-nav-link[data-active='true'] {
|
.sc-nav-link[data-active="true"] {
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background: var(--sc-surface-hover);
|
background: var(--sc-surface-hover);
|
||||||
border-color: var(--sc-border);
|
border-color: var(--sc-border);
|
||||||
@@ -129,6 +152,54 @@
|
|||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-dropdown {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 0.5rem);
|
||||||
|
right: 0;
|
||||||
|
z-index: 20;
|
||||||
|
display: grid;
|
||||||
|
min-width: 11rem;
|
||||||
|
gap: 0.125rem;
|
||||||
|
padding: 0.375rem;
|
||||||
|
background: var(--sc-surface);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
box-shadow: var(--sc-shadow-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu-item {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.625rem 0.75rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The About item falls back to an <a> when no onAbout handler is wired, unlike the other
|
||||||
|
button-based items - without this, the browser's default a:visited color (higher specificity
|
||||||
|
than the class color above) makes it drift from the other dropdown items' color once clicked. */
|
||||||
|
.sc-profile-menu-item:visited {
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu-item:hover {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-icon-button:hover,
|
.sc-icon-button:hover,
|
||||||
.sc-profile-button:hover {
|
.sc-profile-button:hover {
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
@@ -145,7 +216,12 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1rem;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
background: var(--sc-surface);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-lg);
|
||||||
|
box-shadow: var(--sc-shadow-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-page-header h1,
|
.sc-page-header h1,
|
||||||
@@ -209,19 +285,19 @@
|
|||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='success'] {
|
.sc-badge[data-variant="success"] {
|
||||||
color: var(--sc-success-fg);
|
color: var(--sc-success-fg);
|
||||||
background: var(--sc-success);
|
background: var(--sc-success);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='warning'] {
|
.sc-badge[data-variant="warning"] {
|
||||||
color: var(--sc-warning-fg);
|
color: var(--sc-warning-fg);
|
||||||
background: var(--sc-warning);
|
background: var(--sc-warning);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='danger'] {
|
.sc-badge[data-variant="danger"] {
|
||||||
color: var(--sc-danger-fg);
|
color: var(--sc-danger-fg);
|
||||||
background: var(--sc-danger);
|
background: var(--sc-danger);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
@@ -240,7 +316,11 @@
|
|||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
|
transition:
|
||||||
|
color 140ms ease,
|
||||||
|
background 140ms ease,
|
||||||
|
border-color 140ms ease,
|
||||||
|
opacity 140ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-button:hover:not(:disabled) {
|
.sc-button:hover:not(:disabled) {
|
||||||
@@ -255,6 +335,7 @@
|
|||||||
.sc-button:focus-visible,
|
.sc-button:focus-visible,
|
||||||
.sc-icon-button:focus-visible,
|
.sc-icon-button:focus-visible,
|
||||||
.sc-profile-button:focus-visible,
|
.sc-profile-button:focus-visible,
|
||||||
|
.sc-profile-menu-item:focus-visible,
|
||||||
.sc-nav-link:focus-visible,
|
.sc-nav-link:focus-visible,
|
||||||
.sc-dialog-close:focus-visible {
|
.sc-dialog-close:focus-visible {
|
||||||
outline: 3px solid color-mix(in srgb, var(--sc-ring) 45%, transparent);
|
outline: 3px solid color-mix(in srgb, var(--sc-ring) 45%, transparent);
|
||||||
@@ -406,7 +487,9 @@
|
|||||||
border: 1px solid var(--sc-border);
|
border: 1px solid var(--sc-border);
|
||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: border-color 140ms ease, box-shadow 140ms ease;
|
transition:
|
||||||
|
border-color 140ms ease,
|
||||||
|
box-shadow 140ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-textarea {
|
.sc-textarea {
|
||||||
@@ -558,7 +641,11 @@
|
|||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--sc-primary) 18%, transparent), transparent 35%),
|
radial-gradient(
|
||||||
|
circle at 15% 10%,
|
||||||
|
color-mix(in srgb, var(--sc-primary) 18%, transparent),
|
||||||
|
transparent 35%
|
||||||
|
),
|
||||||
var(--sc-bg);
|
var(--sc-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,6 +666,14 @@
|
|||||||
font-weight: 750;
|
font-weight: 750;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-auth-brand-icon {
|
||||||
|
display: block;
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-auth-card h1 {
|
.sc-auth-card h1 {
|
||||||
font-size: 1.7rem;
|
font-size: 1.7rem;
|
||||||
}
|
}
|
||||||
@@ -622,6 +717,86 @@
|
|||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-notification-stack {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 200;
|
||||||
|
top: 1rem;
|
||||||
|
right: 1rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.625rem;
|
||||||
|
width: min(100% - 2rem, 24rem);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.625rem;
|
||||||
|
padding: 0.875rem 1rem;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-raised);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
box-shadow: var(--sc-shadow-lg);
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-top: 0.125rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="success"] .sc-notification-icon {
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="error"] .sc-notification-icon {
|
||||||
|
color: var(--sc-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="warning"] .sc-notification-icon {
|
||||||
|
color: var(--sc-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="info"] .sc-notification-icon {
|
||||||
|
color: var(--sc-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-message {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-close {
|
||||||
|
display: grid;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
place-items: center;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-close:hover {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 30rem) {
|
||||||
|
.sc-notification-stack {
|
||||||
|
top: 0.75rem;
|
||||||
|
right: 0.75rem;
|
||||||
|
left: 0.75rem;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sc-dialog-backdrop {
|
.sc-dialog-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
@@ -727,12 +902,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-mobile-menu-button {
|
.sc-mobile-menu-button {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
display: grid;
|
display: grid;
|
||||||
order: 3;
|
order: 3;
|
||||||
width: 2.25rem;
|
width: 2.25rem;
|
||||||
height: 2.25rem;
|
height: 2.25rem;
|
||||||
margin-left: auto;
|
margin-left: 0;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav {
|
.sc-nav {
|
||||||
@@ -744,7 +922,7 @@
|
|||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav[data-open='true'] {
|
.sc-nav[data-open="true"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +931,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-header-actions {
|
.sc-header-actions {
|
||||||
margin-left: 0;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-profile-button {
|
.sc-profile-button {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from "svelte";
|
||||||
|
|
||||||
export type AsyncAction<T = void> = (value: T) => void | Promise<void>;
|
export type AsyncAction<T = void> = (value: T) => void | Promise<void>;
|
||||||
|
|
||||||
export interface NavItem {
|
export interface NavItem {
|
||||||
href: string;
|
href: string;
|
||||||
label: string;
|
label: string;
|
||||||
|
icon?: string;
|
||||||
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthSetupInput {
|
export interface AuthSetupInput {
|
||||||
@@ -27,7 +29,8 @@ export interface TotpSetupResponse {
|
|||||||
|
|
||||||
export type TotpStatusRequest = () => boolean | Promise<boolean>;
|
export type TotpStatusRequest = () => boolean | Promise<boolean>;
|
||||||
|
|
||||||
export type TotpSetupRequest = () => TotpSetupResponse | Promise<TotpSetupResponse>;
|
export type TotpSetupRequest = () =>
|
||||||
|
TotpSetupResponse | Promise<TotpSetupResponse>;
|
||||||
|
|
||||||
export type TotpTokenAction = (token: string) => void | Promise<void>;
|
export type TotpTokenAction = (token: string) => void | Promise<void>;
|
||||||
|
|
||||||
@@ -41,7 +44,7 @@ export interface ProfileUpdateInput {
|
|||||||
password?: string;
|
password?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserRole = 'superadmin' | 'admin' | 'user';
|
export type UserRole = "superadmin" | "admin" | "user";
|
||||||
|
|
||||||
export type UserId = string | number;
|
export type UserId = string | number;
|
||||||
|
|
||||||
@@ -71,9 +74,14 @@ export interface UserUpdateInput {
|
|||||||
|
|
||||||
export type UserListRequest = () => ManagedUser[] | Promise<ManagedUser[]>;
|
export type UserListRequest = () => ManagedUser[] | Promise<ManagedUser[]>;
|
||||||
|
|
||||||
export type UserCreateRequest = (input: UserCreateInput) => void | Promise<void | ManagedUser>;
|
export type UserCreateRequest = (
|
||||||
|
input: UserCreateInput,
|
||||||
|
) => void | Promise<void | ManagedUser>;
|
||||||
|
|
||||||
export type UserUpdateRequest = (id: UserId, input: UserUpdateInput) => void | Promise<void | ManagedUser>;
|
export type UserUpdateRequest = (
|
||||||
|
id: UserId,
|
||||||
|
input: UserUpdateInput,
|
||||||
|
) => void | Promise<void | ManagedUser>;
|
||||||
|
|
||||||
export type UserDeleteRequest = (id: UserId) => void | Promise<void>;
|
export type UserDeleteRequest = (id: UserId) => void | Promise<void>;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$repositoryRoot = (& git -C $PSScriptRoot rev-parse --show-toplevel).Trim()
|
||||||
|
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($repositoryRoot)) {
|
||||||
|
throw 'Could not locate the shared Git repository.'
|
||||||
|
}
|
||||||
|
|
||||||
|
& git -C $repositoryRoot config core.hooksPath .githooks
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw 'Could not configure the shared Git hooks path.'
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Installed shared post-commit synchronization hook in $repositoryRoot."
|
||||||
@@ -0,0 +1,348 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[string]$SourceRepository,
|
||||||
|
[switch]$Force,
|
||||||
|
[switch]$Commit,
|
||||||
|
[switch]$Push
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
if ($Push -and -not $Commit) {
|
||||||
|
throw 'The -Push switch requires -Commit so that only generated synchronization changes are pushed.'
|
||||||
|
}
|
||||||
|
|
||||||
|
$consumerProjects = @(
|
||||||
|
'Original/AutoCode',
|
||||||
|
'Original/SimpleCollection',
|
||||||
|
'Original/CollabTable',
|
||||||
|
'Original/GameStream',
|
||||||
|
'Original/SyncServer',
|
||||||
|
'Original/UnraidMonitor',
|
||||||
|
'Original/PubliSafe',
|
||||||
|
'Original/MediaCollection',
|
||||||
|
'Forks/Bitmagnet',
|
||||||
|
'Forks/Heretic',
|
||||||
|
'Original/InfiniteVideo',
|
||||||
|
'Forks/MegaBasterd',
|
||||||
|
'Forks/HordeWorker',
|
||||||
|
'Original/OutdoorGames'
|
||||||
|
)
|
||||||
|
|
||||||
|
function Invoke-GitText {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$WorkingDirectory,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string[]]$Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
$output = & git -C $WorkingDirectory @Arguments 2>&1
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
if ($exitCode -ne 0) {
|
||||||
|
$diagnostics = @($output | ForEach-Object { [string]$_ } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
|
||||||
|
$blockingDiagnostics = @($diagnostics | Where-Object { $_ -notmatch '^\s*(warning|hint):' })
|
||||||
|
if ($blockingDiagnostics.Count -eq 0) {
|
||||||
|
$diagnostics | ForEach-Object { Write-Warning $_ }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$details = $diagnostics -join [Environment]::NewLine
|
||||||
|
throw "git $($Arguments -join ' ') failed in '$WorkingDirectory'. $details"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return @($output | ForEach-Object { [string]$_ })
|
||||||
|
}
|
||||||
|
|
||||||
|
function Resolve-FullPath {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Path
|
||||||
|
)
|
||||||
|
|
||||||
|
return (Resolve-Path -LiteralPath $Path -ErrorAction Stop).Path
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-RelativePath {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$BasePath,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$TargetPath
|
||||||
|
)
|
||||||
|
|
||||||
|
$base = (Resolve-FullPath $BasePath).TrimEnd('\') + '\'
|
||||||
|
$target = Resolve-FullPath $TargetPath
|
||||||
|
if (-not $target.StartsWith($base, [System.StringComparison]::OrdinalIgnoreCase)) {
|
||||||
|
throw "'$TargetPath' is not inside '$BasePath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
return $target.Substring($base.Length).Replace('\', '/')
|
||||||
|
}
|
||||||
|
|
||||||
|
function Write-Utf8NoBom {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Path,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Content
|
||||||
|
)
|
||||||
|
|
||||||
|
$encoding = New-Object System.Text.UTF8Encoding($false)
|
||||||
|
$normalizedContent = $Content.Replace("`r`n", "`n").Replace("`r", "`n")
|
||||||
|
[System.IO.File]::WriteAllText($Path, $normalizedContent, $encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Convert-ToConsumerWebUiPackage {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$PackagePath
|
||||||
|
)
|
||||||
|
|
||||||
|
$manifest = Get-Content -LiteralPath $PackagePath -Raw | ConvertFrom-Json
|
||||||
|
$manifest.files = @('src', 'README.md')
|
||||||
|
if ($null -ne $manifest.dependencies) {
|
||||||
|
$designTokensDependency = $manifest.dependencies.PSObject.Properties['@gabriel20xx/design-tokens']
|
||||||
|
if ($null -ne $designTokensDependency) {
|
||||||
|
$manifest.dependencies.PSObject.Properties.Remove('@gabriel20xx/design-tokens')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$manifest.svelte = './src/index.ts'
|
||||||
|
$manifest.types = './src/index.ts'
|
||||||
|
|
||||||
|
$rootExport = $manifest.exports.PSObject.Properties | Where-Object { $_.Name -eq '.' }
|
||||||
|
if ($null -ne $rootExport) {
|
||||||
|
$rootExport.Value.types = './src/index.ts'
|
||||||
|
$rootExport.Value.svelte = './src/index.ts'
|
||||||
|
$rootExport.Value.import = './src/index.ts'
|
||||||
|
}
|
||||||
|
|
||||||
|
$stylesExport = $manifest.exports.PSObject.Properties | Where-Object { $_.Name -eq './styles.css' }
|
||||||
|
if ($null -ne $stylesExport) {
|
||||||
|
$stylesExport.Value = './src/lib/styles.css'
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = $manifest | ConvertTo-Json -Depth 20
|
||||||
|
Write-Utf8NoBom -Path $PackagePath -Content ($json + [Environment]::NewLine)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Convert-ToConsumerWebUiSources {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$WebUiRoot
|
||||||
|
)
|
||||||
|
|
||||||
|
$stylesPath = Join-Path $WebUiRoot 'src/lib/styles.css'
|
||||||
|
if (Test-Path -LiteralPath $stylesPath) {
|
||||||
|
$styles = Get-Content -LiteralPath $stylesPath -Raw
|
||||||
|
$styles = $styles.Replace("@import '@gabriel20xx/design-tokens/theme.css';", "@import '../../../design-tokens/theme.css';")
|
||||||
|
$styles = $styles.Replace('@import "@gabriel20xx/design-tokens/theme.css";', "@import '../../../design-tokens/theme.css';")
|
||||||
|
Write-Utf8NoBom -Path $stylesPath -Content $styles
|
||||||
|
}
|
||||||
|
|
||||||
|
$svelteConfigPath = Join-Path $WebUiRoot 'svelte.config.js'
|
||||||
|
if (Test-Path -LiteralPath $svelteConfigPath) {
|
||||||
|
Write-Utf8NoBom -Path $svelteConfigPath -Content "export default {};`n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Test-LocalSharedDependency {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
$PackageManifest
|
||||||
|
)
|
||||||
|
|
||||||
|
$localPackageNames = @(
|
||||||
|
'@gabriel20xx/web-ui',
|
||||||
|
'@gabriel20xx/node-backend'
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($sectionName in @('dependencies', 'devDependencies', 'optionalDependencies')) {
|
||||||
|
$sectionProperty = $PackageManifest.PSObject.Properties[$sectionName]
|
||||||
|
if ($null -eq $sectionProperty -or $null -eq $sectionProperty.Value) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($dependency in $sectionProperty.Value.PSObject.Properties) {
|
||||||
|
if ($dependency.Name -in $localPackageNames -and ([string]$dependency.Value).StartsWith('file:')) {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrWhiteSpace($SourceRepository)) {
|
||||||
|
$scriptParent = Resolve-FullPath (Join-Path $PSScriptRoot '..')
|
||||||
|
$scriptParentGitRoot = (Invoke-GitText -WorkingDirectory $scriptParent -Arguments @('rev-parse', '--show-toplevel') | Select-Object -First 1).Trim()
|
||||||
|
$scriptParentGitRoot = Resolve-FullPath $scriptParentGitRoot
|
||||||
|
if ($scriptParentGitRoot -ieq $scriptParent) {
|
||||||
|
$SourceRepository = $scriptParent
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$workspaceRoot = Split-Path -Parent (Split-Path -Parent $scriptParentGitRoot)
|
||||||
|
$SourceRepository = Join-Path $workspaceRoot 'shared'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceRoot = Resolve-FullPath $SourceRepository
|
||||||
|
$sourceRepositoryRoot = (Invoke-GitText -WorkingDirectory $sourceRoot -Arguments @('rev-parse', '--show-toplevel') | Select-Object -First 1).Trim()
|
||||||
|
$sourceRoot = Resolve-FullPath $sourceRepositoryRoot
|
||||||
|
$workspaceRoot = Split-Path -Parent $sourceRoot
|
||||||
|
$sourceCommit = (Invoke-GitText -WorkingDirectory $sourceRoot -Arguments @('rev-parse', '--short', 'HEAD') | Select-Object -First 1).Trim()
|
||||||
|
$sourceFiles = @(Invoke-GitText -WorkingDirectory $sourceRoot -Arguments @('ls-files') | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
|
||||||
|
|
||||||
|
$sourceFileSet = @{}
|
||||||
|
foreach ($sourceFile in $sourceFiles) {
|
||||||
|
$sourceFileSet[$sourceFile.Replace('\', '/')] = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Synchronizing $($sourceFiles.Count) tracked shared files from $sourceCommit."
|
||||||
|
|
||||||
|
$failures = New-Object 'System.Collections.Generic.List[string]'
|
||||||
|
|
||||||
|
foreach ($relativeProject in $consumerProjects) {
|
||||||
|
$projectRoot = Join-Path $workspaceRoot ($relativeProject -replace '/', '\')
|
||||||
|
if (-not (Test-Path -LiteralPath $projectRoot -PathType Container)) {
|
||||||
|
$failures.Add("${relativeProject}: project directory not found")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$projectRoot = Resolve-FullPath $projectRoot
|
||||||
|
$destinationRoot = Join-Path $projectRoot 'shared'
|
||||||
|
$legacyDirectoryName = ('Shared' + 'Code')
|
||||||
|
$projectDirectories = @(Get-ChildItem -LiteralPath $projectRoot -Directory -Force)
|
||||||
|
$destinationEntry = $projectDirectories | Where-Object { $_.Name -ceq 'shared' }
|
||||||
|
$legacyEntry = $projectDirectories | Where-Object { $_.Name -ceq $legacyDirectoryName }
|
||||||
|
if ($null -ne $destinationEntry -and $null -ne $legacyEntry) {
|
||||||
|
throw "Both shared and the legacy shared snapshot directory exist. Remove the legacy directory before synchronizing."
|
||||||
|
}
|
||||||
|
|
||||||
|
$dirtyshared = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', 'shared'))
|
||||||
|
$dirtyLegacy = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $legacyDirectoryName))
|
||||||
|
if (($dirtyshared.Count -gt 0 -or $dirtyLegacy.Count -gt 0) -and -not $Force) {
|
||||||
|
throw "shared has local changes. Commit them or rerun with -Force."
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -ne $legacyEntry) {
|
||||||
|
$temporaryRenamePath = Join-Path $projectRoot ('.shared-sync-rename-' + [Guid]::NewGuid().ToString('N'))
|
||||||
|
Move-Item -LiteralPath $legacyEntry.FullName -Destination $temporaryRenamePath
|
||||||
|
Move-Item -LiteralPath $temporaryRenamePath -Destination $destinationRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $destinationRoot | Out-Null
|
||||||
|
|
||||||
|
$existingSharedFiles = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('ls-files', '--', 'shared') | Where-Object { $_ -like 'shared/*' })
|
||||||
|
foreach ($existingSharedFile in $existingSharedFiles) {
|
||||||
|
$relativeSharedFile = $existingSharedFile.Substring('shared/'.Length).Replace('\', '/')
|
||||||
|
if (-not $sourceFileSet.ContainsKey($relativeSharedFile)) {
|
||||||
|
$stalePath = Join-Path $destinationRoot ($relativeSharedFile -replace '/', '\')
|
||||||
|
if (Test-Path -LiteralPath $stalePath -PathType Leaf) {
|
||||||
|
Remove-Item -LiteralPath $stalePath -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($sourceFile in $sourceFiles) {
|
||||||
|
$sourcePath = Join-Path $sourceRoot ($sourceFile -replace '/', '\')
|
||||||
|
$destinationPath = Join-Path $destinationRoot ($sourceFile -replace '/', '\')
|
||||||
|
$destinationDirectory = Split-Path -Parent $destinationPath
|
||||||
|
New-Item -ItemType Directory -Force -Path $destinationDirectory | Out-Null
|
||||||
|
Copy-Item -LiteralPath $sourcePath -Destination $destinationPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
$webUiPackagePath = Join-Path $destinationRoot 'packages/web-ui/package.json'
|
||||||
|
if (Test-Path -LiteralPath $webUiPackagePath) {
|
||||||
|
Convert-ToConsumerWebUiPackage -PackagePath $webUiPackagePath
|
||||||
|
Convert-ToConsumerWebUiSources -WebUiRoot (Join-Path $destinationRoot 'packages/web-ui')
|
||||||
|
}
|
||||||
|
|
||||||
|
$lockFiles = @()
|
||||||
|
$sharedPrefix = ((Resolve-FullPath $destinationRoot).TrimEnd('\') + '\')
|
||||||
|
$packageFiles = @(Get-ChildItem -LiteralPath $projectRoot -Recurse -File -Filter 'package.json' -Force |
|
||||||
|
Where-Object {
|
||||||
|
$_.FullName -notlike "$sharedPrefix*" -and
|
||||||
|
$_.FullName -notmatch '\\node_modules\\'
|
||||||
|
})
|
||||||
|
|
||||||
|
foreach ($packageFile in $packageFiles) {
|
||||||
|
$packageManifest = Get-Content -LiteralPath $packageFile.FullName -Raw | ConvertFrom-Json
|
||||||
|
if (-not (Test-LocalSharedDependency -PackageManifest $packageManifest)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$lockPath = Join-Path $packageFile.DirectoryName 'package-lock.json'
|
||||||
|
if (-not (Test-Path -LiteralPath $lockPath -PathType Leaf)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$relativeLockPath = Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath
|
||||||
|
$trackedLock = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('ls-files', '--', $relativeLockPath))
|
||||||
|
$shouldStageLock = $trackedLock.Count -gt 0
|
||||||
|
Write-Host " Updating $relativeProject/$(Get-RelativePath -BasePath $projectRoot -TargetPath $lockPath)"
|
||||||
|
Push-Location -LiteralPath $packageFile.DirectoryName
|
||||||
|
try {
|
||||||
|
& npm install --package-lock-only --ignore-scripts --prefer-offline
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "npm install --package-lock-only failed with exit code $LASTEXITCODE."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($shouldStageLock -and $lockFiles -notcontains $relativeLockPath) {
|
||||||
|
$lockFiles += $relativeLockPath
|
||||||
|
}
|
||||||
|
elseif (-not $shouldStageLock) {
|
||||||
|
Write-Host " Leaving untracked/ignored lockfile out of the generated commit: $relativeLockPath"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', 'shared')
|
||||||
|
foreach ($lockFile in $lockFiles) {
|
||||||
|
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', $lockFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetPaths = @('shared') + $lockFiles
|
||||||
|
$stagedChanges = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments (@('diff', '--cached', '--name-only', '--') + $targetPaths))
|
||||||
|
if ($Commit -and $stagedChanges.Count -gt 0) {
|
||||||
|
$commitMessage = "Sync shared snapshot from $sourceCommit"
|
||||||
|
$commitArguments = @('commit', '--only', '-m', $commitMessage, '--') + $targetPaths
|
||||||
|
$commitOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments $commitArguments)
|
||||||
|
$commitOutput | ForEach-Object { Write-Host " $_" }
|
||||||
|
$remainingStagedChanges = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments (@('diff', '--cached', '--name-only', '--') + $targetPaths))
|
||||||
|
if ($remainingStagedChanges.Count -gt 0) {
|
||||||
|
throw 'The generated synchronization changes remain staged after the commit.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Push) {
|
||||||
|
$pushOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('push', 'origin', 'main'))
|
||||||
|
$pushOutput | ForEach-Object { Write-Host " $_" }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stagedChanges.Count -gt 0) {
|
||||||
|
Write-Host "Synced $relativeProject."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "$relativeProject is already synchronized."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$message = "${relativeProject}: $($_.Exception.Message)"
|
||||||
|
$failures.Add($message)
|
||||||
|
Write-Warning $message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($failures.Count -gt 0) {
|
||||||
|
throw "shared synchronization failed for $($failures.Count) project(s): $($failures -join '; ')"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host 'shared synchronization completed.'
|
||||||
+356
-13
@@ -1,5 +1,7 @@
|
|||||||
@import './packages/design-tokens/theme.css';
|
@import './packages/design-tokens/theme.css';
|
||||||
|
|
||||||
|
@import "@gabriel20xx/design-tokens/theme.css";
|
||||||
|
|
||||||
:where(.sc-root, .sc-root *) {
|
:where(.sc-root, .sc-root *) {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
@@ -31,7 +33,7 @@
|
|||||||
.sc-main {
|
.sc-main {
|
||||||
width: min(100% - 2rem, 90rem);
|
width: min(100% - 2rem, 90rem);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem 0 3rem;
|
padding: 1rem 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-header {
|
.sc-header {
|
||||||
@@ -62,6 +64,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-brand-mark {
|
.sc-brand-mark {
|
||||||
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 2rem;
|
width: 2rem;
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
@@ -73,6 +76,18 @@
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-brand-icon {
|
||||||
|
/* Fixed instead of percentage-based: the icon isn't wrapped in a sized container (unlike
|
||||||
|
.sc-brand-mark, which this rule mirrors), and .sc-brand's own width is content-driven, so
|
||||||
|
a percentage here has no definite box to resolve against and lets the image render at
|
||||||
|
whatever intrinsic size its source happens to have. */
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-nav {
|
.sc-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
@@ -85,7 +100,17 @@
|
|||||||
.sc-icon-button {
|
.sc-icon-button {
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
|
transition:
|
||||||
|
color 140ms ease,
|
||||||
|
background 140ms ease,
|
||||||
|
border-color 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-nav-link,
|
||||||
|
.sc-profile-button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav-link {
|
.sc-nav-link {
|
||||||
@@ -96,7 +121,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav-link:hover,
|
.sc-nav-link:hover,
|
||||||
.sc-nav-link[data-active='true'] {
|
.sc-nav-link[data-active="true"] {
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background: var(--sc-surface-hover);
|
background: var(--sc-surface-hover);
|
||||||
border-color: var(--sc-border);
|
border-color: var(--sc-border);
|
||||||
@@ -129,6 +154,54 @@
|
|||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-dropdown {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 0.5rem);
|
||||||
|
right: 0;
|
||||||
|
z-index: 20;
|
||||||
|
display: grid;
|
||||||
|
min-width: 11rem;
|
||||||
|
gap: 0.125rem;
|
||||||
|
padding: 0.375rem;
|
||||||
|
background: var(--sc-surface);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
box-shadow: var(--sc-shadow-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu-item {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.625rem 0.75rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
font: inherit;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The About item falls back to an <a> when no onAbout handler is wired, unlike the other
|
||||||
|
button-based items - without this, the browser's default a:visited color (higher specificity
|
||||||
|
than the class color above) makes it drift from the other dropdown items' color once clicked. */
|
||||||
|
.sc-profile-menu-item:visited {
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-profile-menu-item:hover {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-icon-button:hover,
|
.sc-icon-button:hover,
|
||||||
.sc-profile-button:hover {
|
.sc-profile-button:hover {
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
@@ -145,7 +218,12 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1rem;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
background: var(--sc-surface);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-lg);
|
||||||
|
box-shadow: var(--sc-shadow-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-page-header h1,
|
.sc-page-header h1,
|
||||||
@@ -209,19 +287,19 @@
|
|||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='success'] {
|
.sc-badge[data-variant="success"] {
|
||||||
color: var(--sc-success-fg);
|
color: var(--sc-success-fg);
|
||||||
background: var(--sc-success);
|
background: var(--sc-success);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='warning'] {
|
.sc-badge[data-variant="warning"] {
|
||||||
color: var(--sc-warning-fg);
|
color: var(--sc-warning-fg);
|
||||||
background: var(--sc-warning);
|
background: var(--sc-warning);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant='danger'] {
|
.sc-badge[data-variant="danger"] {
|
||||||
color: var(--sc-danger-fg);
|
color: var(--sc-danger-fg);
|
||||||
background: var(--sc-danger);
|
background: var(--sc-danger);
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
@@ -240,7 +318,11 @@
|
|||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
|
transition:
|
||||||
|
color 140ms ease,
|
||||||
|
background 140ms ease,
|
||||||
|
border-color 140ms ease,
|
||||||
|
opacity 140ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-button:hover:not(:disabled) {
|
.sc-button:hover:not(:disabled) {
|
||||||
@@ -255,6 +337,7 @@
|
|||||||
.sc-button:focus-visible,
|
.sc-button:focus-visible,
|
||||||
.sc-icon-button:focus-visible,
|
.sc-icon-button:focus-visible,
|
||||||
.sc-profile-button:focus-visible,
|
.sc-profile-button:focus-visible,
|
||||||
|
.sc-profile-menu-item:focus-visible,
|
||||||
.sc-nav-link:focus-visible,
|
.sc-nav-link:focus-visible,
|
||||||
.sc-dialog-close:focus-visible {
|
.sc-dialog-close:focus-visible {
|
||||||
outline: 3px solid color-mix(in srgb, var(--sc-ring) 45%, transparent);
|
outline: 3px solid color-mix(in srgb, var(--sc-ring) 45%, transparent);
|
||||||
@@ -335,6 +418,66 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-totp-settings {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding-top: 1.25rem;
|
||||||
|
border-top: 1px solid var(--sc-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-heading {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-heading h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-heading p {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-status {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.2rem 0.55rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-status.sc-totp-enabled {
|
||||||
|
border-color: var(--sc-success);
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-secret {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-secret p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-totp-secret code {
|
||||||
|
display: block;
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
background: var(--sc-input-bg);
|
||||||
|
padding: 0.6rem;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-input,
|
.sc-input,
|
||||||
.sc-select,
|
.sc-select,
|
||||||
.sc-textarea {
|
.sc-textarea {
|
||||||
@@ -346,7 +489,9 @@
|
|||||||
border: 1px solid var(--sc-border);
|
border: 1px solid var(--sc-border);
|
||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: border-color 140ms ease, box-shadow 140ms ease;
|
transition:
|
||||||
|
border-color 140ms ease,
|
||||||
|
box-shadow 140ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-textarea {
|
.sc-textarea {
|
||||||
@@ -388,6 +533,109 @@
|
|||||||
color: var(--sc-success);
|
color: var(--sc-success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-user-management {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding-top: 1.5rem;
|
||||||
|
border-top: 1px solid var(--sc-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-management-header,
|
||||||
|
.sc-user-row,
|
||||||
|
.sc-user-edit-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-management-header {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-management-header h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-management-header p {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-form,
|
||||||
|
.sc-user-list {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-form {
|
||||||
|
padding: 0.9rem;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
background: var(--sc-surface-raised);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-row {
|
||||||
|
min-width: 0;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0.7rem 0;
|
||||||
|
border-bottom: 1px solid var(--sc-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-row > div:first-child {
|
||||||
|
display: grid;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-row > div:first-child span {
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-role {
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-edit-row {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-edit-row .sc-input {
|
||||||
|
flex: 1 1 10rem;
|
||||||
|
min-width: 8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 620px) {
|
||||||
|
.sc-user-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-row {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-actions {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sc-auth-page {
|
.sc-auth-page {
|
||||||
display: grid;
|
display: grid;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
@@ -395,7 +643,11 @@
|
|||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--sc-primary) 18%, transparent), transparent 35%),
|
radial-gradient(
|
||||||
|
circle at 15% 10%,
|
||||||
|
color-mix(in srgb, var(--sc-primary) 18%, transparent),
|
||||||
|
transparent 35%
|
||||||
|
),
|
||||||
var(--sc-bg);
|
var(--sc-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,6 +668,14 @@
|
|||||||
font-weight: 750;
|
font-weight: 750;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-auth-brand-icon {
|
||||||
|
display: block;
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-auth-card h1 {
|
.sc-auth-card h1 {
|
||||||
font-size: 1.7rem;
|
font-size: 1.7rem;
|
||||||
}
|
}
|
||||||
@@ -459,6 +719,86 @@
|
|||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-notification-stack {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 200;
|
||||||
|
top: 1rem;
|
||||||
|
right: 1rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.625rem;
|
||||||
|
width: min(100% - 2rem, 24rem);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.625rem;
|
||||||
|
padding: 0.875rem 1rem;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-raised);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
box-shadow: var(--sc-shadow-lg);
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-top: 0.125rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="success"] .sc-notification-icon {
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="error"] .sc-notification-icon {
|
||||||
|
color: var(--sc-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="warning"] .sc-notification-icon {
|
||||||
|
color: var(--sc-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification[data-variant="info"] .sc-notification-icon {
|
||||||
|
color: var(--sc-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-message {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-close {
|
||||||
|
display: grid;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
place-items: center;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-notification-close:hover {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 30rem) {
|
||||||
|
.sc-notification-stack {
|
||||||
|
top: 0.75rem;
|
||||||
|
right: 0.75rem;
|
||||||
|
left: 0.75rem;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sc-dialog-backdrop {
|
.sc-dialog-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
@@ -564,12 +904,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-mobile-menu-button {
|
.sc-mobile-menu-button {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
display: grid;
|
display: grid;
|
||||||
order: 3;
|
order: 3;
|
||||||
width: 2.25rem;
|
width: 2.25rem;
|
||||||
height: 2.25rem;
|
height: 2.25rem;
|
||||||
margin-left: auto;
|
margin-left: 0;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav {
|
.sc-nav {
|
||||||
@@ -581,7 +924,7 @@
|
|||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-nav[data-open='true'] {
|
.sc-nav[data-open="true"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +933,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-header-actions {
|
.sc-header-actions {
|
||||||
margin-left: 0;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-profile-button {
|
.sc-profile-button {
|
||||||
|
|||||||
Reference in new issue
Block a user