@immich/ui 0.33.0 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Card/Card.svelte +2 -2
- package/dist/components/Modal/Modal.svelte +25 -21
- package/dist/components/Modal/Modal.svelte.d.ts +1 -0
- package/dist/components/SiteMetadata/SiteMetadata.svelte +39 -30
- package/dist/components/SiteMetadata/SiteMetadata.svelte.d.ts +4 -10
- package/dist/utilities/common.d.ts +29 -0
- package/dist/utilities/common.js +25 -0
- package/package.json +4 -2
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}: Props = $props();
|
|
33
33
|
|
|
34
34
|
const containerStyles = tv({
|
|
35
|
-
base: 'w-full overflow-hidden shadow-sm',
|
|
35
|
+
base: 'flex w-full overflow-hidden shadow-sm',
|
|
36
36
|
variants: {
|
|
37
37
|
shape: {
|
|
38
38
|
rectangle: '',
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const cardStyles = tv({
|
|
49
|
-
base: 'flex
|
|
49
|
+
base: 'flex grow flex-col',
|
|
50
50
|
variants: {
|
|
51
51
|
color: {
|
|
52
52
|
primary: 'bg-primary/25 dark:bg-primary/25',
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
closeOnBackdropClick?: boolean;
|
|
26
26
|
children: Snippet;
|
|
27
27
|
onClose?: () => void;
|
|
28
|
+
onEscapeKeydown?: (event: KeyboardEvent) => void;
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
let {
|
|
31
32
|
size = 'medium',
|
|
32
33
|
onClose,
|
|
34
|
+
onEscapeKeydown,
|
|
33
35
|
icon = true,
|
|
34
36
|
title,
|
|
35
37
|
class: className,
|
|
@@ -52,6 +54,20 @@
|
|
|
52
54
|
},
|
|
53
55
|
});
|
|
54
56
|
|
|
57
|
+
const modalContentStyles = tv({
|
|
58
|
+
base: 'fixed inset-0 m-auto flex max-h-dvh grow sm:p-4',
|
|
59
|
+
variants: {
|
|
60
|
+
size: {
|
|
61
|
+
tiny: 'sm:h-min md:max-w-sm',
|
|
62
|
+
small: 'sm:h-min md:max-w-md',
|
|
63
|
+
medium: 'sm:h-min md:max-w-(--breakpoint-sm)',
|
|
64
|
+
large: 'sm:h-min md:max-w-(--breakpoint-md)',
|
|
65
|
+
giant: 'sm:h-min md:max-w-(--breakpoint-lg)',
|
|
66
|
+
full: '',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
55
71
|
const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Modal);
|
|
56
72
|
const headerChildren = $derived(getChildSnippet(ChildKey.ModalHeader));
|
|
57
73
|
const bodyChildren = $derived(getChildSnippet(ChildKey.ModalBody));
|
|
@@ -67,32 +83,20 @@
|
|
|
67
83
|
|
|
68
84
|
let cardRef = $state<HTMLElement | null>(null);
|
|
69
85
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
onClose?.();
|
|
76
|
-
};
|
|
86
|
+
const interactOutsideBehavior = $derived(closeOnBackdropClick ? 'close' : 'ignore');
|
|
87
|
+
const escapeKeydownBehavior = $derived(closeOnEsc ? 'close' : 'ignore');
|
|
77
88
|
</script>
|
|
78
89
|
|
|
79
|
-
<Dialog.Root open={true}>
|
|
90
|
+
<Dialog.Root open={true} onOpenChange={(isOpen: boolean) => !isOpen && handleClose()}>
|
|
80
91
|
<Dialog.Portal>
|
|
81
|
-
<Dialog.Overlay class="fixed start-0 top-0 flex h-dvh w-screen bg-black/30" />
|
|
92
|
+
<Dialog.Overlay class="fixed start-0 top-0 flex h-dvh max-h-dvh w-screen bg-black/30" />
|
|
82
93
|
<Dialog.Content
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (closeOnEsc) {
|
|
88
|
-
handleClose();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}}
|
|
92
|
-
onclick={handleCloseOnClick}
|
|
93
|
-
class={cleanClass('fixed start-0 top-0 flex h-dvh w-screen items-center justify-center overflow-hidden sm:p-4')}
|
|
94
|
+
{onEscapeKeydown}
|
|
95
|
+
{escapeKeydownBehavior}
|
|
96
|
+
{interactOutsideBehavior}
|
|
97
|
+
class={cleanClass(modalContentStyles({ size }))}
|
|
94
98
|
>
|
|
95
|
-
<div class={cleanClass('flex
|
|
99
|
+
<div class={cleanClass('flex grow flex-col justify-center')}>
|
|
96
100
|
<Card bind:ref={cardRef} class={cleanClass(modalStyles({ size }), className)}>
|
|
97
101
|
<CardHeader class="border-b border-gray-200 px-5 py-3 dark:border-white/10">
|
|
98
102
|
{#if headerChildren}
|
|
@@ -10,6 +10,7 @@ type Props = {
|
|
|
10
10
|
closeOnBackdropClick?: boolean;
|
|
11
11
|
children: Snippet;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
onEscapeKeydown?: (event: KeyboardEvent) => void;
|
|
13
14
|
};
|
|
14
15
|
declare const Modal: import("svelte").Component<Props, {}, "">;
|
|
15
16
|
type Modal = ReturnType<typeof Modal>;
|
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { resolveUrl } from '../../utilities/common.js';
|
|
2
|
+
import { resolveMetadata, resolveUrl, type ArticleMetadata, type Metadata } from '../../utilities/common.js';
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
site:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
imageUrl?: string;
|
|
9
|
-
};
|
|
10
|
-
page?: {
|
|
11
|
-
title: string;
|
|
12
|
-
description: string;
|
|
13
|
-
imageUrl?: string;
|
|
14
|
-
};
|
|
5
|
+
site: Metadata;
|
|
6
|
+
page?: Metadata;
|
|
7
|
+
article?: ArticleMetadata;
|
|
15
8
|
};
|
|
16
9
|
|
|
17
|
-
const { site, page }: Props = $props();
|
|
10
|
+
const { site, page, article }: Props = $props();
|
|
18
11
|
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
let pageDescription = $derived(page?.description ?? site.description);
|
|
22
|
-
let pageUrl = $derived(page?.imageUrl ?? site?.imageUrl);
|
|
12
|
+
let resolved = $derived(resolveMetadata(site, page, article));
|
|
23
13
|
</script>
|
|
24
14
|
|
|
25
15
|
<svelte:head>
|
|
26
|
-
<title>{
|
|
27
|
-
<meta name="description" content={
|
|
16
|
+
<title>{resolved.title}</title>
|
|
17
|
+
<meta name="description" content={resolved.description} />
|
|
18
|
+
|
|
19
|
+
<!-- Twitter Meta Tags -->
|
|
20
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
21
|
+
<meta name="twitter:title" content={resolved.title} />
|
|
22
|
+
<meta name="twitter:description" content={resolved.description} />
|
|
23
|
+
{#if resolved.imageUrl}
|
|
24
|
+
<meta property="twitter:image" content={resolveUrl(resolved.imageUrl)} />
|
|
25
|
+
{/if}
|
|
28
26
|
|
|
29
27
|
<!-- Facebook Meta Tags -->
|
|
30
|
-
<meta property="og:type" content=
|
|
31
|
-
<meta property="og:site_name" content=
|
|
32
|
-
<meta property="og:title" content={
|
|
33
|
-
<meta property="og:description" content={
|
|
34
|
-
{#if
|
|
35
|
-
<meta property="og:image" content={resolveUrl(
|
|
28
|
+
<meta property="og:type" content={resolved.type} />
|
|
29
|
+
<meta property="og:site_name" content={resolved.siteName} />
|
|
30
|
+
<meta property="og:title" content={resolved.title} />
|
|
31
|
+
<meta property="og:description" content={resolved.description} />
|
|
32
|
+
{#if resolved.imageUrl}
|
|
33
|
+
<meta property="og:image" content={resolveUrl(resolved.imageUrl)} />
|
|
36
34
|
{/if}
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
{#if resolved.article}
|
|
37
|
+
<meta property="og:article:published_time" content={resolved.article.publishedTime} />
|
|
38
|
+
{#if resolved.article.modifiedTime}
|
|
39
|
+
<meta property="og:article:modified_time" content={resolved.article.modifiedTime} />
|
|
40
|
+
{/if}
|
|
41
|
+
{#if resolved.article.expirationTime}
|
|
42
|
+
<meta property="og:article:expiration_time" content={resolved.article.expirationTime} />
|
|
43
|
+
{/if}
|
|
44
|
+
{#if resolved.article.section}
|
|
45
|
+
<meta property="og:article:section" content={resolved.article.section} />
|
|
46
|
+
{/if}
|
|
47
|
+
{#each resolved.article.authors ?? [] as author (author)}
|
|
48
|
+
<meta property="og:article:author" content={author} />
|
|
49
|
+
{/each}
|
|
50
|
+
{#each resolved.article.tags ?? [] as tag (tag)}
|
|
51
|
+
<meta property="og:article:tag" content={tag} />
|
|
52
|
+
{/each}
|
|
44
53
|
{/if}
|
|
45
54
|
</svelte:head>
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
+
import { type ArticleMetadata, type Metadata } from '../../utilities/common.js';
|
|
1
2
|
type Props = {
|
|
2
|
-
site:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
imageUrl?: string;
|
|
6
|
-
};
|
|
7
|
-
page?: {
|
|
8
|
-
title: string;
|
|
9
|
-
description: string;
|
|
10
|
-
imageUrl?: string;
|
|
11
|
-
};
|
|
3
|
+
site: Metadata;
|
|
4
|
+
page?: Metadata;
|
|
5
|
+
article?: ArticleMetadata;
|
|
12
6
|
};
|
|
13
7
|
declare const SiteMetadata: import("svelte").Component<Props, {}, "">;
|
|
14
8
|
type SiteMetadata = ReturnType<typeof SiteMetadata>;
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
1
2
|
export declare const resolveUrl: (url: string, currentHostname?: string) => string;
|
|
2
3
|
export declare const isExternalLink: (href: string) => boolean;
|
|
4
|
+
export type Metadata = {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ArticleMetadata = {
|
|
10
|
+
publishedTime: DateTime;
|
|
11
|
+
modifiedTime?: DateTime;
|
|
12
|
+
expirationTime?: DateTime;
|
|
13
|
+
authors?: string[];
|
|
14
|
+
section?: string;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare const resolveMetadata: (site: Metadata, page?: Metadata, article?: ArticleMetadata) => {
|
|
18
|
+
type: string;
|
|
19
|
+
siteName: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
imageUrl: string | undefined;
|
|
23
|
+
article: {
|
|
24
|
+
publishedTime: string | null;
|
|
25
|
+
modifiedTime: string | null | undefined;
|
|
26
|
+
expirationTime: string | null | undefined;
|
|
27
|
+
authors: string[] | undefined;
|
|
28
|
+
section: string | undefined;
|
|
29
|
+
tags: string[] | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
};
|
package/dist/utilities/common.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { env } from '$env/dynamic/public';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
2
3
|
const getImmichApp = (host) => {
|
|
3
4
|
if (!host || !host.endsWith('immich.app')) {
|
|
4
5
|
return false;
|
|
@@ -20,3 +21,27 @@ export const resolveUrl = (url, currentHostname) => {
|
|
|
20
21
|
export const isExternalLink = (href) => {
|
|
21
22
|
return !(href.startsWith('/') || href.startsWith('#'));
|
|
22
23
|
};
|
|
24
|
+
export const resolveMetadata = (site, page, article) => {
|
|
25
|
+
const title = page ? `${page.title} | ${site.title}` : site.title;
|
|
26
|
+
const description = page?.description ?? site.description;
|
|
27
|
+
const imageUrl = page?.imageUrl ?? site?.imageUrl;
|
|
28
|
+
const siteName = page ? `${site.title} — ${site.description}` : site.title;
|
|
29
|
+
const type = article ? 'article' : 'website';
|
|
30
|
+
return {
|
|
31
|
+
type,
|
|
32
|
+
siteName,
|
|
33
|
+
title,
|
|
34
|
+
description,
|
|
35
|
+
imageUrl,
|
|
36
|
+
article: article
|
|
37
|
+
? {
|
|
38
|
+
publishedTime: article.publishedTime.toISO(),
|
|
39
|
+
modifiedTime: article.modifiedTime?.toISO(),
|
|
40
|
+
expirationTime: article.expirationTime?.toISO(),
|
|
41
|
+
authors: article.authors,
|
|
42
|
+
section: article.section,
|
|
43
|
+
tags: article.tags,
|
|
44
|
+
}
|
|
45
|
+
: undefined,
|
|
46
|
+
};
|
|
47
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@immich/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"license": "GNU Affero General Public License version 3",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"create": "node scripts/create.js",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@tailwindcss/postcss": "^4.1.7",
|
|
49
49
|
"@tailwindcss/vite": "^4.1.7",
|
|
50
50
|
"@types/eslint": "^9.6.0",
|
|
51
|
+
"@types/luxon": "^3.7.1",
|
|
51
52
|
"autoprefixer": "^10.4.20",
|
|
52
53
|
"eslint": "^9.7.0",
|
|
53
54
|
"eslint-config-prettier": "^10.0.0",
|
|
@@ -69,11 +70,12 @@
|
|
|
69
70
|
"dependencies": {
|
|
70
71
|
"@mdi/js": "^7.4.47",
|
|
71
72
|
"bits-ui": "^2.9.8",
|
|
73
|
+
"luxon": "^3.7.2",
|
|
72
74
|
"simple-icons": "^15.14.0",
|
|
73
75
|
"tailwind-merge": "^3.0.0",
|
|
74
76
|
"tailwind-variants": "^3.0.0"
|
|
75
77
|
},
|
|
76
78
|
"volta": {
|
|
77
|
-
"node": "22.
|
|
79
|
+
"node": "22.20.0"
|
|
78
80
|
}
|
|
79
81
|
}
|