@noxlovette/material 0.1.22 → 0.1.23
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.
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import type { IconProps } from './types.js';
|
|
3
|
+
import type { IconProps, IconSize } from './types.js';
|
|
4
|
+
|
|
5
|
+
const sizeMap: Record<IconSize, { cls: string; opsz: number }> = {
|
|
6
|
+
xs: { cls: 'size-4 text-[16px]', opsz: 20 },
|
|
7
|
+
sm: { cls: 'size-5 text-[20px]', opsz: 20 },
|
|
8
|
+
md: { cls: 'size-6 text-[24px]', opsz: 24 },
|
|
9
|
+
lg: { cls: 'size-10 text-[40px]', opsz: 40 },
|
|
10
|
+
xl: { cls: 'size-12 text-[48px]', opsz: 48 }
|
|
11
|
+
};
|
|
4
12
|
|
|
5
13
|
const {
|
|
6
14
|
name,
|
|
15
|
+
size = 'md',
|
|
7
16
|
variant = 'rounded',
|
|
8
17
|
fill = 0,
|
|
9
18
|
wght = 400,
|
|
10
19
|
grad = 0,
|
|
11
|
-
opsz
|
|
12
|
-
class: className
|
|
20
|
+
opsz,
|
|
21
|
+
class: className
|
|
13
22
|
}: IconProps = $props();
|
|
14
23
|
|
|
24
|
+
const resolved = $derived(sizeMap[size]);
|
|
25
|
+
const resolvedOpsz = $derived(opsz ?? resolved.opsz);
|
|
15
26
|
const wrapperClass = 'inline-flex items-center justify-center leading-none';
|
|
16
27
|
</script>
|
|
17
28
|
|
|
18
|
-
<div class={clsx(className, wrapperClass)}>
|
|
29
|
+
<div class={clsx(resolved.cls, className, wrapperClass)}>
|
|
19
30
|
<span
|
|
20
31
|
class="material-symbols-{variant}"
|
|
21
|
-
style="font-size: 1em; font-variation-settings: 'FILL' {fill}, 'wght' {wght}, 'GRAD' {grad}, 'opsz' {
|
|
32
|
+
style="font-size: 1em; font-variation-settings: 'FILL' {fill}, 'wght' {wght}, 'GRAD' {grad}, 'opsz' {resolvedOpsz};"
|
|
22
33
|
>{name}</span
|
|
23
34
|
>
|
|
24
35
|
</div>
|
|
@@ -3,8 +3,10 @@ import Icon from './Icon.svelte';
|
|
|
3
3
|
import type { LoadingIndicatorVariants } from './theme.js';
|
|
4
4
|
export type IconMD = typeof Icon;
|
|
5
5
|
export type IconVariant = 'outlined' | 'rounded' | 'sharp';
|
|
6
|
+
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
7
|
export type IconProps = HTMLAttributes<HTMLSpanElement> & {
|
|
7
8
|
name: string;
|
|
9
|
+
size?: IconSize;
|
|
8
10
|
variant?: IconVariant;
|
|
9
11
|
fill?: 0 | 1;
|
|
10
12
|
wght?: number;
|