@immich/ui 0.31.1 → 0.32.0

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.
Files changed (49) hide show
  1. package/dist/common/context.svelte.js +1 -1
  2. package/dist/common/use-child.svelte.js +1 -1
  3. package/dist/components/Alert/Alert.svelte +1 -1
  4. package/dist/components/AppShell/AppShell.svelte +1 -1
  5. package/dist/components/AppShell/AppShellSidebar.svelte +1 -1
  6. package/dist/components/Card/Card.svelte +1 -1
  7. package/dist/components/Card/CardDescription.svelte +1 -1
  8. package/dist/components/Checkbox/Checkbox.svelte +1 -1
  9. package/dist/components/Code/Code.svelte +1 -1
  10. package/dist/components/Container/Container.svelte +1 -1
  11. package/dist/components/Field/Field.svelte +1 -1
  12. package/dist/components/Heading/Heading.svelte +1 -1
  13. package/dist/components/HelperText/HelperText.svelte +1 -1
  14. package/dist/components/Icon/Icon.svelte +1 -1
  15. package/dist/components/Input/Input.svelte +1 -1
  16. package/dist/components/Kbd/Kbd.svelte +1 -1
  17. package/dist/components/Label/Label.svelte +1 -1
  18. package/dist/components/Link/Link.svelte +13 -6
  19. package/dist/components/Link/Link.svelte.d.ts +1 -2
  20. package/dist/components/LoadingSpinner/LoadingSpinner.svelte +1 -1
  21. package/dist/components/Logo/Logo.svelte +1 -1
  22. package/dist/components/Modal/Modal.svelte +1 -1
  23. package/dist/components/Navbar/NavbarItem.svelte +1 -12
  24. package/dist/components/Navbar/NavbarItem.svelte.d.ts +0 -1
  25. package/dist/components/Scrollable/Scrollable.svelte +1 -1
  26. package/dist/components/Stack/Stack.svelte +1 -1
  27. package/dist/components/SupporterBadge/SupporterBadge.svelte +1 -1
  28. package/dist/components/Switch/Switch.svelte +1 -1
  29. package/dist/components/Text/Text.svelte +1 -1
  30. package/dist/components/Textarea/Textarea.svelte +1 -1
  31. package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +1 -1
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/internal/Button.svelte +5 -3
  35. package/dist/internal/Child.svelte +1 -1
  36. package/dist/internal/Select.svelte +1 -1
  37. package/dist/internal/Text.svelte +1 -1
  38. package/dist/services/command-palette-manager.svelte.d.ts +0 -1
  39. package/dist/services/command-palette-manager.svelte.js +1 -2
  40. package/dist/site/SiteFooter.svelte +3 -1
  41. package/dist/site/SiteFooterLink.svelte +1 -1
  42. package/dist/site/constants.d.ts +2 -2
  43. package/dist/site/constants.js +2 -2
  44. package/dist/types.d.ts +0 -2
  45. package/dist/utilities/common.d.ts +2 -0
  46. package/dist/utilities/common.js +21 -0
  47. package/dist/{utils.d.ts → utilities/internal.d.ts} +1 -1
  48. package/package.json +1 -1
  49. /package/dist/{utils.js → utilities/internal.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { withPrefix } from '../utils.js';
1
+ import { withPrefix } from '../utilities/internal.js';
2
2
  import { getContext, hasContext, setContext } from 'svelte';
3
3
  const fieldKey = Symbol(withPrefix('field'));
4
4
  export const setFieldContext = (field) => setContext(fieldKey, field);
@@ -1,5 +1,5 @@
1
1
  import { ChildKey } from '../constants.js';
2
- import { withPrefix } from '../utils.js';
2
+ import { withPrefix } from '../utilities/internal.js';
3
3
  import { setContext } from 'svelte';
4
4
  import { SvelteMap } from 'svelte/reactivity';
5
5
  export const withChildrenSnippets = (key) => {
@@ -5,7 +5,7 @@
5
5
  import Icon from '../Icon/Icon.svelte';
6
6
  import Text from '../Text/Text.svelte';
7
7
  import type { Color, Size } from '../../types.js';
8
- import { cleanClass } from '../../utils.js';
8
+ import { cleanClass } from '../../utilities/internal.js';
9
9
  import {
10
10
  mdiAlertOutline,
11
11
  mdiCheckCircleOutline,
@@ -2,7 +2,7 @@
2
2
  import { withChildrenSnippets } from '../../common/use-child.svelte.js';
3
3
  import Scrollable from '../Scrollable/Scrollable.svelte';
4
4
  import { ChildKey } from '../../constants.js';
5
- import { cleanClass } from '../../utils.js';
5
+ import { cleanClass } from '../../utilities/internal.js';
6
6
  import type { Snippet } from 'svelte';
7
7
 
8
8
  type Props = {
@@ -2,7 +2,7 @@
2
2
  import Scrollable from '../Scrollable/Scrollable.svelte';
3
3
  import { ChildKey } from '../../constants.js';
4
4
  import Child from '../../internal/Child.svelte';
5
- import { cleanClass } from '../../utils.js';
5
+ import { cleanClass } from '../../utilities/internal.js';
6
6
  import { type Snippet } from 'svelte';
7
7
 
8
8
  type Props = {
@@ -4,7 +4,7 @@
4
4
  import Scrollable from '../Scrollable/Scrollable.svelte';
5
5
  import { ChildKey } from '../../constants.js';
6
6
  import type { Color } from '../../types.js';
7
- import { cleanClass } from '../../utils.js';
7
+ import { cleanClass } from '../../utilities/internal.js';
8
8
  import { mdiChevronDown } from '@mdi/js';
9
9
  import { type Snippet } from 'svelte';
10
10
  import type { HTMLAttributes } from 'svelte/elements';
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Text from '../Text/Text.svelte';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
 
6
6
  type Props = {
@@ -4,7 +4,7 @@
4
4
  import Label from '../Label/Label.svelte';
5
5
  import Text from '../Text/Text.svelte';
6
6
  import type { Color, Shape, Size } from '../../types.js';
7
- import { cleanClass, generateId } from '../../utils.js';
7
+ import { cleanClass, generateId } from '../../utilities/internal.js';
8
8
  import { mdiCheck, mdiMinus } from '@mdi/js';
9
9
  import { Checkbox as CheckboxPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
10
10
  import { tv } from 'tailwind-variants';
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Size, TextColor } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  import { tv } from 'tailwind-variants';
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Size } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
  import { tv } from 'tailwind-variants';
6
6
 
@@ -3,7 +3,7 @@
3
3
  import { withChildrenSnippets } from '../../common/use-child.svelte.js';
4
4
  import { ChildKey } from '../../constants.js';
5
5
  import type { FieldContext } from '../../types.js';
6
- import { cleanClass } from '../../utils.js';
6
+ import { cleanClass } from '../../utilities/internal.js';
7
7
  import { type Snippet } from 'svelte';
8
8
 
9
9
  type Props = FieldContext & {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { FontWeight, HeadingColor, HeadingSize, HeadingTag, TextVariant } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import Text from '../../internal/Text.svelte';
5
5
  import type { Snippet } from 'svelte';
6
6
  import type { HTMLAttributes } from 'svelte/elements';
@@ -3,7 +3,7 @@
3
3
  import { ChildKey } from '../../constants.js';
4
4
  import Child from '../../internal/Child.svelte';
5
5
  import type { TextColor } from '../../types.js';
6
- import { cleanClass } from '../../utils.js';
6
+ import { cleanClass } from '../../utilities/internal.js';
7
7
  import type { Snippet } from 'svelte';
8
8
 
9
9
  type Props = {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { IconProps } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { HTMLAttributes } from 'svelte/elements';
5
5
 
6
6
  const {
@@ -4,7 +4,7 @@
4
4
  import Label from '../Label/Label.svelte';
5
5
  import Text from '../Text/Text.svelte';
6
6
  import type { InputProps } from '../../types.js';
7
- import { cleanClass, generateId, isIconLike } from '../../utils.js';
7
+ import { cleanClass, generateId, isIconLike } from '../../utilities/internal.js';
8
8
  import { tv } from 'tailwind-variants';
9
9
 
10
10
  let {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Color, Size } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  import { tv } from 'tailwind-variants';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { styles } from '../../styles.js';
3
3
  import type { LabelProps } from '../../types.js';
4
- import { cleanClass } from '../../utils.js';
4
+ import { cleanClass } from '../../utilities/internal.js';
5
5
 
6
6
  const { label, size, color, class: className, children, ...restProps }: LabelProps = $props();
7
7
  </script>
@@ -1,26 +1,33 @@
1
1
  <script lang="ts">
2
- import { cleanClass } from '../../utils.js';
2
+ import { isExternalLink, resolveUrl } from '../../utilities/common.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
3
4
  import type { Snippet } from 'svelte';
4
5
  import type { HTMLAnchorAttributes } from 'svelte/elements';
5
6
 
6
7
  type Props = {
7
8
  class?: string;
8
- children: Snippet;
9
+ children?: Snippet;
9
10
  href: string;
10
11
  underline?: boolean;
11
- external?: boolean;
12
12
  } & HTMLAnchorAttributes;
13
13
 
14
- const { href, class: className, underline = true, external, children, ...restProps }: Props = $props();
14
+ const { href, class: className, underline = true, children, ...restProps }: Props = $props();
15
+
16
+ let resolved = $derived(resolveUrl(href));
17
+ let external = $derived(isExternalLink(resolved));
15
18
  </script>
16
19
 
17
20
  <a
18
- {href}
21
+ href={resolved}
19
22
  draggable="false"
20
23
  class={cleanClass(underline && 'underline', className)}
21
24
  target={external ? '_blank' : undefined}
22
25
  rel={external ? 'noopener noreferrer' : undefined}
23
26
  {...restProps}
24
27
  >
25
- {@render children()}
28
+ {#if children}
29
+ {@render children()}
30
+ {:else}
31
+ {href}
32
+ {/if}
26
33
  </a>
@@ -2,10 +2,9 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLAnchorAttributes } from 'svelte/elements';
3
3
  type Props = {
4
4
  class?: string;
5
- children: Snippet;
5
+ children?: Snippet;
6
6
  href: string;
7
7
  underline?: boolean;
8
- external?: boolean;
9
8
  } & HTMLAnchorAttributes;
10
9
  declare const Link: import("svelte").Component<Props, {}, "">;
11
10
  type Link = ReturnType<typeof Link>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { Color, Size } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import { tv } from 'tailwind-variants';
5
5
 
6
6
  interface Props {
@@ -8,7 +8,7 @@
8
8
  import icon from '../../assets/immich-logo.svg';
9
9
  import { theme } from '../../services/theme.svelte.js';
10
10
  import { Theme, type Size } from '../../types.js';
11
- import { cleanClass } from '../../utils.js';
11
+ import { cleanClass } from '../../utilities/internal.js';
12
12
  import { tv } from 'tailwind-variants';
13
13
 
14
14
  type Props = {
@@ -10,7 +10,7 @@
10
10
  import Logo from '../Logo/Logo.svelte';
11
11
  import { ChildKey } from '../../constants.js';
12
12
  import type { ModalSize } from '../../types.js';
13
- import { cleanClass } from '../../utils.js';
13
+ import { cleanClass } from '../../utilities/internal.js';
14
14
  import { Dialog } from 'bits-ui';
15
15
  import { tick, type Snippet } from 'svelte';
16
16
  import { tv } from 'tailwind-variants';
@@ -8,7 +8,6 @@
8
8
  type Props = {
9
9
  title: string;
10
10
  href: string;
11
- external?: boolean;
12
11
  active?: boolean;
13
12
  variant?: 'compact';
14
13
  isActive?: () => boolean;
@@ -18,16 +17,7 @@
18
17
 
19
18
  const startsWithHref = () => page.url.pathname.startsWith(href);
20
19
 
21
- let {
22
- href,
23
- external,
24
- isActive: isActiveOverride,
25
- title,
26
- variant,
27
- active: activeOverride,
28
- icon,
29
- activeIcon,
30
- }: Props = $props();
20
+ let { href, isActive: isActiveOverride, title, variant, active: activeOverride, icon, activeIcon }: Props = $props();
31
21
 
32
22
  const isActive = isActiveOverride ?? startsWithHref;
33
23
  let active = $derived(activeOverride ?? isActive());
@@ -52,7 +42,6 @@
52
42
 
53
43
  <Link
54
44
  {href}
55
- {external}
56
45
  aria-current={active ? 'page' : undefined}
57
46
  underline={false}
58
47
  class={styles({ active, variant: variant ?? 'default' })}
@@ -2,7 +2,6 @@ import type { IconProps } from '../../types.js';
2
2
  type Props = {
3
3
  title: string;
4
4
  href: string;
5
- external?: boolean;
6
5
  active?: boolean;
7
6
  variant?: 'compact';
8
7
  isActive?: () => boolean;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { afterNavigate } from '$app/navigation';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
 
6
6
  type Props = {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { StackProps } from '../../types.js';
3
- import { cleanClass } from '../../utils.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
4
4
  import { tv } from 'tailwind-variants';
5
5
 
6
6
  const {
@@ -2,7 +2,7 @@
2
2
  import Logo from '../Logo/Logo.svelte';
3
3
  import Text from '../Text/Text.svelte';
4
4
  import type { Size } from '../../types.js';
5
- import { cleanClass } from '../../utils.js';
5
+ import { cleanClass } from '../../utilities/internal.js';
6
6
  import type { Snippet } from 'svelte';
7
7
  import { tv } from 'tailwind-variants';
8
8
 
@@ -3,7 +3,7 @@
3
3
  import Label from '../Label/Label.svelte';
4
4
  import Text from '../Text/Text.svelte';
5
5
  import type { Color } from '../../types.js';
6
- import { cleanClass, generateId } from '../../utils.js';
6
+ import { cleanClass, generateId } from '../../utilities/internal.js';
7
7
  import { Switch, type WithoutChildrenOrChild } from 'bits-ui';
8
8
  import { tv } from 'tailwind-variants';
9
9
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Text from '../../internal/Text.svelte';
3
3
  import type { FontWeight, Size, TextColor, TextVariant } from '../../types.js';
4
- import { cleanClass } from '../../utils.js';
4
+ import { cleanClass } from '../../utilities/internal.js';
5
5
  import type { Snippet } from 'svelte';
6
6
  import type { HTMLAttributes } from 'svelte/elements';
7
7
  import { tv } from 'tailwind-variants';
@@ -3,7 +3,7 @@
3
3
  import Label from '../Label/Label.svelte';
4
4
  import Text from '../Text/Text.svelte';
5
5
  import type { TextareaProps } from '../../types.js';
6
- import { cleanClass, generateId } from '../../utils.js';
6
+ import { cleanClass, generateId } from '../../utilities/internal.js';
7
7
  import type { FormEventHandler } from 'svelte/elements';
8
8
  import { tv } from 'tailwind-variants';
9
9
 
@@ -3,7 +3,7 @@
3
3
  import { theme, toggleTheme } from '../../services/theme.svelte.js';
4
4
  import { t } from '../../services/translation.svelte.js';
5
5
  import { Theme, type Color, type Size, type TranslationProps, type Variants } from '../../types.js';
6
- import { cleanClass } from '../../utils.js';
6
+ import { cleanClass } from '../../utilities/internal.js';
7
7
  import { mdiWeatherNight, mdiWeatherSunny } from '@mdi/js';
8
8
 
9
9
  type Props = {
package/dist/index.d.ts CHANGED
@@ -65,5 +65,6 @@ export * from './services/theme.svelte.js';
65
65
  export * from './services/translation.svelte.js';
66
66
  export * from './types.js';
67
67
  export * from './utilities/byte-units.js';
68
+ export * from './utilities/common.js';
68
69
  export * from './site/constants.js';
69
70
  export { default as SiteFooter } from './site/SiteFooter.svelte';
package/dist/index.js CHANGED
@@ -68,6 +68,7 @@ export * from './services/theme.svelte.js';
68
68
  export * from './services/translation.svelte.js';
69
69
  export * from './types.js';
70
70
  export * from './utilities/byte-units.js';
71
+ export * from './utilities/common.js';
71
72
  // site
72
73
  export * from './site/constants.js';
73
74
  export { default as SiteFooter } from './site/SiteFooter.svelte';
@@ -2,7 +2,8 @@
2
2
  import Icon from '../components/Icon/Icon.svelte';
3
3
  import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner.svelte';
4
4
  import type { ButtonProps, Size } from '../types.js';
5
- import { cleanClass } from '../utils.js';
5
+ import { isExternalLink, resolveUrl } from '../utilities/common.js';
6
+ import { cleanClass } from '../utilities/internal.js';
6
7
  import { Button as ButtonPrimitive } from 'bits-ui';
7
8
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
8
9
  import { twMerge } from 'tailwind-merge';
@@ -17,7 +18,6 @@
17
18
  ref = $bindable(null),
18
19
  type = 'button',
19
20
  href,
20
- external,
21
21
  variant = 'filled',
22
22
  color = 'primary',
23
23
  shape = 'semi-round',
@@ -154,9 +154,11 @@
154
154
  {/snippet}
155
155
 
156
156
  {#if href}
157
+ {@const resolved = resolveUrl(href)}
158
+ {@const external = isExternalLink(resolved)}
157
159
  <a
158
160
  bind:this={ref}
159
- {href}
161
+ href={resolved}
160
162
  class={classList}
161
163
  aria-disabled={disabled}
162
164
  target={external ? '_blank' : undefined}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../constants.js';
3
3
  import type { ChildData } from '../types.js';
4
- import { withPrefix } from '../utils.js';
4
+ import { withPrefix } from '../utilities/internal.js';
5
5
  import { getContext, type Snippet } from 'svelte';
6
6
 
7
7
  type ContextType = {
@@ -6,7 +6,7 @@
6
6
  import Input from '../components/Input/Input.svelte';
7
7
  import Label from '../components/Label/Label.svelte';
8
8
  import type { SelectCommonProps, SelectItem } from '../types.js';
9
- import { cleanClass, generateId } from '../utils.js';
9
+ import { cleanClass, generateId } from '../utilities/internal.js';
10
10
  import { mdiArrowDown, mdiArrowUp, mdiCheck, mdiUnfoldMoreHorizontal } from '@mdi/js';
11
11
  import { Select } from 'bits-ui';
12
12
 
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { FontWeight, HeadingColor, HeadingTag, Size, TextVariant } from '../types.js';
3
- import { cleanClass } from '../utils.js';
3
+ import { cleanClass } from '../utilities/internal.js';
4
4
  import type { Snippet } from 'svelte';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  import { tv } from 'tailwind-variants';
@@ -7,7 +7,6 @@ export type CommandItem = {
7
7
  text: string;
8
8
  } & ({
9
9
  href: string;
10
- external?: boolean;
11
10
  } | {
12
11
  action: () => void;
13
12
  });
@@ -52,11 +52,10 @@ class CommandPaletteManager {
52
52
  this.recentItems.unshift(selected);
53
53
  this.recentItems = this.recentItems.slice(0, 5);
54
54
  if ('href' in selected) {
55
- if (selected.href.startsWith('http') || selected.external) {
55
+ if (!selected.href.startsWith('/')) {
56
56
  window.open(selected.href, '_blank');
57
57
  }
58
58
  else {
59
- // eslint-disable-next-line svelte/no-navigation-without-resolve
60
59
  await goto(selected.href);
61
60
  }
62
61
  }
@@ -15,6 +15,7 @@
15
15
  mdiOfficeBuildingOutline,
16
16
  mdiScriptTextOutline,
17
17
  mdiServerOutline,
18
+ mdiShieldAccountOutline,
18
19
  mdiShoppingOutline,
19
20
  } from '@mdi/js';
20
21
  import { siAndroid, siApple, siDiscord, siGithub, siReddit } from 'simple-icons';
@@ -35,7 +36,7 @@
35
36
  <Heading size="tiny">Download</Heading>
36
37
  <SiteFooterLink href={Constants.Get.Android} icon={siAndroid} text="Android" />
37
38
  <SiteFooterLink href={Constants.Get.iOS} icon={siApple} text="iOS" />
38
- <SiteFooterLink href={Constants.Get.DockerCompose} icon={mdiServerOutline} text="Server" />
39
+ <SiteFooterLink href={Constants.Get.Download} icon={mdiServerOutline} text="Server" />
39
40
  </Stack>
40
41
 
41
42
  <Stack>
@@ -56,6 +57,7 @@
56
57
  <Heading size="tiny">Miscellaneous</Heading>
57
58
  <SiteFooterLink href={Constants.Pages.Roadmap} icon={mdiChartGantt} text="Roadmap" />
58
59
  <SiteFooterLink href={Constants.Pages.CursedKnowledge} icon={mdiBookshelf} text="Cursed Knowledge" />
60
+ <SiteFooterLink href={Constants.Pages.PrivacyPolicy} icon={mdiShieldAccountOutline} text="Privacy Policy" />
59
61
  </Stack>
60
62
  </div>
61
63
  <VStack class="text-center">
@@ -13,7 +13,7 @@
13
13
  let { href, icon, text }: Props = $props();
14
14
  </script>
15
15
 
16
- <Link {href} external>
16
+ <Link {href}>
17
17
  <HStack>
18
18
  <Icon {icon} size="1.5em" />
19
19
  <Text>{text}</Text>
@@ -11,7 +11,7 @@ export declare const Constants: {
11
11
  Android: string;
12
12
  FDroid: string;
13
13
  GithubRelease: string;
14
- DockerCompose: string;
14
+ Download: string;
15
15
  };
16
16
  Sites: {
17
17
  Api: string;
@@ -28,6 +28,7 @@ export declare const Constants: {
28
28
  Pages: {
29
29
  CursedKnowledge: string;
30
30
  Roadmap: string;
31
+ PrivacyPolicy: string;
31
32
  };
32
33
  Npm: {
33
34
  Sdk: string;
@@ -41,6 +42,5 @@ export declare const siteCommands: {
41
42
  title: string;
42
43
  description: string;
43
44
  href: string;
44
- external: boolean;
45
45
  text: string;
46
46
  }[];
@@ -13,7 +13,7 @@ export const Constants = {
13
13
  Android: 'https://get.immich.app/android',
14
14
  FDroid: 'https://get.immich.app/fdroid',
15
15
  GithubRelease: 'https://github.com/immich-app/immich/releases/latest',
16
- DockerCompose: 'https://get.immich.app/docker-compose',
16
+ Download: 'https://immich.app/download',
17
17
  },
18
18
  Sites: {
19
19
  Api: 'https://api.immich.app/',
@@ -30,6 +30,7 @@ export const Constants = {
30
30
  Pages: {
31
31
  CursedKnowledge: 'https://immich.app/cursed-knowledge',
32
32
  Roadmap: 'https://immich.app/roadmap',
33
+ PrivacyPolicy: 'https://immich.app/privacy-policy',
33
34
  },
34
35
  Npm: {
35
36
  Sdk: 'https://www.npmjs.com/package/@immich/sdk',
@@ -129,6 +130,5 @@ export const siteCommands = [
129
130
  title: site.title,
130
131
  description: site.description,
131
132
  href: site.href,
132
- external: true,
133
133
  text: asText('Site', 'Link', site.title, site.description, site.href),
134
134
  }));
package/dist/types.d.ts CHANGED
@@ -40,10 +40,8 @@ export type IconProps = {
40
40
  };
41
41
  type ButtonOrAnchor = ({
42
42
  href?: never;
43
- external?: never;
44
43
  } & HTMLButtonAttributes) | ({
45
44
  href: string;
46
- external?: boolean;
47
45
  } & HTMLAnchorAttributes);
48
46
  type ButtonBase = {
49
47
  size?: Size;
@@ -0,0 +1,2 @@
1
+ export declare const resolveUrl: (url: string, currentHostname?: string) => string;
2
+ export declare const isExternalLink: (href: string) => boolean;
@@ -0,0 +1,21 @@
1
+ const getImmichApp = (host) => {
2
+ if (!host.endsWith('immich.app')) {
3
+ return false;
4
+ }
5
+ if (host === 'immich.app' || host.startsWith('pr-')) {
6
+ return 'root';
7
+ }
8
+ return host.split('.')[0];
9
+ };
10
+ export const resolveUrl = (url, currentHostname) => {
11
+ if (!isExternalLink(url)) {
12
+ return url;
13
+ }
14
+ const target = new URL(url);
15
+ const targetApp = getImmichApp(target.hostname);
16
+ const currentApp = getImmichApp(currentHostname ?? globalThis.location.hostname);
17
+ return targetApp && targetApp === currentApp ? target.pathname : target.href;
18
+ };
19
+ export const isExternalLink = (href) => {
20
+ return !(href.startsWith('/') || href.startsWith('#'));
21
+ };
@@ -1,4 +1,4 @@
1
- import type { IconLike } from './types.js';
1
+ import type { IconLike } from '../types.js';
2
2
  export declare const cleanClass: (...classNames: unknown[]) => string;
3
3
  export declare const withPrefix: (key: string) => string;
4
4
  export declare const generateId: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "scripts": {
6
6
  "create": "node scripts/create.js",
File without changes