@immich/ui 0.60.2 → 0.61.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 (66) hide show
  1. package/dist/common/context.svelte.d.ts +8 -1
  2. package/dist/common/context.svelte.js +28 -0
  3. package/dist/components/AppShell/AppShell.svelte +8 -10
  4. package/dist/components/AppShell/AppShellBar.svelte +3 -10
  5. package/dist/components/AppShell/AppShellBar.svelte.d.ts +2 -6
  6. package/dist/components/AppShell/AppShellHeader.svelte +19 -5
  7. package/dist/components/AppShell/AppShellHeader.svelte.d.ts +3 -3
  8. package/dist/components/Avatar/Avatar.svelte +14 -16
  9. package/dist/components/Avatar/Avatar.svelte.d.ts +1 -0
  10. package/dist/components/Card/Card.svelte +11 -11
  11. package/dist/components/Card/CardBody.svelte +3 -10
  12. package/dist/components/Card/CardBody.svelte.d.ts +2 -6
  13. package/dist/components/Card/CardFooter.svelte +3 -10
  14. package/dist/components/Card/CardFooter.svelte.d.ts +2 -6
  15. package/dist/components/Card/CardHeader.svelte +3 -10
  16. package/dist/components/Card/CardHeader.svelte.d.ts +2 -6
  17. package/dist/components/ControlBar/ControlBar.svelte +12 -10
  18. package/dist/components/ControlBar/ControlBarContent.svelte +3 -10
  19. package/dist/components/ControlBar/ControlBarContent.svelte.d.ts +2 -6
  20. package/dist/components/ControlBar/ControlBarHeader.svelte +3 -10
  21. package/dist/components/ControlBar/ControlBarHeader.svelte.d.ts +2 -6
  22. package/dist/components/ControlBar/ControlBarOverflow.svelte +3 -10
  23. package/dist/components/ControlBar/ControlBarOverflow.svelte.d.ts +2 -6
  24. package/dist/components/Field/Field.svelte +4 -9
  25. package/dist/components/HelperText/HelperText.svelte +3 -10
  26. package/dist/components/HelperText/HelperText.svelte.d.ts +2 -5
  27. package/dist/components/Markdown/Table.svelte +12 -0
  28. package/dist/components/Markdown/Table.svelte.d.ts +8 -0
  29. package/dist/components/Markdown/TableBody.svelte +12 -0
  30. package/dist/components/Markdown/TableBody.svelte.d.ts +8 -0
  31. package/dist/components/Markdown/TableCell.svelte +12 -0
  32. package/dist/components/Markdown/TableCell.svelte.d.ts +8 -0
  33. package/dist/components/Markdown/TableHeader.svelte +12 -0
  34. package/dist/components/Markdown/TableHeader.svelte.d.ts +8 -0
  35. package/dist/components/Markdown/TableHeading.svelte +12 -0
  36. package/dist/components/Markdown/TableHeading.svelte.d.ts +8 -0
  37. package/dist/components/Markdown/TableRow.svelte +12 -0
  38. package/dist/components/Markdown/TableRow.svelte.d.ts +8 -0
  39. package/dist/components/Markdown/Text.svelte +12 -0
  40. package/dist/components/Markdown/Text.svelte.d.ts +8 -0
  41. package/dist/components/Markdown/index.d.ts +21 -0
  42. package/dist/components/Markdown/index.js +14 -0
  43. package/dist/components/Modal/Modal.svelte +10 -10
  44. package/dist/components/Modal/ModalBody.svelte +3 -9
  45. package/dist/components/Modal/ModalBody.svelte.d.ts +2 -5
  46. package/dist/components/Modal/ModalFooter.svelte +3 -9
  47. package/dist/components/Modal/ModalFooter.svelte.d.ts +2 -5
  48. package/dist/components/Modal/ModalHeader.svelte +3 -9
  49. package/dist/components/Modal/ModalHeader.svelte.d.ts +2 -5
  50. package/dist/components/Table/Table.svelte +11 -11
  51. package/dist/components/Table/TableBody.svelte +3 -10
  52. package/dist/components/Table/TableBody.svelte.d.ts +2 -6
  53. package/dist/components/Table/TableFooter.svelte +3 -10
  54. package/dist/components/Table/TableFooter.svelte.d.ts +2 -6
  55. package/dist/components/Table/TableHeader.svelte +3 -10
  56. package/dist/components/Table/TableHeader.svelte.d.ts +2 -6
  57. package/dist/components/Text/Text.svelte +3 -5
  58. package/dist/components/Text/Text.svelte.d.ts +1 -1
  59. package/dist/internal/Child.svelte +9 -20
  60. package/dist/internal/Child.svelte.d.ts +2 -5
  61. package/dist/internal/Text.svelte +2 -3
  62. package/dist/internal/Text.svelte.d.ts +1 -1
  63. package/dist/types.d.ts +3 -5
  64. package/package.json +1 -1
  65. package/dist/common/use-child.svelte.d.ts +0 -5
  66. package/dist/common/use-child.svelte.js +0 -15
@@ -1,4 +1,5 @@
1
- import type { FieldContext, TableContext } from '../types.js';
1
+ import type { ChildKey } from '../constants.js';
2
+ import type { ChildData, FieldContext, TableContext } from '../types.js';
2
3
  export declare const setFieldContext: (context: () => FieldContext) => () => FieldContext;
3
4
  export declare const getFieldContext: () => () => {
4
5
  class?: (string & (import("svelte/elements").ClassValue | null)) | undefined;
@@ -455,3 +456,9 @@ export declare const getTableContext: () => () => {
455
456
  size: import("../types.js").Size;
456
457
  striped: boolean;
457
458
  };
459
+ export declare const setChildContext: (key: ChildKey) => {
460
+ getByKey: (key: ChildKey) => ChildData | undefined;
461
+ };
462
+ export declare const getChildContext: (key: ChildKey) => () => {
463
+ register: (key: ChildKey, data: () => ChildData) => void;
464
+ };
@@ -1,5 +1,6 @@
1
1
  import { withPrefix } from '../utilities/internal.js';
2
2
  import { getContext, setContext } from 'svelte';
3
+ import { SvelteMap } from 'svelte/reactivity';
3
4
  const fieldKey = Symbol(withPrefix('field'));
4
5
  export const setFieldContext = (context) => setContext(fieldKey, context);
5
6
  export const getFieldContext = () => {
@@ -18,3 +19,30 @@ export const getTableContext = () => {
18
19
  return { spacing, size, striped };
19
20
  };
20
21
  };
22
+ const asChildKey = (key) => withPrefix(key);
23
+ export const setChildContext = (key) => {
24
+ const map = new SvelteMap();
25
+ const context = {
26
+ register: (child, data) => {
27
+ map.set(child, data);
28
+ return () => {
29
+ map.delete(child);
30
+ };
31
+ },
32
+ };
33
+ setContext(asChildKey(key), () => context);
34
+ return {
35
+ getByKey: (key) => map.get(key)?.(),
36
+ };
37
+ };
38
+ const noop = () => { };
39
+ export const getChildContext = (key) => {
40
+ return () => {
41
+ const context = getContext(asChildKey(key));
42
+ if (!context) {
43
+ console.log(`Unable to find child context for key: ${key}`);
44
+ }
45
+ const { register } = context?.() ?? { register: () => noop };
46
+ return { register };
47
+ };
48
+ };
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { withChildrenSnippets } from '../../common/use-child.svelte.js';
2
+ import { setChildContext } from '../../common/context.svelte.js';
3
3
  import Scrollable from '../Scrollable/Scrollable.svelte';
4
4
  import { ChildKey, zIndex } from '../../constants.js';
5
5
  import { cleanClass } from '../../utilities/internal.js';
@@ -12,25 +12,23 @@
12
12
 
13
13
  const { class: className, children }: Props = $props();
14
14
 
15
- const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.AppShell);
16
- const bar = $derived(getChildSnippet(ChildKey.AppShellBar));
17
- const header = $derived(getChildSnippet(ChildKey.AppShellHeader));
18
- const sidebar = $derived(getChildSnippet(ChildKey.AppShellSidebar));
15
+ const { getByKey } = setChildContext(ChildKey.AppShell);
16
+ const bar = $derived(getByKey(ChildKey.AppShellBar));
17
+ const header = $derived(getByKey(ChildKey.AppShellHeader));
18
+ const sidebar = $derived(getByKey(ChildKey.AppShellSidebar));
19
19
  </script>
20
20
 
21
21
  <div class={cleanClass('flex h-dvh flex-col overflow-hidden', className)}>
22
22
  {#if bar}
23
23
  <div class={cleanClass('h-control-bar-container px-2 pt-2', zIndex.AppShellBar, bar.class)}>
24
- {@render bar.snippet()}
24
+ {@render bar.children?.()}
25
25
  </div>
26
26
  {:else if header}
27
- <header class={cleanClass('h-control-bar-container flex items-center gap-2 border-b', header.class)}>
28
- {@render header.snippet()}
29
- </header>
27
+ {@render header.children?.()}
30
28
  {/if}
31
29
  <div class="relative flex w-full grow overflow-y-auto">
32
30
  {#if sidebar}
33
- {@render sidebar.snippet()}
31
+ {@render sidebar.children?.()}
34
32
  {/if}
35
33
  <Scrollable class="grow" resetOnNavigate>
36
34
  {@render children?.()}
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- children: Snippet;
8
- class?: string;
9
- };
10
-
11
- let { children, class: className }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.AppShell} as={ChildKey.AppShellBar} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.AppShell} as={ChildKey.AppShellBar} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- children: Snippet;
4
- class?: string;
5
- };
6
- declare const AppShellBar: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const AppShellBar: import("svelte").Component<ChildData, {}, "">;
7
3
  type AppShellBar = ReturnType<typeof AppShellBar>;
8
4
  export default AppShellBar;
@@ -1,15 +1,29 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
+ import { cleanClass } from '../../utilities/internal.js';
6
+ import { tv } from 'tailwind-variants';
5
7
 
6
8
  type Props = {
7
- children: Snippet;
8
- };
9
+ border?: boolean;
10
+ } & ChildData;
9
11
 
10
- let { children }: Props = $props();
12
+ let { border = true, class: className, children }: Props = $props();
13
+
14
+ const styles = tv({
15
+ base: 'h-control-bar-container flex items-center gap-2',
16
+ variants: {
17
+ border: {
18
+ true: 'border-b',
19
+ false: '',
20
+ },
21
+ },
22
+ });
11
23
  </script>
12
24
 
13
25
  <Child for={ChildKey.AppShell} as={ChildKey.AppShellHeader}>
14
- {@render children?.()}
26
+ <header class={cleanClass(styles({ border }), className)}>
27
+ {@render children?.()}
28
+ </header>
15
29
  </Child>
@@ -1,7 +1,7 @@
1
- import type { Snippet } from 'svelte';
1
+ import type { ChildData } from '../../types.js';
2
2
  type Props = {
3
- children: Snippet;
4
- };
3
+ border?: boolean;
4
+ } & ChildData;
5
5
  declare const AppShellHeader: import("svelte").Component<Props, {}, "">;
6
6
  type AppShellHeader = ReturnType<typeof AppShellHeader>;
7
7
  export default AppShellHeader;
@@ -1,25 +1,20 @@
1
1
  <script lang="ts">
2
2
  import type { Size } from '../../types.js';
3
+ import { cleanClass } from '../../utilities/internal.js';
3
4
  import { tv } from 'tailwind-variants';
4
5
 
5
6
  type Props = {
6
7
  size?: Size;
7
8
  color?: 'primary' | 'pink' | 'red' | 'yellow' | 'blue' | 'green' | 'purple' | 'orange' | 'gray' | 'amber';
8
9
  name: string;
10
+ class?: string;
9
11
  };
10
12
 
11
- const { color = 'primary', size = 'medium', name }: Props = $props();
13
+ const { color = 'primary', size = 'medium', name, class: className }: Props = $props();
12
14
 
13
15
  const styles = tv({
14
- base: 'flex items-center justify-center font-medium text-white select-none',
16
+ base: 'flex items-center overflow-hidden rounded-full align-middle text-white shadow-md',
15
17
  variants: {
16
- size: {
17
- tiny: 'h-5 w-5 text-xs',
18
- small: 'h-7 w-7 text-sm',
19
- medium: 'h-10 w-10 text-base',
20
- large: 'h-12 w-12 text-lg',
21
- giant: 'h-16 w-16 text-xl',
22
- },
23
18
  color: {
24
19
  primary: 'bg-primary text-light',
25
20
  pink: 'bg-pink-400',
@@ -32,25 +27,28 @@
32
27
  blue: 'bg-blue-500',
33
28
  green: 'bg-green-600',
34
29
  },
30
+ size: {
31
+ tiny: 'h-5 w-5 text-xs',
32
+ small: 'h-7 w-7 text-sm',
33
+ medium: 'h-10 w-10 text-base',
34
+ large: 'h-12 w-12 text-lg',
35
+ giant: 'h-16 w-16 text-xl',
36
+ },
35
37
  },
36
38
  });
37
39
 
38
- const wrapper = tv({
39
- base: 'block w-full overflow-hidden rounded-full shadow-md',
40
- });
41
-
42
40
  const getInitials = (name: string) => {
43
41
  return name
44
42
  .split(' ')
45
43
  .map((part) => part.at(0))
46
44
  .join('')
47
- .substr(0, 2)
45
+ .substring(0, 2)
48
46
  .toUpperCase();
49
47
  };
50
48
 
51
49
  const initials = $derived(getInitials(name));
52
50
  </script>
53
51
 
54
- <figure class={wrapper()}>
55
- <span class={styles({ size, color })}>{initials}</span>
52
+ <figure class={cleanClass(styles({ size, color }), className)}>
53
+ <span class="w-full text-center font-medium select-none">{initials}</span>
56
54
  </figure>
@@ -3,6 +3,7 @@ type Props = {
3
3
  size?: Size;
4
4
  color?: 'primary' | 'pink' | 'red' | 'yellow' | 'blue' | 'green' | 'purple' | 'orange' | 'gray' | 'amber';
5
5
  name: string;
6
+ class?: string;
6
7
  };
7
8
  declare const Avatar: import("svelte").Component<Props, {}, "">;
8
9
  type Avatar = ReturnType<typeof Avatar>;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { withChildrenSnippets } from '../../common/use-child.svelte.js';
2
+ import { setChildContext } from '../../common/context.svelte.js';
3
3
  import IconButton from '../IconButton/IconButton.svelte';
4
4
  import { ChildKey } from '../../constants.js';
5
5
  import type { Color } from '../../types.js';
@@ -77,10 +77,10 @@
77
77
  expanded = !expanded;
78
78
  };
79
79
 
80
- const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Card);
81
- const headerChild = $derived(getChildSnippet(ChildKey.CardHeader));
82
- const bodyChild = $derived(getChildSnippet(ChildKey.CardBody));
83
- const footerChild = $derived(getChildSnippet(ChildKey.CardFooter));
80
+ const { getByKey } = setChildContext(ChildKey.Card);
81
+ const headerChild = $derived(getByKey(ChildKey.CardHeader));
82
+ const bodyChild = $derived(getByKey(ChildKey.CardBody));
83
+ const footerChild = $derived(getByKey(ChildKey.CardFooter));
84
84
 
85
85
  const headerBorder = $derived(!color);
86
86
  const headerPadding = $derived(headerBorder || !expanded);
@@ -103,8 +103,8 @@
103
103
  onclick={onToggle}
104
104
  class={cleanClass('flex w-full items-center justify-between px-4', headerContainerClasses)}
105
105
  >
106
- <div class="flex flex-col">
107
- {@render headerChild?.snippet()}
106
+ <div class={cleanClass('flex flex-col', headerChild?.class)}>
107
+ {@render headerChild?.children?.()}
108
108
  </div>
109
109
  <div>
110
110
  <IconButton
@@ -119,8 +119,8 @@
119
119
  </div>
120
120
  </button>
121
121
  {:else}
122
- <div class={cleanClass('flex flex-col', headerContainerClasses)}>
123
- {@render headerChild?.snippet()}
122
+ <div class={cleanClass('flex flex-col', headerContainerClasses, headerChild?.class)}>
123
+ {@render headerChild?.children?.()}
124
124
  </div>
125
125
  {/if}
126
126
  {/snippet}
@@ -136,13 +136,13 @@
136
136
  transition:slide={{ duration: expandable ? 200 : 0, easing: cubicOut }}
137
137
  class={cleanClass('immich-scrollbar h-full w-full overflow-auto p-4', bodyChild?.class)}
138
138
  >
139
- {@render bodyChild?.snippet()}
139
+ {@render bodyChild?.children?.()}
140
140
  </div>
141
141
  {/if}
142
142
 
143
143
  {#if footerChild}
144
144
  <div class={cleanClass('flex items-center border-t p-4', footerChild.class)}>
145
- {@render footerChild.snippet()}
145
+ {@render footerChild.children?.()}
146
146
  </div>
147
147
  {/if}
148
148
 
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.Card} as={ChildKey.CardBody} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.Card} as={ChildKey.CardBody} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const CardBody: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const CardBody: import("svelte").Component<ChildData, {}, "">;
7
3
  type CardBody = ReturnType<typeof CardBody>;
8
4
  export default CardBody;
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.Card} as={ChildKey.CardFooter} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.Card} as={ChildKey.CardFooter} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const CardFooter: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const CardFooter: import("svelte").Component<ChildData, {}, "">;
7
3
  type CardFooter = ReturnType<typeof CardFooter>;
8
4
  export default CardFooter;
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.Card} as={ChildKey.CardHeader} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.Card} as={ChildKey.CardHeader} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const CardHeader: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const CardHeader: import("svelte").Component<ChildData, {}, "">;
7
3
  type CardHeader = ReturnType<typeof CardHeader>;
8
4
  export default CardHeader;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { shortcuts } from '../../actions/shortcut.js';
3
- import { withChildrenSnippets } from '../../common/use-child.svelte.js';
3
+ import { setChildContext } from '../../common/context.svelte.js';
4
4
  import IconButton from '../IconButton/IconButton.svelte';
5
5
  import { ChildKey } from '../../constants.js';
6
6
  import { t } from '../../services/translation.svelte.js';
@@ -45,10 +45,10 @@
45
45
  }
46
46
  };
47
47
 
48
- const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.ControlBar);
49
- const headerChild = $derived(getChildSnippet(ChildKey.ControlBarHeader));
50
- const contentChild = $derived(getChildSnippet(ChildKey.ControlBarContent));
51
- const overflowChild = $derived(getChildSnippet(ChildKey.ControlBarOverflow));
48
+ const { getByKey } = setChildContext(ChildKey.ControlBar);
49
+ const headerChild = $derived(getByKey(ChildKey.ControlBarHeader));
50
+ const contentChild = $derived(getByKey(ChildKey.ControlBarContent));
51
+ const overflowChild = $derived(getByKey(ChildKey.ControlBarOverflow));
52
52
  </script>
53
53
 
54
54
  <svelte:window use:shortcuts={[{ shortcut: { key: 'Escape' }, onShortcut: onEscape }]} />
@@ -73,18 +73,20 @@
73
73
  />
74
74
  {/if}
75
75
 
76
- <div class={cleanClass('flex shrink-0 flex-col')}>
77
- {@render headerChild?.snippet()}
78
- </div>
76
+ {#if headerChild}
77
+ <div class={cleanClass('flex shrink-0 flex-col', headerChild.class)}>
78
+ {@render headerChild.children?.()}
79
+ </div>
80
+ {/if}
79
81
  </div>
80
82
 
81
83
  <div class={cleanClass('flex grow items-center gap-2', contentChild?.class)}>
82
- {@render contentChild?.snippet()}
84
+ {@render contentChild?.children?.()}
83
85
  </div>
84
86
 
85
87
  {#if overflowChild}
86
88
  <div class={cleanClass('flex shrink-0 items-center gap-2', overflowChild.class)}>
87
- {@render overflowChild.snippet()}
89
+ {@render overflowChild.children?.()}
88
90
  </div>
89
91
  {/if}
90
92
 
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarContent} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarContent} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const ControlBarContent: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const ControlBarContent: import("svelte").Component<ChildData, {}, "">;
7
3
  type ControlBarContent = ReturnType<typeof ControlBarContent>;
8
4
  export default ControlBarContent;
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarHeader} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarHeader} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const ControlBarHeader: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const ControlBarHeader: import("svelte").Component<ChildData, {}, "">;
7
3
  type ControlBarHeader = ReturnType<typeof ControlBarHeader>;
8
4
  export default ControlBarHeader;
@@ -1,16 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { ChildKey } from '../../constants.js';
3
3
  import Child from '../../internal/Child.svelte';
4
- import type { Snippet } from 'svelte';
4
+ import type { ChildData } from '../../types.js';
5
5
 
6
- type Props = {
7
- class?: string;
8
- children: Snippet;
9
- };
10
-
11
- let { class: className, children }: Props = $props();
6
+ let props: ChildData = $props();
12
7
  </script>
13
8
 
14
- <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarOverflow} class={className}>
15
- {@render children?.()}
16
- </Child>
9
+ <Child for={ChildKey.ControlBar} as={ChildKey.ControlBarOverflow} {...props} />
@@ -1,8 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type Props = {
3
- class?: string;
4
- children: Snippet;
5
- };
6
- declare const ControlBarOverflow: import("svelte").Component<Props, {}, "">;
1
+ import type { ChildData } from '../../types.js';
2
+ declare const ControlBarOverflow: import("svelte").Component<ChildData, {}, "">;
7
3
  type ControlBarOverflow = ReturnType<typeof ControlBarOverflow>;
8
4
  export default ControlBarOverflow;
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
- import { setFieldContext } from '../../common/context.svelte.js';
3
- import { withChildrenSnippets } from '../../common/use-child.svelte.js';
2
+ import { setChildContext, setFieldContext } from '../../common/context.svelte.js';
4
3
  import { ChildKey } from '../../constants.js';
5
4
  import type { FieldContext } from '../../types.js';
6
5
  import { cleanClass } from '../../utilities/internal.js';
@@ -17,15 +16,11 @@
17
16
 
18
17
  setFieldContext(() => state);
19
18
 
20
- const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Field);
21
- const helperTextChildren = $derived(getChildSnippet(ChildKey.HelperText));
19
+ const { getByKey } = setChildContext(ChildKey.Field);
20
+ const helperTextChild = $derived(getByKey(ChildKey.HelperText));
22
21
  </script>
23
22
 
24
23
  <div class={cleanClass('w-full', className)}>
25
24
  {@render children()}
26
- {#if helperTextChildren}
27
- <div class={cleanClass('pt-1', helperTextChildren.class)}>
28
- {@render helperTextChildren.snippet()}
29
- </div>
30
- {/if}
25
+ {@render helperTextChild?.children?.()}
31
26
  </div>
@@ -2,23 +2,16 @@
2
2
  import Text from '../Text/Text.svelte';
3
3
  import { ChildKey } from '../../constants.js';
4
4
  import Child from '../../internal/Child.svelte';
5
- import type { TextColor } from '../../types.js';
5
+ import type { ChildData, TextColor } from '../../types.js';
6
6
  import { cleanClass } from '../../utilities/internal.js';
7
- import type { Snippet } from 'svelte';
8
7
 
9
8
  type Props = {
10
9
  color?: TextColor;
11
- class?: string;
12
- children?: Snippet;
13
- };
10
+ } & ChildData;
14
11
 
15
12
  let { class: className, children, color = 'muted' }: Props = $props();
16
13
  </script>
17
14
 
18
15
  <Child for={ChildKey.Field} as={ChildKey.HelperText}>
19
- <div class={cleanClass(className)}>
20
- <Text {color} size="small">
21
- {@render children?.()}
22
- </Text>
23
- </div>
16
+ <Text {color} size="small" {children} class={cleanClass('pt-1', className)} />
24
17
  </Child>
@@ -1,10 +1,7 @@
1
- import type { TextColor } from '../../types.js';
2
- import type { Snippet } from 'svelte';
1
+ import type { ChildData, TextColor } from '../../types.js';
3
2
  type Props = {
4
3
  color?: TextColor;
5
- class?: string;
6
- children?: Snippet;
7
- };
4
+ } & ChildData;
8
5
  declare const HelperText: import("svelte").Component<Props, {}, "">;
9
6
  type HelperText = ReturnType<typeof HelperText>;
10
7
  export default HelperText;
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import Table from '../Table/Table.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
+ <Table striped {children} />
@@ -0,0 +1,8 @@
1
+ import Table from '../Table/Table.svelte';
2
+ import type { Snippet } from 'svelte';
3
+ type Props = {
4
+ children?: Snippet;
5
+ };
6
+ declare const Table: import("svelte").Component<Props, {}, "">;
7
+ type Table = ReturnType<typeof Table>;
8
+ export default Table;