Skip to content

Commit 9b7063b

Browse files
committed
feat: migrate components in image list to runes
1 parent 3f3ceef commit 9b7063b

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Svelte 5 Runes mode is being migrated to slowly. This is the todo list of compon
163163
- [ ] Data Table
164164
- [x] Dialog
165165
- [x] Drawer
166-
- [ ] Image List
166+
- [x] Image List
167167
- Inputs and Controls
168168
- [ ] Autocomplete
169169
- [x] Checkbox

packages/image-list/src/ImageList.svelte

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<svelte:options runes={false} />
1+
<svelte:options runes />
22

33
<ul
44
bind:this={element}
@@ -9,31 +9,46 @@
99
'mdc-image-list--masonry': masonry,
1010
'mdc-image-list--with-text-protection': withTextProtection,
1111
})}
12-
{...$$restProps}
12+
{...restProps}
1313
>
14-
<slot />
14+
{@render children?.()}
1515
</ul>
1616

1717
<script lang="ts">
18+
import type { Snippet } from 'svelte';
1819
import { setContext } from 'svelte';
1920
import type { SmuiAttrs } from '@smui/common';
2021
import type { ActionArray } from '@smui/common/internal';
2122
import { classMap, useActions } from '@smui/common/internal';
2223
2324
type OwnProps = {
25+
/**
26+
* An array of Action or [Action, ActionProps] to be applied to the element.
27+
*/
2428
use?: ActionArray;
29+
/**
30+
* A space separated list of CSS classes.
31+
*/
2532
class?: string;
33+
/**
34+
* Whether to use masonry layout.
35+
*/
2636
masonry?: boolean;
37+
/**
38+
* Whether to move the text over the image in a caption area at the bottom.
39+
*/
2740
withTextProtection?: boolean;
28-
};
29-
type $$Props = OwnProps & SmuiAttrs<'ul', keyof OwnProps>;
3041
31-
// Remember to update $$Props if you add/remove/rename props.
32-
export let use: ActionArray = [];
33-
let className = '';
34-
export { className as class };
35-
export let masonry = false;
36-
export let withTextProtection = false;
42+
children?: Snippet;
43+
};
44+
let {
45+
use = [],
46+
class: className = '',
47+
masonry = false,
48+
withTextProtection = false,
49+
children,
50+
...restProps
51+
}: OwnProps & SmuiAttrs<'ul', keyof OwnProps> = $props();
3752
3853
let element: HTMLUListElement;
3954

packages/site/src/routes/demo/image-list/_EnforceAspectRatio.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<svelte:options runes={false} />
2-
31
<ImageList class="my-image-list-enforce-ratio">
42
{#each Array(15) as _unused, i}
53
<Item>

packages/site/src/routes/demo/image-list/_FourByFive.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<svelte:options runes={false} />
2-
31
<ImageList class="my-image-list-4x5" withTextProtection>
42
{#each Array(15) as _unused, i}
53
<Item>

packages/site/src/routes/demo/image-list/_Masonry.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<svelte:options runes={false} />
2-
31
<ImageList class="my-image-list-masonry" masonry>
42
{#each Array(15) as _unused, i}
53
<Item>

packages/site/src/routes/demo/image-list/_Simple.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<svelte:options runes={false} />
2-
31
<ImageList class="my-image-list-standard">
42
{#each Array(15) as _unused, i}
53
<Item>

0 commit comments

Comments
 (0)