Skip to content

Commit a8f09f0

Browse files
committed
fix: extends svelte/element for Span, P, Secondary
1 parent 3892e76 commit a8f09f0

File tree

7 files changed

+47
-35
lines changed

7 files changed

+47
-35
lines changed

src/lib/typography/Li.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
import type { Snippet } from 'svelte';
33
import { twMerge } from 'tailwind-merge';
44
import { getContext } from 'svelte';
5+
import type { HTMLLiAttributes } from 'svelte/elements';
56
6-
interface Props {
7+
interface Props extends HTMLLiAttributes{
78
children: Snippet;
89
icon?: boolean;
9-
liClass?: string | undefined;
10+
class?: string | undefined;
1011
}
1112
12-
let { children, icon, liClass, ...attributes }: Props = $props();
13+
let { children, icon, class: className, ...attributes }: Props = $props();
1314
const ctxclass: string = getContext('ctxclass');
14-
let classLi: string = twMerge(liClass, ctxclass, icon && 'flex items-center');
1515
</script>
1616

17-
<li {...attributes} class={classLi}>
17+
<li {...attributes} class={twMerge(className, ctxclass, icon && 'flex items-center')}>
1818
{@render children()}
1919
</li>
2020

@@ -24,6 +24,6 @@
2424
## Props
2525
@prop children
2626
@prop icon
27-
@prop liClass
27+
@prop class
2828
@prop ...attributes
2929
-->

src/lib/typography/Mark.svelte

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
<script lang="ts">
22
import type { Snippet } from 'svelte';
33
import { twMerge } from 'tailwind-merge';
4+
import type { HTMLAttributes } from 'svelte/elements';
45
5-
interface Props {
6+
interface Props extends HTMLAttributes<HTMLElement>{
67
children: Snippet;
8+
markClass?: string | undefined;
79
class?: string | undefined;
810
}
911
10-
let { children, class: className, ...attributes }: Props = $props();
11-
let markCls: string = 'text-white dark:bg-blue-500 bg-blue-600 px-2 rounded';
12+
let {
13+
children,
14+
markClass = 'text-white dark:bg-blue-500 bg-blue-600 px-2 rounded',
15+
class: className, ...attributes
16+
}: Props = $props();
17+
1218
</script>
1319

14-
<mark {...attributes} class={twMerge(markCls, className)}>
15-
16-
{@render children()}
17-
20+
<mark {...attributes} class={twMerge(markClass, className)}>
21+
{@render children()}
1822
</mark>
1923

2024
<!--

src/lib/typography/P.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
import type { Snippet } from 'svelte';
33
import { twMerge } from 'tailwind-merge';
44
import type { PsizeType, PweightType, SpaceType } from '../types';
5+
import type { HTMLAttributes } from 'svelte/elements';
56
6-
interface Props {
7+
interface Props extends HTMLAttributes<HTMLParagraphElement>{
78
children: Snippet;
89
color?: string | undefined;
910
class?: string | undefined;

src/lib/typography/Secondary.svelte

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<script lang="ts">
22
import type { Snippet } from 'svelte';
33
import { twMerge } from 'tailwind-merge';
4-
interface Props {
4+
import type { HTMLAttributes } from 'svelte/elements';
5+
6+
interface Props extends HTMLAttributes<HTMLElement>{
57
children: Snippet;
6-
color?: string;
78
secondaryClass?: string;
89
class?: string;
910
}
10-
let { children, color = 'text-gray-500 dark:text-gray-400', secondaryClass = 'font-semibold', class: className, ...attributes }: Props = $props();
11+
let {
12+
children,
13+
secondaryClass = 'text-gray-500 dark:text-gray-400 font-semibold',
14+
class: className,
15+
...attributes
16+
}: Props = $props();
1117
</script>
1218

13-
<small {...attributes} class={twMerge(color, secondaryClass, className)}>
19+
<small {...attributes} class={twMerge(secondaryClass, className)}>
1420
{@render children()}
1521
</small>
1622

src/lib/typography/Span.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts">
22
import type { Snippet } from 'svelte';
33
import { twMerge } from 'tailwind-merge';
4+
import type { HTMLAttributes } from 'svelte/elements';
45
5-
interface Props {
6+
interface Props extends HTMLAttributes<HTMLSpanElement>{
67
children: Snippet;
78
italic?: boolean;
89
underline?: boolean;

src/routes/pages/coverage/+page.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@
304304
<Li># of pages: {componentsAnalysis.total}</Li>
305305
<Li># of components/pages checked: {componentsAnalysis.pageChecked}</Li>
306306
<Li># of components/pages to be completed: {componentsAnalysis.pageUnchecked}</Li>
307-
<Li liClass='text-green-500'># of pages without problems: {componentsAnalysis.pageWithoutProblems}</Li>
308-
<Li liClass='text-red-500'># of examples to be completed: {componentsAnalysis.exampleProblems}</Li>
307+
<Li class='text-green-500'># of pages without problems: {componentsAnalysis.pageWithoutProblems}</Li>
308+
<Li class='text-red-500'># of examples to be completed: {componentsAnalysis.exampleProblems}</Li>
309309
</List>
310310

311311

@@ -314,17 +314,17 @@
314314
<Li># of pages: {formsAnalysis.total}</Li>
315315
<Li># of components/pages checked: {formsAnalysis.pageChecked}</Li>
316316
<Li># of components/pages to be completed: {formsAnalysis.pageUnchecked}</Li>
317-
<Li liClass='text-green-500'># of pages without problems: {formsAnalysis.pageWithoutProblems}</Li>
318-
<Li liClass='text-red-500'># of examples to be completed: {formsAnalysis.exampleProblems}</Li>
317+
<Li class='text-green-500'># of pages without problems: {formsAnalysis.pageWithoutProblems}</Li>
318+
<Li class='text-red-500'># of examples to be completed: {formsAnalysis.exampleProblems}</Li>
319319
</List>
320320

321321
<H2>Typography</H2>
322322
<List tag="ul" class="space-y-1 text-gray-500 dark:text-gray-400" list="none">
323323
<Li># of pages: {typographyAnalysis.total}</Li>
324324
<Li># of components/pages checked: {typographyAnalysis.pageChecked}</Li>
325325
<Li># of components/pages to be completed: {typographyAnalysis.pageUnchecked}</Li>
326-
<Li liClass='text-green-500'># of pages without problems: {typographyAnalysis.pageWithoutProblems}</Li>
327-
<Li liClass='text-red-500'># of examples to be completed: {typographyAnalysis.exampleProblems}</Li>
326+
<Li class='text-green-500'># of pages without problems: {typographyAnalysis.pageWithoutProblems}</Li>
327+
<Li class='text-red-500'># of examples to be completed: {typographyAnalysis.exampleProblems}</Li>
328328
</List>
329329

330330
<Heading

src/routes/typography/list/+page.svelte

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,23 +210,23 @@
210210
class="mb-8 space-y-4 text-gray-500 dark:text-gray-400"
211211
list="none"
212212
>
213-
<Li icon liClass="gap-3">
213+
<Li icon class="gap-3">
214214
<CheckOutline class="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
215215
Individual configuration
216216
</Li>
217-
<Li icon liClass="gap-3">
217+
<Li icon class="gap-3">
218218
<CheckOutline class="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
219219
No setup, or hidden fees
220220
</Li>
221-
<Li icon liClass="gap-3">
221+
<Li icon class="gap-3">
222222
<CheckOutline class="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
223223
<span>Team size: <Span>1 developer</Span></span>
224224
</Li>
225-
<Li icon liClass="gap-3">
225+
<Li icon class="gap-3">
226226
<CheckOutline class="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
227227
<span>Premium support: <Span>6 months</Span></span>
228228
</Li>
229-
<Li icon liClass="gap-3">
229+
<Li icon class="gap-3">
230230
<CheckOutline class="h-3.5 w-3.5 text-green-500 dark:text-green-400" />
231231
<span>Free updates: <Span>6 months</Span></span>
232232
</Li>
@@ -242,7 +242,7 @@
242242
list="none"
243243
class="max-w-md divide-y divide-gray-200 dark:divide-gray-700"
244244
>
245-
<Li liClass="pb-3 sm:pb-4">
245+
<Li class="pb-3 sm:pb-4">
246246
<div class="flex items-center space-x-4 rtl:space-x-reverse">
247247
<div class="flex-shrink-0">
248248
<img
@@ -266,7 +266,7 @@
266266
</div>
267267
</div>
268268
</Li>
269-
<Li liClass="py-3 sm:py-4">
269+
<Li class="py-3 sm:py-4">
270270
<div class="flex items-center space-x-4 rtl:space-x-reverse">
271271
<div class="flex-shrink-0">
272272
<img
@@ -290,7 +290,7 @@
290290
</div>
291291
</div>
292292
</Li>
293-
<Li liClass="py-3 sm:py-4">
293+
<Li class="py-3 sm:py-4">
294294
<div class="flex items-center space-x-4 rtl:space-x-reverse">
295295
<div class="flex-shrink-0">
296296
<img
@@ -314,7 +314,7 @@
314314
</div>
315315
</div>
316316
</Li>
317-
<Li liClass="py-3 sm:py-4">
317+
<Li class="py-3 sm:py-4">
318318
<div class="flex items-center space-x-4 rtl:space-x-reverse">
319319
<div class="flex-shrink-0">
320320
<img
@@ -338,7 +338,7 @@
338338
</div>
339339
</div>
340340
</Li>
341-
<Li liClass="py-3 sm:py-4">
341+
<Li class="py-3 sm:py-4">
342342
<div class="flex items-center space-x-4 rtl:space-x-reverse">
343343
<div class="flex-shrink-0">
344344
<img

0 commit comments

Comments
 (0)