@inlaylab/opaline-svelte 1.0.0 → 1.1.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/README.md CHANGED
@@ -17,6 +17,12 @@ npm i @inlaylab/opaline-svelte
17
17
 
18
18
  Props: `seed`, `look`, `size`, `src`, `alt`, and every core option.
19
19
 
20
+ Groups: `AvatarGroup` overlaps avatars and adds a `+N` chip past `max`.
21
+
22
+ ```svelte
23
+ <AvatarGroup look={clay} members={[user.email, { seed: 'grace', src, alt: 'Grace' }]} max={4} />
24
+ ```
25
+
20
26
  Same seed, same avatar: from 1.0, the same seed and options give a byte-identical SVG in every 1.x release.
21
27
 
22
28
  [Playground and docs](https://inlaylab.github.io/Opaline/) · [GitHub](https://github.com/Inlaylab/Opaline) · MIT for code and art.
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import { avatarGroup } from '@inlaylab/opaline'
3
+ import Avatar from './Avatar.svelte'
4
+ import type { AvatarGroupProps } from './types.js'
5
+
6
+ let { members, max, alt, size = 40, ...options }: AvatarGroupProps = $props()
7
+ const g = $derived(avatarGroup(members, { max, size, shape: options.shape }))
8
+ </script>
9
+
10
+ <span data-opaline-group="" role="group" aria-label={alt || undefined} style={g.css.root}>
11
+ {#each g.shown as m, i (i)}
12
+ <span data-opaline-member="" style={i ? g.css.member : g.css.first}>
13
+ <Avatar {...options} {size} seed={m.seed} src={m.src} alt={m.alt} />
14
+ </span>
15
+ {/each}
16
+ {#if g.rest}
17
+ <span data-opaline-more="" role="img" aria-label="{g.rest} more" style={g.css.more}
18
+ >+{g.rest}</span
19
+ >
20
+ {/if}
21
+ </span>
@@ -0,0 +1,4 @@
1
+ import type { AvatarGroupProps } from './types.js';
2
+ declare const AvatarGroup: import("svelte").Component<AvatarGroupProps, {}, "">;
3
+ type AvatarGroup = ReturnType<typeof AvatarGroup>;
4
+ export default AvatarGroup;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as Avatar } from './Avatar.svelte';
2
- export type { AvatarProps } from './types.js';
2
+ export { default as AvatarGroup } from './AvatarGroup.svelte';
3
+ export type { AvatarGroupProps, AvatarProps } from './types.js';
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export { default as Avatar } from './Avatar.svelte';
2
+ export { default as AvatarGroup } from './AvatarGroup.svelte';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AuraOptions, ClayOptions, Style } from '@inlaylab/opaline';
1
+ import type { AuraOptions, ClayOptions, GroupMember, InitialsOptions, Style } from '@inlaylab/opaline';
2
2
  export type AvatarProps = {
3
3
  seed: string | number | null | undefined;
4
4
  /** The style object, e.g. `morph` from `@inlaylab/opaline/morph`. */
@@ -8,4 +8,12 @@ export type AvatarProps = {
8
8
  src?: string;
9
9
  /** Accessible name. Without it the avatar is decorative and hidden from assistive tech. */
10
10
  alt?: string;
11
- } & ClayOptions & AuraOptions;
11
+ } & ClayOptions & AuraOptions & InitialsOptions;
12
+ export type AvatarGroupProps = Omit<AvatarProps, 'seed' | 'src' | 'alt'> & {
13
+ /** Seeds, or `{ seed, src, alt }` for a photo and an accessible name. */
14
+ members: readonly GroupMember[];
15
+ /** Show at most this many avatars, then a `+N` chip. Shows everyone when unset. */
16
+ max?: number;
17
+ /** Accessible name for the whole group, e.g. "Project members". */
18
+ alt?: string;
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inlaylab/opaline-svelte",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Seeded avatars for Svelte 5: an SSR-safe Avatar component.",
5
5
  "keywords": [
6
6
  "avatar",
@@ -45,7 +45,7 @@
45
45
  "svelte": ">=5.20"
46
46
  },
47
47
  "dependencies": {
48
- "@inlaylab/opaline": "1.0.0"
48
+ "@inlaylab/opaline": "1.1.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@inlaylab/opaline-contract": "0.0.0",