@immich/ui 0.39.2 → 0.40.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.
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import Text from '../Text/Text.svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ children: Snippet;
7
+ };
8
+
9
+ const { children }: Props = $props();
10
+ </script>
11
+
12
+ <Text {children} class="border-muted border-s-4 ps-4" variant="italic" />
@@ -0,0 +1,7 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ children: Snippet;
4
+ };
5
+ declare const BlockQuote: import("svelte").Component<Props, {}, "">;
6
+ type BlockQuote = ReturnType<typeof BlockQuote>;
7
+ export default BlockQuote;
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import Code from '../Code/Code.svelte';
3
+ import CodeBlock from '../CodeBlock/CodeBlock.svelte';
4
+ import * as languages from 'svelte-highlight/languages';
5
+
6
+ type Props = {
7
+ code: string;
8
+ multiline?: boolean;
9
+ lang?: string;
10
+ };
11
+
12
+ const { code, lang, multiline }: Props = $props();
13
+
14
+ const getLanguage = (lang: string | undefined) => {
15
+ switch (lang) {
16
+ case 'js': {
17
+ lang = 'javascript';
18
+ break;
19
+ }
20
+
21
+ case 'ts': {
22
+ lang = 'typescript';
23
+ break;
24
+ }
25
+ }
26
+
27
+ if (lang) {
28
+ return languages[lang as keyof typeof languages];
29
+ }
30
+ };
31
+
32
+ let language = $derived(getLanguage(lang) ?? languages.plaintext);
33
+ </script>
34
+
35
+ {#if multiline}
36
+ <div class="mt-2 mb-2">
37
+ <CodeBlock {code} {language} />
38
+ </div>
39
+ {:else}
40
+ <Code>{code}</Code>
41
+ {/if}
@@ -0,0 +1,9 @@
1
+ import Code from '../Code/Code.svelte';
2
+ type Props = {
3
+ code: string;
4
+ multiline?: boolean;
5
+ lang?: string;
6
+ };
7
+ declare const Code: import("svelte").Component<Props, {}, "">;
8
+ type Code = ReturnType<typeof Code>;
9
+ export default Code;
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import Heading from '../Heading/Heading.svelte';
3
+ import type { HeadingTag, Size } from '../../types.js';
4
+ import type { Snippet } from 'svelte';
5
+
6
+ type Props = {
7
+ id?: string;
8
+ level?: number;
9
+ children: Snippet;
10
+ };
11
+
12
+ const { children, id, level }: Props = $props();
13
+
14
+ const getSizeAndTag = (level?: number): { size: Size; tag: HeadingTag } => {
15
+ switch (level) {
16
+ case 1: {
17
+ return { size: 'giant', tag: 'h1' };
18
+ }
19
+ case 2: {
20
+ return { size: 'large', tag: 'h2' };
21
+ }
22
+ case 3: {
23
+ return { size: 'medium', tag: 'h3' };
24
+ }
25
+ case 4: {
26
+ return { size: 'small', tag: 'h4' };
27
+ }
28
+ case 5: {
29
+ return { size: 'tiny', tag: 'h5' };
30
+ }
31
+ case 6: {
32
+ return { size: 'tiny', tag: 'h6' };
33
+ }
34
+ default: {
35
+ return { size: 'tiny', tag: 'p' };
36
+ }
37
+ }
38
+ };
39
+
40
+ let { size, tag } = $derived(getSizeAndTag(level));
41
+ </script>
42
+
43
+ <Heading {size} {tag} class="mt-4" {id}>
44
+ {@render children()}
45
+ </Heading>
@@ -0,0 +1,10 @@
1
+ import Heading from '../Heading/Heading.svelte';
2
+ import type { Snippet } from 'svelte';
3
+ type Props = {
4
+ id?: string;
5
+ level?: number;
6
+ children: Snippet;
7
+ };
8
+ declare const Heading: import("svelte").Component<Props, {}, "">;
9
+ type Heading = ReturnType<typeof Heading>;
10
+ export default Heading;
@@ -0,0 +1,11 @@
1
+ <script lang="ts">
2
+ import { cleanClass } from '../../utilities/internal.js';
3
+
4
+ type Props = {
5
+ class?: string;
6
+ };
7
+
8
+ const { class: className }: Props = $props();
9
+ </script>
10
+
11
+ <hr class={cleanClass('my-6 border-t', className)} />
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ class?: string;
3
+ };
4
+ declare const LineBreak: import("svelte").Component<Props, {}, "">;
5
+ type LineBreak = ReturnType<typeof LineBreak>;
6
+ export default LineBreak;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import Link from '../Link/Link.svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ href: string;
7
+ title?: string;
8
+ children?: Snippet;
9
+ };
10
+
11
+ const { href, title, children }: Props = $props();
12
+ </script>
13
+
14
+ <Link {href} {title} {children} />
@@ -0,0 +1,10 @@
1
+ import Link from '../Link/Link.svelte';
2
+ import type { Snippet } from 'svelte';
3
+ type Props = {
4
+ href: string;
5
+ title?: string;
6
+ children?: Snippet;
7
+ };
8
+ declare const Link: import("svelte").Component<Props, {}, "">;
9
+ type Link = ReturnType<typeof Link>;
10
+ export default Link;
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ type Props = {
5
+ ordered?: boolean;
6
+ children: Snippet;
7
+ };
8
+
9
+ const { children, ordered }: Props = $props();
10
+ const styles = 'list-outside ps-6 w-full flex flex-col gap-1';
11
+ </script>
12
+
13
+ {#if ordered}
14
+ <ol class="list-decimal {styles}">
15
+ {@render children?.()}
16
+ </ol>
17
+ {:else}
18
+ <ul class="list-disc {styles}">
19
+ {@render children?.()}
20
+ </ul>
21
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ ordered?: boolean;
4
+ children: Snippet;
5
+ };
6
+ declare const List: import("svelte").Component<Props, {}, "">;
7
+ type List = ReturnType<typeof List>;
8
+ export default List;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import Checkbox from '../Checkbox/Checkbox.svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ checked?: boolean;
7
+ task?: boolean;
8
+ children: Snippet;
9
+ };
10
+
11
+ const { children, checked, task }: Props = $props();
12
+ </script>
13
+
14
+ <li class:list-none={task}>
15
+ {#if task}
16
+ <Checkbox {checked} readonly size="tiny" color="secondary" />
17
+ {/if}
18
+ {@render children?.()}
19
+ </li>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ checked?: boolean;
4
+ task?: boolean;
5
+ children: Snippet;
6
+ };
7
+ declare const ListItem: import("svelte").Component<Props, {}, "">;
8
+ type ListItem = ReturnType<typeof ListItem>;
9
+ export default ListItem;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import Text from '../Text/Text.svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ children: Snippet;
7
+ };
8
+
9
+ const { children }: Props = $props();
10
+ </script>
11
+
12
+ <Text class="mb-1">
13
+ {@render children()}
14
+ </Text>
@@ -0,0 +1,7 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ children: Snippet;
4
+ };
5
+ declare const Paragraph: import("svelte").Component<Props, {}, "">;
6
+ type Paragraph = ReturnType<typeof Paragraph>;
7
+ export default Paragraph;
@@ -0,0 +1,35 @@
1
+ export declare const Markdown: {
2
+ Link: import("svelte").Component<{
3
+ href: string;
4
+ title?: string;
5
+ children?: import("svelte").Snippet;
6
+ }, {}, "">;
7
+ BlockQuote: import("svelte").Component<{
8
+ children: import("svelte").Snippet;
9
+ }, {}, "">;
10
+ Code: import("svelte").Component<{
11
+ code: string;
12
+ multiline?: boolean;
13
+ lang?: string;
14
+ }, {}, "">;
15
+ Heading: import("svelte").Component<{
16
+ id?: string;
17
+ level?: number;
18
+ children: import("svelte").Snippet;
19
+ }, {}, "">;
20
+ LineBreak: import("svelte").Component<{
21
+ class?: string;
22
+ }, {}, "">;
23
+ ListItem: import("svelte").Component<{
24
+ checked?: boolean;
25
+ task?: boolean;
26
+ children: import("svelte").Snippet;
27
+ }, {}, "">;
28
+ List: import("svelte").Component<{
29
+ ordered?: boolean;
30
+ children: import("svelte").Snippet;
31
+ }, {}, "">;
32
+ Paragraph: import("svelte").Component<{
33
+ children: import("svelte").Snippet;
34
+ }, {}, "">;
35
+ };
@@ -0,0 +1,18 @@
1
+ import BlockQuote from './BlockQuote.svelte';
2
+ import Code from './Code.svelte';
3
+ import Heading from './Heading.svelte';
4
+ import LineBreak from './LineBreak.svelte';
5
+ import Link from './Link.svelte';
6
+ import List from './List.svelte';
7
+ import ListItem from './ListItem.svelte';
8
+ import Paragraph from './Paragraph.svelte';
9
+ export const Markdown = {
10
+ Link,
11
+ BlockQuote,
12
+ Code,
13
+ Heading,
14
+ LineBreak,
15
+ ListItem,
16
+ List,
17
+ Paragraph,
18
+ };
package/dist/index.d.ts CHANGED
@@ -42,6 +42,7 @@ export { default as Label } from './components/Label/Label.svelte';
42
42
  export { default as Link } from './components/Link/Link.svelte';
43
43
  export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
44
44
  export { default as Logo } from './components/Logo/Logo.svelte';
45
+ export { Markdown } from './components/Markdown/index.js';
45
46
  export { default as Modal } from './components/Modal/Modal.svelte';
46
47
  export { default as ModalBody } from './components/Modal/ModalBody.svelte';
47
48
  export { default as ModalFooter } from './components/Modal/ModalFooter.svelte';
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ export { default as Label } from './components/Label/Label.svelte';
44
44
  export { default as Link } from './components/Link/Link.svelte';
45
45
  export { default as LoadingSpinner } from './components/LoadingSpinner/LoadingSpinner.svelte';
46
46
  export { default as Logo } from './components/Logo/Logo.svelte';
47
+ export { Markdown } from './components/Markdown/index.js';
47
48
  export { default as Modal } from './components/Modal/Modal.svelte';
48
49
  export { default as ModalBody } from './components/Modal/ModalBody.svelte';
49
50
  export { default as ModalFooter } from './components/Modal/ModalFooter.svelte';
@@ -8,6 +8,7 @@
8
8
  --color-danger: rgb(var(--immich-ui-danger));
9
9
  --color-warning: rgb(var(--immich-ui-warning));
10
10
  --color-info: rgb(var(--immich-ui-info));
11
+ --color-muted: rgb(var(--immich-ui-muted));
11
12
  --color-subtle: rgb(var(--immich-ui-gray));
12
13
  }
13
14
 
@@ -24,6 +25,7 @@
24
25
  --immich-ui-danger: 200 60 60;
25
26
  --immich-ui-warning: 216 143 64;
26
27
  --immich-ui-info: 8 111 230;
28
+ --immich-ui-muted: 161 161 161;
27
29
  --immich-ui-gray: 246 246 246;
28
30
 
29
31
  --immich-ui-default-border: 209 213 219;
@@ -38,6 +40,7 @@
38
40
  --immich-ui-danger: 246 125 125;
39
41
  --immich-ui-warning: 254 197 132;
40
42
  --immich-ui-info: 121 183 254;
43
+ --immich-ui-muted: 212 212 212;
41
44
  --immich-ui-gray: 33 33 33;
42
45
 
43
46
  --immich-ui-default-border: 33 33 33;
@@ -12,10 +12,15 @@ export const resolveUrl = (url, currentHostname) => {
12
12
  if (!isExternalLink(url)) {
13
13
  return url;
14
14
  }
15
- const target = new URL(url);
16
- const targetApp = getImmichApp(target.hostname);
17
- const currentApp = getImmichApp(currentHostname ?? globalThis.location?.hostname ?? env.PUBLIC_IMMICH_HOSTNAME);
18
- return targetApp && targetApp === currentApp ? target.pathname : target.href;
15
+ try {
16
+ const target = new URL(url);
17
+ const targetApp = getImmichApp(target.hostname);
18
+ const currentApp = getImmichApp(currentHostname ?? globalThis.location?.hostname ?? env.PUBLIC_IMMICH_HOSTNAME);
19
+ return targetApp && targetApp === currentApp ? target.pathname : target.href;
20
+ }
21
+ catch {
22
+ return url;
23
+ }
19
24
  };
20
25
  export const isExternalLink = (href) => {
21
26
  return !(href.startsWith('/') || href.startsWith('#'));
package/package.json CHANGED
@@ -1,27 +1,11 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.39.2",
3
+ "version": "0.40.1",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/immich-app/ui.git"
8
- },
9
- "scripts": {
10
- "create": "node scripts/create.js",
11
- "start": "npm run start:dev",
12
- "start:dev": "vite dev",
13
- "watch": "vite build --watch",
14
- "build": "vite build && npm run package",
15
- "preview": "vite preview",
16
- "package": "npm run sync && svelte-package && publint",
17
- "check": "npm run sync && svelte-check --tsconfig ./tsconfig.json",
18
- "check:watch": "npm run sync && svelte-check --tsconfig ./tsconfig.json --watch",
19
- "lint": "eslint . --max-warnings 0",
20
- "lint:fix": "npm run lint -- --fix",
21
- "format": "prettier --check .",
22
- "format:fix": "prettier --write .",
23
- "test": "vitest",
24
- "sync": "svelte-kit sync"
7
+ "url": "git+https://github.com/immich-app/ui.git",
8
+ "directory": "packages/ui"
25
9
  },
26
10
  "files": [
27
11
  "dist",
@@ -51,35 +35,41 @@
51
35
  "@sveltejs/vite-plugin-svelte": "^6.0.0",
52
36
  "@tailwindcss/postcss": "^4.1.7",
53
37
  "@tailwindcss/vite": "^4.1.7",
54
- "@types/eslint": "^9.6.0",
55
38
  "@types/luxon": "^3.7.1",
56
39
  "autoprefixer": "^10.4.20",
57
- "eslint": "^9.7.0",
58
- "eslint-config-prettier": "^10.0.0",
59
- "eslint-plugin-svelte": "^3.9.3",
60
40
  "globals": "^16.0.0",
61
- "prettier": "^3.3.2",
62
- "prettier-plugin-svelte": "^3.2.6",
63
- "prettier-plugin-tailwindcss": "^0.7.0",
64
41
  "publint": "^0.3.0",
65
42
  "svelte": "^5.37.0",
66
43
  "svelte-check": "^4.0.0",
67
44
  "tailwindcss": "^4.1.7",
68
45
  "typescript": "^5.0.0",
69
- "typescript-eslint": "^8.34.1",
70
46
  "vite": "^7.0.0",
71
47
  "vitest": "^3.0.0"
72
48
  },
73
49
  "dependencies": {
74
- "svelte-highlight": "^7.8.4",
75
50
  "@mdi/js": "^7.4.47",
76
51
  "bits-ui": "^2.9.8",
77
52
  "luxon": "^3.7.2",
78
53
  "simple-icons": "^15.14.0",
54
+ "svelte-highlight": "^7.8.4",
79
55
  "tailwind-merge": "^3.0.0",
80
- "tailwind-variants": "^3.0.0"
56
+ "tailwind-variants": "^3.0.0",
57
+ "@immich/svelte-markdown-preprocess": "^0.0.1"
81
58
  },
82
59
  "volta": {
83
60
  "node": "22.20.0"
61
+ },
62
+ "scripts": {
63
+ "create": "node scripts/create.js",
64
+ "start": "npm run start:dev",
65
+ "start:dev": "vite dev",
66
+ "watch": "vite build --watch",
67
+ "build": "vite build && pnpm package",
68
+ "preview": "vite preview",
69
+ "package": "npm run sync && svelte-package && publint",
70
+ "check": "npm run sync && svelte-check --tsconfig ./tsconfig.json",
71
+ "check:watch": "npm run sync && svelte-check --tsconfig ./tsconfig.json --watch",
72
+ "test": "vitest",
73
+ "sync": "svelte-kit sync"
84
74
  }
85
- }
75
+ }
package/README.md DELETED
@@ -1,44 +0,0 @@
1
- # @immich/ui
2
-
3
- A component library for [Immich](https://immich.app), written in [Svelte](https://svelte.dev).
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm i -D @immich/ui
9
- ```
10
-
11
- ## Usage
12
-
13
- Import components from `@immich/ui`. For example:
14
-
15
- ```html
16
- <script lang="ts">
17
- import { Card, CardBody, CardHeader, CardTitle, CardDescription, Heading, Text } from '@immich/ui';
18
- </script>
19
-
20
- <Card>
21
- <CardHeader>
22
- <CardTitle>@immich/ui</CardTitle>
23
- <CardDescription>A component library</CardDescription>
24
- </CardHeader>
25
- <CardBody>
26
- <Lorem />
27
- </CardBody>
28
- <CardFooter>Privacy should not be a luxury</CardFooter>
29
- </Card>
30
- ```
31
-
32
- ## Documentation
33
-
34
- To view the examples located at `src/routes/examples`, run `npm start` and navigate to http://localhost:5173/.
35
-
36
- ## Contributing
37
-
38
- PR's are welcome! Also feel free to reach out to the team on [Discord](https://discord.immich.app).
39
-
40
- ## Technology
41
-
42
- - [Svelte](https://svelte.dev)
43
- - [tailwindcss](https://tailwindcss.com)
44
- - [Material Design icons (@mdi/js)](https://pictogrammers.com/library/mdi/)