@noxlovette/material 0.1.22 → 0.1.24
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,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Layer } from '../../../utils/index.js';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import { listiem } from './theme.js';
|
|
4
5
|
import type { ListitemProps } from './types.js';
|
|
5
6
|
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
}: ListitemProps = $props();
|
|
18
19
|
|
|
19
20
|
const cls = $derived(listiem({ lines, selected }));
|
|
21
|
+
const baseCls = $derived(cls.base({ class: clsx(className) }));
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
24
|
{#snippet content()}
|
|
@@ -44,12 +46,12 @@
|
|
|
44
46
|
{#snippet action()}
|
|
45
47
|
{#if 'label' in restProps}
|
|
46
48
|
{@const { label: _, ...extra } = restProps}
|
|
47
|
-
<label class={
|
|
49
|
+
<label class={baseCls} {...extra}>
|
|
48
50
|
<Layer />
|
|
49
51
|
{@render content()}
|
|
50
52
|
</label>
|
|
51
53
|
{:else if 'onclick' in restProps}
|
|
52
|
-
<button type="button" class={
|
|
54
|
+
<button type="button" class={baseCls} {...restProps}>
|
|
53
55
|
<Layer />
|
|
54
56
|
{@render content()}
|
|
55
57
|
</button>
|
|
@@ -57,13 +59,13 @@
|
|
|
57
59
|
{@const { href, ...extra } = restProps as typeof restProps & {
|
|
58
60
|
href?: string | null;
|
|
59
61
|
}}
|
|
60
|
-
<a class={
|
|
62
|
+
<a class={baseCls} {href} {...extra}>
|
|
61
63
|
<Layer />
|
|
62
64
|
{@render content()}
|
|
63
65
|
</a>
|
|
64
66
|
{:else}
|
|
65
67
|
{@const { href: _, ...extra } = restProps as Record<string, unknown>}
|
|
66
|
-
<div class={
|
|
68
|
+
<div class={baseCls} {...extra}>
|
|
67
69
|
<Layer />
|
|
68
70
|
{@render content()}
|
|
69
71
|
</div>
|
|
@@ -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;
|